From 0c6c62dacc8eff1f63d16ad756c30df2557e0f15 Mon Sep 17 00:00:00 2001
From: CeDo <cedoogle@gmail.com>
Date: 星期三, 19 五月 2021 14:54:23 +0800
Subject: [PATCH] ADD:高龄认证

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java |  132 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 128 insertions(+), 4 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
index fc0b95b..01749c2 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -2,6 +2,7 @@
 
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.panzhihua.common.exceptions.ServiceException;
 import com.panzhihua.common.model.dtos.community.*;
@@ -11,11 +12,12 @@
 import com.panzhihua.common.model.vos.community.questnaire.EditComActQuestnaireVo;
 import com.panzhihua.common.model.vos.community.questnaire.QuestnaireVO;
 import com.panzhihua.common.model.vos.community.questnaire.UsersAnswerQuestnaireVO;
+import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO;
 import com.panzhihua.common.model.vos.user.UserPhoneVO;
-import com.panzhihua.service_community.model.dos.ComActActPrizeDO;
-import com.panzhihua.service_community.model.dos.ComActDynDO;
-import com.panzhihua.service_community.model.dos.ComActMicroWishDO;
-import com.panzhihua.service_community.model.dos.ComMngStructAreaDO;
+import com.panzhihua.common.utlis.ClazzUtils;
+import com.panzhihua.common.utlis.IdCardUtil;
+import com.panzhihua.service_community.dao.ComMngPopulationDAO;
+import com.panzhihua.service_community.model.dos.*;
 import com.panzhihua.service_community.service.*;
 
 import lombok.extern.slf4j.Slf4j;
@@ -28,6 +30,7 @@
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.Comparator;
+import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -67,6 +70,11 @@
     private ComActMessageService comActMessageService;
     @Resource
     private ComActQuestnaireService comActQuestnaireService;
+
+    @Resource
+    private EldersAuthService eldersAuthService;
+    @Resource
+    public ComMngPopulationDAO comMngPopulationDAO;
 
     /**
      * 新增社区活动
@@ -1469,4 +1477,120 @@
     public R deletemicrowish(@RequestParam("id") Long id){
         return comActMicroWishService.deleteMicroWish(id);
     }
+
+
+
+
+    /**
+     * 新增高龄认证
+     * @param eldersAuthAddDTO
+     * @return 新增结果
+     */
+    @PostMapping("/eldersauth/add")
+    R add(@RequestBody EldersAuthAddDTO eldersAuthAddDTO){
+        return eldersAuthService.add(eldersAuthAddDTO);
+    };
+
+    /**
+     * 修改高龄认证
+     * @param eldersAuthEditDTO
+     * @return 维护结果
+     */
+    @PostMapping("/eldersauth/edit")
+    R edit(@RequestBody EldersAuthEditDTO eldersAuthEditDTO){
+        return eldersAuthService.edit(eldersAuthEditDTO);
+    };
+
+    /**
+     * 分页查找高龄认证
+     * @param pageEldersAuthDTO
+     * @return 维护结果
+     */
+    @PostMapping("/eldersauth/page")
+    R<IPage<EldersAuthVO>> query(@RequestBody PageEldersAuthDTO pageEldersAuthDTO){
+        return eldersAuthService.query(pageEldersAuthDTO);
+    };
+
+    /**
+     * 删除高龄认证
+     * @param EldersAuthDeleteDTO
+     * @return 平台用户信息
+     */
+    @PostMapping("/eldersauth/delete")
+    R delete(@RequestBody EldersAuthDeleteDTO EldersAuthDeleteDTO){
+        return eldersAuthService.delete(EldersAuthDeleteDTO);
+    };
+
+    /**
+     * 查询高龄认证详细信息
+     * @param id 高龄认证 id
+     * @return 查找结果
+     */
+    @PostMapping("/eldersauth/{id}")
+    R<EldersAuthDetailsVO> eldersAuthDetails(@PathVariable("id") Long id){
+        return eldersAuthService.eldersAuthDetails(id);
+    };
+
+    @PostMapping("/eldersauth/getMyfamilyElders/{userId}")
+    R<List<ComMngFamilyInfoVO>> getMyfamilyElders(@PathVariable("userId") Long userId){
+        List<ComMngFamilyInfoVO> list = comMngPopulationDAO.listFamilyByUserId(userId);
+        List<ComMngFamilyInfoVO> listRt = new ArrayList<>();
+        list.forEach(rt -> {
+            boolean isElders =  rt.getAge()>=80;
+            if(isElders){
+                listRt.add(rt);
+            }
+        });
+        return R.ok(listRt);
+    }
+
+    @PostMapping("/eldersauth/addByFamilyUser")
+    R addByFamilyUser(@RequestBody EldersAuthAddByFamilyDTO eldersAuthAddByFamilyDTO){
+
+        List<ComMngFamilyInfoVO> list = comMngPopulationDAO.listFamilyByUserId(eldersAuthAddByFamilyDTO.getUserId());
+        ComMngFamilyInfoVO theFamily = null;
+        Long familyUserId = eldersAuthAddByFamilyDTO.getFamilyUserId();
+        for (ComMngFamilyInfoVO family : list) {
+            if (familyUserId == family.getId()) {
+                theFamily = family;
+            }
+        }
+
+        if(theFamily==null){
+            return R.fail("家庭成员信息错误");
+        }
+        if(theFamily.getAge()>=80){
+            Long loginUserId = eldersAuthAddByFamilyDTO.getUserId();
+            EldersAuthDO eldersAuthDO = new EldersAuthDO();
+            eldersAuthDO.setSumitUserId(eldersAuthAddByFamilyDTO.getSumitUserId());
+            eldersAuthDO.setCreateBy(loginUserId);
+            eldersAuthDO.setCreateAt(new Date());
+            eldersAuthDO.setIdCard(theFamily.getIdCard());
+            eldersAuthDO.setAuthUserName(theFamily.getName());
+            eldersAuthDO.setVideoUrl(eldersAuthAddByFamilyDTO.getVideoUrl());
+            //根据身份证查询出籍贯 出生日期
+            String domicile = "";
+            Date birthDay = new Date();
+            eldersAuthDO.setDomicile(domicile);
+            eldersAuthDO.setBirthDay(birthDay);
+            int add = eldersAuthService.getBaseMapper().insert(eldersAuthDO);
+            if(add==1){
+                return R.ok();
+            }
+        }else{
+            return R.fail("家庭成员年龄还未达到80");
+        }
+        return R.fail();
+    }
+
+    /**
+     * 新增高龄认证社区反馈
+     * @param {classNameFirstLower}AddDTO 添加高龄认证社区反馈传递对象
+     * @return 新增结果
+     */
+    @PostMapping("/eldersauth/addFeedback")
+    R add(@RequestBody EldersAuthFeedbackAddDTO eldersAuthFeedbackAddDTO){
+        ClazzUtils.setIfStringIsEmpty(eldersAuthFeedbackAddDTO);
+        return eldersAuthService.addFeedback(eldersAuthFeedbackAddDTO);
+    }
 }

--
Gitblit v1.7.1