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 |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 106 insertions(+), 2 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 20953f8..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
@@ -1,10 +1,21 @@
 package com.ruoyi.system.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.system.mapper.TInspectorMapper;
-import com.ruoyi.system.model.TInspector;
+import com.ruoyi.common.basic.PageInfo;
+import com.ruoyi.common.core.domain.BaseModel;
+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;
+import com.ruoyi.system.vo.system.TaskListVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * <p>
@@ -17,4 +28,97 @@
 @Service
 public class TInspectorServiceImpl extends ServiceImpl<TInspectorMapper, TInspector> implements TInspectorService {
 
+    @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<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){
+//                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