浏览代码

xielianghe

lange 5 年之前
父节点
当前提交
176776c5e1

+ 8 - 8
whepi-ui/templates/home/home.ftl

@@ -89,14 +89,14 @@
         <#if msReport ??> msReport = ${msReport!{}}</#if>;
         $('#ribao_jinrijujian').append(msReport.safetyNum);
         if (msReport.reportStatus == 1) {
-            var date = new Date(msReport.timeUpdate*1);
-            var year = date.getFullYear();
-            var month = date.getMonth() + 1;
-            var day = date.getDate();
-            var hour = date.getHours();
-            var minute = date.getMinutes();
-            var second = date.getSeconds();
-            var time = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
+            var date = new Date(msReport.timeUpdate * 1);
+            var Y = date.getFullYear() + '-';
+            var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+            var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
+            var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
+            var m = (date.getMinutes()<10?'0'+(date.getMinutes()):date.getMinutes())+':';
+            var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
+            var time = Y + M + D + h + m + s;
             canSahngbao = false;
             document.getElementById("btn_shangbao").style['background-color'] = "#D9D9D9";
             document.getElementById("txt_shangbao").style['color'] = "#0bb20c";

+ 15 - 15
whepi-ui/templates/home/ribao.js

@@ -1264,13 +1264,13 @@ function ribaoCommit() {
       //修改
       if (suspectedId > 0) {
         var date = new Date();
-        var year = date.getFullYear();
-        var month = date.getMonth() + 1;
-        var day = date.getDate();
-        var hour = date.getHours();
-        var minute = date.getMinutes();
-        var second = date.getSeconds();
-        var time = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
+        var Y = date.getFullYear() + '-';
+        var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+        var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
+        var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
+        var m = (date.getMinutes()<10?'0'+(date.getMinutes()):date.getMinutes())+':';
+        var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
+        var time = Y + M + D + h + m + s;
         canSahngbao = false;
         document.getElementById("btn_shangbao").style['background-color'] = "#D9D9D9";
         document.getElementById("txt_shangbao").style['color'] = "#0bb20c";
@@ -1313,7 +1313,7 @@ function deleteSuspected(suspectedId) {
       $('#txt_shangbao').append("今日未上报");
       $('#txt_shangbaotime').empty();
       ribao_refrash();
-      $.toast("删除后请重新点击上报");
+      $.toast("删除后请重新添加上报");
     },
   });
 }
@@ -1525,13 +1525,13 @@ function addReport() {
     success: function (data) {
       $.toast(data.msg)
       var date = new Date();
-      var year = date.getFullYear();
-      var month = date.getMonth() + 1;
-      var day = date.getDate();
-      var hour = date.getHours();
-      var minute = date.getMinutes();
-      var second = date.getSeconds();
-      var time = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
+      var Y = date.getFullYear() + '-';
+      var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+      var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
+      var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
+      var m = (date.getMinutes()<10?'0'+(date.getMinutes()):date.getMinutes())+':';
+      var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
+      var time = Y + M + D + h + m + s;
       if (data.msg == "操作成功") {
         canSahngbao = false;
         document.getElementById("btn_shangbao").style['background-color'] = "#D9D9D9";

+ 27 - 21
whepi-web/src/main/java/com/bofeng/service/MsReportService.java

@@ -448,10 +448,15 @@ public class MsReportService {
             //添加到今天日报
             MsReport msReport = msReportMapper.selectById(Long.parseLong(listSuspected.get(0).getReportId().toString()));
             Long reportId = 0L;
+            Long houseId = 0L;
             if (msReport != null) {
                 MsReport msReport1 = new MsReport();
                 msReport1.setReportId(IdWorker.getId());
-                msReport1.setHouseId(msReport.getHouseId());
+                if (msReport.getHouseId() == 0L)
+                    houseId = msReportMapper.selectHouseIdByUserId(userCreate);
+                else
+                    houseId = msReport.getHouseId();
+                msReport1.setHouseId(houseId);
                 msReport1.setSafetyNum(msReport.getSafetyNum());
                 msReport1.setSureNum(msReport.getSureNum());
                 msReport1.setSuspectedNum(msReport.getSuspectedNum());
@@ -574,43 +579,44 @@ public class MsReportService {
         queryParam.put("userCreate", userCreate);
         return msReportMapper.selectByReportDateTest(queryParam);
     }
+
     public List<MsSuspected> getByReportReportDateTestxq(Map<String, Object> queryParam) {
         List<MsSuspected> msReports = msReportMapper.selectByReportDateTestxq(queryParam);
-        if(msReports.size() != 0){
+        if (msReports.size() != 0) {
             for (int i = 0; i < msReports.size(); i++) {
-                if(msReports.get(i).getWorkLocal() == 1){
+                if (msReports.get(i).getWorkLocal() == 1) {
                     msReports.get(i).setWorkLocalOtherStr("武汉市");
-                }else if(msReports.get(i).getWorkLocal() == 2){
+                } else if (msReports.get(i).getWorkLocal() == 2) {
                     msReports.get(i).setWorkLocalOtherStr("宜昌市");
-                }else if(msReports.get(i).getWorkLocal() == 3){
+                } else if (msReports.get(i).getWorkLocal() == 3) {
                     msReports.get(i).setWorkLocalOtherStr("当阳市");
                 }
-                if(msReports.get(i).getTodayLocal() == 1){
+                if (msReports.get(i).getTodayLocal() == 1) {
                     msReports.get(i).setTodayLocalOtherStr("武汉市");
-                }else if(msReports.get(i).getTodayLocal() == 2){
+                } else if (msReports.get(i).getTodayLocal() == 2) {
                     msReports.get(i).setTodayLocalOtherStr("宜昌市");
-                }else if(msReports.get(i).getTodayLocal() == 3){
+                } else if (msReports.get(i).getTodayLocal() == 3) {
                     msReports.get(i).setTodayLocalOtherStr("当阳市");
                 }
 
-                if(msReports.get(i).getEndLocal() != null){
-                    if(msReports.get(i).getEndLocal() == 1){
+                if (msReports.get(i).getEndLocal() != null) {
+                    if (msReports.get(i).getEndLocal() == 1) {
                         msReports.get(i).setEndLocalOtherStr("武汉市");
-                    }else if(msReports.get(i).getEndLocal() == 2){
+                    } else if (msReports.get(i).getEndLocal() == 2) {
                         msReports.get(i).setEndLocalOtherStr("宜昌市");
-                    }else if(msReports.get(i).getEndLocal() == 3){
+                    } else if (msReports.get(i).getEndLocal() == 3) {
                         msReports.get(i).setEndLocalOtherStr("当阳市");
                     }
                 }
-               if(msReports.get(i).getStartLocal() != null){
-                   if(msReports.get(i).getStartLocal() == 1){
-                       msReports.get(i).setStartLocalOtherStr("武汉市");
-                   }else if(msReports.get(i).getStartLocal() == 2){
-                       msReports.get(i).setStartLocalOtherStr("宜昌市");
-                   }else if(msReports.get(i).getStartLocal() == 3){
-                       msReports.get(i).setStartLocalOtherStr("当阳市");
-                   }
-               }
+                if (msReports.get(i).getStartLocal() != null) {
+                    if (msReports.get(i).getStartLocal() == 1) {
+                        msReports.get(i).setStartLocalOtherStr("武汉市");
+                    } else if (msReports.get(i).getStartLocal() == 2) {
+                        msReports.get(i).setStartLocalOtherStr("宜昌市");
+                    } else if (msReports.get(i).getStartLocal() == 3) {
+                        msReports.get(i).setStartLocalOtherStr("当阳市");
+                    }
+                }
 
             }
         }