| | |
| | | private ComElderAuthRecordsDAO comElderAuthRecordsDAO; |
| | | @Resource |
| | | private ComElderAuthElderliesDAO comElderAuthElderliesDAO; |
| | | @Resource |
| | | private ComPensionAuthHistoryRecordMapper comPensionAuthHistoryRecordMapper; |
| | | @Resource |
| | | private ComPensionAuthRecordDAO comPensionAuthRecordDAO; |
| | | @Resource |
| | | private ComPensionAuthPensionerDAO comPensionAuthPensionerDAO; |
| | | |
| | | @Value("${domain.aesKey:}") |
| | | private String aesKey; |
| | |
| | | public R timedTaskEldersRecordAuthJobHandler(){ |
| | | Date nowDate = new Date(); |
| | | |
| | | String authPeriod = DateUtils.getCurrentDateString_YYYY_MM(); |
| | | //高龄认证本期期数 |
| | | String elderAuthPeriod = DateUtils.getCurrentDateString_YYYY_MM(); |
| | | //养老认证本期期数 |
| | | String pensionAuthPeriod = DateUtils.getCurrentDateString_YYYY(); |
| | | |
| | | //养老认证本期期数 |
| | | //查询所有老人信息并加入到老人认证历史记录表中,如果不存在则新增,存在则不做操作 |
| | | List<ComElderAuthElderliesDO> authElderliesList = comElderAuthElderliesDAO.selectList(new QueryWrapper<>()); |
| | | authElderliesList.forEach(authElderlies -> { |
| | | //查询高龄认证记录 |
| | | ComEldersAuthHistoryRecordDO authHistoryRecordDO = comEldersAuthHistoryRecordMapper.selectOne(new QueryWrapper<ComEldersAuthHistoryRecordDO>().lambda() |
| | | .eq(ComEldersAuthHistoryRecordDO::getElderliesId,authElderlies.getId()) |
| | | .eq(ComEldersAuthHistoryRecordDO::getAuthPeriod,authPeriod)); |
| | | .eq(ComEldersAuthHistoryRecordDO::getAuthPeriod,elderAuthPeriod)); |
| | | if(authHistoryRecordDO == null){ |
| | | authHistoryRecordDO = new ComEldersAuthHistoryRecordDO(); |
| | | BeanUtils.copyProperties(authElderlies,authHistoryRecordDO); |
| | | authHistoryRecordDO.setIsAuth(ComEldersAuthHistoryRecordDO.isAuth.no); |
| | | authHistoryRecordDO.setElderliesId(authElderlies.getId()); |
| | | authHistoryRecordDO.setAuthPeriod(authPeriod); |
| | | authHistoryRecordDO.setAuthPeriod(elderAuthPeriod); |
| | | authHistoryRecordDO.setCreateAt(nowDate); |
| | | comEldersAuthHistoryRecordMapper.insert(authHistoryRecordDO); |
| | | } |
| | | |
| | | //查询养老认证记录 |
| | | ComPensionAuthHistoryRecordDO pensionAuthDO = comPensionAuthHistoryRecordMapper.selectOne(new QueryWrapper<ComPensionAuthHistoryRecordDO>().lambda() |
| | | .eq(ComPensionAuthHistoryRecordDO::getElderliesId,authElderlies.getId()) |
| | | .eq(ComPensionAuthHistoryRecordDO::getAuthPeriod,pensionAuthPeriod)); |
| | | if(pensionAuthDO == null){ |
| | | pensionAuthDO = new ComPensionAuthHistoryRecordDO(); |
| | | BeanUtils.copyProperties(authElderlies,pensionAuthDO); |
| | | pensionAuthDO.setIsAuth(ComPensionAuthHistoryRecordDO.isAuth.no); |
| | | pensionAuthDO.setElderliesId(authElderlies.getId()); |
| | | pensionAuthDO.setAuthPeriod(pensionAuthPeriod); |
| | | pensionAuthDO.setCreateAt(nowDate); |
| | | comPensionAuthHistoryRecordMapper.insert(pensionAuthDO); |
| | | } |
| | | }); |
| | | |
| | |
| | | }else{ |
| | | authHistoryRecordDO = new ComEldersAuthHistoryRecordDO(); |
| | | BeanUtils.copyProperties(authRecords,authHistoryRecordDO); |
| | | //查询老人信息 |
| | | ComElderAuthElderliesDO authElderliesDO = comElderAuthElderliesDAO.selectById(authRecords.getElderliesId()); |
| | | if(authElderliesDO != null){ |
| | | BeanUtils.copyProperties(authElderliesDO,authHistoryRecordDO); |
| | | } |
| | | authHistoryRecordDO.setIsAuth(ComEldersAuthHistoryRecordDO.isAuth.yes); |
| | | authHistoryRecordDO.setAuthId(authRecords.getId()); |
| | | comEldersAuthHistoryRecordMapper.insert(authHistoryRecordDO); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | //查询养老认证记录列表 |
| | | List<ComPensionAuthRecordDO> pensionAuthList = comPensionAuthRecordDAO.selectList(new QueryWrapper<ComPensionAuthRecordDO>().lambda() |
| | | .ge(ComPensionAuthRecordDO::getCreateAt,DateUtils.getFirstDayOfMonth())); |
| | | //遍历养老认证记录列表 |
| | | pensionAuthList.forEach(authRecords -> { |
| | | ComPensionAuthHistoryRecordDO pensionAuthDO = comPensionAuthHistoryRecordMapper.selectOne(new QueryWrapper<ComPensionAuthHistoryRecordDO>().lambda() |
| | | .eq(ComPensionAuthHistoryRecordDO::getElderliesId,authRecords.getPensionerId()) |
| | | .eq(ComPensionAuthHistoryRecordDO::getAuthPeriod,authRecords.getAuthPeriod())); |
| | | if(pensionAuthDO != null){//存在记录 |
| | | if(pensionAuthDO.getIsAuth().equals(ComPensionAuthHistoryRecordDO.isAuth.no)){ |
| | | pensionAuthDO.setIsAuth(ComPensionAuthHistoryRecordDO.isAuth.yes); |
| | | pensionAuthDO.setAuthDate(authRecords.getApprovalDate()); |
| | | pensionAuthDO.setApprovalDate(authRecords.getApprovalDate()); |
| | | pensionAuthDO.setApproverId(authRecords.getApproverId()); |
| | | pensionAuthDO.setSubmitUserId(authRecords.getSubmitUserId()); |
| | | pensionAuthDO.setAuthMethod(authRecords.getAuthMethod()); |
| | | pensionAuthDO.setVerificationResult(authRecords.getVerificationResult()); |
| | | pensionAuthDO.setAuthId(authRecords.getId()); |
| | | comPensionAuthHistoryRecordMapper.updateById(pensionAuthDO); |
| | | } |
| | | }else{ |
| | | pensionAuthDO = new ComPensionAuthHistoryRecordDO(); |
| | | BeanUtils.copyProperties(authRecords,pensionAuthDO); |
| | | //查询老人信息 |
| | | ComPensionAuthPensionerDO authPensionerDO = comPensionAuthPensionerDAO.selectById(authRecords.getPensionerId()); |
| | | if(authPensionerDO != null){ |
| | | BeanUtils.copyProperties(authPensionerDO,pensionAuthDO); |
| | | } |
| | | pensionAuthDO.setIsAuth(ComPensionAuthHistoryRecordDO.isAuth.yes); |
| | | pensionAuthDO.setAuthId(authRecords.getId()); |
| | | comPensionAuthHistoryRecordMapper.insert(pensionAuthDO); |
| | | } |
| | | }); |
| | | return R.ok(); |
| | | } |
| | | |