From 1a054c486c9037b7cb0bca5c4472c628d1d1c36c Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期一, 28 六月 2021 16:54:06 +0800 Subject: [PATCH] 解决代码被合并后删除问题 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java | 41 +++++++++++++++++++++++++++++++++++------ 1 files changed, 35 insertions(+), 6 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 3e704fe..be11475 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 @@ -86,6 +86,8 @@ public ComEldersAuthUserService comEldersAuthUserService; @Resource private ComEldersAuthHistoryRecordMapper comEldersAuthHistoryRecordMapper; + @Resource + private ComActEasyPhotoActivityService comActEasyPhotoActivityService; /** * 新增社区活动 @@ -553,6 +555,15 @@ @PostMapping("addeasyphoto") public R addEasyPhoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { return comActEasyPhotoService.addEasyPhoto(comActEasyPhotoVO); + } + + /** + * 查询随手拍是否有活动 + * @return 活动详情 + */ + @PostMapping("getEasyPhotoActivity") + public R getEasyPhotoActivity(@RequestParam("communityId") Long communityId) { + return comActEasyPhotoActivityService.getEasyPhotoActivity(communityId); } /** @@ -1578,6 +1589,7 @@ } @PostMapping("/eldersauth/addByFamilyUser") + @Transactional(rollbackFor = Exception.class) R addByFamilyUser(@RequestBody EldersAuthAddByFamilyDTO eldersAuthAddByFamilyDTO){ ComEldersAuthUserDO authUserDO = comEldersAuthUserService.getById(eldersAuthAddByFamilyDTO.getFamilyUserId()); @@ -1585,16 +1597,24 @@ return R.fail("未查询到老人信息"); } + Long elderId = authUserDO.getId(); + boolean canReAuthThisMonth = comEldersAuthUserService.checkReAuthAgain(elderId); + if(!canReAuthThisMonth){ + return R.fail("当月已认证,不能再次进行认证"); + } + + String idCard = authUserDO.getIdCard(); + Long loginUserId = eldersAuthAddByFamilyDTO.getUserId(); EldersAuthDO eldersAuthDO = new EldersAuthDO(); eldersAuthDO.setSumitUserId(loginUserId); eldersAuthDO.setCreateBy(loginUserId); eldersAuthDO.setCreateAt(new Date()); - eldersAuthDO.setIdCard(authUserDO.getIdCard()); + eldersAuthDO.setIdCard(idCard); eldersAuthDO.setAuthUserName(authUserDO.getName()); eldersAuthDO.setVideoUrl(eldersAuthAddByFamilyDTO.getVideoUrl()); eldersAuthDO.setFamilyUserId(authUserDO.getId()); - eldersAuthDO.setAge(IdcardUtil.getAgeByIdCard(authUserDO.getIdCard())); + eldersAuthDO.setAge(IdcardUtil.getAgeByIdCard(idCard)); //根据身份证查询出籍贯 出生日期 //String domicile = IdCard.domicile(eldersAuthDO.getIdCard()); String domicile = eldersAuthService.queryDomicile(eldersAuthDO.getIdCard()); @@ -1602,22 +1622,31 @@ domicile = "暂无"; } - Date birthDay = IdCard.birthDay(eldersAuthDO.getIdCard()); + Date birthDay = IdCard.birthDay(idCard); eldersAuthDO.setDomicile(domicile); eldersAuthDO.setBirthDay(birthDay); int add = eldersAuthService.getBaseMapper().insert(eldersAuthDO); if(add==1){ + //设置认证成功 + Long familyUserId = eldersAuthDO.getFamilyUserId(); + ComEldersAuthUserDO comEldersAuthUserDO = new ComEldersAuthUserDO(); + comEldersAuthUserDO.setId(familyUserId); + comEldersAuthUserDO.setIsAuth(1); + boolean updated = comEldersAuthUserService.updateById(comEldersAuthUserDO); + if(!updated){ + throw new ServiceException("添加认证失败,更新认证状态"); + } //认证成功 添加认证记录 List<ComEldersAuthHistoryRecordDO> authHistoryRecordDOList = comEldersAuthHistoryRecordMapper.selectList(new QueryWrapper<ComEldersAuthHistoryRecordDO>() - .lambda().eq(ComEldersAuthHistoryRecordDO::getIdCard,eldersAuthDO.getIdCard()).ge(ComEldersAuthHistoryRecordDO::getCreateAt, DateUtils.getFirstDayOfMonth())); + .lambda().eq(ComEldersAuthHistoryRecordDO::getIdCard,idCard).ge(ComEldersAuthHistoryRecordDO::getCreateAt, DateUtils.getFirstDayOfMonth())); if(authHistoryRecordDOList.isEmpty()){ ComEldersAuthHistoryRecordDO authHistoryRecordDO = new ComEldersAuthHistoryRecordDO(); authHistoryRecordDO.setUserId(eldersAuthAddByFamilyDTO.getFamilyUserId()); authHistoryRecordDO.setAuthId(eldersAuthDO.getId()); BeanUtils.copyProperties(eldersAuthDO,authHistoryRecordDO); authHistoryRecordDO.setId(null); - authHistoryRecordDO.setBrithday(AgeUtils.getAgeFormatBirthday(IdcardUtil.getBirthByIdCard(eldersAuthDO.getIdCard()))); - authHistoryRecordDO.setAge(IdcardUtil.getAgeByIdCard(eldersAuthDO.getIdCard())); + authHistoryRecordDO.setBrithday(AgeUtils.getAgeFormatBirthday(IdcardUtil.getBirthByIdCard(idCard))); + authHistoryRecordDO.setAge(IdcardUtil.getAgeByIdCard(idCard)); authHistoryRecordDO.setIsAuth(1); authHistoryRecordDO.setDomicile(domicile); comEldersAuthHistoryRecordMapper.insert(authHistoryRecordDO); -- Gitblit v1.7.1