Commit 3f339e50 by Java-聂换换

举报

parent d9aafc3f
...@@ -5,6 +5,7 @@ import com.ejweb.core.persistence.annotation.MyBatisDao; ...@@ -5,6 +5,7 @@ import com.ejweb.core.persistence.annotation.MyBatisDao;
import com.ejweb.modules.front.report.bean.FrontReportBean; import com.ejweb.modules.front.report.bean.FrontReportBean;
import com.ejweb.modules.front.report.bean.ReportAttachmentBean; import com.ejweb.modules.front.report.bean.ReportAttachmentBean;
import com.ejweb.modules.front.report.entity.FrontReportEntity; import com.ejweb.modules.front.report.entity.FrontReportEntity;
import com.ejweb.modules.sys.entity.User;
/** /**
* Created by lenovo on 2017/9/8. * Created by lenovo on 2017/9/8.
...@@ -18,5 +19,8 @@ public interface FrontReportDao extends CrudDao<FrontReportEntity> { ...@@ -18,5 +19,8 @@ public interface FrontReportDao extends CrudDao<FrontReportEntity> {
// 添加举报附件 // 添加举报附件
public Integer insertReportAttachment(ReportAttachmentBean bean); public Integer insertReportAttachment(ReportAttachmentBean bean);
// 查找管理员
public User getUser();
} }
...@@ -4,14 +4,17 @@ import com.ejweb.conf.ErrorCode; ...@@ -4,14 +4,17 @@ import com.ejweb.conf.ErrorCode;
import com.ejweb.conf.GConstants; import com.ejweb.conf.GConstants;
import com.ejweb.core.api.ResponseBean; import com.ejweb.core.api.ResponseBean;
import com.ejweb.core.service.CrudService; import com.ejweb.core.service.CrudService;
import com.ejweb.core.utils.DateUtils;
import com.ejweb.core.utils.IdWorker; import com.ejweb.core.utils.IdWorker;
import com.ejweb.modules.front.report.bean.FrontReportBean; import com.ejweb.modules.front.report.bean.FrontReportBean;
import com.ejweb.modules.front.report.bean.ReportAttachmentBean; import com.ejweb.modules.front.report.bean.ReportAttachmentBean;
import com.ejweb.modules.front.report.dao.FrontReportDao; import com.ejweb.modules.front.report.dao.FrontReportDao;
import com.ejweb.modules.front.report.entity.FrontReportEntity; import com.ejweb.modules.front.report.entity.FrontReportEntity;
import com.ejweb.modules.sys.entity.User;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List; import java.util.List;
...@@ -28,6 +31,19 @@ public class FrontReportService extends CrudService<FrontReportDao,FrontReportEn ...@@ -28,6 +31,19 @@ public class FrontReportService extends CrudService<FrontReportDao,FrontReportEn
public ResponseBean addReport(FrontReportBean bean){ public ResponseBean addReport(FrontReportBean bean){
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
bean.setId(IdWorker.getNextId("R")); bean.setId(IdWorker.getNextId("R"));
bean.setReportTime(DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
// 现在写的是微信公众号,可能不是这个
bean.setReportSource("wechat");
bean.setReportStatus("0");
// 查询管理员
User user = dao.getUser();
if(user!= null){
bean.setExchangeBeforeUser(user.getId());
}
//
// bean.setExchangeBeforeUser("");
// 添加举报信息表 // 添加举报信息表
int row = dao.insertReport(bean); int row = dao.insertReport(bean);
if(row == 1){ // 添加成功 if(row == 1){ // 添加成功
......
...@@ -85,4 +85,13 @@ ...@@ -85,4 +85,13 @@
) )
</insert> </insert>
<select id="getUser" resultType="com.ejweb.modules.sys.entity.User">
SELECT u.id
FROM sys_user u
LEFT JOIN sys_user2role u2r ON u2r.user_id = u.id
LEFT JOIN sys_role r ON r.id = u2r.role_id
WHERE r.enname = 'admin'
limit 1
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment