From e7f03acfa5ee4ad4fd6d1ee9e9ae9a5655488f6d Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期二, 09 十一月 2021 17:04:46 +0800 Subject: [PATCH] 1109修改 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPensionAuthRecordServiceImpl.java | 107 +++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 82 insertions(+), 25 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPensionAuthRecordServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPensionAuthRecordServiceImpl.java index 585c71c..2fe1fe7 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPensionAuthRecordServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPensionAuthRecordServiceImpl.java @@ -15,10 +15,8 @@ import javax.annotation.Resource; -import cn.hutool.core.util.IdcardUtil; -import com.panzhihua.common.utlis.WxUtil; -import com.panzhihua.common.utlis.WxXCXTempSend; -import com.panzhihua.service_community.dao.ComActActSignDAO; +import com.panzhihua.common.model.vos.community.*; +import com.panzhihua.service_community.service.ComPensionAuthPensionerService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -30,7 +28,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.panzhihua.common.enums.PopulHouseUseEnum; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.dtos.community.AddIdentityAuthDTO; import com.panzhihua.common.model.dtos.community.EldersAuthTypeQueryDTO; @@ -38,16 +35,12 @@ import com.panzhihua.common.model.dtos.community.PageIdentityAuthRecordDTO; import com.panzhihua.common.model.helper.AESUtil; import com.panzhihua.common.model.vos.R; -import com.panzhihua.common.model.vos.community.ComPensionAuthRecordExcleVO; -import com.panzhihua.common.model.vos.community.ComPensionAuthRecordImportExcelVO; -import com.panzhihua.common.model.vos.community.ComPensionAuthRecordImportMistakeExcelVO; -import com.panzhihua.common.model.vos.community.ComPensionAuthRecordStatisticExcleVO; -import com.panzhihua.common.model.vos.community.ComPensionAuthRecordVO; -import com.panzhihua.common.model.vos.community.SysConfVO; import com.panzhihua.common.utlis.AgeUtils; import com.panzhihua.common.utlis.DateUtils; -import com.panzhihua.common.utlis.Snowflake; import com.panzhihua.common.utlis.StringUtils; +import com.panzhihua.common.utlis.WxUtil; +import com.panzhihua.common.utlis.WxXCXTempSend; +import com.panzhihua.service_community.dao.ComActActSignDAO; import com.panzhihua.service_community.dao.ComActDAO; import com.panzhihua.service_community.dao.ComMngPopulationDAO; import com.panzhihua.service_community.dao.ComPensionAuthPensionerDAO; @@ -62,6 +55,7 @@ import com.panzhihua.service_community.model.dos.SysConfDO; import com.panzhihua.service_community.service.ComPensionAuthRecordService; +import cn.hutool.core.util.IdcardUtil; import lombok.extern.slf4j.Slf4j; /** @@ -92,6 +86,8 @@ private ComActActSignDAO comActActSignDAO; @Value("${domain.aesKey:}") private String aesKey; + @Resource + private ComPensionAuthPensionerService comPensionAuthPensionerService; @Override public R pagePensionAuthRecords(PageElderAuthRecordsDTO pageElderAuthRecordsDTO) { @@ -106,6 +102,13 @@ } page.setSize(pageSize); page.setCurrent(pageNum); + try { + //关键词为空时需要进行加密,通过加密去检索身份证号筛选高龄认证记录 + String idCard = AESUtil.encrypt128(pageElderAuthRecordsDTO.getSearchKey(), aesKey); + pageElderAuthRecordsDTO.setIdCard(idCard); + }catch (Exception e){ + log.error("查询高龄认证记录转换身份证号失败"); + } IPage<ComPensionAuthRecordVO> iPage = comPensionAuthRecordDAO.pagePensionAuthRecords(page, pageElderAuthRecordsDTO); if (!iPage.getRecords().isEmpty()) { iPage.getRecords().forEach(comPensionAuthRecordVO -> { @@ -135,10 +138,19 @@ if (comPensionAuthRecordDO == null) { return R.fail("未查询到养老认证记录"); } + + ComPensionAuthPensionerDO authPensionerDO = comPensionAuthPensionerDAO.selectById(comPensionAuthRecordDO.getPensionerId()); + if(authPensionerDO == null){ + return R.fail("未查询到老人信息"); + } + BeanUtils.copyProperties(comPensionAuthRecordVO, comPensionAuthRecordDO); if (comPensionAuthRecordVO.getApprovalStatus().equals(PASS_THROUGH.getStatus())) { comPensionAuthRecordDO.setAuthStatus(CERTIFIED.getStatus()); sendAuthSubscribe(comPensionAuthRecordDO.getSubmitUserId(), "养老认证", "认证成功!"); + + authPensionerDO.setAddress(comPensionAuthRecordVO.getAddress()); + comPensionAuthPensionerDAO.updateById(authPensionerDO); } else { sendAuthSubscribe(comPensionAuthRecordDO.getSubmitUserId(), "养老认证", comPensionAuthRecordVO.getRejectReason()); } @@ -194,6 +206,8 @@ List<ComPensionAuthRecordDO> saveList = new ArrayList<>(); // 需要修改的认证记录集合 List<ComPensionAuthRecordDO> updateList = new ArrayList<>(); + // 需要更新的老人信息 + List<ComPensionAuthPensionerDO> updatePensionerList = new ArrayList<>(); log.info("开始处理导入数据"); Date nowDate = new Date(); List<ComPensionAuthRecordImportMistakeExcelVO> mistakes = new ArrayList<>(); @@ -253,15 +267,30 @@ //存在待审核记录,进行更新认证信息 comPensionAuthRecordDO = updatePensionAuthRecordsDO(vo, comPensionAuthRecordDO, userId,communityId,nowDate); updateList.add(comPensionAuthRecordDO); + + if(StringUtils.isNotEmpty(vo.getAddress())){ + comPensionAuthPensionerDO.setAddress(vo.getAddress()); + updatePensionerList.add(comPensionAuthPensionerDO); + } }else { // 不存在记录,则新增 comPensionAuthRecordDO = savePensionAuthRecordsDO(vo, comPensionAuthPensionerDO, authPeriod, userId,communityId,nowDate); saveList.add(comPensionAuthRecordDO); + + if(StringUtils.isNotEmpty(vo.getAddress())){ + comPensionAuthPensionerDO.setAddress(vo.getAddress()); + updatePensionerList.add(comPensionAuthPensionerDO); + } } }else { // 不存在记录,则新增 comPensionAuthRecordDO = savePensionAuthRecordsDO(vo, comPensionAuthPensionerDO, authPeriod, userId,communityId,nowDate); saveList.add(comPensionAuthRecordDO); + + if(StringUtils.isNotEmpty(vo.getAddress())){ + comPensionAuthPensionerDO.setAddress(vo.getAddress()); + updatePensionerList.add(comPensionAuthPensionerDO); + } } } } @@ -290,6 +319,9 @@ log.info("执行数据库更新线下认证记录"); comPensionAuthRecordDAO.updateAll(updateList); log.info("数据库更新线下认证记录完成"); + } + if(!updatePensionerList.isEmpty()){ + comPensionAuthPensionerService.updateBatchById(updatePensionerList); } log.info("执行数据库导入完成"); @@ -375,14 +407,9 @@ comPensionAuthStatisticsDO.setSum(comPensionAuthPensionerDOS.size()); } comPensionAuthStatisticsDAO.insert(comPensionAuthStatisticsDO); - //上期已认证人数 - int authSum = comPensionAuthPensionerDAO.havePensionAuthPensionerAmount(act.getCommunityId(), String.valueOf(year - 1)); - ComPensionAuthStatisticsDO comPensionAuthStatisticsDO1 = comPensionAuthStatisticsDAO.selectOne(new QueryWrapper<ComPensionAuthStatisticsDO>() - .lambda().eq(ComPensionAuthStatisticsDO::getCommunityId, act.getCommunityId()).eq(ComPensionAuthStatisticsDO::getYear, year - 1)); - comPensionAuthStatisticsDO1.setAuthSum(authSum); - comPensionAuthStatisticsDO1.setNoAuthSum(comPensionAuthStatisticsDO1.getSum() - comPensionAuthStatisticsDO1.getAuthSum()); - comPensionAuthStatisticsDAO.updateById(comPensionAuthStatisticsDO1); }); + + return R.ok(); } @@ -404,7 +431,6 @@ , ComPensionAuthPensionerDO comPensionAuthPensionerDO, String authPeriod, Long userId, Long communityId,Date date) { ComPensionAuthRecordDO comPensionAuthRecordDO = new ComPensionAuthRecordDO(); BeanUtils.copyProperties(vo, comPensionAuthRecordDO); - comPensionAuthRecordDO.setId(Snowflake.getId()); comPensionAuthRecordDO.setPensionerId(comPensionAuthPensionerDO.getId()); comPensionAuthRecordDO.setAuthPeriod(authPeriod); comPensionAuthRecordDO.setSubmitUserId(userId); @@ -459,16 +485,15 @@ return R.fail("信息有误,请检查!"); } Date dateNow = new Date(); - String currentAuthPeriod = new SimpleDateFormat("yyyy").format(dateNow); List<ComPensionAuthRecordDO> currentAuthPeriodRecords = comPensionAuthRecordDAO .selectList(new QueryWrapper<ComPensionAuthRecordDO>().lambda() - .eq(ComPensionAuthRecordDO::getAuthPeriod, currentAuthPeriod) + .eq(ComPensionAuthRecordDO::getAuthPeriod, comPensionAuthPensionerDO) .eq(ComPensionAuthRecordDO::getPensionerId, comPensionAuthPensionerDO.getId())); if (!currentAuthPeriodRecords.isEmpty()) { boolean alreadyAuth = currentAuthPeriodRecords.stream() .filter(record -> record.getAuthStatus().equals(CERTIFIED.getStatus())).findFirst().isPresent(); if (alreadyAuth) { - return R.fail(String.format("该人员%s期已认证无需重复认证", currentAuthPeriod)); + return R.fail(String.format("该人员%s期已认证无需重复认证", addIdentityAuthDTO.getAuthPeriod())); } boolean isPendingReview = currentAuthPeriodRecords.stream() .filter(record -> record.getApprovalStatus().intValue() == PENDING_REVIEW.getStatus()).findFirst().isPresent(); @@ -479,8 +504,8 @@ ComPensionAuthRecordDO comPensionAuthRecordDO = new ComPensionAuthRecordDO(); BeanUtils.copyProperties(addIdentityAuthDTO, comPensionAuthRecordDO); comPensionAuthRecordDO.setPensionerId(comPensionAuthPensionerDO.getId()); - comPensionAuthRecordDO.setAuthDate(dateNow); - comPensionAuthRecordDO.setAuthPeriod(currentAuthPeriod); + comPensionAuthRecordDO.setAuthDate(addIdentityAuthDTO.getAuthTime()); + comPensionAuthRecordDO.setAuthPeriod(addIdentityAuthDTO.getAuthPeriod()); if (addIdentityAuthDTO.getAuthMethod().intValue() == FACE_AUTH.getMethod()) { comPensionAuthRecordDO.setApprovalStatus(PASS_THROUGH.getStatus()); comPensionAuthRecordDO.setApprovalDate(dateNow); @@ -515,4 +540,36 @@ public R retrievePensionAuthDetail(Long identityAuthId) { return R.ok(comPensionAuthRecordDAO.findById(identityAuthId)); } + + @Override + public R add(ComElderAuthRecordVO comElderAuthRecordVO) { + if(!comElderAuthRecordVO.getIdCard().isEmpty()){ + List<ComMngPopulationDO> comMngPopulationDOS=comMngPopulationDAO.selectList(new QueryWrapper<ComMngPopulationDO>().lambda().eq(ComMngPopulationDO::getCardNoStr,comElderAuthRecordVO.getIdCard()).orderByDesc(ComMngPopulationDO::getCreateAt)); + if(!comMngPopulationDOS.isEmpty()){ + ComMngPopulationDO comMngPopulationDO=comMngPopulationDOS.get(0); + ComPensionAuthPensionerDO comPensionAuthPensionerDO=comPensionAuthPensionerDAO.selectOne(new QueryWrapper<ComPensionAuthPensionerDO>().lambda().eq(ComPensionAuthPensionerDO::getPopulationId,comMngPopulationDO.getId())); + if(comPensionAuthPensionerDO!=null){ + Integer count=comPensionAuthRecordDAO.selectCount(new QueryWrapper<ComPensionAuthRecordDO>().lambda().eq(ComPensionAuthRecordDO::getPensionerId,comPensionAuthPensionerDO.getId()).eq(ComPensionAuthRecordDO::getAuthPeriod,comElderAuthRecordVO.getAuthPeriod())); + if(count==0){ + ComPensionAuthRecordDO comPensionAuthRecordDO=new ComPensionAuthRecordDO(); + BeanUtils.copyProperties(comElderAuthRecordVO,comPensionAuthRecordDO); + comPensionAuthRecordDO.setApprovalStatus(PASS_THROUGH.getStatus()); + comPensionAuthRecordDO.setApprovalDate(new Date()); + comPensionAuthRecordDO.setAuthStatus(CERTIFIED.getStatus()); + comPensionAuthRecordDO.setAuthMethod(ComPensionAuthRecordDO.authMethod.xxrz); + comPensionAuthRecordDO.setPensionerId(comPensionAuthPensionerDO.getId()); + comPensionAuthRecordDO.setSubmitUserId(comElderAuthRecordVO.getSubmitUserId()); + if (this.baseMapper.insert(comPensionAuthRecordDO) < 0) { + return R.fail("认证失败,请重新尝试"); + } + return R.ok(); + } + return R.fail("当前期数也认证,请勿重复认证"); + } + return R.fail("无养老认证数据"); + } + return R.fail("该身份证无实有人口信息"); + } + return R.fail("身份证不能为空"); + } } -- Gitblit v1.7.1