| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.service_community.dao.*; |
| | | import com.panzhihua.service_community.model.dos.*; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | 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.ComElderAuthElderliesDAO; |
| | | import com.panzhihua.service_community.dao.ComElderAuthRecordsDAO; |
| | | import com.panzhihua.service_community.dao.ComEldersAuthStatisticsMapper; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationDAO; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.model.dos.ComElderAuthElderliesDO; |
| | | import com.panzhihua.service_community.model.dos.ComElderAuthRecordsDO; |
| | | import com.panzhihua.service_community.model.dos.ComEldersAuthStatisticsDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationDO; |
| | | import com.panzhihua.service_community.service.ComElderAuthRecordsService; |
| | | |
| | | import cn.hutool.core.util.IdcardUtil; |
| | |
| | | private ComActActSignDAO comActActSignDAO; |
| | | @Value("${domain.aesKey:}") |
| | | private String aesKey; |
| | | @Resource |
| | | private ComEldersAuthHistoryRecordMapper comEldersAuthHistoryRecordMapper; |
| | | @Resource |
| | | private ComPensionAuthHistoryRecordMapper comPensionAuthHistoryRecordMapper; |
| | | @Resource |
| | | private ComPensionAuthRecordDAO comPensionAuthRecordDAO; |
| | | @Resource |
| | | private ComPensionAuthPensionerDAO comPensionAuthPensionerDAO; |
| | | |
| | | @Override |
| | | public R pageElderAuthRecords(PageElderAuthRecordsDTO pageElderAuthRecordsDTO) { |
| | |
| | | return R.ok(comElderAuthRecordStatisticExcleVOS); |
| | | } |
| | | |
| | | /** |
| | | * 身份认证定时任务 |
| | | * @return 执行结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R timedTaskElderAuthStatisticsJobHandler() { |
| | | Date nowDate = new Date(); |
| | | int month = DateUtils.getMonth(nowDate) + 1; |
| | | int year = DateUtils.getYear(nowDate); |
| | | //查询所有启用中社区 |
| | | List<ComActDO> actList = comActDAO.selectList(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getState,0)); |
| | | actList.forEach(act -> { |
| | | //高龄认证统计本期应认证人数 |
| | | ComEldersAuthStatisticsDO comEldersAuthStatisticsDO = new ComEldersAuthStatisticsDO(); |
| | | comEldersAuthStatisticsDO.setCommunityId(act.getCommunityId()); |
| | | comEldersAuthStatisticsDO.setMonth(month); |
| | | comEldersAuthStatisticsDO.setYear(year); |
| | | comEldersAuthStatisticsDO.setCreateAt(nowDate); |
| | | List<ComElderAuthElderliesDO> comElderAuthElderliesDOS = comElderAuthElderliesDAO.selectList(new QueryWrapper<ComElderAuthElderliesDO>().lambda() |
| | | .eq(ComElderAuthElderliesDO::getCommunityId, act.getCommunityId()) |
| | | .eq(ComElderAuthElderliesDO::getIsAlive, 1) |
| | | .eq(ComElderAuthElderliesDO::getIsRegister, 1)); |
| | | if (null != comElderAuthElderliesDOS) { |
| | | comEldersAuthStatisticsDO.setSum(comElderAuthElderliesDOS.size()); |
| | | //查询高龄认证记录列表 |
| | | List<ComElderAuthRecordsDO> authRecordsList = comElderAuthRecordsDAO.selectList(new QueryWrapper<ComElderAuthRecordsDO>().lambda() |
| | | .eq(ComElderAuthRecordsDO::getAuthStatus,ComElderAuthRecordsDO.authStatus.yrz)); |
| | | //遍历高龄认证记录列表 |
| | | authRecordsList.forEach(authRecords -> { |
| | | if(authRecords.getApprovalStatus().equals(ComElderAuthRecordsDO.approvalStatus.tg)){ |
| | | ComEldersAuthHistoryRecordDO authHistoryRecordDO = comEldersAuthHistoryRecordMapper.selectOne(new QueryWrapper<ComEldersAuthHistoryRecordDO>().lambda() |
| | | .eq(ComEldersAuthHistoryRecordDO::getElderliesId,authRecords.getElderliesId()) |
| | | .eq(ComEldersAuthHistoryRecordDO::getAuthPeriod,authRecords.getAuthPeriod())); |
| | | if(authHistoryRecordDO != null){//存在记录 |
| | | if(authHistoryRecordDO.getIsAuth().equals(ComEldersAuthHistoryRecordDO.isAuth.no)){ |
| | | //查询老人信息 |
| | | ComElderAuthElderliesDO authElderliesDO = comElderAuthElderliesDAO.selectById(authRecords.getElderliesId()); |
| | | if(authElderliesDO != null){ |
| | | Long authId = authHistoryRecordDO.getId(); |
| | | BeanUtils.copyProperties(authElderliesDO,authHistoryRecordDO); |
| | | authHistoryRecordDO.setId(authId); |
| | | authHistoryRecordDO.setBrithday(DateUtils.format(IdcardUtil.getBirthDate(authElderliesDO.getIdCard()),DateUtils.yyyyMMdd_format)); |
| | | authHistoryRecordDO.setAge(IdcardUtil.getAgeByIdCard(authElderliesDO.getIdCard())); |
| | | } |
| | | authHistoryRecordDO.setIsAuth(ComEldersAuthHistoryRecordDO.isAuth.yes); |
| | | authHistoryRecordDO.setAuthDate(authRecords.getApprovalDate()); |
| | | authHistoryRecordDO.setApprovalDate(authRecords.getApprovalDate()); |
| | | authHistoryRecordDO.setApproverId(authRecords.getApproverId()); |
| | | authHistoryRecordDO.setSubmitUserId(authRecords.getSubmitUserId()); |
| | | authHistoryRecordDO.setAuthMethod(authRecords.getAuthMethod()); |
| | | authHistoryRecordDO.setVerificationResult(authRecords.getVerificationResult()); |
| | | authHistoryRecordDO.setAuthId(authRecords.getId()); |
| | | |
| | | comEldersAuthHistoryRecordMapper.updateById(authHistoryRecordDO); |
| | | } |
| | | }else{ |
| | | authHistoryRecordDO = new ComEldersAuthHistoryRecordDO(); |
| | | //查询老人信息 |
| | | ComElderAuthElderliesDO authElderliesDO = comElderAuthElderliesDAO.selectById(authRecords.getElderliesId()); |
| | | if(authElderliesDO != null){ |
| | | BeanUtils.copyProperties(authElderliesDO,authHistoryRecordDO); |
| | | authHistoryRecordDO.setBrithday(DateUtils.format(IdcardUtil.getBirthDate(authElderliesDO.getIdCard()),DateUtils.yyyyMMdd_format)); |
| | | authHistoryRecordDO.setAge(IdcardUtil.getAgeByIdCard(authElderliesDO.getIdCard())); |
| | | } |
| | | BeanUtils.copyProperties(authRecords,authHistoryRecordDO); |
| | | authHistoryRecordDO.setAuthDate(authRecords.getApprovalDate()); |
| | | authHistoryRecordDO.setMark(null); |
| | | authHistoryRecordDO.setIsAuth(ComEldersAuthHistoryRecordDO.isAuth.yes); |
| | | authHistoryRecordDO.setAuthId(authRecords.getId()); |
| | | comEldersAuthHistoryRecordMapper.insert(authHistoryRecordDO); |
| | | } |
| | | } |
| | | comEldersAuthStatisticsMapper.insert(comEldersAuthStatisticsDO); |
| | | //上期已认证人数 |
| | | String authPeriod = ""; |
| | | if (month < 10) { |
| | | authPeriod = String.valueOf(year) + 0 + month; |
| | | } else { |
| | | authPeriod = String.valueOf(year) + month; |
| | | }); |
| | | |
| | | //查询养老认证记录列表 |
| | | List<ComPensionAuthRecordDO> pensionAuthList = comPensionAuthRecordDAO.selectList(new QueryWrapper<ComPensionAuthRecordDO>().lambda() |
| | | .eq(ComPensionAuthRecordDO::getAuthStatus,ComPensionAuthRecordDO.authStatus.rez)); |
| | | //遍历养老认证记录列表 |
| | | 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)){ |
| | | //查询老人信息 |
| | | ComPensionAuthPensionerDO authPensionerDO = comPensionAuthPensionerDAO.selectById(authRecords.getPensionerId()); |
| | | if(authPensionerDO != null){ |
| | | Long authId = pensionAuthDO.getId(); |
| | | BeanUtils.copyProperties(authPensionerDO,pensionAuthDO); |
| | | pensionAuthDO.setId(authId); |
| | | pensionAuthDO.setBrithday(DateUtils.format(IdcardUtil.getBirthDate(authPensionerDO.getIdCard()),DateUtils.yyyyMMdd_format)); |
| | | pensionAuthDO.setAge(IdcardUtil.getAgeByIdCard(authPensionerDO.getIdCard())); |
| | | } |
| | | 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(); |
| | | //查询老人信息 |
| | | ComPensionAuthPensionerDO authPensionerDO = comPensionAuthPensionerDAO.selectById(authRecords.getPensionerId()); |
| | | if(authPensionerDO != null){ |
| | | BeanUtils.copyProperties(authPensionerDO,pensionAuthDO); |
| | | pensionAuthDO.setBrithday(DateUtils.format(IdcardUtil.getBirthDate(authPensionerDO.getIdCard()),DateUtils.yyyyMMdd_format)); |
| | | pensionAuthDO.setAge(IdcardUtil.getAgeByIdCard(authPensionerDO.getIdCard())); |
| | | } |
| | | BeanUtils.copyProperties(authRecords,pensionAuthDO); |
| | | pensionAuthDO.setAuthDate(authRecords.getApprovalDate()); |
| | | pensionAuthDO.setMark(null); |
| | | pensionAuthDO.setIsAuth(ComPensionAuthHistoryRecordDO.isAuth.yes); |
| | | pensionAuthDO.setAuthId(authRecords.getId()); |
| | | comPensionAuthHistoryRecordMapper.insert(pensionAuthDO); |
| | | } |
| | | int authSum = comElderAuthElderliesDAO.haveElderAuthElderliesAmount(act.getCommunityId(), authPeriod); |
| | | ComEldersAuthStatisticsDO comEldersAuthStatisticsDO1 = comEldersAuthStatisticsMapper.selectOne(new QueryWrapper<ComEldersAuthStatisticsDO>() |
| | | .lambda().eq(ComEldersAuthStatisticsDO::getCommunityId, act.getCommunityId()).eq(ComEldersAuthStatisticsDO::getYear, year) |
| | | .eq(ComEldersAuthStatisticsDO::getMonth, month - 1)); |
| | | comEldersAuthStatisticsDO1.setAuthSum(authSum); |
| | | comEldersAuthStatisticsDO1.setNoAuthSum(comEldersAuthStatisticsDO1.getSum() - comEldersAuthStatisticsDO1.getAuthSum()); |
| | | comEldersAuthStatisticsMapper.updateById(comEldersAuthStatisticsDO1); |
| | | }); |
| | | return R.ok(); |
| | | } |