From caefe9a9cc486247f831e46356b0b03ca450fdf9 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期五, 25 二月 2022 10:14:36 +0800
Subject: [PATCH] Merge branch 'dev' of http://gitlab.nhys.cdnhxx.com/root/zhihuishequ into dev

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   61 ++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 1 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 6f673aa..6eb960a 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
@@ -578,6 +578,66 @@
         return R.ok(iPage);
     }
 
+    @Override
+    public R exportOld(ComMngPopulationDTO comMngPopulationVO) {
+        if (StringUtils.isNotEmpty(comMngPopulationVO.getAgeStart())) {
+            String ageStartTime = DateUtils.getDateFormatString(
+                    DateUtils.yearAddNum(new Date(), -(Integer.parseInt(comMngPopulationVO.getAgeStart()))), "yyyy-MM-dd");
+            if (StringUtils.isNotEmpty(ageStartTime)) {
+                comMngPopulationVO.setAgeStartTime(ageStartTime);
+            }
+        }
+
+        if (StringUtils.isNotEmpty(comMngPopulationVO.getAgeEnd())) {
+            String ageEndTime = DateUtils.getDateFormatString(
+                    DateUtils.yearAddNum(new Date(), -(Integer.parseInt(comMngPopulationVO.getAgeEnd()))), "yyyy-MM-dd");
+            if (StringUtils.isNotEmpty(ageEndTime)) {
+                comMngPopulationVO.setAgeEndTime(ageEndTime);
+            }
+        }
+        if (comMngPopulationVO.getAgeStartTime() != null && !"".equals(comMngPopulationVO.getAgeStartTime())
+                && comMngPopulationVO.getAgeEndTime() != null && !"".equals(comMngPopulationVO.getAgeEndTime())) {
+            if (comMngPopulationVO.getAgeStartTime().equals(comMngPopulationVO.getAgeEndTime())) {
+                Date endAge =
+                        DateUtils.stringToDate(comMngPopulationVO.getAgeEndTime(), new SimpleDateFormat("yyyy-MM-dd"));
+                String ageStartTime = DateUtils.getDateFormatString(DateUtils.yearAddNum(endAge, -1), "yyyy-MM-dd");
+                if (StringUtils.isNotEmpty(ageStartTime)) {
+                    comMngPopulationVO.setAgeStartTimeEnd(ageStartTime);
+                }
+            } else {
+                Date endAge =
+                        DateUtils.stringToDate(comMngPopulationVO.getAgeEndTime(), new SimpleDateFormat("yyyy-MM-dd"));
+                String ageStartTime = DateUtils.getDateFormatString(DateUtils.yearAddNum(endAge, -1), "yyyy-MM-dd");
+                if (StringUtils.isNotEmpty(ageStartTime)) {
+                    comMngPopulationVO.setAgeEndTimeEnd(ageStartTime);
+                }
+            }
+        }
+        List<ComMngPopulationVO> comMngPopulationVOS=this.comMngPopulationDAO.exportOld(comMngPopulationVO);
+        if(!comMngPopulationVOS.isEmpty()){
+            comMngPopulationVOS.forEach(populDO -> {
+                if (StringUtils.isNotEmpty(populDO.getBirthday())) {
+                    populDO.setAge(AgeUtils.getAgeFromBirthTimes(populDO.getBirthday()));
+                    populDO.setRelationName(PopulRelationEnum.getCnDescByName(populDO.getRelation()));
+                    populDO.setCultureLevelName(PopulCultureLevelEnum.getCnDescByName(populDO.getCultureLevel()));
+                    populDO.setPoliticalOutlookName(
+                            PopulPoliticalOutlookEnum.getCnDescByName(populDO.getPoliticalOutlook()));
+                    populDO.setMarriageName(PopulMarriageEnum.getCnDescByName(populDO.getMarriage()));
+                    if(populDO.getAge()>=80&&populDO.getAge()<=89){
+                        populDO.setType(1);
+                    }
+                    if(populDO.getAge()>=90&&populDO.getAge()<=99){
+                        populDO.setType(2);
+                    }
+                    if(populDO.getAge()>=100){
+                        populDO.setType(3);
+                    }
+                }
+            });
+        }
+        return R.ok(comMngPopulationVOS);
+    }
+
     /**
      * 删除实有人口
      *
@@ -8017,7 +8077,6 @@
                     if (nonNull(personType)) {
                         populationDO.setPersonType(personType.toString());
                     }
-                    populationDO.setUpdateBy(userId);
                     updateList.add(populationDO);
                 } else {
                     // 不存在实有人口,返回

--
Gitblit v1.7.1