From 53d014edd19f57125c355abe71ec5b478500e610 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 05 八月 2025 09:57:40 +0800
Subject: [PATCH] 保洁巡检所有代码

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TInspectorServiceImpl.java |   96 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 77 insertions(+), 19 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TInspectorServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TInspectorServiceImpl.java
index ade0445..4cb37c4 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TInspectorServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TInspectorServiceImpl.java
@@ -4,14 +4,9 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.basic.PageInfo;
 import com.ruoyi.common.core.domain.BaseModel;
-import com.ruoyi.system.mapper.TDeptMapper;
-import com.ruoyi.system.mapper.TInspectorMapper;
-import com.ruoyi.system.mapper.TTaskDetailMapper;
-import com.ruoyi.system.mapper.TTaskMapper;
-import com.ruoyi.system.model.TDept;
-import com.ruoyi.system.model.TInspector;
-import com.ruoyi.system.model.TTask;
-import com.ruoyi.system.model.TTaskDetail;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.system.mapper.*;
+import com.ruoyi.system.model.*;
 import com.ruoyi.system.query.InsepectorListQuery;
 import com.ruoyi.system.service.TInspectorService;
 import com.ruoyi.system.vo.system.InspectorListVO;
@@ -36,31 +31,94 @@
     @Autowired
     private TDeptMapper deptMapper;
     @Autowired
+    private TProjectDeptMapper projectDeptMapper;
+    @Autowired
     private TTaskDetailMapper taskDetailMapper;
     @Autowired
     private TTaskMapper taskMapper;
+    @Autowired
+    private SysUserMapper sysUserMapper;
+    @Autowired
+    private TLocationMapper locationMapper;
     @Override
     public PageInfo<InspectorListVO> pageList(InsepectorListQuery query) {
+        List<SysUser> sysUsers = sysUserMapper.selectAllList();
         PageInfo<InspectorListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
         List<InspectorListVO> list = this.baseMapper.pageList(query,pageInfo);
 
-        List<TTaskDetail> tTaskDetails = taskDetailMapper.selectList(new LambdaQueryWrapper<TTaskDetail>()
-                .orderByDesc(BaseModel::getCreateTime)
-                .in(TTaskDetail::getHandleType, Arrays.asList(1,4)));
+
         List<TTask> tTasks = taskMapper.selectList(null);
+        List<TLocation> locations = locationMapper.selectList(null);
         for (InspectorListVO taskListVO : list) {
-            TTask tTask = tTasks.stream().filter(e -> e.getId().equals(taskListVO.getTaskId())).findFirst().orElse(null);
-            if (tTask!=null){
-                TDept tDept = deptMapper.selectById(tTask.getPatrolInspectorDept());
-                taskListVO.setDeptName(tDept.getDeptName());
-                TTaskDetail tTaskDetail = tTaskDetails.stream().filter(e -> e.getTaskId().equals(taskListVO.getId())).findFirst().orElse(null);
-                if (tTaskDetail!=null){
-                    taskListVO.setPicture(tTaskDetail.getPicture());
-                    taskListVO.setClearStatus(tTaskDetail.getClearStatus());
+//            TTask tTask = tTasks.stream().filter(e -> e.getId().equals(taskListVO.getTaskId())).findFirst().orElse(null);
+//            if (tTask!=null){
+//                taskListVO.setTaskType(tTask.getTaskType());
+//
+//            }
+            TLocation tLocation = locations.stream().filter(e -> e.getId().equals(taskListVO.getLocationId())).findFirst()
+                    .orElse(null);
+            if (tLocation == null){
+                continue;
+            }
+            SysUser sysUser = sysUsers.stream().filter(e -> e.getUserId().equals(Long.valueOf(tLocation.getLocationLeader()))).findFirst().orElse(null);
+            if (sysUser!=null){
+                if (sysUser.getDeptType()==2){
+                    TDept tDept = deptMapper.selectById(sysUser.getDeptId());
+                    if (tDept!=null){
+                        taskListVO.setDeptName(tDept.getDeptName());
+                    }
+                }else{
+                    TProjectDept tProjectDept = projectDeptMapper.selectById(sysUser.getDeptId());
+                    if (tProjectDept != null) {
+                        if (!tProjectDept.getParentId().equals("0")) {
+                            TProjectDept tProjectDept1 = projectDeptMapper.selectById(tProjectDept.getParentId());
+                            if (tProjectDept1 != null) {
+                                taskListVO.setDeptName(tProjectDept1.getProjectName() + ">" + tProjectDept.getProjectName());
+                            }
+                        } else {
+                            taskListVO.setDeptName(tProjectDept.getProjectName());
+                        }
+                    }
                 }
             }
         }
         pageInfo.setRecords(list);
         return pageInfo;
     }
+    public List<InspectorListVO> pageListExport(InsepectorListQuery query) {
+        List<SysUser> sysUsers = sysUserMapper.selectAllList();
+        PageInfo<InspectorListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
+        List<InspectorListVO> list = this.baseMapper.pageListExport(query,pageInfo);
+        List<TLocation> locations = locationMapper.selectList(null);
+        for (InspectorListVO taskListVO : list) {
+            TLocation tLocation = locations.stream().filter(e -> e.getId().equals(taskListVO.getLocationId())).findFirst()
+                    .orElse(null);
+            if (tLocation == null){
+                continue;
+            }
+            SysUser sysUser = sysUsers.stream().filter(e -> e.getUserId().equals(Long.valueOf(tLocation.getLocationLeader()))).findFirst().orElse(null);
+            if (sysUser!=null){
+                if (sysUser.getDeptType()==2){
+                    TDept tDept = deptMapper.selectById(sysUser.getDeptId());
+                    if (tDept!=null){
+                        taskListVO.setDeptName(tDept.getDeptName());
+                    }
+                }else{
+                    TProjectDept tProjectDept = projectDeptMapper.selectById(sysUser.getDeptId());
+                    if (tProjectDept != null) {
+                        if (!tProjectDept.getParentId().equals("0")) {
+                            TProjectDept tProjectDept1 = projectDeptMapper.selectById(tProjectDept.getParentId());
+                            if (tProjectDept1 != null) {
+                                taskListVO.setDeptName(tProjectDept1.getProjectName() + ">" + tProjectDept.getProjectName());
+                            }
+                        } else {
+                            taskListVO.setDeptName(tProjectDept.getProjectName());
+                        }
+                    }
+                }
+            }
+        }
+        pageInfo.setRecords(list);
+        return list;
+    }
 }

--
Gitblit v1.7.1