浏览代码

xielianghe

lange 5 年之前
父节点
当前提交
78e1b7ce8e

+ 10 - 4
whepi-web/src/main/java/com/bofeng/service/MsReportService.java

@@ -22,13 +22,15 @@ import java.util.List;
  * @Date: 2020/2/4 15:44
  */
 @Service
-@Transactional(readOnly = true)
+@Transactional()
 public class MsReportService {
 
     @Autowired
     private MsSuspectedMapper msSuspectedMapper;
     @Autowired
     private MsReportMapper msReportMapper;
+    @Autowired
+    private MsReportService msReportService;
 
     public List<MsSuspected> getByReportId(Long reportId) {
         return msSuspectedMapper.selectByReportId(reportId);
@@ -47,6 +49,8 @@ public class MsReportService {
 
     //获取今天数据
     public MsReport getReportByDateNow(Long userCreate) {
+        //根据昨天的获取今天的
+       msReportService.getNowByYesterday(userCreate);
         Date t = new Date();
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
         String reportDate = df.format(t);
@@ -90,6 +94,7 @@ public class MsReportService {
         if (listReport != null && listReport.size() > 0) {
             //添加到今天日报
             MsReport msReport = msReportMapper.selectById(Long.parseLong(listReport.get(0).getReportId().toString()));
+            Long reportId=0L;
             if (msReport != null) {
                 MsReport msReport1 = new MsReport();
                 msReport1.setReportId(IdWorker.getId());
@@ -106,7 +111,8 @@ public class MsReportService {
                 msReport1.setTimeCreate(DateTime.now());
                 msReport1.setUserUpdate(userCreate);
                 msReport1.setTimeUpdate(DateTime.now());
-                msReportMapper.insert(msReport);
+                msReportMapper.insert(msReport1);
+                reportId=msReport1.getReportId();
             }
             //添加今日家庭
             List<MsSuspected> listSuspected = msSuspectedMapper.selectByReportId(Long.parseLong(listReport.get(0).getReportId().toString()));
@@ -115,7 +121,7 @@ public class MsReportService {
 
                     MsSuspected msSuspected1 = new MsSuspected();
                     msSuspected1.setSuspectedId(IdWorker.getId());
-                    msSuspected1.setReportId(Long.parseLong(listReport.get(0).getReportId().toString()));
+                    msSuspected1.setReportId(reportId);
                     msSuspected1.setUserName(msSuspected.getUserName());
                     msSuspected1.setGrender(msSuspected.getGrender());
                     msSuspected1.setAge(msSuspected.getAge());
@@ -134,7 +140,7 @@ public class MsReportService {
                     msSuspected1.setTimeCreate(DateTime.now());
                     msSuspected1.setUserUpdate(userCreate);
                     msSuspected1.setTimeUpdate(DateTime.now());
-                    msSuspectedMapper.insert(msSuspected);
+                    msSuspectedMapper.insert(msSuspected1);
                 }
             }
         }

+ 0 - 8
whepi-web/src/main/java/com/bofeng/wx/controller/HomeController.java

@@ -48,14 +48,6 @@ public class HomeController {
     @GetMapping("/home/home.html")
     public ModelAndView home(ModelMap model) throws JsonProcessingException {
         model.put("user", new JsonWapper("{\"www\": \"er\"}"));
-        //初始化今日日报
-        UserOpen userOpen = homeService.getUserOpen();
-        Long userId = userOpen.getUserId();
-        //Long userId = 1224706869998772226L;
-        MsReport msReport = msReportService.getReportByDateNow(userId);
-        //根据昨天的获取今天的
-        msReportService.getNowByYesterday(userId);
-        model.put("msReport", new JsonWapper(msReport));
         return new ModelAndView("/home/home.ftl", model);
     }