From 201518a621d0d5f3c2040217950b10a5eaba22e6 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期六, 12 七月 2025 14:51:01 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/EmailUtils.java                |   99 ++++
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TEarlyWarningServiceImpl.java |  138 +++++-
 ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml                        |    8 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TLocationController.java        |   10 
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TIndexController.java          |   12 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TEarlyWarningController.java    |   33 +
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTaskController.java            |  226 ++++++----
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java      |    2 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java                  |   58 ++
 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java               |    2 
 ruoyi-system/src/main/resources/mapper/system/TEarlyWarningMapper.xml                  |    4 
 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java                  |    2 
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TInspectorServiceImpl.java    |    1 
 ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml                        |    2 
 ruoyi-system/src/main/java/com/ruoyi/system/mapper/TEarlyWarningMapper.java            |    2 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectorController.java       |   34 +
 ruoyi-system/src/main/resources/mapper/system/TInspectorMapper.xml                     |    5 
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java                 |  150 ++++++-
 ruoyi-system/src/main/resources/mapper/system/TLeaveMapper.xml                         |    1 
 ruoyi-system/src/main/java/com/ruoyi/system/vo/system/InspectorListVO.java             |    4 
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java           |  151 ++++++-
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java       |    4 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java       |   13 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java                  |  149 ++++++
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/EmailUtils.java               |   85 ++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppealController.java          |   47 ++
 26 files changed, 1,031 insertions(+), 211 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppealController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppealController.java
index a8d58d5..c232c77 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppealController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppealController.java
@@ -15,6 +15,8 @@
 import com.ruoyi.system.service.*;
 import com.ruoyi.system.vo.system.AppealDetailVO;
 import com.ruoyi.system.vo.system.AppealListVO;
+import com.ruoyi.web.controller.tool.EmailUtils;
+import com.ruoyi.web.controller.tool.MsgUtils;
 import com.tencentcloudapi.es.v20180416.models.TaskDetail;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -192,11 +194,20 @@
     }
     @Resource
     private TNoticeService noticeService;
+    @Resource
+    private MsgUtils msgUtils;
+    @Resource
+    private TNoticeSetService noticeSetService;
+    @Resource
+    private TDictDataService dictDataService;
     @Log(title = "审核申诉记录", businessType = BusinessType.UPDATE)
     @ApiOperation(value = "审核申诉记录")
     @PostMapping(value = "/audit")
-    public R<Boolean> audit(@RequestBody @Valid TAppealAuditDTO dto) {
+    public R<Boolean> audit(@RequestBody @Valid TAppealAuditDTO dto) throws Exception {
+        List<SysUser> sysUsers = sysUserService.selectAllList();
         TAppeal appeal = appealService.getById(dto.getId());
+        SysUser sysUser = sysUsers.stream().filter(e -> e.getUserId().equals(Long.valueOf(dto.getAppealPerson())))
+                .findFirst().orElse(null);
         dto.setStatus(dto.getStatus());
         dto.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
         dto.setAuditTime(LocalDateTime.now());
@@ -211,6 +222,12 @@
         taskDetail.setTaskId(appeal.getTaskId());
         Long count = tTaskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, appeal.getTaskId())
                 .eq(TTaskDetail::getHandleType, 1).count();
+        TNoticeSet noticeSet = noticeSetService.lambdaQuery().eq(TNoticeSet::getType, 2).last("limit 1")
+                .one();
+        // 邮箱
+        TDictData email = dictDataService.lambdaQuery().eq(TDictData::getDataType,4).one();
+        // 授权码
+        TDictData code = dictDataService.lambdaQuery().eq(TDictData::getDataType,5).one();
         if (dto.getStatus()==2){
             taskDetail.setClearStatus(1);
             taskDetail.setAuditTime(LocalDateTime.now());
@@ -231,6 +248,20 @@
             taskCleanService.updateById(byId);
             tNotice.setNoticeType(5);
             tNotice.setNoticeContent("【"+location.getLocationName()+"】任务申诉通过");
+            if (sysUser!=null){
+                switch (noticeSet.getNoticeType()) {
+                    case 1:
+                        msgUtils.sendMsg3(sysUser.getPhonenumber(),location.getLocationName(),"通过");
+                        break;
+                    case 2:
+                        if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())){
+                            EmailUtils.sendEmail(sysUser.getEmail(),email.getDataContent(),code.getDataContent(),"【"+location.getLocationName()+"】任务申诉通过");
+                        }
+                        break;
+                    case 3:
+                        break;
+                }
+            }
         }else{
             taskDetail.setClearStatus(2);
             taskDetail.setAuditTime(LocalDateTime.now());
@@ -241,6 +272,20 @@
             taskDetail.setAppealId(dto.getId());
             tNotice.setNoticeType(4);
             tNotice.setNoticeContent("【"+location.getLocationName()+"】任务申诉驳回");
+            if (sysUser!=null){
+                switch (noticeSet.getNoticeType()) {
+                    case 1:
+                        msgUtils.sendMsg3(sysUser.getPhonenumber(),location.getLocationName(),"通过");
+                        break;
+                    case 2:
+                        if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())){
+                            EmailUtils.sendEmail(sysUser.getEmail(),email.getDataContent(),code.getDataContent(),"【"+location.getLocationName()+"】任务申诉驳回");
+                        }
+                        break;
+                    case 3:
+                        break;
+                }
+            }
         }
         noticeService.save(tNotice);
         dto.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TEarlyWarningController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TEarlyWarningController.java
index 1e8dc3c..9c617f7 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TEarlyWarningController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TEarlyWarningController.java
@@ -68,18 +68,30 @@
         List<TLocation> locationList = locationService.list();
         List<TTask> taskList = taskCleanerService.list();
         if (StringUtils.hasLength(query.getDeptName())){
-            List<String> projectIds = projectDeptService.lambdaQuery().like(TProjectDept::getProjectName, query.getDeptName()).list()
+            List<TProjectDept> list = projectDeptService.lambdaQuery().like(TProjectDept::getProjectName, query.getDeptName()).list();
+            List<String> listIds = projectDeptService.lambdaQuery().like(TProjectDept::getProjectName, query.getDeptName()).list()
                     .stream().map(TProjectDept::getId).collect(Collectors.toList());
+            for (TProjectDept tProjectDept : list) {
+                if (tProjectDept.getParentId().equals("0")){
+                    List<String> collect = projectDeptService.lambdaQuery().eq(TProjectDept::getParentId, tProjectDept.getId()).list()
+                            .stream().map(TProjectDept::getId).collect(Collectors.toList());
+                    listIds.addAll(collect);
+                    listIds.add(tProjectDept.getId());
+                }
+            }
             List<String> deptIds = deptService.lambdaQuery().like(TDept::getDeptName, query.getDeptName()).list()
                     .stream().map(TDept::getId).collect(Collectors.toList());
-            projectIds.addAll(deptIds);
-            if (projectIds.isEmpty()){
+            listIds.addAll(deptIds);
+            if (listIds.isEmpty()){
                 return R.ok(new PageInfo<>());
             }
+            List<Long> collect = sysUsers.stream().filter(e -> listIds.contains(e.getDeptId()))
+                    .map(SysUser::getUserId).collect(Collectors.toList());
+            query.setPatrolInspectorIds( collect);
             if (StringUtils.hasLength(query.getPhonenumber())){
                 List<Long> patrolInspectorIds = sysUsers.stream().filter(sysUser ->
-                        sysUser.getPhonenumber().equals(query.getPhonenumber())
-                                && projectIds.contains(sysUser.getDeptId())
+                        sysUser.getPhonenumber().contains(query.getPhonenumber())
+                                && listIds.contains(sysUser.getDeptId())
                 ).map(SysUser::getUserId).collect(Collectors.toList());
                 if (patrolInspectorIds.isEmpty()){
                     return R.ok(new PageInfo<>());
@@ -89,8 +101,9 @@
         }
         if (StringUtils.hasLength(query.getPhonenumber())){
             List<Long> patrolInspectorIds = sysUsers.stream().filter(sysUser ->
-                    sysUser.getPhonenumber().equals(query.getPhonenumber())
+                    sysUser.getPhonenumber().contains(query.getPhonenumber())
             ).map(SysUser::getUserId).collect(Collectors.toList());
+            query.setPatrolInspectorIds(patrolInspectorIds);
             if (!query.getPatrolInspectorIds().isEmpty()){
                 // 取交集
                 patrolInspectorIds = patrolInspectorIds.stream().filter(query.getPatrolInspectorIds()::contains).collect(Collectors.toList());
@@ -118,9 +131,11 @@
                 query.setLocationIds(collect);
                 return R.ok(new PageInfo<>());
             }else{
-                collect = collect.stream().filter(query.getLocationIds()::contains).collect(Collectors.toList());
-                if (collect.isEmpty()){
-                    return R.ok(new PageInfo<>());
+                if (query.getLocationIds()!=null && !query.getLocationIds().isEmpty()){
+                    collect = collect.stream().filter(query.getLocationIds()::contains).collect(Collectors.toList());
+                    if (collect.isEmpty()){
+                        return R.ok(new PageInfo<>());
+                    }
                 }
                 query.setLocationIds(collect);
             }
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectorController.java
index 94d13b9..9770e05 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectorController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectorController.java
@@ -19,6 +19,8 @@
 import com.ruoyi.system.service.*;
 import com.ruoyi.system.vo.system.InspectorListVO;
 import com.ruoyi.system.vo.system.TaskListVO;
+import com.ruoyi.web.controller.tool.EmailUtils;
+import com.ruoyi.web.controller.tool.MsgUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -135,6 +137,10 @@
                 }
                 query.setLocationIds(collect);
             }
+        }
+        if (StringUtils.hasLength(query.getEndTime())){
+            String replace = query.getEndTime().replace(" 00:00:00", " 23:59:59");
+            query.setEndTime(replace);
         }
         return R.ok(inspectorService.pageList(query));
     }
@@ -254,10 +260,14 @@
     private TNoticeService noticeService;
     @Resource
     private TNoticeSetService noticeSetService;
+    @Resource
+    private TDictDataService dictDataService;
+    @Resource
+    private MsgUtils msgUtils;
     @Log(title = "审核任务", businessType = BusinessType.UPDATE)
     @ApiOperation(value = "审核任务")
     @PostMapping(value = "/audit")
-    public R<Boolean> audit(@RequestBody TInspectorAuditDTO dto) {
+    public R<Boolean> audit(@RequestBody TInspectorAuditDTO dto) throws Exception {
         TTaskAuditDTO tTaskAuditDTO = new TTaskAuditDTO();
         BeanUtils.copyProperties(dto, tTaskAuditDTO);
         TTask task = taskCleanerService.getById(dto.getTaskId());
@@ -269,14 +279,32 @@
         tNotice.setStatus(1);
         tNotice.setDataId(task.getId());
         tNotice.setNoticeSetType(noticeSet.getNoticeType());
+        TInspector byId = inspectorService.getById(dto.getId());
+        SysUser sysUser = sysUserService.selectUserById(Long.valueOf(task.getPatrolInspector()));
+        // 邮箱
+        TDictData email = dictDataService.lambdaQuery().eq(TDictData::getDataType,4).one();
+        // 授权码
+        TDictData code = dictDataService.lambdaQuery().eq(TDictData::getDataType,5).one();
         if (dto.getAuditStatus()==1){
-            if (dto.getClearStatus()==2){
+            if (byId.getClearStatus()==2){
                 tTaskAuditDTO.setHandleType(3);
                 dto.setStatus(2);
                 // 增加消息
-                tNotice.setNoticeType(1);
+                tNotice.setNoticeType(8);
                 tNotice.setNoticeContent("【"+location.getLocationName()+"】督察任务不合格,请重新上传!");
                 noticeService.save(tNotice);
+                switch (noticeSet.getNoticeType()) {
+                    case 1:
+                        msgUtils.sendMsg5(sysUser.getPhonenumber(), location.getLocationName());
+                        break;
+                    case 2:
+                        if (StringUtils.hasLength(email.getDataContent()) && StringUtils.hasLength(code.getDataContent())) {
+                            EmailUtils.sendEmail(sysUser.getEmail(), email.getDataContent(), code.getDataContent(), "【"+location.getLocationName()+"】任务督察不合格,请及时整改!");
+                        }
+                        break;
+                    case 3:
+                        break;
+                }
             }else{
                 if (dto.getAuditTime()!=null){
                     dto.setStatus(3);
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TLocationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TLocationController.java
index 15d0200..e96f3cb 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TLocationController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TLocationController.java
@@ -269,7 +269,15 @@
     @ApiOperation(value = "根据部门/项目部id查询巡检员列表 不分页")
     @GetMapping(value = "/listUsers")
     public R<List<SysUser>> listUsers(@RequestParam String id) {
-            List<SysUser> res = sysUserService.selectUserByDeptId(id);
+        List<String> strings = new ArrayList<>();
+        strings.add(id);
+        TProjectDept projectDept = projectDeptService.getById(id);
+        if (projectDept.getParentId().equals("0")){
+            List<String> collect = projectDeptService.lambdaQuery().eq(TProjectDept::getParentId, projectDept.getId())
+                    .list().stream().map(TProjectDept::getId).collect(Collectors.toList());
+            strings.addAll(collect);
+        }
+        List<SysUser> res = sysUserService.selectUserByDeptId(strings);
         return R.ok(res);
     }
     @Log(title = "新增点位", businessType = BusinessType.INSERT)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTaskController.java
index b7d84a6..7b59cb6 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTaskController.java
@@ -1,4 +1,5 @@
 package com.ruoyi.web.controller.api;
+
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.net.URLEncoder;
@@ -29,6 +30,8 @@
 import com.ruoyi.system.query.TaskListQuery;
 import com.ruoyi.system.service.*;
 import com.ruoyi.system.vo.system.*;
+import com.ruoyi.web.controller.tool.EmailUtils;
+import com.ruoyi.web.controller.tool.MsgUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -62,8 +65,7 @@
     private TTaskCleanService taskCleanerService;
     @Resource
     private TNoticeService noticeService;
-    @Resource
-    private TNoticeSetService noticeSetService;
+
     @Resource
     private TEarlyWarningService earlyWarningService;
     @Resource
@@ -83,8 +85,7 @@
     private TDeptService deptService;
     @Resource
     private ISysUserService sysUserService;
-    @Resource
-    private TDictDataService dictDataService;
+
     @Resource
     private TokenService tokenService;
     @Resource
@@ -95,77 +96,77 @@
     public R<PageInfo<TaskListVO>> pageList(@RequestBody TaskListQuery query) {
         List<SysUser> sysUsers = sysUserService.selectAllList();
         List<TLocation> locationList = locationService.list();
-        if (StringUtils.hasLength(query.getDeptName())){
+        if (StringUtils.hasLength(query.getDeptName())) {
             List<TProjectDept> list = projectDeptService.lambdaQuery().like(TProjectDept::getProjectName, query.getDeptName()).list();
             List<String> listIds = projectDeptService.lambdaQuery().like(TProjectDept::getProjectName, query.getDeptName()).list()
                     .stream().map(TProjectDept::getId).collect(Collectors.toList());
             for (TProjectDept tProjectDept : list) {
-                if (tProjectDept.getParentId().equals("0")){
-                        List<String> collect = projectDeptService.lambdaQuery().eq(TProjectDept::getParentId, tProjectDept.getId()).list()
-                                .stream().map(TProjectDept::getId).collect(Collectors.toList());
-                        listIds.addAll(collect);
+                if (tProjectDept.getParentId().equals("0")) {
+                    List<String> collect = projectDeptService.lambdaQuery().eq(TProjectDept::getParentId, tProjectDept.getId()).list()
+                            .stream().map(TProjectDept::getId).collect(Collectors.toList());
+                    listIds.addAll(collect);
                     listIds.add(tProjectDept.getId());
                 }
             }
             List<String> deptIds = deptService.lambdaQuery().like(TDept::getDeptName, query.getDeptName()).list()
                     .stream().map(TDept::getId).collect(Collectors.toList());
             listIds.addAll(deptIds);
-            if (listIds.isEmpty()){
+            if (listIds.isEmpty()) {
                 return R.ok(new PageInfo<>());
             }
             List<Long> collect = sysUsers.stream().filter(e -> listIds.contains(e.getDeptId()))
                     .map(SysUser::getUserId).collect(Collectors.toList());
-            query.setPatrolInspectorIds( collect);
-            if (StringUtils.hasLength(query.getPhonenumber())){
+            query.setPatrolInspectorIds(collect);
+            if (StringUtils.hasLength(query.getPhonenumber())) {
                 List<Long> patrolInspectorIds = sysUsers.stream().filter(sysUser ->
                         sysUser.getPhonenumber().contains(query.getPhonenumber())
                                 && listIds.contains(sysUser.getDeptId())
                 ).map(SysUser::getUserId).collect(Collectors.toList());
-                if (patrolInspectorIds.isEmpty()){
+                if (patrolInspectorIds.isEmpty()) {
                     return R.ok(new PageInfo<>());
                 }
                 query.setPatrolInspectorIds(patrolInspectorIds);
             }
         }
-        if (StringUtils.hasLength(query.getPhonenumber())){
+        if (StringUtils.hasLength(query.getPhonenumber())) {
             List<Long> patrolInspectorIds = sysUsers.stream().filter(sysUser ->
                     sysUser.getPhonenumber().contains(query.getPhonenumber())
             ).map(SysUser::getUserId).collect(Collectors.toList());
             query.setPatrolInspectorIds(patrolInspectorIds);
-            if (!query.getPatrolInspectorIds().isEmpty()){
+            if (!query.getPatrolInspectorIds().isEmpty()) {
                 // 取交集
                 patrolInspectorIds = patrolInspectorIds.stream().filter(query.getPatrolInspectorIds()::contains).collect(Collectors.toList());
             }
             query.setPatrolInspectorIds(patrolInspectorIds);
-            if (patrolInspectorIds.isEmpty()){
+            if (patrolInspectorIds.isEmpty()) {
                 return R.ok(new PageInfo<>());
             }
         }
-        if (query.getClearStatus()!=null){
+        if (query.getClearStatus() != null) {
             List<String> collect = tTaskDetailService.lambdaQuery().eq(TTaskDetail::getClearStatus, query.getClearStatus())
                     .list().stream().distinct().map(TTaskDetail::getTaskId).collect(Collectors.toList());
             query.setTaskIds(collect);
-            if (collect.isEmpty()){
+            if (collect.isEmpty()) {
                 return R.ok(new PageInfo<>());
             }
         }
-        if (StringUtils.hasLength(query.getLocationType())){
+        if (StringUtils.hasLength(query.getLocationType())) {
             List<String> collect = locationList.stream().filter(e -> e.getLocationType().equals(query.getLocationType())).map(TLocation::getId)
                     .collect(Collectors.toList());
-            if (collect.isEmpty()){
+            if (collect.isEmpty()) {
                 return R.ok(new PageInfo<>());
             }
             query.setLocationIds(collect);
         }
-        if (StringUtils.hasLength(query.getLocationName())){
+        if (StringUtils.hasLength(query.getLocationName())) {
             List<String> collect = locationList.stream().filter(e -> e.getLocationName().contains(query.getLocationName())).map(TLocation::getId)
                     .collect(Collectors.toList());
             query.setLocationIds(collect);
-            if (collect.isEmpty()){
+            if (collect.isEmpty()) {
                 return R.ok(new PageInfo<>());
-            }else{
+            } else {
                 collect = collect.stream().filter(query.getLocationIds()::contains).collect(Collectors.toList());
-                if (collect.isEmpty()){
+                if (collect.isEmpty()) {
                     return R.ok(new PageInfo<>());
                 }
                 query.setLocationIds(collect);
@@ -190,29 +191,43 @@
         taskCleanerService.save(dto);
         return R.ok();
     }
+
+    @Resource
+    private MsgUtils msgUtils;
+    @Resource
+    private TNoticeSetService noticeSetService;
+    @Resource
+    private TDictDataService dictDataService;
     @Log(title = "审核任务", businessType = BusinessType.UPDATE)
     @ApiOperation(value = "审核任务")
     @PostMapping(value = "/audit")
-    public R<Boolean> audit(@RequestBody  TTaskAuditDTO dto) {
+    public R<Boolean> audit(@RequestBody TTaskAuditDTO dto) throws Exception {
         dto.setAuditTime(LocalDateTime.now());
         TTask task = taskCleanerService.getById(dto.getTaskId());
+        SysUser sysUser = sysUserService.selectUserById(Long.valueOf(task.getPatrolInspector()));
+
         TTaskDetail one = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, dto.getTaskId())
-                .eq(TTaskDetail::getHandleType,1)
+                .eq(TTaskDetail::getHandleType, 1)
                 .orderByDesc(BaseModel::getCreateTime).last("limit 1").one();
         dto.setClearStatus(one.getClearStatus());
         TLocation location = locationService.getById(task.getLocationId());
         TNotice tNotice = new TNotice();
         TNoticeSet noticeSet = noticeSetService.lambdaQuery().eq(TNoticeSet::getType, 2).last("limit 1")
                 .one();
+        // 邮箱
+        TDictData email = dictDataService.lambdaQuery().eq(TDictData::getDataType,4).one();
+        // 授权码
+        TDictData code = dictDataService.lambdaQuery().eq(TDictData::getDataType,5).one();
+
         tNotice.setUserId(task.getPatrolInspector());
         tNotice.setStatus(1);
         tNotice.setDataId(task.getId());
         tNotice.setNoticeSetType(noticeSet.getNoticeType());
-        if (dto.getAuditStatus()==2){
-            if (StringUtils.hasLength(location.getUnqualifiedTaskId())){
-                if (location.getUnqualifiedTaskId().split(",").length==2){
+        if (dto.getAuditStatus() == 2) {
+            if (StringUtils.hasLength(location.getUnqualifiedTaskId())) {
+                if (location.getUnqualifiedTaskId().split(",").length == 2) {
                     // 已经两条不合格了 生成点位不合格预警记录
-                    location.setUnqualifiedTaskId(location.getUnqualifiedTaskId()+","+dto.getTaskId());
+                    location.setUnqualifiedTaskId(location.getUnqualifiedTaskId() + "," + dto.getTaskId());
                     TEarlyWarning tEarlyWarning = new TEarlyWarning();
                     tEarlyWarning.setWarningType(2);
                     tEarlyWarning.setTaskId(location.getUnqualifiedTaskId());
@@ -220,7 +235,7 @@
                     location.setUnqualifiedTaskId("");
                     locationService.updateById(location);
                 }
-            }else{
+            } else {
                 location.setUnqualifiedTaskId(dto.getTaskId());
                 locationService.updateById(location);
             }
@@ -230,13 +245,30 @@
             taskCleanerService.updateById(task);
             // 增加消息
             tNotice.setNoticeType(1);
-            tNotice.setNoticeContent("【"+location.getLocationName()+"】任务不合格,请重新上传!");
-        }else{
-            if (dto.getClearStatus()==2){
-                if (StringUtils.hasLength(location.getUnqualifiedTaskId())){
-                    if (location.getUnqualifiedTaskId().split(",").length==2){
+            tNotice.setNoticeContent("【" + location.getLocationName() + "】任务不合格,请重新上传!");
+            if (sysUser!=null){
+                switch (noticeSet.getNoticeType()) {
+                    case 1:
+                        msgUtils.sendMsg1(sysUser.getPhonenumber(),location.getLocationName(),"驳回");
+                        break;
+                    case 2:
+                        if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())){
+                            EmailUtils.sendEmail(sysUser.getEmail(),email.getDataContent(),code.getDataContent(),"【" + location.getLocationName() + "】任务不合格,请重新上传!");
+                        }
+                        break;
+                    case 3:
+                        break;
+
+                }
+            }
+
+
+        } else {
+            if (dto.getClearStatus() == 2) {
+                if (StringUtils.hasLength(location.getUnqualifiedTaskId())) {
+                    if (location.getUnqualifiedTaskId().split(",").length == 2) {
                         // 已经两条不合格了 生成点位不合格预警记录
-                        location.setUnqualifiedTaskId(location.getUnqualifiedTaskId()+","+dto.getTaskId());
+                        location.setUnqualifiedTaskId(location.getUnqualifiedTaskId() + "," + dto.getTaskId());
                         TEarlyWarning tEarlyWarning = new TEarlyWarning();
                         tEarlyWarning.setWarningType(2);
                         tEarlyWarning.setTaskId(location.getUnqualifiedTaskId());
@@ -244,7 +276,7 @@
                         location.setUnqualifiedTaskId("");
                         locationService.updateById(location);
                     }
-                }else{
+                } else {
                     location.setUnqualifiedTaskId(dto.getTaskId());
                     locationService.updateById(location);
                 }
@@ -252,54 +284,70 @@
             dto.setHandleType(2);
             // 如果是初次审核就通过 将状态设置为已完成
             List<TTaskDetail> list = tTaskDetailService.lambdaQuery()
-                    .eq(TTaskDetail::getHandleType,1)
+                    .eq(TTaskDetail::getHandleType, 1)
                     .eq(TTaskDetail::getTaskId, dto.getTaskId()).list();
-                if (list.size()<2){
-                    task.setStatus(6);
-                    taskCleanerService.updateById(task);
-                    tNotice.setNoticeType(2);
-                    tNotice.setNoticeContent("【"+location.getLocationName()+"】任务已通过");
-                }else{
-                    task.setStatus(5);
-                    taskCleanerService.updateById(task);
-                    tNotice.setNoticeType(2);
-                    tNotice.setNoticeContent("【"+location.getLocationName()+"】任务已通过");
+            if (list.size() < 2) {
+                task.setStatus(6);
+                taskCleanerService.updateById(task);
+                tNotice.setNoticeType(2);
+                tNotice.setNoticeContent("【" + location.getLocationName() + "】任务已通过");
+            } else {
+                task.setStatus(5);
+                taskCleanerService.updateById(task);
+                tNotice.setNoticeType(2);
+                tNotice.setNoticeContent("【" + location.getLocationName() + "】任务已通过");
+            }
+            if (sysUser!=null){
+                switch (noticeSet.getNoticeType()) {
+                    case 1:
+                        msgUtils.sendMsg1(sysUser.getPhonenumber(),location.getLocationName(),"通过");
+                        break;
+                    case 2:
+                        if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())){
+                            EmailUtils.sendEmail(sysUser.getEmail(),email.getDataContent(),code.getDataContent(),"【" + location.getLocationName() + "】任务已通过");
+                        }
+                        break;
+                    case 3:
+                        break;
                 }
+            }
         }
         noticeService.save(tNotice);
-        dto.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
+        dto.setAuditPerson(tokenService.getLoginUser().getUserId() + "");
         taskDetailService.save(dto);
-        one.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
+        one.setAuditPerson(tokenService.getLoginUser().getUserId() + "");
         one.setAuditTime(LocalDateTime.now());
         one.setAuditRemark(dto.getAuditRemark());
         one.setAuditStatus(dto.getAuditStatus());
         taskDetailService.updateById(one);
         return R.ok();
     }
+
     @Log(title = "批量审核任务", businessType = BusinessType.UPDATE)
     @ApiOperation(value = "批量审核任务")
     @PostMapping(value = "/auditBatch")
-    public R<Boolean> auditBatch(@RequestBody  TTaskAuditBatchDTO dto) {
+    public R<Boolean> auditBatch(@RequestBody TTaskAuditBatchDTO dto) {
         List<TTaskDetail> tTaskDetails = new ArrayList<>();
         for (String s : dto.getTaskIds().split(",")) {
             TTask byId = taskCleanerService.getById(s);
             TTaskDetail tTaskDetail = new TTaskDetail();
             tTaskDetail.setTaskId(s);
             tTaskDetail.setAuditTime(LocalDateTime.now());
-            tTaskDetail.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
-            if (dto.getAuditStatus()==2){
+            tTaskDetail.setAuditPerson(tokenService.getLoginUser().getUserId() + "");
+            if (dto.getAuditStatus() == 2) {
                 tTaskDetail.setHandleType(3);
                 // 将任务修改为待整改
                 byId.setStatus(4);
                 taskCleanerService.updateById(byId);
-            }else{
+            } else {
                 tTaskDetail.setHandleType(2);
                 // 如果是初次审核就通过 将状态设置为已完成
-                List<TTaskDetail> list = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, s).list();
-                if (list.isEmpty()){
+                List<TTaskDetail> list = taskDetailService.lambdaQuery()
+                        .eq(TTaskDetail::getHandleType, 1).eq(TTaskDetail::getTaskId, s).list();
+                if (list.size() == 1) {
                     byId.setStatus(6);
                     taskCleanerService.updateById(byId);
-                }else{
+                } else {
                     byId.setStatus(5);
                     taskCleanerService.updateById(byId);
                 }
@@ -309,6 +357,7 @@
         taskDetailService.saveBatch(tTaskDetails);
         return R.ok();
     }
+
     @ApiOperation(value = "详情任务")
     @GetMapping(value = "/detail")
     public R<TaskDetailVO> detail(@RequestParam String id) {
@@ -324,26 +373,27 @@
         taskDetailVO.setLocationName(byId1.getLocationName());
         taskDetailVO.setLocationTypeName(byId2.getLocationName());
         TTaskDetail tTaskDetail = list.stream().filter(e -> e.getHandleType() == 1).findFirst().orElse(null);
-        if (tTaskDetail!=null &&  tTaskDetail.getUnqualified()!=null){
+        if (tTaskDetail != null && tTaskDetail.getUnqualified() != null) {
             TDictData byId3 = dictDataService.getById(tTaskDetail.getUnqualified());
-            if (byId3!=null){
+            if (byId3 != null) {
                 tTaskDetail.setUnqualifiedName(byId3.getDataContent());
             }
         }
-        if (tTaskDetail!=null){
+        if (tTaskDetail != null) {
             tTaskDetail.setFinishTime(tTaskDetail.getCreateTime());
         }
         taskDetailVO.setTaskDetail(tTaskDetail);
         taskDetailVO.setRecords(list);
         return R.ok(taskDetailVO);
     }
+
     @ApiOperation(value = "详情任务-根据任务编号")
     @GetMapping(value = "/detailByTaskCode")
     public R<TaskDetailVO> detailByTaskCode(@RequestParam String taskCode) {
         TTask task = taskCleanerService.lambdaQuery().eq(TTask::getTaskCode, taskCode)
                 .last("limit 1").one();
         TaskDetailVO taskDetailVO = new TaskDetailVO();
-        if (task!=null){
+        if (task != null) {
             String id = task.getId();
             List<TTaskDetail> list = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, id)
                     .orderByDesc(BaseModel::getCreateTime).list();
@@ -355,20 +405,21 @@
             taskDetailVO.setLocationIcon(byId2.getLocationIcon());
             taskDetailVO.setLocationName(byId2.getLocationName());
             TTaskDetail tTaskDetail = list.stream().filter(e -> e.getHandleType() == 1).findFirst().orElse(null);
-            if (tTaskDetail!=null &&  tTaskDetail.getUnqualified()!=null){
+            if (tTaskDetail != null && tTaskDetail.getUnqualified() != null) {
                 TDictData byId3 = dictDataService.getById(tTaskDetail.getUnqualified());
-                if (byId3!=null){
+                if (byId3 != null) {
                     tTaskDetail.setUnqualifiedName(byId3.getDataContent());
                 }
             }
             taskDetailVO.setTaskDetail(tTaskDetail);
             taskDetailVO.setRecords(list);
-        }else{
+        } else {
             return R.fail("任务不存在");
         }
 
         return R.ok(taskDetailVO);
     }
+
     @ApiOperation(value = "详情任务-操作记录-详情")
     @GetMapping(value = "/detailRecord")
     public R<TaskRecordDetailVO> detailRecord(@RequestParam String id) {
@@ -382,21 +433,22 @@
         taskDetailVO.setLocationAddress(byId1.getLocationAddress());
         taskDetailVO.setLocationIcon(byId2.getLocationIcon());
         taskDetailVO.setLocationName(byId2.getLocationName());
-        if (  byId4.getUnqualified()!=null){
+        if (byId4.getUnqualified() != null) {
             TDictData byId3 = dictDataService.getById(byId4.getUnqualified());
-            if (byId3!=null){
+            if (byId3 != null) {
                 byId4.setUnqualifiedName(byId3.getDataContent());
             }
         }
-        if (byId4.getAuditPerson()!=null){
+        if (byId4.getAuditPerson() != null) {
             SysUser sysUser = sysUserService.selectUserById(Long.valueOf(byId4.getAuditPerson()));
-            if (sysUser!=null){
+            if (sysUser != null) {
                 byId4.setAuditPersonName(sysUser.getUserName());
             }
         }
         taskDetailVO.setTaskDetail(byId4);
         return R.ok(taskDetailVO);
     }
+
     @Log(title = "批量删除任务", businessType = BusinessType.DELETE)
     @ApiOperation(value = "批量删除任务")
     @DeleteMapping(value = "/deleteByIds")
@@ -412,14 +464,14 @@
     public void exportExcel(@RequestBody TaskListQuery query) {
         List<SysUser> sysUsers = sysUserService.selectAllList();
         List<TLocation> locationList = locationService.list();
-        if(CollectionUtils.isEmpty(query.getTaskIds())){
+        if (CollectionUtils.isEmpty(query.getTaskIds())) {
 
-            if (StringUtils.hasLength(query.getDeptName())){
+            if (StringUtils.hasLength(query.getDeptName())) {
                 List<TProjectDept> list = projectDeptService.lambdaQuery().like(TProjectDept::getProjectName, query.getDeptName()).list();
                 List<String> listIds = projectDeptService.lambdaQuery().like(TProjectDept::getProjectName, query.getDeptName()).list()
                         .stream().map(TProjectDept::getId).collect(Collectors.toList());
                 for (TProjectDept tProjectDept : list) {
-                    if (tProjectDept.getParentId().equals("0")){
+                    if (tProjectDept.getParentId().equals("0")) {
                         List<String> collect = projectDeptService.lambdaQuery().eq(TProjectDept::getParentId, tProjectDept.getId()).list()
                                 .stream().map(TProjectDept::getId).collect(Collectors.toList());
                         listIds.addAll(collect);
@@ -428,62 +480,62 @@
                 List<String> deptIds = deptService.lambdaQuery().like(TDept::getDeptName, query.getDeptName()).list()
                         .stream().map(TDept::getId).collect(Collectors.toList());
                 listIds.addAll(deptIds);
-                if (listIds.isEmpty()){
+                if (listIds.isEmpty()) {
                     listIds.add("0");
                 }
                 List<Long> collect = sysUsers.stream().filter(e -> listIds.contains(e.getDeptId()))
                         .map(SysUser::getUserId).collect(Collectors.toList());
-                query.setPatrolInspectorIds( collect);
-                if (StringUtils.hasLength(query.getPhonenumber())){
+                query.setPatrolInspectorIds(collect);
+                if (StringUtils.hasLength(query.getPhonenumber())) {
                     List<Long> patrolInspectorIds = sysUsers.stream().filter(sysUser ->
                             sysUser.getPhonenumber().contains(query.getPhonenumber())
                                     && listIds.contains(sysUser.getDeptId())
                     ).map(SysUser::getUserId).collect(Collectors.toList());
-                    if (patrolInspectorIds.isEmpty()){
+                    if (patrolInspectorIds.isEmpty()) {
                         patrolInspectorIds.add(0L);
                     }
                     query.setPatrolInspectorIds(patrolInspectorIds);
                 }
             }
-            if (StringUtils.hasLength(query.getPhonenumber())){
+            if (StringUtils.hasLength(query.getPhonenumber())) {
                 List<Long> patrolInspectorIds = sysUsers.stream().filter(sysUser ->
                         sysUser.getPhonenumber().contains(query.getPhonenumber())
                 ).map(SysUser::getUserId).collect(Collectors.toList());
                 query.setPatrolInspectorIds(patrolInspectorIds);
-                if (!query.getPatrolInspectorIds().isEmpty()){
+                if (!query.getPatrolInspectorIds().isEmpty()) {
                     // 取交集
                     patrolInspectorIds = patrolInspectorIds.stream().filter(query.getPatrolInspectorIds()::contains).collect(Collectors.toList());
                 }
                 query.setPatrolInspectorIds(patrolInspectorIds);
-                if (patrolInspectorIds.isEmpty()){
+                if (patrolInspectorIds.isEmpty()) {
                     patrolInspectorIds.add(0L);
                 }
             }
-            if (query.getClearStatus()!=null){
+            if (query.getClearStatus() != null) {
                 List<String> collect = tTaskDetailService.lambdaQuery().eq(TTaskDetail::getClearStatus, query.getClearStatus())
                         .list().stream().distinct().map(TTaskDetail::getTaskId).collect(Collectors.toList());
                 query.setTaskIds(collect);
-                if (collect.isEmpty()){
+                if (collect.isEmpty()) {
                     collect.add("0");
                 }
             }
-            if (StringUtils.hasLength(query.getLocationType())){
+            if (StringUtils.hasLength(query.getLocationType())) {
                 List<String> collect = locationList.stream().filter(e -> e.getLocationType().equals(query.getLocationType())).map(TLocation::getId)
                         .collect(Collectors.toList());
-                if (collect.isEmpty()){
+                if (collect.isEmpty()) {
                     collect.add("0");
                 }
                 query.setLocationIds(collect);
             }
-            if (StringUtils.hasLength(query.getLocationName())){
+            if (StringUtils.hasLength(query.getLocationName())) {
                 List<String> collect = locationList.stream().filter(e -> e.getLocationName().contains(query.getLocationName())).map(TLocation::getId)
                         .collect(Collectors.toList());
                 query.setLocationIds(collect);
-                if (collect.isEmpty()){
+                if (collect.isEmpty()) {
                     collect.add("0");
-                }else{
+                } else {
                     collect = collect.stream().filter(query.getLocationIds()::contains).collect(Collectors.toList());
-                    if (collect.isEmpty()){
+                    if (collect.isEmpty()) {
                         collect.add("0");
                     }
                     query.setLocationIds(collect);
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
index 0a3c444..4ca9299 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -147,7 +147,7 @@
             String code = String.valueOf((int) (Math.random() * 1000000));
             redisCache.setCacheObject(phone, code,5*60,TimeUnit.SECONDS);
             try {
-                msgUtils.sendMsg(phone, code);
+//                msgUtils.sendMsg(phone, code);
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
index 62b9c59..5108cf7 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
@@ -144,15 +144,14 @@
         roleInfoVo.setRoleType(role.getRoleType());
         // 获取当前角色的菜单列表
         List<SysMenu> menus = menuService.selectListByRoleId(roleId);
-        if(menus.size()==0){
-            return AjaxResult.success(new ArrayList<>());
-        }
         List<Long> menusId = menus.stream().map(SysMenu::getMenuId).collect(Collectors.toList());
-
         // 获取当前的权限菜单(有层级)
-        List<SysMenu> levelMenus = roleService.getMenuLevelList(menusId);
-
-        roleInfoVo.setMenus(menusId);
+        if (!menusId.isEmpty()){
+            List<SysMenu> levelMenus = roleService.getMenuLevelList(menusId);
+            roleInfoVo.setMenus(menusId);
+        }else{
+            roleInfoVo.setMenus(new ArrayList<>());
+        }
         return AjaxResult.success(roleInfoVo);
     }
 
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
index 79c63b8..34324ab 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
@@ -10,6 +10,8 @@
 import com.ruoyi.system.mapper.TCleanerMapper;
 import com.ruoyi.system.model.*;
 import com.ruoyi.system.service.*;
+import com.ruoyi.web.controller.tool.EmailUtils;
+import com.ruoyi.web.controller.tool.MsgUtils;
 import javafx.concurrent.Task;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.ss.formula.functions.T;
@@ -17,7 +19,9 @@
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
@@ -64,6 +68,8 @@
     private TEarlyWarningService earlyWarningService;
     @Autowired
     private TLeaveService leaveService;
+    @Resource
+    private TNoticeService noticeService;
 
 
     // 每一个小时执行一次
@@ -86,7 +92,12 @@
             e.printStackTrace();
         }
     }
-
+    @Resource
+    private TNoticeSetService noticeSetService;
+    @Resource
+    private MsgUtils msgUtils;
+    @Resource
+    private TDictDataService dictDataService;
     @Scheduled(cron = "0 0 20 * * ?")
     public void dayOfEarlyWarning() {
         try {
@@ -94,16 +105,61 @@
             List<TTask> taskCleanList = taskCleanService.list(Wrappers.lambdaQuery(TTask.class)
                     .like(TTask::getImplementTime, LocalDate.now())
                     .eq(TTask::getStatus, 1));
+            List<String> userIds = taskCleanList.stream().map(TTask::getPatrolInspector).distinct().collect(Collectors.toList());
+            List<SysUser> sysUsers = sysUserService.selectAllList();
+            TNoticeSet noticeSet = noticeSetService.lambdaQuery().eq(TNoticeSet::getType, 2).last("limit 1")
+                    .one();
+            // 邮箱
+            TDictData email = dictDataService.lambdaQuery().eq(TDictData::getDataType,4).one();
+            // 授权码
+            TDictData code = dictDataService.lambdaQuery().eq(TDictData::getDataType,5).one();
             if (!CollectionUtils.isEmpty(taskCleanList)) {
                 List<TEarlyWarning> earlyWarningList = new ArrayList<>();
+                List<TNotice> noticeList = new ArrayList<>();
+                List<TNotice> addNotice = new ArrayList<>();
                 taskCleanList.forEach(task -> {
                     task.setStatus(2);
                     TEarlyWarning earlyWarning = new TEarlyWarning();
                     earlyWarning.setWarningType(1);
                     earlyWarning.setTaskId(task.getId());
                     earlyWarningList.add(earlyWarning);
+                    TNotice tNotice = new TNotice();
+                    tNotice.setUserId(task.getPatrolInspector());
+                    tNotice.setStatus(1);
+                    tNotice.setDataId(task.getId());
+                    tNotice.setNoticeType(3);
+                    tNotice.setNoticeSetType(noticeSet.getNoticeType());
+                    noticeList.add(tNotice);
                 });
                 earlyWarningService.saveBatch(earlyWarningList);
+
+                for (String userId : userIds) {
+                    SysUser sysUser = sysUsers.stream().filter(e -> e.getUserId().equals(Long.valueOf(userId))).findFirst().orElse(null);
+                    long count = taskCleanList.stream().filter(e -> e.getPatrolInspector().equals(userId)).count();
+                    TNotice tNotice = new TNotice();
+                    tNotice.setUserId(userId);
+                    tNotice.setStatus(1);
+                    tNotice.setNoticeType(3);
+                    tNotice.setNoticeContent("今日剩余"+count+"个任务未完成,请尽快处理");
+                    tNotice.setNoticeSetType(noticeSet.getNoticeType());
+                    addNotice.add(tNotice);
+
+                    if (sysUser!=null){
+                        switch (noticeSet.getNoticeType()) {
+                            case 1:
+                                msgUtils.sendMsg2(sysUser.getPhonenumber(),count+"");
+                                break;
+                            case 2:
+                                if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())){
+                                    EmailUtils.sendEmail(sysUser.getEmail(),email.getDataContent(),code.getDataContent(),"今日剩余"+count+"个任务未完成,请尽快处理");
+                                }
+                                break;
+                            case 3:
+                                break;
+                        }
+                    }
+                }
+                noticeService.saveBatch(addNotice);
                 taskCleanService.updateBatchById(taskCleanList);
             }
         } catch (Exception e) {
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/EmailUtils.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/EmailUtils.java
new file mode 100644
index 0000000..7ca4fef
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/EmailUtils.java
@@ -0,0 +1,99 @@
+package com.ruoyi.web.controller.tool;
+
+import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
+import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
+import com.aliyun.tea.TeaException;
+import com.aliyun.teaopenapi.models.Config;
+import com.aliyun.teautil.models.RuntimeOptions;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.compress.utils.IOUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.activation.DataHandler;
+import javax.activation.FileDataSource;
+import javax.mail.*;
+import javax.mail.internet.*;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.util.Date;
+import java.util.Properties;
+
+@Slf4j
+public class EmailUtils {
+
+    public static void sendEmail(String userEmail, String sendEmail, String code, String content) throws Exception {
+// 发送邮箱
+        // 收件人电子邮箱,TODO 换成自己的收件箱
+        String to = userEmail;
+        // 发件人电子邮箱,TODO 换成自己的发件箱
+        String from = sendEmail;
+        // 指定发送邮件的主机为
+        String host = "smtp.163.com";
+        Properties properties = new Properties();
+        properties.put("mail.smtp.host", host);
+        properties.put("mail.smtp.socketFactory.port", "465");
+        properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+        properties.put("mail.smtp.auth", "true");
+        properties.put("mail.smtp.port", "465");
+        properties.put("mail.smtp.ssl.enable", "true"); // 明确开启SSL
+        // 获取默认session对象
+        Session session = Session.getDefaultInstance(properties,new Authenticator(){
+            @Override
+            public javax.mail.PasswordAuthentication getPasswordAuthentication()
+            {
+                //发件人邮件用户名、授权码,换成自己的发件箱及授权码
+                return new PasswordAuthentication(from, code);
+            }
+        });
+
+        try{
+            // 创建默认的 MimeMessage 对象
+            MimeMessage message = new MimeMessage(session);
+            // Set From,设置发件人
+            InternetAddress fromMail = new InternetAddress(from);
+            //设置发件人名称,TODO 换成自己的发件箱
+            fromMail.setPersonal(MimeUtility.encodeText("沿海市政<" + from + ">"));
+            message.setFrom(fromMail);
+            // Set To: 设置收件人
+            InternetAddress toMail = new InternetAddress(to);
+            // TODO 换成自己的收件箱
+            InternetAddress toMail2 = new InternetAddress(to);
+            //发多个邮箱
+            Address[] allRecipients = {toMail, toMail2};
+            message.setRecipients(Message.RecipientType.TO, allRecipients);
+            // Set Subject: 邮件主体
+            message.setSubject("沿海市政");
+            // 设置消息体
+            message.setSentDate(new Date());
+            javax.mail.internet.MimeMultipart msgMultipart = new MimeMultipart("mixed");
+
+            // 指定为混合关系
+            message.setContent(msgMultipart);
+            // 邮件信息组装
+            //组装的顺序非常重要,一定要先组装文本域,再组装文件
+            javax.mail.internet.MimeBodyPart htmlPart = new javax.mail.internet.MimeBodyPart();
+            // 组装内容
+            htmlPart.setContent(content, "text/html;charset=UTF-8");
+            msgMultipart.addBodyPart(htmlPart);
+            try {
+                message.saveChanges();
+                //发送
+                //Transport.send(message, message.getAllRecipients());
+                Transport.send(message);
+                System.out.println("发送成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }catch (MessagingException | UnsupportedEncodingException mex) {
+            mex.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java
index 119a5ea..92b678d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java
@@ -13,18 +13,7 @@
 @Slf4j
 public class MsgUtils {
 
-    @Value("${code.config.accessKeyId}")
-    private  String accessKeyId;
-    @Value("${code.config.accessKeySecret}")
-    private  String accessKeySecret;
-    @Value("${code.config.signName}")
-    private  String signName;
-    @Value("${code.config.templateCode}")
-    private  String templateCode;
-    @Value("${code.config.signNameTest}")
-    private  String signNameTest;
-    @Value("${code.config.templateCodeTest}")
-    private  String templateCodeTest;
+
 
     /**
      * 使用AK&SK初始化账号Client
@@ -44,27 +33,147 @@
         return new com.aliyun.dysmsapi20170525.Client(config);
     }
 
-    public void sendMsg(String phone,String code) throws Exception {
-        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient(accessKeyId,accessKeySecret);
+    // 任务审核结果通知
+    public void sendMsg1(String phone,String point,String result) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
         SendSmsRequest sendSmsRequest = new SendSmsRequest()
-                .setSignName(signName)
-                .setTemplateCode(templateCode)
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490460059")
                 .setPhoneNumbers(phone)
-                .setTemplateParam("{\"code\":\""+code+"\"}");
+                .setTemplateParam("{\"point\":\""+point+"\",\"result\":\""+result+"\"}");
         RuntimeOptions runtime = new RuntimeOptions();
         try {
             // 复制代码运行请自行打印 API 的返回值
             SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
-            log.info("短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+            log.info("任务审核结果通知短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
         } catch (TeaException error) {
             // 如有需要,请打印 error
             com.aliyun.teautil.Common.assertAsString(error.message);
-            log.info("短信发送失败:{}",error.message);
+            log.info("任务审核结果通知短信发送失败:{}",error.message);
         } catch (Exception _error) {
             TeaException error = new TeaException(_error.getMessage(), _error);
             // 如有需要,请打印 error
             com.aliyun.teautil.Common.assertAsString(error.message);
-            log.info("短信发送失败:{}",error.message);
+            log.info("任务审核结果通知短信发送失败:{}",error.message);
+        }
+    }
+    // 今日任务未完成
+    public void sendMsg2(String phone,String count) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
+        SendSmsRequest sendSmsRequest = new SendSmsRequest()
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490450039")
+                .setPhoneNumbers(phone)
+                .setTemplateParam("{\"count\":\""+count+"\"}");
+        RuntimeOptions runtime = new RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            log.info("今日任务未完成短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("今日任务未完成短信发送失败:{}",error.message);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("今日任务未完成短信发送失败:{}",error.message);
+        }
+    }
+    // 申诉结果通知通知
+    public void sendMsg3(String phone,String point,String result) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
+        SendSmsRequest sendSmsRequest = new SendSmsRequest()
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490535047")
+                .setPhoneNumbers(phone)
+                .setTemplateParam("{\"point\":\""+point+"\",\"result\":\""+result+"\"}");
+        RuntimeOptions runtime = new RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            log.info("申诉结果通知短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("申诉结果通知短信发送失败:{}",error.message);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("申诉结果通知短信发送失败:{}",error.message);
+        }
+    }
+    // 请假待审核提醒
+    public void sendMsg3(String phone) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
+        SendSmsRequest sendSmsRequest = new SendSmsRequest()
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490305062")
+                .setPhoneNumbers(phone);
+        RuntimeOptions runtime = new RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            log.info("请假待审核提醒短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("请假待审核提醒短信发送失败:{}",error.message);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("请假待审核提醒短信发送失败:{}",error.message);
+        }
+    }
+    // 请假结果抄送
+    public void sendMsg4(String phone,String name,String date) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
+        SendSmsRequest sendSmsRequest = new SendSmsRequest()
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490325051")
+                .setPhoneNumbers(phone)
+                .setTemplateParam("{\"name\":\""+name+"\",\"date\":\""+date+"\"}");
+        RuntimeOptions runtime = new RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            log.info("请假结果抄送短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("请假结果抄送短信发送失败:{}",error.message);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("请假结果抄送短信发送失败:{}",error.message);
+        }
+    }
+    // 督察任务整改通知
+    public void sendMsg5(String phone,String point) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
+        SendSmsRequest sendSmsRequest = new SendSmsRequest()
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490375046")
+                .setPhoneNumbers(phone)
+                .setTemplateParam("{\"point\":\""+point+"\"}");
+        RuntimeOptions runtime = new RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            log.info("督察任务整改通知短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("督察任务整改通知短信发送失败:{}",error.message);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("督察任务整改通知短信发送失败:{}",error.message);
         }
     }
 }
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TIndexController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TIndexController.java
index 1409ea0..75f382b 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TIndexController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TIndexController.java
@@ -41,6 +41,7 @@
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -106,6 +107,7 @@
         TSystemBulletin systemBulletin = systemBulletinService.lambdaQuery().eq(TSystemBulletin::getStatus, 1).last("limit 1").one();
         return R.ok(systemBulletin);
     }
+
 
     @ApiOperation(value = "首页-数据概览-更多")
     @PostMapping(value = "/dataReport")
@@ -186,8 +188,10 @@
             // 获取今天凌晨00:00:00 和今天23:59:59 类型为LocalDateTime
             LocalDateTime startOfToday = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
             LocalDateTime endOfToday = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
-            tTaskLambdaQueryWrapper.ge(TTask::getImplementTime, startOfToday);
-            tTaskLambdaQueryWrapper.le(TTask::getImplementTime, endOfToday);
+            String startOfTodayStr = startOfToday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+            String endOfTodayStr = endOfToday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+            tTaskLambdaQueryWrapper.ge(TTask::getImplementTime, startOfTodayStr);
+            tTaskLambdaQueryWrapper.le(TTask::getImplementTime, endOfTodayStr);
         }
 //        tTaskLambdaQueryWrapper.ne(TTask::getStatus, 1);
         List<TTask> tasks = taskCleanerService.list(tTaskLambdaQueryWrapper);
@@ -336,8 +340,10 @@
         // 获取今天凌晨00:00:00 和今天23:59:59 类型为LocalDateTime
         LocalDateTime startOfToday = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
         LocalDateTime endOfToday = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
+        String startOfTodayStr = startOfToday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        String endOfTodayStr = endOfToday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
         List<TTask> taskToday = taskCleanerService.lambdaQuery()
-                .between(TTask::getImplementTime, startOfToday, endOfToday)
+                .between(TTask::getImplementTime, startOfTodayStr, endOfTodayStr)
                 .eq(TTask::getPatrolInspector, userId).list();
         List<SysUser> sysUsers = sysUserService.selectAllList();
         SysUser sysUser = sysUserService.selectUserById(userId);
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java
index e9ec6e0..570babe 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java
@@ -35,6 +35,8 @@
 import com.ruoyi.system.utils.wx.tools.WxAppletTools;
 import com.ruoyi.system.utils.wx.tools.WxUtils;
 import com.ruoyi.system.vo.system.*;
+import com.ruoyi.web.controller.tool.EmailUtils;
+import com.ruoyi.web.controller.tool.MsgUtils;
 import com.sun.jna.platform.win32.LMAccess;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -94,6 +96,8 @@
     @Resource
     private TDictDataService dictDataService;
     @Resource
+    private TNoticeSetService noticeSetService;
+    @Resource
     private TLeaveService leaveService;
     @Resource
     private TLeaveAuditService leaveAuditService;
@@ -134,6 +138,8 @@
         sysUserService.updateUser(sysUser);
         return R.ok();
     }
+    @Resource
+    private MsgUtils msgUtils;
 
     @ApiOperation(value = "消息通知列表")
     @PostMapping(value = "/noticeList")
@@ -481,10 +487,10 @@
     public R<List<TaskListAllVO>> listAllTask(@RequestBody AppealListDTO appealListDTO) {
         appealListDTO.setUserId(tokenService.getLoginUserApplet().getUserId() + "");
         SysUser sysUser = sysUserService.selectUserById(tokenService.getLoginUserApplet().getUserId());
-        if (sysUser.getDeptType()==2){
-            // 公司部门查询所有任务
-            appealListDTO.setUserId(null);
-        }
+//        if (sysUser.getDeptType()==2){
+//            // 公司部门查询所有任务
+//            appealListDTO.setUserId(null);
+//        }
         List<TaskListAllVO> res = appealService.listAllTask(appealListDTO);
         return R.ok(res);
     }
@@ -501,22 +507,17 @@
 
     @ApiOperation(value = "上传督察任务")
     @PostMapping(value = "/addInspector")
-    public R<Boolean> addInspector(@RequestBody InspectorAddDTO dto) {
+    public R<Boolean> addInspector(@RequestBody InspectorAddDTO dto) throws Exception {
         TTask task = taskCleanerService.getById(dto.getTaskId());
         TLocation location = locationService.getById(task.getLocationId());
         SysUser sysUser = sysUserService.selectUserById(Long.valueOf(task.getPatrolInspector()));
         dto.setCommitPerson(tokenService.getLoginUserApplet().getUserId() + "");
+
         if (dto.getClearStatus() == 1) {
             dto.setStatus(4);
         } else {
             dto.setStatus(1);
-            TNotice tNotice = new TNotice();
-            tNotice.setUserId(sysUser.getUserId()+"");
-            tNotice.setNoticeContent("【"+location.getLocationName()+"】任务督察不合格,请及时整改!");
-            tNotice.setStatus(1);
-            tNotice.setDataId(dto.getTaskId());
-            tNotice.setNoticeType(8);
-            noticeService.save(tNotice);
+
         }
         inspectorService.save(dto);
         return R.ok();
@@ -674,7 +675,7 @@
 
     @ApiOperation(value = "发起请假")
     @PostMapping(value = "/addLeave")
-    public R addLeave(@RequestBody LeaveDTO leaveDTO) {
+    public R addLeave(@RequestBody LeaveDTO leaveDTO) throws Exception {
 //        String startTime1 = leaveDTO.getStartTime1();
 //        // 轉化爲LocalDateTime類型
 //        leaveDTO.setStartTime(LocalDateTime.parse(startTime1, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
@@ -696,6 +697,12 @@
         leaveDTO.setTemplateId(user.getTemplateId());
         leaveDTO.setLeavePerson(userId + "");
         leaveService.save(leaveDTO);
+        TNoticeSet noticeSet = noticeSetService.lambdaQuery().eq(TNoticeSet::getType, 2).last("limit 1")
+                .one();
+        // 邮箱
+        TDictData email = dictDataService.lambdaQuery().eq(TDictData::getDataType,4).one();
+        // 授权码
+        TDictData code = dictDataService.lambdaQuery().eq(TDictData::getDataType,5).one();
         //项目部负责人、部门负责人、公司成员提交由最终审批人审批;
         if (user.getDeptType() == 2 || sysRole.getRoleName().contains("项目部负责人") || sysRole.getRoleName().contains("部门负责人")) {
             TLeaveAudit tLeaveAudit1 = new TLeaveAudit();
@@ -734,6 +741,29 @@
                                tLeaveAudit1.setAuditId(sysUser.getUserId() + "");
                                tLeaveAudit1.setAuditType(1);
                                leaveAuditService.save(tLeaveAudit1);
+                               // 新增消息
+                               TNotice tNotice = new TNotice();
+                               tNotice.setUserId(sysUser.getUserId()+"");
+                               tNotice.setNoticeContent(user.getNickName() + "提交了请假申请,请尽快审核");
+                               tNotice.setStatus(1);
+                               tNotice.setDataId(leaveDTO.getId());
+                               tNotice.setNoticeType(6);
+
+                               switch (noticeSet.getNoticeType()) {
+                                   case 1:
+                                       msgUtils.sendMsg4(sysUser.getPhonenumber());
+                                       break;
+                                   case 2:
+                                       if (StringUtils.hasLength(email.getDataContent()) && StringUtils.hasLength(code.getDataContent())) {
+                                           EmailUtils.sendEmail(sysUser.getEmail(), email.getDataContent(), code.getDataContent(), "你有一条请假申请待处理,请登录沿海市政质管小程序处理。");
+                                       }
+                                       break;
+                                   case 3:
+                                       break;
+                               }
+
+
+                               noticeService.save(tNotice);
                                TLeaveAudit tLeaveAudit2 = new TLeaveAudit();
                                tLeaveAudit2.setLeaveId(leaveDTO.getId());
                                tLeaveAudit2.setAuditStatus(2);
@@ -754,6 +784,26 @@
                                tLeaveAudit1.setAuditId(sysUser.getUserId() + "");
                                tLeaveAudit1.setAuditType(1);
                                leaveAuditService.save(tLeaveAudit1);
+                               // 新增消息
+                               TNotice tNotice = new TNotice();
+                               tNotice.setUserId(sysUser.getUserId()+"");
+                               tNotice.setNoticeContent(user.getNickName() + "提交了请假申请,请尽快审核");
+                               tNotice.setStatus(1);
+                               tNotice.setDataId(leaveDTO.getId());
+                               tNotice.setNoticeType(6);
+                               noticeService.save(tNotice);
+                               switch (noticeSet.getNoticeType()) {
+                                   case 1:
+                                       msgUtils.sendMsg4(sysUser.getPhonenumber());
+                                       break;
+                                   case 2:
+                                       if (StringUtils.hasLength(email.getDataContent()) && StringUtils.hasLength(code.getDataContent())) {
+                                           EmailUtils.sendEmail(sysUser.getEmail(), email.getDataContent(), code.getDataContent(), "你有一条请假申请待处理,请登录沿海市政质管小程序处理。");
+                                       }
+                                       break;
+                                   case 3:
+                                       break;
+                               }
                                TLeaveAudit tLeaveAudit2 = new TLeaveAudit();
                                tLeaveAudit2.setLeaveId(leaveDTO.getId());
                                tLeaveAudit2.setAuditStatus(2);
@@ -781,6 +831,26 @@
                     tLeaveAudit1.setAuditId(sysUser.getUserId() + "");
                     tLeaveAudit1.setAuditType(1);
                     leaveAuditService.save(tLeaveAudit1);
+                    // 新增消息
+                    TNotice tNotice = new TNotice();
+                    tNotice.setUserId(sysUser.getUserId()+"");
+                    tNotice.setNoticeContent(user.getNickName() + "提交了请假申请,请尽快审核");
+                    tNotice.setStatus(1);
+                    tNotice.setDataId(leaveDTO.getId());
+                    tNotice.setNoticeType(6);
+                    noticeService.save(tNotice);
+                    switch (noticeSet.getNoticeType()) {
+                        case 1:
+                            msgUtils.sendMsg4(sysUser.getPhonenumber());
+                            break;
+                        case 2:
+                            if (StringUtils.hasLength(email.getDataContent()) && StringUtils.hasLength(code.getDataContent())) {
+                                EmailUtils.sendEmail(sysUser.getEmail(), email.getDataContent(), code.getDataContent(), "你有一条请假申请待处理,请登录沿海市政质管小程序处理。");
+                            }
+                            break;
+                        case 3:
+                            break;
+                    }
                     TLeaveAudit tLeaveAudit2 = new TLeaveAudit();
                     tLeaveAudit2.setLeaveId(leaveDTO.getId());
                     tLeaveAudit2.setAuditStatus(2);
@@ -792,14 +862,7 @@
             }
         }
 
-        // 新增消息
-        TNotice tNotice = new TNotice();
-        tNotice.setUserId(leaveDTO.getAuditId());
-        tNotice.setNoticeContent(user.getNickName() + "提交了请假申请,请尽快审核");
-        tNotice.setStatus(1);
-        tNotice.setDataId(leaveDTO.getId());
-        tNotice.setNoticeType(6);
-        noticeService.save(tNotice);
+
         return R.ok();
     }
 
@@ -812,14 +875,21 @@
 
     @ApiOperation(value = "我的审批-审批")
     @PostMapping(value = "/auditLeave")
-    public R<Boolean> auditLeave(@RequestBody LeaveAuditDTO dto) {
+    public R<Boolean> auditLeave(@RequestBody LeaveAuditDTO dto) throws Exception {
 
         dto.setAuditId(tokenService.getLoginUserApplet().getUserId() + "");
         dto.setAuditTime(LocalDateTime.now());
         leaveService.updateById(dto);
+        List<SysUser> sysUsers = sysUserService.selectAllList();
         SysUser sysUser = sysUserService.selectUserById(Long.valueOf(dto.getLeavePerson()));
         TLeaveAudit leaveAudit = leaveAuditService.lambdaQuery().eq(TLeaveAudit::getLeaveId, dto.getId())
                 .eq(TLeaveAudit::getAuditType, 2).one();
+        TNoticeSet noticeSet = noticeSetService.lambdaQuery().eq(TNoticeSet::getType, 2).last("limit 1")
+                .one();
+        // 邮箱
+        TDictData email = dictDataService.lambdaQuery().eq(TDictData::getDataType,4).one();
+        // 授权码
+        TDictData code = dictDataService.lambdaQuery().eq(TDictData::getDataType,5).one();
         TNotice tNotice = new TNotice();
         tNotice.setUserId(leaveAudit.getAuditId().split(",")[0]);
         tNotice.setNoticeContent(sysUser.getNickName()+"的请假申请已审核,请查收");
@@ -827,6 +897,29 @@
         tNotice.setDataId(dto.getId());
         tNotice.setNoticeType(7);
         noticeService.save(tNotice);
+        LocalDateTime startTime = dto.getStartTime();
+        LocalDateTime endTime = dto.getEndTime();
+        SysUser sysUser1 = sysUsers.stream().filter(e -> e.getUserId().equals(Long.valueOf(leaveAudit.getAuditId().split(",")[0])))
+                .findFirst().orElse(null);
+        SysUser sysUser2 = sysUsers.stream().filter(e -> e.getUserId().equals(Long.valueOf(leaveAudit.getAuditId().split(",")[1])))
+                .findFirst().orElse(null);
+        // 转化为yyyy-MM-dd 格式字符串
+        String leaveTime = startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))+"至"+endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        if (sysUser1!=null){
+            switch (noticeSet.getNoticeType()) {
+                case 1:
+                    msgUtils.sendMsg5(sysUser1.getPhonenumber(),sysUser1.getNickName(),leaveTime);
+                    break;
+                case 2:
+                    if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())){
+                        EmailUtils.sendEmail(sysUser1.getEmail(),email.getDataContent(),code.getDataContent(),sysUser1.getNickName()+"的请假申请已审核,请查收");
+                    }
+                    break;
+                case 3:
+                    break;
+            }
+        }
+
         TNotice tNotice1 = new TNotice();
         tNotice1.setUserId(leaveAudit.getAuditId().split(",")[1]);
         tNotice1.setNoticeContent(sysUser.getNickName()+"的请假申请已审核,请查收");
@@ -834,6 +927,20 @@
         tNotice1.setDataId(dto.getId());
         tNotice1.setNoticeType(7);
         noticeService.save(tNotice1);
+        if (sysUser2!=null) {
+            switch (noticeSet.getNoticeType()) {
+                case 1:
+                    msgUtils.sendMsg5(sysUser2.getPhonenumber(), sysUser2.getNickName(), leaveTime);
+                    break;
+                case 2:
+                    if (StringUtils.hasLength(email.getDataContent()) && StringUtils.hasLength(code.getDataContent())) {
+                        EmailUtils.sendEmail(sysUser2.getEmail(), email.getDataContent(), code.getDataContent(), sysUser2.getNickName() + "的请假申请已审核,请查收");
+                    }
+                    break;
+                case 3:
+                    break;
+            }
+        }
         return R.ok();
     }
 
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/EmailUtils.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/EmailUtils.java
new file mode 100644
index 0000000..b8ad0dd
--- /dev/null
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/EmailUtils.java
@@ -0,0 +1,85 @@
+package com.ruoyi.web.controller.tool;
+
+import lombok.extern.slf4j.Slf4j;
+
+import javax.mail.*;
+import javax.mail.internet.*;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.util.Properties;
+
+@Slf4j
+public class EmailUtils {
+
+    public static void sendEmail(String userEmail, String sendEmail, String code, String content) throws Exception {
+// 发送邮箱
+        // 收件人电子邮箱,TODO 换成自己的收件箱
+        String to = userEmail;
+        // 发件人电子邮箱,TODO 换成自己的发件箱
+        String from = sendEmail;
+        // 指定发送邮件的主机为
+        String host = "smtp.163.com";
+        Properties properties = new Properties();
+        properties.put("mail.smtp.host", host);
+        properties.put("mail.smtp.socketFactory.port", "465");
+        properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+        properties.put("mail.smtp.auth", "true");
+        properties.put("mail.smtp.port", "465");
+        properties.put("mail.smtp.ssl.enable", "true"); // 明确开启SSL
+        // 获取默认session对象
+        Session session = Session.getDefaultInstance(properties,new Authenticator(){
+            @Override
+            public PasswordAuthentication getPasswordAuthentication()
+            {
+                //发件人邮件用户名、授权码,换成自己的发件箱及授权码
+                return new PasswordAuthentication(from, code);
+            }
+        });
+
+        try{
+            // 创建默认的 MimeMessage 对象
+            MimeMessage message = new MimeMessage(session);
+            // Set From,设置发件人
+            InternetAddress fromMail = new InternetAddress(from);
+            //设置发件人名称,TODO 换成自己的发件箱
+            fromMail.setPersonal(MimeUtility.encodeText("沿海市政<" + from + ">"));
+            message.setFrom(fromMail);
+            // Set To: 设置收件人
+            InternetAddress toMail = new InternetAddress(to);
+            // TODO 换成自己的收件箱
+            InternetAddress toMail2 = new InternetAddress(to);
+            //发多个邮箱
+            Address[] allRecipients = {toMail, toMail2};
+            message.setRecipients(Message.RecipientType.TO, allRecipients);
+            // Set Subject: 邮件主体
+            message.setSubject("沿海市政");
+            // 设置消息体
+            message.setSentDate(new Date());
+            MimeMultipart msgMultipart = new MimeMultipart("mixed");
+
+            // 指定为混合关系
+            message.setContent(msgMultipart);
+            // 邮件信息组装
+            //组装的顺序非常重要,一定要先组装文本域,再组装文件
+            MimeBodyPart htmlPart = new MimeBodyPart();
+            // 组装内容
+            htmlPart.setContent(content, "text/html;charset=UTF-8");
+            msgMultipart.addBodyPart(htmlPart);
+            try {
+                message.saveChanges();
+                //发送
+                //Transport.send(message, message.getAllRecipients());
+                Transport.send(message);
+                System.out.println("发送成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }catch (MessagingException | UnsupportedEncodingException mex) {
+            mex.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+}
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java
index 119a5ea..cf681aa 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java
@@ -6,25 +6,13 @@
 import com.aliyun.teaopenapi.models.Config;
 import com.aliyun.teautil.models.RuntimeOptions;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 @Component
 @Slf4j
 public class MsgUtils {
 
-    @Value("${code.config.accessKeyId}")
-    private  String accessKeyId;
-    @Value("${code.config.accessKeySecret}")
-    private  String accessKeySecret;
-    @Value("${code.config.signName}")
-    private  String signName;
-    @Value("${code.config.templateCode}")
-    private  String templateCode;
-    @Value("${code.config.signNameTest}")
-    private  String signNameTest;
-    @Value("${code.config.templateCodeTest}")
-    private  String templateCodeTest;
+
 
     /**
      * 使用AK&SK初始化账号Client
@@ -44,27 +32,147 @@
         return new com.aliyun.dysmsapi20170525.Client(config);
     }
 
-    public void sendMsg(String phone,String code) throws Exception {
-        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient(accessKeyId,accessKeySecret);
+    // 任务审核结果通知
+    public void sendMsg1(String phone,String point,String result) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
         SendSmsRequest sendSmsRequest = new SendSmsRequest()
-                .setSignName(signName)
-                .setTemplateCode(templateCode)
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490460059")
                 .setPhoneNumbers(phone)
-                .setTemplateParam("{\"code\":\""+code+"\"}");
+                .setTemplateParam("{\"point\":\""+point+"\",\"result\":\""+result+"\"}");
         RuntimeOptions runtime = new RuntimeOptions();
         try {
             // 复制代码运行请自行打印 API 的返回值
             SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
-            log.info("短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+            log.info("任务审核结果通知短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
         } catch (TeaException error) {
             // 如有需要,请打印 error
             com.aliyun.teautil.Common.assertAsString(error.message);
-            log.info("短信发送失败:{}",error.message);
+            log.info("任务审核结果通知短信发送失败:{}",error.message);
         } catch (Exception _error) {
             TeaException error = new TeaException(_error.getMessage(), _error);
             // 如有需要,请打印 error
             com.aliyun.teautil.Common.assertAsString(error.message);
-            log.info("短信发送失败:{}",error.message);
+            log.info("任务审核结果通知短信发送失败:{}",error.message);
+        }
+    }
+    // 今日任务未完成
+    public void sendMsg2(String phone,String count) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
+        SendSmsRequest sendSmsRequest = new SendSmsRequest()
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490450039")
+                .setPhoneNumbers(phone)
+                .setTemplateParam("{\"count\":\""+count+"\"}");
+        RuntimeOptions runtime = new RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            log.info("今日任务未完成短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("今日任务未完成短信发送失败:{}",error.message);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("今日任务未完成短信发送失败:{}",error.message);
+        }
+    }
+    // 申诉结果通知通知
+    public void sendMsg3(String phone,String point,String result) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
+        SendSmsRequest sendSmsRequest = new SendSmsRequest()
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490535047")
+                .setPhoneNumbers(phone)
+                .setTemplateParam("{\"point\":\""+point+"\",\"result\":\""+result+"\"}");
+        RuntimeOptions runtime = new RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            log.info("申诉结果通知短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("申诉结果通知短信发送失败:{}",error.message);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("申诉结果通知短信发送失败:{}",error.message);
+        }
+    }
+    // 请假待审核提醒
+    public void sendMsg4(String phone) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
+        SendSmsRequest sendSmsRequest = new SendSmsRequest()
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490305062")
+                .setPhoneNumbers(phone);
+        RuntimeOptions runtime = new RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            log.info("请假待审核提醒短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("请假待审核提醒短信发送失败:{}",error.message);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("请假待审核提醒短信发送失败:{}",error.message);
+        }
+    }
+    // 请假结果抄送
+    public void sendMsg5(String phone,String name,String date) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
+        SendSmsRequest sendSmsRequest = new SendSmsRequest()
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490325051")
+                .setPhoneNumbers(phone)
+                .setTemplateParam("{\"name\":\""+name+"\",\"date\":\""+date+"\"}");
+        RuntimeOptions runtime = new RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            log.info("请假结果抄送短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("请假结果抄送短信发送失败:{}",error.message);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("请假结果抄送短信发送失败:{}",error.message);
+        }
+    }
+    // 督察任务整改通知
+    public void sendMsg6(String phone,String point) throws Exception {
+        com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient("LTAI5t6SvJEZ9Wv28ranrfLV","hL9wbTdM3rPOLMj0DAhCn90URVzvvw");
+        SendSmsRequest sendSmsRequest = new SendSmsRequest()
+                .setSignName("沿海市政")
+                .setTemplateCode("SMS_490375046")
+                .setPhoneNumbers(phone)
+                .setTemplateParam("{\"point\":\""+point+"\"}");
+        RuntimeOptions runtime = new RuntimeOptions();
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
+            log.info("督察任务整改通知短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode());
+        } catch (TeaException error) {
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("督察任务整改通知短信发送失败:{}",error.message);
+        } catch (Exception _error) {
+            TeaException error = new TeaException(_error.getMessage(), _error);
+            // 如有需要,请打印 error
+            com.aliyun.teautil.Common.assertAsString(error.message);
+            log.info("督察任务整改通知短信发送失败:{}",error.message);
         }
     }
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
index 200e4a1..dfd6b12 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -181,7 +181,7 @@
 
     List<SysUser> selectUserByTempLateId(@Param("templateId")String templateId);
 
-    List<SysUser> selectUserByDeptId(@Param("id")String id);
+    List<SysUser> selectUserByDeptId(@Param("ids")List<String> ids);
 
     List<TaskFinishListVO> pageListReport(@Param("query")DataReportQuery query, @Param("pageInfo")PageInfo<TaskFinishListVO> pageInfo);
 
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TEarlyWarningMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TEarlyWarningMapper.java
index 4dc0f8d..691e46a 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TEarlyWarningMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TEarlyWarningMapper.java
@@ -19,6 +19,6 @@
  */
 public interface TEarlyWarningMapper extends BaseMapper<TEarlyWarning> {
 
-    List<TaskWarningVO> pageList(@Param("query")TaskWarningQuery query, @Param("pageInfo")PageInfo<TaskWarningVO> pageInfo);
+    List<TaskWarningVO> pageList(@Param("query")TaskWarningQuery query);
 
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
index ab39bd3..e7091b1 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
@@ -287,7 +287,7 @@
      */
     List<SysUser> selectListByDeptIds(List<String> projectIds);
 
-    List<SysUser> selectUserByDeptId(String id);
+    List<SysUser> selectUserByDeptId(List<String> ids);
 
     PageInfo<TaskFinishListVO> pageListReport(DataReportQuery dataReportQuery);
 
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index 5dc4774..40d5402 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -746,8 +746,8 @@
     }
 
     @Override
-    public List<SysUser> selectUserByDeptId(String id) {
-        return userMapper.selectUserByDeptId(id);
+    public List<SysUser> selectUserByDeptId(List<String> ids) {
+        return userMapper.selectUserByDeptId(ids);
     }
 
     @Override
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TEarlyWarningServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TEarlyWarningServiceImpl.java
index 1bc2f35..0e2fb33 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TEarlyWarningServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TEarlyWarningServiceImpl.java
@@ -9,10 +9,18 @@
 import com.ruoyi.system.service.TEarlyWarningService;
 import com.ruoyi.system.vo.system.CleanerListVO;
 import com.ruoyi.system.vo.system.TaskWarningVO;
+import com.sun.org.apache.bcel.internal.generic.NEW;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -38,9 +46,11 @@
     @Override
     public PageInfo<TaskWarningVO> pageList(TaskWarningQuery query) {
         List<TTask> taskList = taskMapper.selectList(null);
-
         PageInfo<TaskWarningVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
-        List<TaskWarningVO> list = this.baseMapper.pageList(query,pageInfo);
+        List<TaskWarningVO> list = this.baseMapper.pageList(query);
+        List<String> strings = new ArrayList<>();
+        List<String> taskIds = new ArrayList<>();
+        List<TaskWarningVO> res = new ArrayList<>();
         for (TaskWarningVO taskWarningVO : list) {
             String[] split = taskWarningVO.getTaskId().split(",");
             TTask tTask = taskList.stream().filter(e -> e.getId().equals(split[0])).findFirst().orElse(null);
@@ -52,33 +62,109 @@
                 }
             }
             // 去除最后一位
-            taskWarningVO.setTaskCode(taskWarningVO.getTaskCode().substring(0, taskWarningVO.getTaskCode().length() - 1));
-            if (tTask!=null){
-                TLocation tLocation = locationMapper.selectById(tTask.getLocationId());
-                if (tLocation!=null){
-                    taskWarningVO.setLocationName(tLocation.getLocationName());
-                }
-                SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(tTask.getPatrolInspector()));
-                if (sysUser!=null){
-                    taskWarningVO.setPhonenumber(sysUser.getPhonenumber());
-                    taskWarningVO.setPatrolInspectorName(sysUser.getNickName());
-                    if (sysUser.getDeptType() == 1){
-                        TProjectDept tProjectDept = projectDeptMapper.selectById(sysUser.getDeptId());
-                        if (!tProjectDept.getParentId().equals("0")){
-                            TProjectDept tProjectDept1 = projectDeptMapper.selectById(tProjectDept.getParentId());
-                            taskWarningVO.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName());
-                        }else{
-                            taskWarningVO.setDeptName(tProjectDept.getProjectName());
-                        }
-                    }else{
-                        TDept tDept = deptMapper.selectById(sysUser.getDeptId());
-                        taskWarningVO.setDeptName(tDept.getDeptName());
-                    }
-                }
+            if (StringUtils.hasLength(taskCode.toString())){
+                taskWarningVO.setTaskCode(taskCode.substring(0, taskCode.length() - 1));
+                strings.add(taskWarningVO.getTaskCode());
             }
+            String format = taskWarningVO.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+
+            taskIds.add(taskWarningVO.getTaskId()+","+format);
 
         }
-        pageInfo.setRecords(list);
+
+        for (String string : taskIds) {
+            if (string.split(",").length>2){
+                List<String> userIds = new ArrayList<>();
+                List<TaskWarningVO> temp = new ArrayList<>();
+                String s1 = string.split(",")[3];
+                // 转化为LocalDateTime
+                LocalDateTime localDateTime = LocalDateTime.parse(s1, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+                // 点位不合格预警
+                for (String s : string.split(",")) {
+                    TaskWarningVO taskWarningVO = new TaskWarningVO();
+                    taskWarningVO.setWarningType(2);
+                    taskWarningVO.setCreateTime(localDateTime);
+                    TTask tTask = taskList.stream().filter(e -> e.getId().equals(s)).findFirst().orElse(null);
+                    // 任务所属巡检员
+                    if (tTask!=null){
+                        SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(tTask.getPatrolInspector()));
+                        if (!userIds.contains(tTask.getPatrolInspector())){
+                            userIds.add(tTask.getPatrolInspector());
+                            taskWarningVO.setTaskCode(tTask.getTaskCode());
+                            TLocation tLocation = locationMapper.selectById(tTask.getLocationId());
+                            if (tLocation!=null){
+                                taskWarningVO.setLocationName(tLocation.getLocationName());
+                            }
+                            if (sysUser!=null){
+                                taskWarningVO.setPhonenumber(sysUser.getPhonenumber());
+                                taskWarningVO.setPatrolInspectorName(sysUser.getNickName());
+                                if (sysUser.getDeptType() == 1){
+                                    TProjectDept tProjectDept = projectDeptMapper.selectById(sysUser.getDeptId());
+                                    if (!tProjectDept.getParentId().equals("0")){
+                                        TProjectDept tProjectDept1 = projectDeptMapper.selectById(tProjectDept.getParentId());
+                                        taskWarningVO.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName());
+                                    }else{
+                                        taskWarningVO.setDeptName(tProjectDept.getProjectName());
+                                    }
+                                }else{
+                                    TDept tDept = deptMapper.selectById(sysUser.getDeptId());
+                                    taskWarningVO.setDeptName(tDept.getDeptName());
+                                }
+                            }
+                            temp.add(taskWarningVO);
+                            res.add(taskWarningVO);
+                        }else{
+                            for (TaskWarningVO warningVO : temp) {
+                                if (warningVO.getPhonenumber().equals(sysUser.getPhonenumber()+"")){
+                                    warningVO.setTaskCode(warningVO.getTaskCode()+","+tTask.getTaskCode());
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                }
+            }else{
+                String s1 = string.split(",")[1];
+                // 转化为LocalDateTime
+                LocalDateTime localDateTime = LocalDateTime.parse(s1, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+                // 超时预警
+                TaskWarningVO taskWarningVO = new TaskWarningVO();
+                taskWarningVO.setCreateTime(localDateTime);
+
+                taskWarningVO.setWarningType(1);
+                TTask tTask = taskList.stream().filter(e -> e.getId().equals(string.split(",")[0])).findFirst().orElse(null);
+                // 任务所属巡检员
+                if (tTask!=null){
+                    SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(tTask.getPatrolInspector()));
+                        taskWarningVO.setTaskCode(tTask.getTaskCode());
+                        TLocation tLocation = locationMapper.selectById(tTask.getLocationId());
+                        if (tLocation!=null){
+                            taskWarningVO.setLocationName(tLocation.getLocationName());
+                        }
+                        if (sysUser!=null){
+                            taskWarningVO.setPhonenumber(sysUser.getPhonenumber());
+                            taskWarningVO.setPatrolInspectorName(sysUser.getNickName());
+                            if (sysUser.getDeptType() == 1){
+                                TProjectDept tProjectDept = projectDeptMapper.selectById(sysUser.getDeptId());
+                                if (!tProjectDept.getParentId().equals("0")){
+                                    TProjectDept tProjectDept1 = projectDeptMapper.selectById(tProjectDept.getParentId());
+                                    taskWarningVO.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName());
+                                }else{
+                                    taskWarningVO.setDeptName(tProjectDept.getProjectName());
+                                }
+                            }else{
+                                TDept tDept = deptMapper.selectById(sysUser.getDeptId());
+                                taskWarningVO.setDeptName(tDept.getDeptName());
+                            }
+                        }
+                        res.add(taskWarningVO);
+                    }
+            }
+        }
+        pageInfo.setTotal(res.size());
+        // 手动对res进行分页
+        res = res.stream().skip((long) (query.getPageNum() - 1) * query.getPageSize()).limit(query.getPageSize()).collect(Collectors.toList());
+        pageInfo.setRecords(res);
         return pageInfo;
     }
 }
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 e1fb35e..427fc44 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
@@ -51,6 +51,7 @@
         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());
                 SysUser sysUser = sysUsers.stream().filter(e -> e.getUserId().equals(Long.valueOf(tTask.getPatrolInspector()))).findFirst().orElse(null);
                 if (sysUser!=null){
                     if (sysUser.getDeptType()==2){
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/system/InspectorListVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/system/InspectorListVO.java
index 6c39166..9199f1e 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/system/InspectorListVO.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/system/InspectorListVO.java
@@ -38,5 +38,9 @@
     @Excel(name = "清洁情况 1合格2不合格", orderNum = "7", width = 20,replace = {"1_合格","2_不合格"})
 
     private Integer clearStatus;
+    @ApiModelProperty(value = "任务类型1日常任务 2自建任务")
+    @Excel(name = "任务类型", orderNum = "8", width = 20,replace = {"1_日常任务","2_自建任务"})
+
+    private Integer taskType;
 
 }
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
index 6eca4ec..a3bc92a 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
@@ -26,7 +26,7 @@
 	
 	<sql id="selectRoleVo">
 	    select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
-            r.status, r.del_flag, r.create_time, r.remark,r.postType,r.removeDays
+            r.status, r.del_flag, r.create_time, r.remark,r.postType,r.removeDays,r.role_type as roleType
         from sys_role r
 	        left join sys_user_role ur on ur.role_id = r.role_id
 	        left join sys_user u on u.user_id = ur.user_id
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 120bc3e..a03756b 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -274,7 +274,13 @@
 	</select>
     <select id="selectUserByDeptId" resultType="com.ruoyi.common.core.domain.entity.SysUser">
 	select  * from sys_user
-	where deptId = #{id}
+	where 1=1
+		<if test="ids != null and ids.size()>0">
+			AND deptId IN
+			<foreach collection="ids" separator="," item="id" open="(" close=")">
+				#{id}
+			</foreach>
+		</if>
 	and status = 0
 	and del_flag = 0
 	</select>
diff --git a/ruoyi-system/src/main/resources/mapper/system/TEarlyWarningMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TEarlyWarningMapper.xml
index c63767b..d439dff 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TEarlyWarningMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TEarlyWarningMapper.xml
@@ -29,7 +29,11 @@
         <if test="query.startTime != null and startTime != ''">
             and (t1.create_time between #{startTime} and #{endTime})
         </if>
+        <if test="query.warningType != null ">
+            and t1.warning_type= #{query.warningType}
+        </if>
         and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        order by t1.create_time desc
     </select>
 
 </mapper>
diff --git a/ruoyi-system/src/main/resources/mapper/system/TInspectorMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TInspectorMapper.xml
index 36ca009..5a88b82 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TInspectorMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TInspectorMapper.xml
@@ -61,9 +61,10 @@
         <if test="query.status != null">
             and t1.status = #{query.status}
         </if>
-        <if test="query.startTime != null and startTime != ''">
-            and (t5.implement_time between #{startTime} and #{endTime})
+        <if test="query.startTime != null and query.startTime != ''">
+            and (t1.create_time between #{query.startTime} and #{query.endTime})
         </if>
+        order by t1.create_time desc
     </select>
     <select id="pageListExport" resultType="com.ruoyi.system.vo.system.InspectorListVO">
         select t1.*,t2.location_name as locationName,t3.location_name as locationTypeName,
diff --git a/ruoyi-system/src/main/resources/mapper/system/TLeaveMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TLeaveMapper.xml
index ae61c89..85c00d6 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TLeaveMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TLeaveMapper.xml
@@ -77,6 +77,7 @@
                 #{id}
             </foreach>
         </if>
+        order by t1.create_time desc
     </select>
 
 </mapper>

--
Gitblit v1.7.1