From 9576bebcacea938771f6f5b51d958e6a4ac59df6 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期四, 09 十二月 2021 16:59:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/civil/CivilVillageStatisticsVO.java      |    6 +++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenServiceImpl.java        |    7 +++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngPopulationDOMapper.xml                                      |    5 ++
 springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml                                                        |    4 +-
 springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityConvenientApi.java           |    2 
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   23 +++++++++++
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/SensitiveUtil.java                                            |   15 +++++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java                  |   10 ++++
 8 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/civil/CivilVillageStatisticsVO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/civil/CivilVillageStatisticsVO.java
index 463db65..8c35d36 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/civil/CivilVillageStatisticsVO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/civil/CivilVillageStatisticsVO.java
@@ -3,9 +3,12 @@
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 
+import com.panzhihua.common.model.vos.community.screen.index.IndexSpecialStatisticsVO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+
+import java.util.List;
 
 @Data
 @ApiModel("民生统计小区列表返回参数")
@@ -66,4 +69,7 @@
     @ApiModelProperty("其他人员")
     private Integer otherPeopleNum;
 
+    @ApiModelProperty("特殊人群统计模块数据")
+    private List<IndexSpecialStatisticsVO> specialStatisticsList;
+
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/SensitiveUtil.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/SensitiveUtil.java
index 8d463c9..f6278fb 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/SensitiveUtil.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/SensitiveUtil.java
@@ -1,5 +1,8 @@
 package com.panzhihua.common.utlis;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 /**
  * @description: 身份证手机号脱敏处理
  * @author: Null
@@ -38,4 +41,16 @@
         return idNumber;
     }
 
+
+    public static String replaceName(String str) {
+        if(StringUtils.isNotEmpty(str)){
+            if(str.length()==2){
+                str=str.replace(str.substring(1),"*");
+            }
+            if(str.length()>2) {
+                str=str.replace(str.substring(1,str.length()-1),"*");
+            }
+        }
+        return str;
+    }
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityConvenientApi.java b/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityConvenientApi.java
index d8da1eb..2d57141 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityConvenientApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityConvenientApi.java
@@ -226,7 +226,7 @@
         try {
             SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
             sftp.login();
-            InputStream is = BaseUtils.base64StrToInputStream(file.getFile().replace("data:image/png;base64,","").replace("data:image/jpg;base64,",""));
+            InputStream is = BaseUtils.base64StrToInputStream(file.getFile().replace("data:image/png;base64,","").replace("data:image/jpg;base64,","").replace("data:image/jpeg;base64,",""));
             sftp.uploadMore(FtpConstants.FTPFILEPATH_IDCARD, name, is);
             sftp.logout();
             return R.ok(url + "/idcard/" + name);
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
index e5722ec..6693862 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -366,7 +366,7 @@
     CivilPopulationStatisticsVO getCivilScreenPopulation(@Param("communityId") Long communityId,
         @Param("lastMonth") Date lastMonth);
 
-    @Select("SELECT `NAME`, " + " user_sum, " + " lng, " + " lat, " + " village_images, " + " village_id  " + "FROM "
+    @Select("SELECT `NAME`, " + "user_sum, " + " lng, " + " lat, " + " village_images, " + " village_id  " + "FROM "
         + " com_mng_village AS cmv  " + "WHERE " + " community_id = #{communityId}")
     List<CivilVillageStatisticsVO> getCivilScreenVillageList(@Param("communityId") Long communityId);
 
@@ -615,6 +615,14 @@
      */
     void updatePopulationUnit(@Param("villageId") Long villageId, @Param("floor") String floor,@Param("oldUnitNo") String oldUnitNo,@Param("newUnitNo") String newUnitNo);
 
+    /**
+     * 根据villageId查询特殊人群数
+     * @param villageId
+     * @param label
+     * @return
+     */
+    Integer selectCountByVillageId(@Param("villageId") Long villageId,@Param("label")String label);
+
     CivilPartyStatisticsVO getCivilParty(@Param("communityId") Long communityId);
 
     CivilGovernmentStatisticsVO getCivilGovernment(@Param("communityId") Long communityId);
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenServiceImpl.java
index 641d135..c23df3c 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenServiceImpl.java
@@ -5,6 +5,8 @@
 
 import javax.annotation.Resource;
 
+import com.panzhihua.common.utlis.SensitiveUtil;
+import com.panzhihua.common.utlis.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
@@ -86,6 +88,11 @@
                 listRt = listRt.subList(0, 3);
             }
         }
+        listRt.forEach(partyBuildingMemberVO -> {
+            if(StringUtils.isNotEmpty(partyBuildingMemberVO.getName())){
+                partyBuildingMemberVO.setName(SensitiveUtil.replaceName(partyBuildingMemberVO.getName()));
+            }
+        });
         return R.ok(listRt);
     }
 
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
index ff6f552..5c97c19 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -7041,7 +7041,7 @@
         // 查询特殊人群统计
         List<IndexSpecialStatisticsVO> specialStatisticsVOList = new ArrayList<>();
 
-        // 查询特殊人群标签列表
+        //查询特殊人群标签列表
         List<ComMngUserTagVO> userTagList = comMngPopulationDAO.getUserTagListByCommunityId(communityId);
         IndexSpecialStatisticsVO otherSpecialVO = new IndexSpecialStatisticsVO();
         otherSpecialVO.setTitle("其他");
@@ -7125,6 +7125,27 @@
 
         // 查询小区列表
         List<CivilVillageStatisticsVO> villageStatisticsList = this.baseMapper.getCivilScreenVillageList(communityId);
+//        villageStatisticsList.forEach(civilVillageStatisticsVO -> {
+//            civilVillageStatisticsVO.setUserSum(comMngPopulationDAO.selectCount(new QueryWrapper<ComMngPopulationDO>().lambda().eq(ComMngPopulationDO::getVillageId,civilVillageStatisticsVO.getVillageId())));
+//            List<IndexSpecialStatisticsVO> specialStatisticsVOS = new ArrayList<>();
+//            IndexSpecialStatisticsVO otherSpecial = new IndexSpecialStatisticsVO();
+//            otherSpecial.setTitle("其他");
+//            otherSpecial.setSum(0);
+//            // 查询特殊人群标签列表
+//            List<ComMngUserTagVO> userTagVOS = comMngPopulationDAO.getUserTagListByCommunityId(communityId);
+//
+//            userTagVOS.forEach(comMngUserTagVO -> {
+//              Integer count=comMngPopulationDAO.selectCountByVillageId(civilVillageStatisticsVO.getVillageId(),comMngUserTagVO.getTagName());
+//              IndexSpecialStatisticsVO indexSpecialStatisticsVO=new IndexSpecialStatisticsVO();
+//              indexSpecialStatisticsVO.setTitle(comMngUserTagVO.getTagName());
+//              indexSpecialStatisticsVO.setSum(count);
+//              otherSpecial.setSum(otherSpecial.getSum()+count);
+//              specialStatisticsVOS.add(indexSpecialStatisticsVO);
+//            });
+//            otherSpecial.setSum(civilVillageStatisticsVO.getUserSum()-otherSpecial.getSum());
+//            specialStatisticsVOS.add(otherSpecial);
+//            civilVillageStatisticsVO.setSpecialStatisticsList(specialStatisticsVOS);
+//        });
         civilStatisticsVO.setVillageStatisticsList(villageStatisticsList);
 
         //查询党建引领数据
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngPopulationDOMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngPopulationDOMapper.xml
index 8e97428..027d064 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngPopulationDOMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngPopulationDOMapper.xml
@@ -638,6 +638,11 @@
         update com_mng_population set unit_no = #{newUnitNo} where village_id = #{villageId} and floor = #{floor} and unit_no = #{oldUnitNo}
     </update>
 
+    <select id="selectCountByVillageId" resultType="Integer">
+        select count(*) from com_mng_population t LEFT JOIN com_mng_population_community_tags t1 on t.id= t1.population_id
+        where t.village_id=#{villageId} and t1.label like concat('%',#{label},'%')
+    </select>
+
     <select id="getCivilParty" resultType="com.panzhihua.common.model.vos.community.screen.civil.CivilPartyStatisticsVO">
         SELECT
             count( id ) as committeeNum,
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml
index 576b8d3..6fced52 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml
@@ -1352,8 +1352,8 @@
 		SELECT
 			count( id ) as populationTotal,
 			(select count(id) from com_mng_population where village_id = #{villageId} and out_or_local = 1) as localTotal,
-			(select count(id) from com_mng_population where village_id = #{villageId} and out_or_local = 2) as localTotal,
-			(select count(id) from com_mng_population_community_tags as cmpct left join com_mng_population as cmp on cmpct.population_id = cmp.id where cmp.village_id = #{villageId} and cmpct.label is not null) as specialTotal,
+			(select count(id) from com_mng_population where village_id = #{villageId} and out_or_local = 2) as outTotal,
+			(select count(cmp.id) from com_mng_population_community_tags as cmpct left join com_mng_population as cmp on cmpct.population_id = cmp.id where cmp.village_id = #{villageId} and cmpct.label is not null) as specialTotal,
 			(select count(id) from com_mng_building where village_id = #{villageId}) as buildTotal
 		FROM
 			com_mng_population AS cmp

--
Gitblit v1.7.1