From 562e95b7cc53fe809d092ac5320eed711993bb7e Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期五, 23 五月 2025 21:20:06 +0800
Subject: [PATCH] 修改bug

---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java          |    6 +-
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/AnalyticStatisticsController.java  |   14 +++---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/aspectj/OperLogAspect.java             |    1 
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml                                    |   58 +++++++++++++++++++++++++++++
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java |   19 ++++++---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/dao/ComplaintMapper.java               |    4 ++
 6 files changed, 85 insertions(+), 17 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/AnalyticStatisticsController.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/AnalyticStatisticsController.java
index 806e34a..44109e2 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/AnalyticStatisticsController.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/AnalyticStatisticsController.java
@@ -131,7 +131,7 @@
                     // 区县账号 找出code
                     districtsCodes = systemUserLevels2.stream().map(SystemUserLevel::getDistrictsCode).collect(Collectors.toList());
                 }else {
-                    districtsCodes.add("0");
+                    districtsCodes.add("-1");
                 }
 
                 List<SystemUserLevel> systemUserLevels3 = listBySystemUsers.stream().filter(e -> e.getLevel() == 3).collect(Collectors.toList());
@@ -140,10 +140,10 @@
                     List<String> finalDistrictsCodes1 = districtsCodes;
                     streetIds = systemUserLevels3.stream().filter(e -> !finalDistrictsCodes1.contains(e.getDistrictsCode())).map(SystemUserLevel::getStreetId).collect(Collectors.toList());
                     if(streetIds.isEmpty()){
-                        streetIds.add("0");
+                        streetIds.add("-1");
                     }
                 }else {
-                    streetIds.add("0");
+                    streetIds.add("-1");
                 }
 
                 List<SystemUserLevel> systemUserLevels4 = listBySystemUsers.stream().filter(e -> e.getLevel() == 4).collect(Collectors.toList());
@@ -153,7 +153,7 @@
                     List<String> finalDistrictsCodes2 = districtsCodes;
                     communityIds = systemUserLevels4.stream().filter(e -> !finalStreetIds1.contains(e.getStreetId()) && !finalDistrictsCodes2.contains(e.getDistrictsCode())).map(SystemUserLevel::getCommunityId).collect(Collectors.toList());
                 }else {
-                    communityIds.add(0L);
+                    communityIds.add(-1L);
                 }
                 List<String> finalDistrictsCodes = districtsCodes;
                 List<String> finalStreetIds = streetIds;
@@ -220,7 +220,7 @@
         // 拥有的区县code
         List<String> collect = systemUserLevels.stream().map(SystemUserLevel::getDistrictsCode).collect(Collectors.toList());
         if(collect.size()==0){
-            collect.add("0");
+            collect.add("-1");
         }
         // 找出这个区县的
         List<BcRegion> list = bcRegionService.list(new LambdaQueryWrapper<BcRegion>().eq(BcRegion::getParentId, 510400).in(BcRegion::getRegionCode, collect));
@@ -234,7 +234,7 @@
         List<SystemUserLevel> systemUserLevels1 = listBySystemUsers.stream().filter(e -> e.getLevel() == 3 && !collect.contains(e.getDistrictsCode())).collect(Collectors.toList());
         List<String> collect1 = systemUserLevels1.stream().map(SystemUserLevel::getStreetId).collect(Collectors.toList());
         if(collect1.size()==0){
-            collect1.add("0");
+            collect1.add("-1");
         }
 
         // 区县街道
@@ -250,7 +250,7 @@
         List<SystemUserLevel> systemUserLevels2 = listBySystemUsers.stream().filter(e -> e.getLevel() == 4 && !collect.contains(e.getDistrictsCode()) && !collect1.contains(e.getStreetId())).collect(Collectors.toList());
         List<Long> collect2 = systemUserLevels2.stream().map(SystemUserLevel::getCommunityId).collect(Collectors.toList());
         if(collect2.size()==0){
-            collect2.add(0l);
+            collect2.add(-1l);
         }
 
         // 区县社区
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java
index 7900a51..1017965 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java
@@ -64,7 +64,7 @@
 		List<RegionVO> dispatchVOList = new ArrayList<>();
 		for (BcRegion bcRegion : list1) {
 			RegionVO regionVO = new RegionVO();
-			regionVO.setTier(1);
+			regionVO.setTier(2);
 			regionVO.setId(bcRegion.getRegionCode());
 			regionVO.setName(bcRegion.getRegionName());
 			List<RegionVO> dispatchVOList1 = new ArrayList<>();
@@ -72,13 +72,13 @@
 			for (ComStreet street : collect) {
 				List<RegionVO> dispatchVOList2 = new ArrayList<>();
 				RegionVO regionVO1 = new RegionVO();
-				regionVO1.setTier(2);
+				regionVO1.setTier(3);
 				regionVO1.setId(street.getStreetId());
 				regionVO1.setName(street.getName());
 				List<ComAct> collect1 = list2.stream().filter(e -> e.getStreetId().toString().equals(street.getStreetId())).collect(Collectors.toList());
 				for (ComAct comAct : collect1) {
 					RegionVO regionVO2 = new RegionVO();
-					regionVO2.setTier(3);
+					regionVO2.setTier(4);
 					regionVO2.setId(comAct.getCommunityId().toString());
 					regionVO2.setName(comAct.getName());
 					dispatchVOList2.add(regionVO2);
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/aspectj/OperLogAspect.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/aspectj/OperLogAspect.java
index cf9e8f3..d5e0f92 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/aspectj/OperLogAspect.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/aspectj/OperLogAspect.java
@@ -221,6 +221,7 @@
                     // 党员审核
                 case 9:
                     if(opLog.operatorCategory().contains("诉求导出")){
+                        sysLog.setOperatorCategory(opLog.operatorCategory());
                         sysLog.setOperatorName(opLog.operatorCategory());
                     }else {
                         JSONObject auditData = jsonResult.getJSONObject("data");
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/dao/ComplaintMapper.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/dao/ComplaintMapper.java
index 0dedeb3..43d1601 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/dao/ComplaintMapper.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/dao/ComplaintMapper.java
@@ -106,4 +106,8 @@
                                                      @Param("accountLevel") Integer accountLevel, @Param("targetId") Long targetId);
 
     List<Complaint> queryCompliantList(@Param("targetId") Long targetId, @Param("accountLevel") Integer accountLevel, @Param("loginUserInfo") LoginUserInfoVO loginUserInfo,  @Param("query")AppStaticsQuery query);
+
+    List<Complaint> getStatusForList(@Param("ids") List<Long> ids);
+
+
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
index df35992..c8469d3 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -1468,8 +1468,9 @@
         } else {
             lastYearMonth = LocalDate.now().minusMonths(1).getYear() + "-" + LocalDate.now().minusMonths(1).getMonth().getValue();
         }
-
-
+        // 要根据驳回表来改状态
+        List<Long> ids = complaints.stream().map(Complaint::getId).collect(Collectors.toList());
+        complaints = this.baseMapper.getStatusForList(ids);
         AnalyticStatisticsOneVo vo = new AnalyticStatisticsOneVo();
 
         // 诉求单量总计
@@ -1528,6 +1529,9 @@
                 BigDecimal lastMonthAverageTime1 = BigDecimal.valueOf(lastMonthAverageTime).setScale(2, RoundingMode.HALF_UP);
 
                 vo.setLastMonthCompareAverageTime( new BigDecimal(vo.getThisMonthAverageTime()).subtract(lastMonthAverageTime1).setScale(2,RoundingMode.HALF_UP).doubleValue());
+            }else {
+                vo.setLastMonthCompareAverageTime( new BigDecimal(vo.getThisMonthAverageTime()).setScale(2,RoundingMode.HALF_UP).doubleValue());
+
             }
 
         }
@@ -1561,6 +1565,7 @@
         }
         return vo;
     }
+
 
     public static void main(String[] args) {
         String time = "2022-02-02 - 2023-02-02";
@@ -1609,7 +1614,7 @@
                 // 近7天数据
                 complaints = complaints.stream().filter(e -> e.getCreateTime().getTime() <= new Date().getTime() && e.getCreateTime().getTime() >= parse.getTime()).collect(Collectors.toList());
 
-                for (int i = 6; i > 0; i--) {
+                for (int i = 6; i >= 0; i--) {
                     // 获取前7天的时间
                     String day = DateUtils.getBeforeDay(i);
                     List<Complaint> complaintList = complaints.stream().filter(e -> simpleDateFormat.format(e.getCreateTime()).contains(day)).collect(Collectors.toList());
@@ -1666,10 +1671,10 @@
         long count3 = complaints.stream().filter(e -> e.getCommentRate() != null && e.getCommentRate() == 3).count();
         vo.setGreatSatisfactionNum((int) count3);
         if (complaints.size() > 0) {
-            vo.setDissatisfactionRate(BigDecimal.valueOf(count).divide(BigDecimal.valueOf(complaints.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).doubleValue());
-            vo.setGeneralSatisfactionRate(BigDecimal.valueOf(count1).divide(BigDecimal.valueOf(complaints.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).doubleValue());
-            vo.setSatisfactionRate(BigDecimal.valueOf(count2).divide(BigDecimal.valueOf(complaints.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).doubleValue());
-            vo.setGreatSatisfactionRate(BigDecimal.valueOf(count3).divide(BigDecimal.valueOf(complaints.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).doubleValue());
+            vo.setDissatisfactionRate(BigDecimal.valueOf(count).divide(BigDecimal.valueOf(complaints.size()),4,RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2,RoundingMode.HALF_UP).doubleValue());
+            vo.setGeneralSatisfactionRate(BigDecimal.valueOf(count1).divide(BigDecimal.valueOf(complaints.size()),4,RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2,RoundingMode.HALF_UP).doubleValue());
+            vo.setSatisfactionRate(BigDecimal.valueOf(count2).divide(BigDecimal.valueOf(complaints.size()),4,RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2,RoundingMode.HALF_UP).doubleValue());
+            vo.setGreatSatisfactionRate(BigDecimal.valueOf(count3).divide(BigDecimal.valueOf(complaints.size()),4,RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2,RoundingMode.HALF_UP).doubleValue());
         }
         return vo;
     }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
index 1612220..bdbae87 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
@@ -741,4 +741,62 @@
         </where>
         ORDER BY sc.create_time DESC
     </select>
+
+    <select id="getStatusForList" resultType="com.panzhihua.sangeshenbian.model.entity.Complaint">
+        select  sc.id,
+        sc.serial_number,
+        sc.time,
+        sc.problem_type,
+        sc.name,
+        sc.contact_number,
+        sc.location,
+        sc.detailed_address,
+        sc.description_title,
+        sc.description_content,
+        sc.images,
+        sc.videos,
+        CASE
+        WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 7
+        WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 5
+        WHEN sc.status = 0 and scar.audit_status = 2 THEN 6
+        ELSE sc.status
+        END AS status,
+        sc.superior_type,
+        sc.superior_id,
+        sc.report_user_name,
+        sc.report_user_phone,
+        sc.report_type,
+        sc.voice_file,
+        sc.city_code,
+        sc.districts_code,
+        sc.street_id,
+        sc.community_id,
+        sc.party_member_id,
+        sc.create_time,
+        sc.create_by,
+        sc.update_time,
+        sc.update_by,
+        sc.completion_description,
+        sc.completion_images,
+        sc.completion_videos,
+        sc.completion_other_description,
+        sc.completion_time,
+        sc.completion_user_id,
+        sc.completion_username,
+        sc.completion_user_phone,
+        sc.closing_time,
+        sc.over_time_days,
+        sc.longitude,
+        sc.latitude,
+        sc.completion_user_level,
+        sc.handling_day,
+        sc.comment_rate
+        FROM sgsb_complaint sc
+        LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id
+        where scar.audit_status!=1 and  sc.id in
+        <foreach item="item" collection="ids" index="index" close=")" open="(" separator=",">
+            #{item}
+        </foreach>
+
+    </select>
 </mapper>

--
Gitblit v1.7.1