From f6222774733db5783c8a06fe933174779c7c58b9 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 10 六月 2025 08:56:41 +0800
Subject: [PATCH] 打通用户数据  新增大屏接口  优化流程

---
 springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/scheduled/ComplaintTasks.java |  286 ++++++++-------------------------------------------------
 1 files changed, 40 insertions(+), 246 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/scheduled/ComplaintTasks.java b/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/scheduled/ComplaintTasks.java
index 84af306..524158d 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/scheduled/ComplaintTasks.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/scheduled/ComplaintTasks.java
@@ -39,43 +39,39 @@
     public void complaintTimeout() {
 
         WorkOrderItemConfig config = workOrderItemConfigService.getById(1);
-        Integer demandProcessingTime = config.getDemandProcessingTime();
 
         // 超时未处理短信发送及告会上一级督办
-        timeOutHandle(config,demandProcessingTime);
+        timeOutHandle(config);
 
-        // 临期提醒
-        reminderHandle(config, demandProcessingTime);
-
-        // 诉求超时提醒
-        List<Complaint> complaintList = complaintService.list(new LambdaQueryWrapper<Complaint>()
-                .le(Complaint::getClosingTime, new Date())
-                .eq(Complaint::getStatus, 0));
-        List<MessageNotification> messageNotificationList = new ArrayList<>();
-        complaintList.forEach(complaint -> {
-            complaint.setStatus(2);
-            complaint.setCompletionTime(new Date());
-
-
-            // 代办信息
-            R<LoginUserInfoVO> uR = userService.getUserInfoByUserId(String.valueOf(complaint.getCreateBy()));
-            if (!R.isOk(uR)){
-                log.error("未查询到用户信息");
-            }
-            LoginUserInfoVO data = uR.getData();
-            MessageNotification messageNotification = new MessageNotification();
-            messageNotification.setTitle(complaint.getDescriptionTitle());
-            messageNotification.setUndertakerUserId(String.valueOf(complaint.getSuperiorId()));
-            messageNotification.setUndertakerType(1);
-            messageNotification.setPhone(data.getPhone());
-            messageNotification.setResponseTime(complaint.getClosingTime());
-            messageNotification.setPromptType(1);
-            messageNotification.setReadStatus(0);
-            messageNotification.setCreateTime(new Date());
-            messageNotificationList.add(messageNotification);
-        });
-        complaintService.updateBatchById(complaintList);
-        messageNotificationService.saveBatch(messageNotificationList);
+//        // 诉求超时提醒
+//        List<Complaint> complaintList = complaintService.list(new LambdaQueryWrapper<Complaint>()
+//                .le(Complaint::getClosingTime, new Date())
+//                .eq(Complaint::getStatus, 0));
+//        List<MessageNotification> messageNotificationList = new ArrayList<>();
+//        complaintList.forEach(complaint -> {
+//            complaint.setStatus(2);
+//            complaint.setCompletionTime(new Date());
+//
+//
+//            // 代办信息
+//            R<LoginUserInfoVO> uR = userService.getUserInfoByUserId(String.valueOf(complaint.getCreateBy()));
+//            if (!R.isOk(uR)){
+//                log.error("未查询到用户信息");
+//            }
+//            LoginUserInfoVO data = uR.getData();
+//            MessageNotification messageNotification = new MessageNotification();
+//            messageNotification.setTitle(complaint.getDescriptionTitle());
+//            messageNotification.setUndertakerUserId(String.valueOf(complaint.getSuperiorId()));
+//            messageNotification.setUndertakerType(1);
+//            messageNotification.setPhone(data.getPhone());
+//            messageNotification.setResponseTime(complaint.getClosingTime());
+//            messageNotification.setPromptType(1);
+//            messageNotification.setReadStatus(0);
+//            messageNotification.setCreateTime(new Date());
+//            messageNotificationList.add(messageNotification);
+//        });
+//        complaintService.updateBatchById(complaintList);
+//        messageNotificationService.saveBatch(messageNotificationList);
     }
     
     
@@ -100,43 +96,26 @@
     
 
     // 诉求超时处理
-    private void timeOutHandle(WorkOrderItemConfig config,Integer demandProcessingTime) {
+    private void timeOutHandle(WorkOrderItemConfig config) {
 
         List<ComplaintTimeout> complaintTimeoutList = complaintAuditRecordMapper.getComplaintTimeout(
-                config.getCityHandlingTime() + demandProcessingTime,
-                config.getDistrictHandlingTime() + demandProcessingTime,
-                config.getStreetHandlingTime() + demandProcessingTime,
-                config.getCommunityHandlingTime() + demandProcessingTime,
-                config.getPartyMemberHandlingTime() + demandProcessingTime);
-
+                config.getDistrictHandlingTime() ,
+                config.getStreetHandlingTime(),
+                config.getCommunityHandlingTime()
+              );
 
 
         Map<Integer, List<ComplaintTimeout>> timeOutMap = complaintTimeoutList.stream()
-                .collect(Collectors.groupingBy(ComplaintTimeout::getReportType));
-
-        // 市超时
-        List<ComplaintTimeout> cityTimeOutList = timeOutMap.get(1);
-        if (!CollectionUtils.isEmpty(cityTimeOutList)){
-
-            List<SystemUser> cityUserList = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
-                    .eq(SystemUser::getAccountLevel, 1)
-                    .eq(SystemUser::getStatus, 1));
-            List<String> cityPhoneList = cityUserList.stream().map(SystemUser::getPhone).collect(Collectors.toList());
-
-            cityTimeOutList.forEach(complaintTimeout -> {
-                // 发送短信
-                AliSmsUtil.sendTimeoutMessage(cityPhoneList,complaintTimeout.getTitle());
-            });
-        }
+                .collect(Collectors.groupingBy(ComplaintTimeout::getNowLevel));
 
         // 区县超时
         List<ComplaintTimeout> districtTimeOutList = timeOutMap.get(2);
         if (!CollectionUtils.isEmpty(districtTimeOutList)){
             districtTimeOutList.forEach(complaintTimeout -> {
-
+                // 查询状态正常 是区纪委和管理员
                 List<SystemUser> districtUserList = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
                         .eq(SystemUser::getAccountLevel, 2)
-                        .eq(SystemUser::getDistrictsCode, complaintTimeout.getSuperiorId())
+                        .in(SystemUser::getSystemRoleId,1,2)
                         .eq(SystemUser::getStatus, 1));
                 List<String> districtPhoneList = districtUserList.stream().map(SystemUser::getPhone).collect(Collectors.toList());
 
@@ -151,10 +130,9 @@
             streetTimeOutList.forEach(complaintTimeout -> {
                 List<SystemUser> streetUserList = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
                         .eq(SystemUser::getAccountLevel, 3)
-                        .eq(SystemUser::getStreetId, complaintTimeout.getSuperiorId())
+                        .in(SystemUser::getSystemRoleId,1,2)
                         .eq(SystemUser::getStatus, 1));
                 List<String> streetPhoneList = streetUserList.stream().map(SystemUser::getPhone).collect(Collectors.toList());
-
 
                 // 发送短信
                 AliSmsUtil.sendTimeoutMessage(streetPhoneList,complaintTimeout.getTitle());
@@ -167,7 +145,7 @@
             communityTimeOutList.forEach(complaintTimeout -> {
                 List<SystemUser> communityUserList = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
                         .eq(SystemUser::getAccountLevel, 4)
-                        .eq(SystemUser::getCommunityId, complaintTimeout.getSuperiorId())
+                        .in(SystemUser::getSystemRoleId,1,2)
                         .eq(SystemUser::getStatus, 1));
                 List<String> communityPhoneList = communityUserList.stream().map(SystemUser::getPhone).collect(Collectors.toList());
 
@@ -176,190 +154,6 @@
             });
         }
 
-        // 党员超时
-        List<ComplaintTimeout> partyMemberTimeOutList = timeOutMap.get(5);
-        if (!CollectionUtils.isEmpty(partyMemberTimeOutList)){
-            partyMemberTimeOutList.forEach(complaintTimeout -> {
-                R<LoginUserInfoVO> uR = userService.getUserInfoByUserId(String.valueOf(complaintTimeout.getCreateBy()));
-                if (!R.isOk(uR)){
-                    throw new ServiceException("获取用户信息失败");
-                }
-                LoginUserInfoVO data = uR.getData();
-                AliSmsUtil.sendTimeoutMessage(Collections.singletonList(data.getPhone()),complaintTimeout.getTitle());
-            });
-        }
     }
 
-    // 临期提醒
-    private void reminderHandle(WorkOrderItemConfig config,Integer demandProcessingTime) {
-
-        List<ComplaintTimeout> complaintTimeoutList = complaintAuditRecordMapper.getComplaintTimeout(
-                demandProcessingTime - config.getCityDeadlineReminder(),
-                demandProcessingTime - config.getDistrictDeadlineReminder(),
-                demandProcessingTime - config.getStreetDeadlineReminder(),
-                demandProcessingTime - config.getCommunityDeadlineReminder(),
-                demandProcessingTime - config.getPartyMemberDeadlineReminder());
-
-
-        Map<Integer, List<ComplaintTimeout>> timeOutMap = complaintTimeoutList.stream()
-                .collect(Collectors.groupingBy(ComplaintTimeout::getReportType));
-
-        // 市超时
-        List<ComplaintTimeout> cityTimeOutList = timeOutMap.get(1);
-        if (!CollectionUtils.isEmpty(cityTimeOutList)){
-
-            List<SystemUser> cityUserList = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
-                    .eq(SystemUser::getAccountLevel, 1)
-                    .eq(SystemUser::getStatus, 1));
-            List<String> cityPhoneList = cityUserList.stream().map(SystemUser::getPhone).collect(Collectors.toList());
-
-            cityTimeOutList.forEach(complaintTimeout -> {
-                // 发送短信
-                Date closingTime = complaintTimeout.getClosingTime();
-                int daysRemaining = DateUtils.retrieveRemainingDays(closingTime);
-                AliSmsUtil.sendExpireMessage(cityPhoneList,complaintTimeout.getTitle(),closingTime, daysRemaining);
-                // 代办信息
-                List<MessageNotification> messageNotificationList = new ArrayList<>();
-                for (String phone : cityPhoneList) {
-                    MessageNotification messageNotification = new MessageNotification();
-                    messageNotification.setTitle(complaintTimeout.getTitle());
-                    messageNotification.setUndertakerUserId(String.valueOf(complaintTimeout.getSuperiorId()));
-                    messageNotification.setUndertakerType(1);
-                    messageNotification.setPhone(phone);
-                    messageNotification.setResponseTime(complaintTimeout.getClosingTime());
-                    messageNotification.setPromptType(1);
-                    messageNotification.setReadStatus(0);
-                    messageNotification.setCreateTime(new Date());
-                }
-                messageNotificationService.saveBatch(messageNotificationList);
-
-            });
-        }
-
-        // 区县超时
-        List<ComplaintTimeout> districtTimeOutList = timeOutMap.get(2);
-        if (!CollectionUtils.isEmpty(districtTimeOutList)){
-            districtTimeOutList.forEach(complaintTimeout -> {
-
-                List<SystemUser> districtUserList = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
-                        .eq(SystemUser::getAccountLevel, 2)
-                        .eq(SystemUser::getDistrictsCode, complaintTimeout.getSuperiorId())
-                        .eq(SystemUser::getStatus, 1));
-                List<String> districtPhoneList = districtUserList.stream().map(SystemUser::getPhone).collect(Collectors.toList());
-
-                // 发送短信
-                Date closingTime = complaintTimeout.getClosingTime();
-                int daysRemaining = DateUtils.retrieveRemainingDays(closingTime);
-                AliSmsUtil.sendExpireMessage(districtPhoneList,complaintTimeout.getTitle(),closingTime, daysRemaining);
-
-
-                // 代办信息
-                List<MessageNotification> messageNotificationList = new ArrayList<>();
-                for (String phone : districtPhoneList) {
-                    MessageNotification messageNotification = new MessageNotification();
-                    messageNotification.setTitle(complaintTimeout.getTitle());
-                    messageNotification.setUndertakerUserId(String.valueOf(complaintTimeout.getSuperiorId()));
-                    messageNotification.setUndertakerType(1);
-                    messageNotification.setPhone(phone);
-                    messageNotification.setResponseTime(complaintTimeout.getClosingTime());
-                    messageNotification.setPromptType(1);
-                    messageNotification.setReadStatus(0);
-                    messageNotification.setCreateTime(new Date());
-                }
-                messageNotificationService.saveBatch(messageNotificationList);
-            });
-        }
-
-        // 街道超时
-        List<ComplaintTimeout> streetTimeOutList = timeOutMap.get(3);
-        if (!CollectionUtils.isEmpty(streetTimeOutList)){
-            streetTimeOutList.forEach(complaintTimeout -> {
-                List<SystemUser> streetUserList = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
-                        .eq(SystemUser::getAccountLevel, 3)
-                        .eq(SystemUser::getStreetId, complaintTimeout.getSuperiorId())
-                        .eq(SystemUser::getStatus, 1));
-                List<String> streetPhoneList = streetUserList.stream().map(SystemUser::getPhone).collect(Collectors.toList());
-
-                // 发送短信
-                Date closingTime = complaintTimeout.getClosingTime();
-                int daysRemaining = DateUtils.retrieveRemainingDays(closingTime);
-                AliSmsUtil.sendExpireMessage(streetPhoneList,complaintTimeout.getTitle(),closingTime, daysRemaining);
-
-                // 代办信息
-                List<MessageNotification> messageNotificationList = new ArrayList<>();
-                for (String phone : streetPhoneList) {
-                    MessageNotification messageNotification = new MessageNotification();
-                    messageNotification.setTitle(complaintTimeout.getTitle());
-                    messageNotification.setUndertakerUserId(String.valueOf(complaintTimeout.getSuperiorId()));
-                    messageNotification.setUndertakerType(1);
-                    messageNotification.setPhone(phone);
-                    messageNotification.setResponseTime(complaintTimeout.getClosingTime());
-                    messageNotification.setPromptType(1);
-                    messageNotification.setReadStatus(0);
-                    messageNotification.setCreateTime(new Date());
-                }
-                messageNotificationService.saveBatch(messageNotificationList);
-            });
-        }
-
-        // 社区超时
-        List<ComplaintTimeout> communityTimeOutList = timeOutMap.get(4);
-        if (!CollectionUtils.isEmpty(communityTimeOutList)){
-            communityTimeOutList.forEach(complaintTimeout -> {
-                List<SystemUser> communityUserList = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
-                        .eq(SystemUser::getAccountLevel, 4)
-                        .eq(SystemUser::getCommunityId, complaintTimeout.getSuperiorId())
-                        .eq(SystemUser::getStatus, 1));
-                List<String> communityPhoneList = communityUserList.stream().map(SystemUser::getPhone).collect(Collectors.toList());
-
-                // 发送短信
-                Date closingTime = complaintTimeout.getClosingTime();
-                int daysRemaining = DateUtils.retrieveRemainingDays(closingTime);
-                AliSmsUtil.sendExpireMessage(communityPhoneList,complaintTimeout.getTitle(),closingTime, daysRemaining);
-
-                // 代办信息
-                List<MessageNotification> messageNotificationList = new ArrayList<>();
-                for (String phone : communityPhoneList) {
-                    MessageNotification messageNotification = new MessageNotification();
-                    messageNotification.setTitle(complaintTimeout.getTitle());
-                    messageNotification.setUndertakerUserId(String.valueOf(complaintTimeout.getSuperiorId()));
-                    messageNotification.setUndertakerType(1);
-                    messageNotification.setPhone(phone);
-                    messageNotification.setResponseTime(complaintTimeout.getClosingTime());
-                    messageNotification.setPromptType(1);
-                    messageNotification.setReadStatus(0);
-                    messageNotification.setCreateTime(new Date());
-                }
-                messageNotificationService.saveBatch(messageNotificationList);
-            });
-        }
-
-        // 党员超时
-        List<ComplaintTimeout> partyMemberTimeOutList = timeOutMap.get(5);
-        if (!CollectionUtils.isEmpty(partyMemberTimeOutList)){
-            partyMemberTimeOutList.forEach(complaintTimeout -> {
-                R<LoginUserInfoVO> uR = userService.getUserInfoByUserId(String.valueOf(complaintTimeout.getCreateBy()));
-                if (!R.isOk(uR)){
-                    throw new ServiceException("获取用户信息失败");
-                }
-                LoginUserInfoVO data = uR.getData();
-                // 发送短信
-                Date closingTime = complaintTimeout.getClosingTime();
-                int daysRemaining = DateUtils.retrieveRemainingDays(closingTime);
-                AliSmsUtil.sendExpireMessage(Collections.singletonList(data.getPhone()),complaintTimeout.getTitle(),closingTime, daysRemaining);
-
-                // 代办信息
-                MessageNotification messageNotification = new MessageNotification();
-                messageNotification.setTitle(complaintTimeout.getTitle());
-                messageNotification.setUndertakerUserId(String.valueOf(complaintTimeout.getSuperiorId()));
-                messageNotification.setUndertakerType(1);
-                messageNotification.setPhone(data.getPhone());
-                messageNotification.setResponseTime(complaintTimeout.getClosingTime());
-                messageNotification.setPromptType(1);
-                messageNotification.setReadStatus(0);
-                messageNotification.setCreateTime(new Date());
-                messageNotificationService.save(messageNotification);
-            });
-        }
-    }
 }

--
Gitblit v1.7.1