From 26e9429512245f4b441b55c3ce59c21a5ebb570f Mon Sep 17 00:00:00 2001
From: manailin <261030956@qq.com>
Date: 星期一, 21 六月 2021 12:55:56 +0800
Subject: [PATCH] Merge remote-tracking branch 'remotes/origin/test_excel610' into test

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

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 f95a52b..5571b1e 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
@@ -21,6 +21,17 @@
 import com.panzhihua.common.model.vos.area.AreaAddressVO;
 import com.panzhihua.common.model.vos.community.*;
 import com.panzhihua.common.model.vos.screen.ComActPopulationCultureVO;
+import com.panzhihua.common.model.vos.screen.ComActPopulationScreenVO;
+import com.panzhihua.common.model.vos.screen.ComMngPopulationAgeVO;
+import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO;
+import com.panzhihua.common.model.vos.user.ComMngHouseVo;
+import com.panzhihua.common.model.vos.user.InputUserInfoVO;
+import com.panzhihua.common.model.vos.user.UserElectronicFileVO;
+import com.panzhihua.common.utlis.AgeUtils;
+import com.panzhihua.common.utlis.DateUtils;
+import com.panzhihua.common.utlis.Snowflake;
+import com.panzhihua.common.utlis.StringUtils;
+import com.panzhihua.common.model.vos.screen.ComActPopulationCultureVO;
 import com.panzhihua.common.model.vos.community.bigscreen.BigScreenStatisticPartyBuild;
 import com.panzhihua.common.model.vos.community.screen.civil.CivilPopulationStatisticsVO;
 import com.panzhihua.common.model.vos.community.screen.civil.CivilStatisticsVO;
@@ -45,6 +56,11 @@
 import org.springframework.util.ObjectUtils;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 import javax.crypto.BadPaddingException;
 import javax.crypto.IllegalBlockSizeException;
 import javax.crypto.NoSuchPaddingException;
@@ -782,6 +798,62 @@
         return R.ok(this.baseMapper.getPopulationTotalByAdmin(communityId));
     }
 
+    @Override
+    public R editTagPopulationByCardNo(ComMngPopulationTagCardNoDTO comMngPopulationTagCardNoDTO) {
+        ComMngPopulationDO comMngPopulationDO = getPopulationByCardNo(comMngPopulationTagCardNoDTO.getCardNo());
+        if (comMngPopulationDO == null) {
+            return R.fail("未查询到人口记录");
+        }
+        ComMngPopulationDO comMngPopulation = new ComMngPopulationDO();
+        if (comMngPopulationDO.getLabel() != null) {
+            if (!comMngPopulationDO.getLabel().contains(comMngPopulationTagCardNoDTO.getLabel())) {
+                comMngPopulation.setLabel(comMngPopulationTagCardNoDTO.getLabel().concat(",").concat(comMngPopulationDO.getLabel()));
+            }
+        } else {
+            comMngPopulation.setLabel(comMngPopulationTagCardNoDTO.getLabel());
+        }
+        comMngPopulation.setCardNo(null);
+        comMngPopulation.setId(comMngPopulationDO.getId());
+        int nub = populationDAO.updateById(comMngPopulation);
+        if (nub < 1) {
+            return R.fail();
+        }
+        return R.ok();
+    }
+
+    @Override
+    public ComMngPopulationDO getPopulationByCardNo(String cardNo) {
+        try {
+            String aesCardNo = AESUtil.encrypt128(cardNo, aesKey);
+            return baseMapper.selectOne(
+                    new QueryWrapper<ComMngPopulationDO>()
+                            .eq("card_no", aesCardNo)
+            );
+        } catch (Exception e) {
+            log.error("根据身份证查询业务-加密证件信息出错:{}", e.getCause());
+        }
+        return null;
+    }
+
+    @Override
+    public R screenStatistic(Long communityId) {
+        ComActPopulationScreenVO comActPopulationScreenVO = new ComActPopulationScreenVO();
+        ComMngPopulationTotalVO vo = populationDAO.getPopulationTotalByAdmin(communityId);
+        comActPopulationScreenVO.setTotalNum(vo.getPopulationTotal() == null ? 0 : vo.getPopulationTotal());
+        comActPopulationScreenVO.setLocalNum(vo.getLocalTotal() == null ? 0 : vo.getLocalTotal().longValue());
+        comActPopulationScreenVO.setOutNum(vo.getOutTotal() == null ? 0 : vo.getOutTotal().longValue());
+        comActPopulationScreenVO.setSpecialNum(vo.getSpecialTotal() == null ? 0 : vo.getSpecialTotal().longValue());
+        //统计已使用社区通人数
+        Long count = populationDAO.countUsedCommunityPopulation(communityId);
+        comActPopulationScreenVO.setUsedCommunityNum(count == null ? 0 : count);
+
+        //统计性别
+        Map<String, Long> sexMap = populationDAO.countBySex(communityId);
+        comActPopulationScreenVO.setWoman(sexMap.get("woman") == null ? 0L : sexMap.get("woman"));
+        comActPopulationScreenVO.setManNum(sexMap.get("man") == null ? 0L : sexMap.get("man"));
+        int manPoint = (int) (((double) comActPopulationScreenVO.getManNum() / (double) comActPopulationScreenVO.getTotalNum()) * 100);
+        comActPopulationScreenVO.setManPoint(manPoint);
+        comActPopulationScreenVO.setWomanPoint(100 - manPoint);
     /**
      * 首页大屏统计接口
      * @param communityId   社区id

--
Gitblit v1.7.1