| | |
| | | |
| | | 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.*; |
| | |
| | | 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.IdCard; |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | private ComActMessageService comActMessageService; |
| | | @Resource |
| | | private ComActQuestnaireService comActQuestnaireService; |
| | | |
| | | @Resource |
| | | private EldersAuthService eldersAuthService; |
| | | @Resource |
| | | public ComMngPopulationDAO comMngPopulationDAO; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | 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()); |
| | | eldersAuthDO.setFamilyUserId(eldersAuthAddByFamilyDTO.getFamilyUserId()); |
| | | //根据身份证查询出籍贯 出生日期 |
| | | String domicile = ""; |
| | | Date birthDay = IdCard.birthDay(eldersAuthDO.getIdCard()); |
| | | eldersAuthDO.setDomicile(domicile); |
| | | eldersAuthDO.setBirthDay(birthDay); |
| | | int add = eldersAuthService.getBaseMapper().insert(eldersAuthDO); |
| | | if(add==1){ |
| | | return R.ok(eldersAuthDO.getId()); |
| | | } |
| | | }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); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询导出高龄老人 |
| | | * @param pageEldersAuthDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/eldersauth/eldersAuthQuery") |
| | | R eldersAuthQuery(@RequestBody PageEldersAuthDTO pageEldersAuthDTO){ |
| | | return eldersAuthService.queryExportData(pageEldersAuthDTO); |
| | | } |
| | | } |