From 9bef6f6e735d16d2ec04c12028c3df6cdeccf1a5 Mon Sep 17 00:00:00 2001
From: 罗元桥 <2376770955@qq.com>
Date: 星期一, 27 九月 2021 10:58:31 +0800
Subject: [PATCH] Merge branch 'test_bak' into 'test'

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComElderAuthRecordsServiceImpl.java   |    9 +++++++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngPopulationDOMapper.xml                                           |    7 +++++++
 springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml                                                             |    3 +++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java      |    2 ++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComElderAuthRecordsMapper.xml                                          |    3 ++-
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/PageElderAuthRecordsDTO.java                        |    2 ++
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/grid/PageEventManageDTO.java                                  |    2 ++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java                       |   10 ++++++++--
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationHouseServiceImpl.java |    2 +-
 9 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/PageElderAuthRecordsDTO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/PageElderAuthRecordsDTO.java
index 8f21f12..06363ab 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/PageElderAuthRecordsDTO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/PageElderAuthRecordsDTO.java
@@ -52,4 +52,6 @@
 
     @ApiModelProperty(value = "认证方式(1.视频认证 2.人脸认证 3.线下认证)")
     private String authMethod;
+
+    private String idCard;
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/grid/PageEventManageDTO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/grid/PageEventManageDTO.java
index 0b873ce..5e4fa72 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/grid/PageEventManageDTO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/grid/PageEventManageDTO.java
@@ -46,6 +46,8 @@
     @ApiModelProperty(value = "事件分类:1治安隐患、2公共服务、3矛盾纠纷、4不稳定因素、5突发事件", hidden = false, example = "1")
     // @NotNull(message = "事件分类不能为空")
     private Integer eventType;
+    @ApiModelProperty(value = "事件类型")
+    private String eventClazz;
     @Max(127)
     @ApiModelProperty(value = "危险级别", hidden = false, example = "1")
     private Integer dangerLevel;
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 7ae69d9..7ca614d 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
@@ -181,7 +181,7 @@
     AreaAddressVO getAreaAddress(@Param("provinceCode") String provinceCode, @Param("cityCode") String cityCode,
         @Param("districtCode") String districtCode);
 
-    @Select("select count(id) as populationTotal "
+    @Select("select count(cmpct.id) as populationTotal "
         + ",(select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = #{communityId} and cmp.out_or_local = 1) as localTotal "
         + ",(select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = #{communityId} and cmp.out_or_local = 2) as outTotal "
         + ",(select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = #{communityId} and IFNULL(cmpct.label,'') != '') as specialTotal "
@@ -195,7 +195,7 @@
         + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','退役军人','%')) as veteransTotal "
         + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','残疾人','%')) as disabilityTotal "
         + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','低保户','%')) as lowSecurityTotal "
-        + " from com_mng_population_community_tags as cmpct where community_id = #{communityId}")
+        + " from com_mng_population_community_tags as cmpct inner join com_mng_population as cmp on cmp.id = cmpct.population_id where community_id = #{communityId}")
     ComMngPopulationTotalVO getPopulationTotalByAdmin(@Param("communityId") Long communityId);
 
     @Select("select count(id) as populationTotal," +
@@ -594,6 +594,12 @@
         + "</foreach>" + " </script>")
     Integer getPopulationVisitingCount(@Param("ids") List<Long> ids);
 
+    /**
+     * 综治后台删除居民,并清理人口与社区绑定关系
+     * @param ids   需要删除的人口id集合
+     */
+    void deletePopulaitonRelation(@Param("ids") List<Long> ids);
+
     @Select("<script> " + "SELECT " + "   cmp.id, " + "   cmp.`name`, " + "   cmp.card_no as idCard, "
         + "   cmpct.label, " + "   cmp.sex, " + "   IFNULL( cmp.phone, '暂无' ) as phone, " + "   cmp.address, "
         + "   cmp.political_outlook " + "  FROM "
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComElderAuthRecordsServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComElderAuthRecordsServiceImpl.java
index 919fa11..6f809d7 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComElderAuthRecordsServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComElderAuthRecordsServiceImpl.java
@@ -100,6 +100,15 @@
         }
         page.setSize(pageSize);
         page.setCurrent(pageNum);
+
+        try {
+            //关键词为空时需要进行加密,通过加密去检索身份证号筛选高龄认证记录
+            String idCard = AESUtil.encrypt128(pageElderAuthRecordsDTO.getSearchKey(), aesKey);
+            pageElderAuthRecordsDTO.setIdCard(idCard);
+        }catch (Exception e){
+            log.error("查询高龄认证记录转换身份证号失败");
+        }
+
         IPage<ComElderAuthRecordVO> iPage = comElderAuthRecordsDAO.pageElderAuthRecords(page, pageElderAuthRecordsDTO);
         if (!iPage.getRecords().isEmpty()) {
             iPage.getRecords().forEach(comElderAuthRecordVO -> {
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationHouseServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationHouseServiceImpl.java
index 281fb67..5239ad7 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationHouseServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationHouseServiceImpl.java
@@ -389,7 +389,7 @@
             }
             // 查询该房屋的住户信息
             List<PopulationListVO> populationList =
-                this.baseMapper.getGridVillageBuildingPopulationList(buildingHouseDetailVO.getId(), null, 1);
+                this.baseMapper.getGridVillageBuildingPopulationList(buildingHouseDetailVO.getId(), null, null);
             if (!populationList.isEmpty()) {
                 populationList.forEach(population -> {
                     try {
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 73d25e9..d81bbe7 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
@@ -7604,6 +7604,8 @@
             return R.fail("您选择的数据中存在被引用的,无法删除");
         }
         this.baseMapper.deleteBatchIds(ids);
+        //删除人口并删除人口和社区关联关系
+        this.baseMapper.deletePopulaitonRelation(ids);
         return R.ok("删除成功");
     }
 
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComElderAuthRecordsMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComElderAuthRecordsMapper.xml
index d1c0307..84e60e0 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComElderAuthRecordsMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComElderAuthRecordsMapper.xml
@@ -84,7 +84,8 @@
         </if>
         <if test="pageElderAuthRecordsDTO.searchKey != null and pageElderAuthRecordsDTO.searchKey != ''">
             and (ceae.`name` like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%')
-            or  cear.mark like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%'))
+            or cear.mark like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%')
+            or ceae.id_card = #{pageElderAuthRecordsDTO.idCard})
         </if>
         order by cear.create_at desc
     </select>
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 7227840..7bd0808 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
@@ -270,4 +270,11 @@
         select t.village_id as villageId,concat(t.alley,t.house_num,'号') as villageName,t1.id,concat(t1.unit_no,'栋',t1.floor,'单元',t1.code,'号') as name  from com_mng_village t left join com_mng_population_house t1 on t.village_id = t1.village_id where t.community_id=#{communityId} and t1.id is not null
     </select>
 
+    <delete id="deletePopulaitonRelation">
+        delete from com_mng_population_community_tags where population_id in
+        <foreach item="item" collection="ids" separator="," open="(" close=")" index="">
+            #{item}
+        </foreach>
+    </delete>
+
 </mapper>
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 a59d122..e16eb42 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
@@ -480,6 +480,9 @@
 			<if test="pageEventManageDTO.yellowCard!=null">
 				AND e.yellow_card = #{pageEventManageDTO.yellowCard}
 			</if>
+			<if test="pageEventManageDTO.eventClazz != null and pageEventManageDTO.eventClazz != &quot;&quot;">
+				AND e.event_clazz like concat('%',#{pageEventDTO.eventClazz},'%')
+			</if>
 			<if test="pageEventManageDTO.urgent!=null">
 				AND e.urgent = #{pageEventManageDTO.urgent}
 			</if>

--
Gitblit v1.7.1