From ae491ab1663209a21322be073e5f9104dd46bbb3 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期一, 24 一月 2022 14:40:36 +0800
Subject: [PATCH] 老人导出修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 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 8e5cbdf..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);
+    }
+
     /**
      * 删除实有人口
      *

--
Gitblit v1.7.1