wenhongquan 2 vuotta sitten
vanhempi
commit
fec54f7fdc
18 muutettua tiedostoa jossa 558 lisäystä ja 7 poistoa
  1. 2 0
      ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
  2. 474 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/BigScreenController.java
  3. 7 0
      ruoyi-common/pom.xml
  4. 8 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/OtherApiUtils.java
  5. 3 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/TblDetectionLogMapper.java
  6. 3 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/TblMaintainLogMapper.java
  7. 2 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ITblDetectionLogService.java
  8. 3 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ITblMaintainLogService.java
  9. 8 1
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TableDetectionServiceImpl.java
  10. 7 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TblDetectionLogServiceImpl.java
  11. 7 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TblMaintainLogServiceImpl.java
  12. 8 1
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TblMaintainServiceImpl.java
  13. 1 1
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TblTaskLogServiceImpl.java
  14. 2 2
      ruoyi-system/src/main/resources/mapper/system/TableDetectionMapper.xml
  15. 8 0
      ruoyi-system/src/main/resources/mapper/system/TblDetectionLogMapper.xml
  16. 8 0
      ruoyi-system/src/main/resources/mapper/system/TblMaintainLogMapper.xml
  17. 2 2
      ruoyi-system/src/main/resources/mapper/system/TblMaintainMapper.xml
  18. 5 0
      ruoyi-system/src/main/resources/mapper/system/TblTaskLogMapper.xml

+ 2 - 0
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java

@@ -1,5 +1,6 @@
 package com.ruoyi;
 
+import com.dtflys.forest.springboot.annotation.ForestScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -10,6 +11,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  * @author ruoyi
  */
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
+@ForestScan(basePackages = "com.ruoyi.common.utils")
 public class RuoYiApplication
 {
     public static void main(String[] args)

+ 474 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/BigScreenController.java

@@ -0,0 +1,474 @@
+package com.ruoyi.web.controller.system;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.config.RuoYiConfig;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.JSUtils;
+import com.ruoyi.common.utils.OtherApiUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.file.ImageUtils;
+import com.ruoyi.framework.web.service.PermissionService;
+import com.ruoyi.quartz.task.RyTask;
+import com.ruoyi.system.domain.*;
+import com.ruoyi.system.service.*;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 工单任务Controller
+ * 
+ * @author ruoyi
+ * @date 2022-05-25
+ */
+@RestController
+@RequestMapping("/system/screen")
+public class BigScreenController extends BaseController
+{
+
+    @Autowired
+    private ITblTaskService tblTaskService;
+
+    @Autowired
+    private ITblTaskLogService tblTaskLogService;
+
+
+    @Autowired
+    private ITableDetectionService tableDetectionService;
+    @Autowired
+    private ITblDetectionLogService tblDetectionLogService;
+
+    @Autowired
+    private ITblMaintainService tblMaintainService;
+
+    @Autowired
+    private ITblMaintainLogService tblMaintainLogService;
+
+    @Autowired
+    private ISysUserService userService;
+    @Autowired
+    private RedisCache redisCache;
+
+    @Autowired
+    private ISysDictDataService sysDictDataService;
+
+    @Autowired
+    private ISysDeptService deptService;
+
+
+
+    @Autowired
+    private OtherApiUtils otherApiUtils;
+
+
+
+
+    @GetMapping("/weatherdata")
+    public Object getweatherdata(){
+        Object w = Getweather();
+        return  AjaxResult.success(w);
+    }
+    @GetMapping("/renyuandata")
+    public Object getrenyuandata(){
+
+
+        //当前时间
+        String currentyearstart = DateUtils.parseDateToStr(DateUtils.YYYY,new Date())+"-01-01";
+        String currentyearend =   DateUtils.parseDateToStr(DateUtils.YYYY,DateUtils.addYears(new Date(),1))+"-01-01";
+        String currentdaystart = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date());
+        String currentdayend = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,DateUtils.addDays(new Date(),1));
+
+        //当天
+        TblTaskLog selectTaskLog = new TblTaskLog();
+        Map<String,Object> temp = new HashMap<>();
+        temp.put("beginTime",currentdaystart);
+        temp.put("endTime",currentdayend);
+        selectTaskLog.setParams(temp);
+        List<TblTaskLog> taskLogs =  tblTaskLogService.selectTblTaskLogList(selectTaskLog);
+        List<TblTask> res = new ArrayList<>();
+        for (TblTaskLog tasklog:taskLogs
+             ) {
+            if(tasklog.getTaskStatus().longValue()==1L||tasklog.getTaskStatus().longValue()==2L) continue;
+            TblTask t = tblTaskService.selectTblTaskByTaskId(tasklog.getTaskId());
+            //获取人员信息
+            Map<String,Object> p = new HashMap<>();
+            if(tasklog.getCreateBy()!=null && tasklog.getCreateBy().contains("$")){
+                String cu = tasklog.getCreateBy();
+                String uname = cu.split("\\$")[0];
+                String uid = cu.split("\\$")[1];
+                SysUser u =  userService.selectUserById(Long.parseLong(uid));
+                if(u!=null){
+                    p.put("deptname",u.getDept().getDeptName());
+                    p.put("username",u.getNickName());
+                }else{
+                    p.put("deptname","-");
+                    p.put("username",uname);
+                }
+
+            }else{
+                p.put("username",tasklog.getCreateBy()==null?"-":tasklog.getCreateBy());
+                p.put("deptname","-");
+            }
+            t.setParams(p);
+            res.add(t);
+        }
+        return  AjaxResult.success(res);
+    }
+
+    @GetMapping("/yanghuyeardata")
+    public Object getyanghuyeardata(){
+        //当前时间
+        String currentyearstart = DateUtils.parseDateToStr(DateUtils.YYYY,new Date())+"-01-01";
+        String currentyearend =   DateUtils.parseDateToStr(DateUtils.YYYY,DateUtils.addYears(new Date(),1))+"-01-01";
+        String currentdaystart = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date());
+        String currentdayend = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,DateUtils.addDays(new Date(),1));
+
+        //养护
+        Map<String,Object> temp = new HashMap<>();
+        TblMaintain selectMaintain = new TblMaintain();
+        temp = new HashMap<>();
+        temp.put("beginTime",currentyearstart);
+        temp.put("endTime",currentyearend);
+        selectMaintain.setParams(temp);
+        List<TblMaintain> tblMaintains =  tblMaintainService.selectTblMaintainList(selectMaintain);
+
+
+        //检测
+        temp = new HashMap<>();
+        TableDetection selectTableDetection = new TableDetection();
+        temp = new HashMap<>();
+        temp.put("beginTime",currentyearstart);
+        temp.put("endTime",currentyearend);
+        selectTableDetection.setParams(temp);
+        List<TableDetection> tableDetections =  tableDetectionService.selectTableDetectionList(selectTableDetection);
+
+        SysDictData sysDictData = new SysDictData();
+        sysDictData.setDictType("maintain_type");
+        Map<Long,String> typemap=new HashMap<>();
+        List<SysDictData>  list1 = sysDictDataService.selectDictDataList(sysDictData);
+        for (SysDictData d:list1
+        ) {
+            typemap.put(Long.parseLong(d.getDictValue()),d.getDictLabel());
+        }
+
+        SysDictData sysDictData1 = new SysDictData();
+        sysDictData1.setDictType("detection_type");
+        Map<Long,String> typemap1=new HashMap<>();
+        List<SysDictData>  list2 = sysDictDataService.selectDictDataList(sysDictData1);
+        for (SysDictData d:list2
+        ) {
+            if(d.getDictValue().equals("2")||d.getDictValue().equals("3")||d.getDictValue().equals("5"))
+            typemap1.put(Long.parseLong(d.getDictValue()),d.getDictLabel());
+        }
+
+
+        Map<String,List<Object>> res = new HashMap<>();
+        for (TblMaintain tblmain:tblMaintains
+             ) {
+            String typename =  typemap.get(tblmain.getMaintainType());
+            if(typename!=null){
+                List<Object> maintains = res.get(typename);
+                if(maintains!=null){
+                    maintains.add(tblmain);
+                }else{
+                    maintains = new ArrayList<>();
+                    maintains.add(tblmain);
+                }
+                res.put(typename,maintains);
+            }
+        }
+
+//        Map<String,List<TblMaintain>> res = new HashMap<>();
+        for (TableDetection tblmain:tableDetections
+        ) {
+            String typename =  typemap1.get(tblmain.getDetectionType());
+            if(typename!=null){
+                List<Object> maintains = res.get(typename);
+                if(maintains!=null){
+                    maintains.add(tblmain);
+                }else{
+                    maintains = new ArrayList<>();
+                    maintains.add(tblmain);
+                }
+                res.put(typename,maintains);
+            }
+        }
+        for(String c :typemap.values()){
+            if(res.get(c)==null){
+                res.put(c,new ArrayList<>());
+            }
+        }
+        for(String c :typemap1.values()){
+            if(res.get(c)==null){
+                res.put(c,new ArrayList<>());
+            }
+        }
+
+        return  AjaxResult.success(res);
+    }
+
+
+    @GetMapping("/tongjidata")
+    public Object gettongjidata(){
+
+
+        //当前时间
+        String currentyearstart = DateUtils.parseDateToStr(DateUtils.YYYY,new Date())+"-01-01";
+        String currentyearend =   DateUtils.parseDateToStr(DateUtils.YYYY,DateUtils.addYears(new Date(),1))+"-01-01";
+        String currentdaystart = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date());
+        String currentdayend = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,DateUtils.addDays(new Date(),1));
+
+        Map<String,Object> res = new HashMap<>();
+
+        //养护
+        Map<String,Object> temp = new HashMap<>();
+        TblMaintain selectMaintain = new TblMaintain();
+        temp = new HashMap<>();
+        temp.put("beginTime",currentyearstart);
+        temp.put("endTime",currentyearend);
+        selectMaintain.setParams(temp);
+        List<TblMaintain> tblMaintains =  tblMaintainService.selectTblMaintainList(selectMaintain);
+        res.put("maintain",tblMaintains);
+
+        //检测
+        temp = new HashMap<>();
+        TableDetection selectTableDetection = new TableDetection();
+        temp = new HashMap<>();
+        temp.put("beginTime",currentyearstart);
+        temp.put("endTime",currentyearend);
+        selectTableDetection.setParams(temp);
+        List<TableDetection> tableDetections =  tableDetectionService.selectTableDetectionList(selectTableDetection);
+        res.put("detection",tableDetections);
+
+
+        //任务
+        //工单
+        TblTask selectTask = new TblTask();
+        temp = new HashMap<>();
+        temp.put("beginTime",currentyearstart);
+        temp.put("endTime",currentyearend);
+        selectTask.setParams(temp);
+        List<TblTask> tasks = tblTaskService.selectTblTaskList(selectTask);
+        res.put("task",tasks);
+
+
+
+        {
+
+            SysDictData sysDictData = new SysDictData();
+            sysDictData.setDictType("task_type");
+            List<SysDictData>  list1 = sysDictDataService.selectDictDataList(sysDictData);
+            Map<Long,String> typemap = new HashMap<>();
+            for (SysDictData d:list1
+            ) {
+                typemap.put(Long.parseLong(d.getDictValue()),d.getDictLabel());
+            }
+
+            sysDictData = new SysDictData();
+            sysDictData.setDictType("sys_area");
+            list1 = sysDictDataService.selectDictDataList(sysDictData);
+            Map<String,String> areamap = new HashMap<>();
+            for (SysDictData d:list1
+            ) {
+                areamap.put(d.getDictValue(),d.getDictLabel());
+            }
+
+            sysDictData = new SysDictData();
+            sysDictData.setDictType("task_event_type");
+            list1 = sysDictDataService.selectDictDataList(sysDictData);
+            Map<String,String> taskeventtype = new HashMap<>();
+            for (SysDictData d:list1
+            ) {
+                taskeventtype.put(d.getDictValue(),d.getDictLabel());
+            }
+
+            List<SysUser> users = userService.selectUserList(new SysUser());
+            Map<Long,SysUser> usermap = new HashMap<>();
+            for (SysUser d:users
+            ) {
+                usermap.put(d.getUserId(),d);
+            }
+
+            List<SysDept> depts = deptService.selectDeptList(new SysDept());
+            Map<Long,SysDept> deptmap = new HashMap<>();
+            for (SysDept d:depts
+            ) {
+                deptmap.put(d.getDeptId(),d);
+            }
+            for (TblTask task:tasks
+                 ) {
+                Map<Long,TblTaskLog> logs = new HashMap<>();
+                for (TblTaskLog l:task.getTblTaskLogList()
+                ) {
+                    if(logs.get(l.getTaskStatus())!=null){
+                        TblTaskLog log = logs.get(l.getTaskStatus());
+                        if(log.getCreateTime().getTime()<l.getCreateTime().getTime()) {
+                            logs.put(l.getTaskStatus(), l);
+                        }
+                    }else{
+                        logs.put(l.getTaskStatus(),l);
+                    }
+                }
+                List<TblTaskLog> loglist = new ArrayList<>();
+                loglist.addAll(logs.values());
+                task.setTblTaskLogList(loglist);
+
+                Map<Long,TblTaskLog> logmap = new HashMap<>();
+                for (TblTaskLog d:task.getTblTaskLogList()
+                ) {
+                    logmap.put(d.getTaskStatus(),d);
+                }
+
+                String commjs = "function run(){"+ "var allusers="+JSON.toJSONString(users)+";";
+                commjs+="var alldept = "+JSON.toJSONString(depts)+";";
+                commjs+="var taskinfo = "+JSON.toJSONString(task)+";";
+
+
+                String deptn = "";
+                if(task.getTaskDeptRange()!=null) {
+                    for (SysDept d : depts
+                    ) {
+                        for (String i : task.getTaskDeptRange().split(",")
+                        ) {
+                            if ((d.getDeptId().toString()).equals(i)) {
+                                deptn += d.getDeptName() + ",";
+                            }
+                        }
+                    }
+                    deptn = deptn.substring(0,deptn.length()-1);
+                }
+
+
+                String runjs = commjs+"return JSON.parse(\n" +
+                        "                          taskinfo.tblTaskLogList.filter(\n" +
+                        "                            function(ii) { return ii.taskStatus === 3}\n" +
+                        "                          )[0].logDes\n" +
+                        "                        ).gzldata[0].value1 }";
+                Object xchs = JSUtils.runjs(runjs);
+
+                runjs = commjs+"return JSON.parse(\n" +
+                        "                          taskinfo.tblTaskLogList.filter(\n" +
+                        "                            function(ii) { return ii.taskStatus === 3}\n" +
+                        "                          )[0].logDes\n" +
+                        "                        ).czff }";
+                Object czff = JSUtils.runjs(runjs);
+
+
+
+
+                String datap = "<table class='maptable'><tr><td>事件分类:</td><td>"+(task.getTaskType()==null?"-": typemap.get(task.getTaskType())) + "</td></tr>";
+                datap+="<tr><td>区域:</td><td>"+areamap.get(task.getTaskArea())+ "</td></tr>";
+                datap+="<tr><td>班组:</td><td>"+deptn+ "</td></tr>";
+                datap+="<tr><td>日期:</td><td>"+(task.getTaskTime()==null?"-": DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",task.getTaskTime()) )+ "</td></tr>";
+                datap+="<tr><td>工单号:</td><td>"+(task.getTaskCode()==null?"-": task.getTaskCode())+ "</td></tr>";
+                datap+="<tr><td>事件地址:</td><td>"+(task.getTaskAddr()==null?"-": task.getTaskAddr())+ "</td></tr>";
+                datap+="<tr><td>事件内容:</td><td>"+(task.getTaskContent()==null?"-": task.getTaskContent())+ "</td></tr>";
+                datap+="<tr><td>事件类型:</td><td>"+(task.getTaskEventType()==null?"-": taskeventtype.get(task.getTaskEventType()+""))+ "</td></tr>";
+                datap+="<tr><td>现场核实:</td><td>"+(xchs==null?"-": xchs.toString() )+ "</td></tr>";
+                datap+="<tr><td>处理方法:</td><td>"+(czff==null?"-": czff.toString() )+ "</td></tr></table>";;
+
+                Map<String,Object> tt = new HashMap<>();
+                tt.put("data",datap);
+                task.setParams(tt);
+
+
+            }
+
+        }
+
+        return  AjaxResult.success(res);
+    }
+
+    @GetMapping("/data")
+    public Object getdata(TblTask tblTask)
+    {
+        Map<String,Object> data = new HashMap<>();
+//        5.1 在线单元/组,统计今日人员动态数量;
+//        5.2 统计今日新增热线工单数量;
+//        5.3 今日养护设施km  (只查主管养护)
+//        5.4 今日核查设备km  (检测)
+//
+
+
+        //当前时间
+        String currentyearstart = DateUtils.parseDateToStr(DateUtils.YYYY,new Date())+"-01-01";
+        String currentyearend =   DateUtils.parseDateToStr(DateUtils.YYYY,DateUtils.addYears(new Date(),1))+"-01-01";
+        String currentdaystart = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date());
+        String currentdayend = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,DateUtils.addDays(new Date(),1));
+
+        //当天
+        TblTaskLog selectTaskLog = new TblTaskLog();
+        Map<String,Object> temp = new HashMap<>();
+        temp.put("beginTime",currentdaystart);
+        temp.put("endTime",currentdayend);
+        selectTaskLog.setParams(temp);
+        List<TblTaskLog>  taskLogs = tblTaskLogService.selectTblTaskLogList(selectTaskLog);
+        data.put("tasklog",taskLogs);
+
+        //年度
+        //工单
+        TblTask selectTask = new TblTask();
+        temp = new HashMap<>();
+        temp.put("beginTime",currentdaystart);
+        temp.put("endTime",currentdayend);
+        selectTask.setParams(temp);
+        List<TblTask>  tasks = tblTaskService.selectTblTaskList(selectTask);
+        data.put("tasks",tasks);
+
+
+        //养护
+
+        TblMaintainLog maintainLog = new TblMaintainLog();
+        temp = new HashMap<>();
+        temp.put("datetime",currentdaystart);
+        maintainLog.setParams(temp);
+        List<TblMaintainLog>  tblMaintainLogs = tblMaintainLogService.selectTblMaintainLogToday(maintainLog);
+        data.put("maintain",tblMaintainLogs);
+
+
+
+
+        //检测
+        TblDetectionLog detectionLog = new TblDetectionLog();
+        temp = new HashMap<>();
+        temp.put("datetime",currentdaystart);
+        detectionLog.setParams(temp);
+        List<TblDetectionLog> detectionLogs =  tblDetectionLogService.selectTblDetectionLogToday(detectionLog);
+        data.put("detection",detectionLogs);
+
+
+
+
+        return AjaxResult.success(data);
+    }
+
+    private Object Getweather(){
+       Object w =   redisCache.getCacheObject("weather");
+       if(w==null){
+           Object res =  otherApiUtils.getweather();
+           DateUtils.addDays(new Date(),1).getTime();
+           long time =  DateUtils.dateTime(DateUtils.YYYY_MM_DD,DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,DateUtils.addDays(new Date(),1))).getTime()- (new Date()).getTime();
+           redisCache.setCacheObject("weather",res,(int)(time/1000),TimeUnit.SECONDS);
+           w = res;
+       }
+       return w;
+    }
+
+
+}

+ 7 - 0
ruoyi-common/pom.xml

@@ -149,6 +149,13 @@
         </dependency>
 
 
+        <dependency>
+            <groupId>com.dtflys.forest</groupId>
+            <artifactId>forest-spring-boot-starter</artifactId>
+            <version>1.5.27</version>
+        </dependency>
+
+
 
 
     </dependencies>

+ 8 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/OtherApiUtils.java

@@ -0,0 +1,8 @@
+package com.ruoyi.common.utils;
+
+import com.dtflys.forest.annotation.Get;
+
+public interface OtherApiUtils {
+    @Get("https://devapi.qweather.com/v7/weather/7d?key=cfa3eab4a64f45de9bb354254408a42d&location=101300101")
+    Object getweather();
+}

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TblDetectionLogMapper.java

@@ -27,6 +27,9 @@ public interface TblDetectionLogMapper
      */
     public List<TblDetectionLog> selectTblDetectionLogList(TblDetectionLog tblDetectionLog);
 
+
+    public List<TblDetectionLog> selectTblDetectionLogToday(TblDetectionLog tblDetectionLog);
+
     /**
      * 新增检测计划日志【检测计划日志内容 ,计划派发内容,计划执行反馈】
      * 

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TblMaintainLogMapper.java

@@ -27,6 +27,9 @@ public interface TblMaintainLogMapper
      */
     public List<TblMaintainLog> selectTblMaintainLogList(TblMaintainLog tblMaintainLog);
 
+    public List<TblMaintainLog> selectTblMaintainLogToday(TblMaintainLog tblMaintainLog);
+
+
     /**
      * 新增养护计划日志【养护计划日志内容 ,计划派发内容,计划执行反馈】
      * 

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ITblDetectionLogService.java

@@ -27,6 +27,8 @@ public interface ITblDetectionLogService
      */
     public List<TblDetectionLog> selectTblDetectionLogList(TblDetectionLog tblDetectionLog);
 
+    public List<TblDetectionLog> selectTblDetectionLogToday(TblDetectionLog tblDetectionLog);
+
     /**
      * 新增检测计划日志【检测计划日志内容 ,计划派发内容,计划执行反馈】
      * 

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ITblMaintainLogService.java

@@ -27,6 +27,9 @@ public interface ITblMaintainLogService
      */
     public List<TblMaintainLog> selectTblMaintainLogList(TblMaintainLog tblMaintainLog);
 
+    public List<TblMaintainLog> selectTblMaintainLogToday(TblMaintainLog tblMaintainLog);
+
+
     /**
      * 新增养护计划日志【养护计划日志内容 ,计划派发内容,计划执行反馈】
      * 

+ 8 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TableDetectionServiceImpl.java

@@ -61,7 +61,14 @@ public class TableDetectionServiceImpl implements ITableDetectionService
     @Override
     public List<TableDetection> selectTableDetectionList(TableDetection tableDetection)
     {
-        return tableDetectionMapper.selectTableDetectionList(tableDetection);
+        List<TableDetection> taskList = tableDetectionMapper.selectTableDetectionList(tableDetection);
+        for (TableDetection t:taskList
+        ) {
+            TblDetectionLog taskLog = new TblDetectionLog();
+            taskLog.setDetectionId(t.getId());
+            t.setDetectionLogs( detectionLogService.selectTblDetectionLogList(taskLog));
+        }
+        return taskList;
     }
 
     /**

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TblDetectionLogServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
 
 import java.util.List;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.TblDetectionLogMapper;
@@ -44,6 +45,11 @@ public class TblDetectionLogServiceImpl implements ITblDetectionLogService
         return tblDetectionLogMapper.selectTblDetectionLogList(tblDetectionLog);
     }
 
+    @Override
+    public List<TblDetectionLog> selectTblDetectionLogToday(TblDetectionLog tblDetectionLog) {
+        return tblDetectionLogMapper.selectTblDetectionLogToday(tblDetectionLog);
+    }
+
     /**
      * 新增检测计划日志【检测计划日志内容 ,计划派发内容,计划执行反馈】
      * 
@@ -54,6 +60,7 @@ public class TblDetectionLogServiceImpl implements ITblDetectionLogService
     public int insertTblDetectionLog(TblDetectionLog tblDetectionLog)
     {
         tblDetectionLog.setCreateTime(DateUtils.getNowDate());
+        tblDetectionLog.setCreateBy(SecurityUtils.getUsername()+"$"+SecurityUtils.getUserId());
         return tblDetectionLogMapper.insertTblDetectionLog(tblDetectionLog);
     }
 

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TblMaintainLogServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
 
 import java.util.List;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.TblMaintainLogMapper;
@@ -44,6 +45,11 @@ public class TblMaintainLogServiceImpl implements ITblMaintainLogService
         return tblMaintainLogMapper.selectTblMaintainLogList(tblMaintainLog);
     }
 
+    @Override
+    public List<TblMaintainLog> selectTblMaintainLogToday(TblMaintainLog tblMaintainLog) {
+        return tblMaintainLogMapper.selectTblMaintainLogToday(tblMaintainLog);
+    }
+
     /**
      * 新增养护计划日志【养护计划日志内容 ,计划派发内容,计划执行反馈】
      * 
@@ -54,6 +60,7 @@ public class TblMaintainLogServiceImpl implements ITblMaintainLogService
     public int insertTblMaintainLog(TblMaintainLog tblMaintainLog)
     {
         tblMaintainLog.setCreateTime(DateUtils.getNowDate());
+        tblMaintainLog.setCreateBy(SecurityUtils.getUsername()+"$"+SecurityUtils.getUserId());
         return tblMaintainLogMapper.insertTblMaintainLog(tblMaintainLog);
     }
 

+ 8 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TblMaintainServiceImpl.java

@@ -61,7 +61,14 @@ public class TblMaintainServiceImpl implements ITblMaintainService
     @Override
     public List<TblMaintain> selectTblMaintainList(TblMaintain tblMaintain)
     {
-        return tblMaintainMapper.selectTblMaintainList(tblMaintain);
+        List<TblMaintain> taskList = tblMaintainMapper.selectTblMaintainList(tblMaintain);
+        for (TblMaintain t:taskList
+        ) {
+            TblMaintainLog taskLog = new TblMaintainLog();
+            taskLog.setMaintainId(t.getId());
+            t.setMaintainLogs( tblMaintainLogService.selectTblMaintainLogList(taskLog));
+        }
+        return taskList;
     }
 
     /**

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TblTaskLogServiceImpl.java

@@ -55,7 +55,7 @@ public class TblTaskLogServiceImpl implements ITblTaskLogService
     public int insertTblTaskLog(TblTaskLog tblTaskLog)
     {
         tblTaskLog.setCreateTime(DateUtils.getNowDate());
-        tblTaskLog.setCreateBy(SecurityUtils.getUsername());
+        tblTaskLog.setCreateBy(SecurityUtils.getUsername()+"$"+SecurityUtils.getUserId());
         return tblTaskLogMapper.insertTblTaskLog(tblTaskLog);
     }
 

+ 2 - 2
ruoyi-system/src/main/resources/mapper/system/TableDetectionMapper.xml

@@ -47,10 +47,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
             <if test="params.searchkey != null  and params.searchkey != ''"> and  ( ext1->'$.facilities_road' like  concat('%', #{params.searchkey}, '%') or ext1->'$.facilities_name' like concat('%', #{params.searchkey}, '%') )</if>
             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-                and date_format(ext1->'$.task.datestart','%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+                and date_format(CONCAT(ext1->>'$.task.datestart','-01'),'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
             </if>
             <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-                and date_format(ext1->'$.task.dateend','%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+                and date_format(CONCAT(ext1->>'$.task.dateend','-01'),'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
             </if>
 
             <if test="params.userId != null and params.userId != ''"><!-- 派发用户自己的或自己填报的或自己处理的 -->

+ 8 - 0
ruoyi-system/src/main/resources/mapper/system/TblDetectionLogMapper.xml

@@ -20,6 +20,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select id, detection_id, detection_status, log_des, log_pics, log_videos, create_time, update_time, remark from tbl_detection_log
     </sql>
 
+    <select id="selectTblDetectionLogToday" parameterType="TblDetectionLog" resultMap="TblDetectionLogResult">
+        SELECT b.id as id, b.log_des->'$.wcgzl.\"${params.datetime}\"' as log_des  from tbl_detection_log b,  (
+            SELECT detection_id,detection_status,MAX( create_time ) as create_time from tbl_detection_log where log_des->'$.wcgzl.\"${params.datetime}\"' is not NULL GROUP BY detection_id,detection_status) a WHERE a.create_time=b.create_time and a.detection_id=b.detection_id and a.detection_status=b.detection_status
+
+    </select>
+
     <select id="selectTblDetectionLogList" parameterType="TblDetectionLog" resultMap="TblDetectionLogResult">
         <include refid="selectTblDetectionLogVo"/>
         <where>  
@@ -45,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="logPics != null">log_pics,</if>
             <if test="logVideos != null">log_videos,</if>
             <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="remark != null">remark,</if>
          </trim>
@@ -55,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="logPics != null">#{logPics},</if>
             <if test="logVideos != null">#{logVideos},</if>
             <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
          </trim>

+ 8 - 0
ruoyi-system/src/main/resources/mapper/system/TblMaintainLogMapper.xml

@@ -35,6 +35,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectTblMaintainLogVo"/>
         where id = #{id}
     </select>
+
+    <select id="selectTblMaintainLogToday" parameterType="TblMaintainLog" resultMap="TblMaintainLogResult">
+        SELECT b.id as id,b.log_des->'$.wcgzl.\"${params.datetime}\"'  as log_des from tbl_maintain_log b,  (
+            SELECT maintain_id,maintain_status,MAX( create_time ) as create_time from tbl_maintain_log where log_des->'$.wcgzl.\"${params.datetime}\"' is not NULL GROUP BY maintain_id,maintain_status) a WHERE a.create_time=b.create_time and a.maintain_id=b.maintain_id and a.maintain_status=b.maintain_status
+
+    </select>
         
     <insert id="insertTblMaintainLog" parameterType="TblMaintainLog" useGeneratedKeys="true" keyProperty="id">
         insert into tbl_maintain_log
@@ -45,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="logPics != null">log_pics,</if>
             <if test="logVideos != null">log_videos,</if>
             <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="remark != null">remark,</if>
          </trim>
@@ -55,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="logPics != null">#{logPics},</if>
             <if test="logVideos != null">#{logVideos},</if>
             <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
          </trim>

+ 2 - 2
ruoyi-system/src/main/resources/mapper/system/TblMaintainMapper.xml

@@ -49,10 +49,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
             <if test="params.searchkey != null  and params.searchkey != ''"> and  ( ext1->'$.facilities_road' like  concat('%', #{params.searchkey}, '%') or ext1->'$.facilities_name' like concat('%', #{params.searchkey}, '%') )</if>
             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-                and date_format(ext1->'$.task.datestart','%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+                and date_format(CONCAT(ext1->>'$.task.datestart','-01'),'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
             </if>
             <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-                and date_format(ext1->'$.task.dateend','%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+                and date_format(CONCAT(ext1->>'$.task.dateend','-01'),'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
             </if>
             <if test="params.userId != null and params.userId != ''"><!-- 派发用户自己的或自己填报的或自己处理的 -->
                 <![CDATA[

+ 5 - 0
ruoyi-system/src/main/resources/mapper/system/TblTaskLogMapper.xml

@@ -30,6 +30,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="logDes != null  and logDes != ''"> and log_des = #{logDes}</if>
             <if test="logPics != null  and logPics != ''"> and log_pics = #{logPics}</if>
             <if test="logVideos != null  and logVideos != ''"> and log_videos = #{logVideos}</if>
+            <if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"><!-- 开始时间检索 -->
+                and ( ( date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d') and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') ) or
+                ( date_format(update_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')  and  date_format(update_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') ))
+            </if>
+
         </where>
     </select>