From c6512655e722d9ca80dd8c34b79f6d3923ecf86c Mon Sep 17 00:00:00 2001 From: 罗元桥 <2376770955@qq.com> Date: 星期二, 22 六月 2021 16:07:50 +0800 Subject: [PATCH] Merge branch 'test' into 'test_screen' --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java | 30 ++++++++++++++++++++++++------ 1 files changed, 24 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..b668a7b 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 @@ -1578,6 +1578,7 @@ } @PostMapping("/eldersauth/addByFamilyUser") + @Transactional(rollbackFor = Exception.class) R addByFamilyUser(@RequestBody EldersAuthAddByFamilyDTO eldersAuthAddByFamilyDTO){ ComEldersAuthUserDO authUserDO = comEldersAuthUserService.getById(eldersAuthAddByFamilyDTO.getFamilyUserId()); @@ -1585,16 +1586,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 +1611,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