From 802bbc9b1a26334607b04ab562e62594e383d2c2 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期六, 31 七月 2021 17:58:31 +0800
Subject: [PATCH] 修改bug以及获取天气接口

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwDangerReportServiceImpl.java |   67 +++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwDangerReportServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwDangerReportServiceImpl.java
index d0a3837..ad70165 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwDangerReportServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwDangerReportServiceImpl.java
@@ -33,6 +33,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @auther txb
@@ -95,12 +96,78 @@
             BeanUtils.copyProperties(comSwPatrolRecordDO, comSwDangerReportVO);
         }
         BeanUtils.copyProperties(comSwDangerReportDO, comSwDangerReportVO);
+
+        //组装巡查类型
+        if(StringUtils.isNotEmpty(comSwDangerReportVO.getPatrolType())){
+            StringBuilder sb = new StringBuilder();
+            String patrolTypes[] = comSwDangerReportVO.getPatrolType().split(",");
+            for (int i = 0; i < patrolTypes.length; i++) {
+                if(i != 0){
+                    sb.append(",");
+                }
+                if(patrolTypes[i].equals("1")){
+                    sb.append("防火巡查");
+                }else if(patrolTypes[i].equals("2")){
+                    sb.append("防汛巡查");
+                }else if(patrolTypes[i].equals("3")){
+                    sb.append("防疫巡查");
+                }
+            }
+            comSwDangerReportVO.setPatrolType(sb.toString());
+        }
+
+        //查询人员信息
+        if(StringUtils.isNotEmpty(comSwDangerReportVO.getRectifyPerson())){
+            StringBuilder sb = new StringBuilder();
+            String personIds[] = comSwDangerReportVO.getRectifyPerson().split(",");
+            for (int i = 0; i < personIds.length; i++) {
+                if(i != 0){
+                    sb.append(",");
+                }
+                Map<String,String> personMap = comSwPatrolRecordDAO.getPbServiceTeamById(personIds[i]);
+                if(personMap != null){
+                    sb.append(personMap.get("name"));
+                }
+            }
+            comSwDangerReportVO.setPersonName(sb.toString());
+        }
+
+        //查询填报人名称
+        if(comSwDangerReportVO.getCreateBy() != null){
+            comSwDangerReportVO.setCreateName(comSwPatrolRecordDAO.getCreateName(comSwDangerReportVO.getCreateBy()));
+        }
+
+        //查询指派人名称
+        if(StringUtils.isNotEmpty(comSwDangerReportVO.getAssignPerson())){
+            StringBuilder sb = new StringBuilder();
+            String personIds[] = comSwDangerReportVO.getAssignPerson().split(",");
+            for (int i = 0; i < personIds.length; i++) {
+                if(i != 0){
+                    sb.append(",");
+                }
+                Map<String,String> personMap = comSwPatrolRecordDAO.getPbServiceTeamById(personIds[i]);
+                if(personMap != null){
+                    sb.append(personMap.get("name"));
+                }
+            }
+            comSwDangerReportVO.setAssignPersonName(sb.toString());
+        }
+
+        //查询巡查人员
+        Map<String,String> map = comSwPatrolRecordDAO.getPatrolPersonName(comSwDangerReportVO.getId());
+        if(map != null){
+            comSwDangerReportVO.setPatrolName(map.get("person_name"));
+        }
+
         return R.ok(comSwDangerReportVO);
     }
 
     @Override
     public R detailDangerReportByPrId(Long patrolRecordId) {
         ComSwPatrolRecordDO comSwPatrolRecordDO = comSwPatrolRecordDAO.selectById(patrolRecordId);
+        if(comSwPatrolRecordDO == null){
+            return R.fail("该隐患报告不存在");
+        }
         ComSwDangerReportVO comSwDangerReportVO = new ComSwDangerReportVO();
         ComSwPatrolRecordReportDO comSwPatrolRecordReportDO = comSwPatrolRecordReportDAO.selectOne(new QueryWrapper<ComSwPatrolRecordReportDO>().lambda().eq(ComSwPatrolRecordReportDO::getPatrolRecordId, patrolRecordId));
         if (null != comSwPatrolRecordReportDO) {

--
Gitblit v1.7.1