| | |
| | | package com.panzhihua.service_community.api; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.SysUserNoticeVO; |
| | | 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.service.user.UserService; |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | 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 UserService userService; |
| | | @Resource |
| | | private EldersAuthService eldersAuthService; |
| | | @Resource |
| | | public ComMngPopulationDAO comMngPopulationDAO; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | return comActEasyPhotoService.detailEasyPhoto(id, userId); |
| | | } |
| | | |
| | | /** |
| | | * 随手拍删除 |
| | | * |
| | | * @param id 随手拍主键 |
| | | * @param userId 登录用户 |
| | | * @return 详情内容 |
| | | */ |
| | | @PostMapping("deleteEasyPhoto") |
| | | public R deleteEasyPhoto(@RequestParam("id") Long id, @RequestParam("userId") Long userId) { |
| | | ComActEasyPhotoDO comActEasyPhotoDO = comActEasyPhotoService.getBaseMapper().selectById(id); |
| | | if(comActEasyPhotoDO==null){ |
| | | return R.fail("随手拍不存在"); |
| | | } |
| | | comActEasyPhotoDO.setDelTag(1); |
| | | int updateById = comActEasyPhotoService.getBaseMapper().updateById(comActEasyPhotoDO); |
| | | if(updateById==1){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | /** |
| | | * 分页查询微心愿 |
| | | * |
| | |
| | | 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 -> { |
| | | int age = IdCard.IdNOToAge(rt.getIdCard()); |
| | | boolean isElders = age >= 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("家庭成员信息错误"); |
| | | } |
| | | Integer age = IdCard.IdNOToAge(theFamily.getIdCard()); |
| | | if(age>=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 = IdCard.domicile(eldersAuthDO.getIdCard()); |
| | | String domicile = eldersAuthService.queryDomicile(eldersAuthDO.getIdCard()); |
| | | if(StringUtils.isEmpty(domicile)){ |
| | | 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); |
| | | EldersAuthDO eldersAuthDO = eldersAuthService.getBaseMapper().selectById(eldersAuthFeedbackAddDTO.getAuthId()); |
| | | if(eldersAuthDO==null){ |
| | | return R.fail("认证记录不存在"); |
| | | } |
| | | R addR = eldersAuthService.addFeedback(eldersAuthFeedbackAddDTO); |
| | | if(R.isOk(addR)){ |
| | | SysUserNoticeVO sysUserNoticeVO=new SysUserNoticeVO(); |
| | | sysUserNoticeVO.setUserId(eldersAuthDO.getSumitUserId()); |
| | | sysUserNoticeVO.setType(3); |
| | | sysUserNoticeVO.setTitle("高龄认证社区反馈"); |
| | | sysUserNoticeVO.setBusinessType(13); |
| | | sysUserNoticeVO.setBusinessTitle(" "); |
| | | sysUserNoticeVO.setBusinessContent("你提交【" +eldersAuthDO.getAuthUserName() + "】的高龄认证,社区反馈:" |
| | | + eldersAuthFeedbackAddDTO.getFeedBack()); |
| | | sysUserNoticeVO.setBusinessId(eldersAuthDO.getId()); |
| | | sysUserNoticeVO.setStatus(0); |
| | | sysUserNoticeVO.setBusinessStatus(2); |
| | | R r1 = userService.addNotice(sysUserNoticeVO); |
| | | if (R.isOk(r1)) { |
| | | log.info("新增用户报名党建活动通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); |
| | | } |
| | | } |
| | | |
| | | return addR; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询导出高龄老人 |
| | | * @param pageEldersAuthDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/eldersauth/eldersAuthQuery") |
| | | R eldersAuthQuery(@RequestBody PageEldersAuthDTO pageEldersAuthDTO){ |
| | | return eldersAuthService.queryExportData(pageEldersAuthDTO); |
| | | } |
| | | } |