| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.common.model.vos.elders.ComEldersAuthHistoryVO; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private ComEldersAuthHistoryRecordMapper comEldersAuthHistoryRecordMapper; |
| | | @Resource |
| | | private ComEldersAuthStatisticsMapper comEldersAuthStatisticsMapper; |
| | | @Resource |
| | | private ComActDAO comActDAO; |
| | | |
| | | @Value("${domain.aesKey:}") |
| | | private String aesKey; |
| | |
| | | public R communityAuthType(EldersAuthTypeQueryDTO eldersAuthTypeQueryDTO) { |
| | | Long communityId = eldersAuthTypeQueryDTO.getCommunityId(); |
| | | List<SysConfDO> confDOList = sysConfDao.selectList(new LambdaQueryWrapper<SysConfDO>() |
| | | .eq(SysConfDO::getCommunityId, communityId).orderByDesc(SysConfDO::getCreateAt)); |
| | | .eq(SysConfDO::getCommunityId, communityId).eq(SysConfDO::getCode,"ELDER_AUTH_TYPE").orderByDesc(SysConfDO::getCreateAt)); |
| | | if (confDOList == null || confDOList.size() == 0) { |
| | | SysConfDO sysConfDO = new SysConfDO(); |
| | | sysConfDO.setCode("ELDER_AUTH_TYPE"); |
| | |
| | | pageEldersAuthElderlyDTO)); |
| | | } |
| | | |
| | | @Override |
| | | public R getAuthHistoryExport(PageEldersAuthHistoryDTO pageEldersAuthElderlyDTO) { |
| | | Date startTime = |
| | | DateUtils.getYearMonthStart(pageEldersAuthElderlyDTO.getYear(), pageEldersAuthElderlyDTO.getMonth()); |
| | |
| | | }); |
| | | return R.ok(authHistoryExcelVOS); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R timedTaskEldersAuthJobHandler(){ |
| | | |
| | | Date nowDate = new Date(); |
| | | //查询所有启用中社区 |
| | | List<ComActDO> actList = comActDAO.selectList(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getState,0)); |
| | | |
| | | actList.forEach(act -> { |
| | | //查询社区老人认证统计信息,并存储到数据库中 |
| | | Map<String,Object> resultMap = this.baseMapper.getEldersAuthStatistics(act.getCommunityId()); |
| | | if(resultMap != null){ |
| | | ComEldersAuthStatisticsDO authStatisticsDO = new ComEldersAuthStatisticsDO(); |
| | | authStatisticsDO.setCommunityId(act.getCommunityId()); |
| | | authStatisticsDO.setMonth(DateUtils.getMonth(nowDate) + 1); |
| | | authStatisticsDO.setYear(DateUtils.getYear(nowDate)); |
| | | authStatisticsDO.setCreateAt(nowDate); |
| | | authStatisticsDO.setSum(Integer.parseInt(resultMap.get("oldCount").toString())); |
| | | authStatisticsDO.setNoAuthSum(Integer.parseInt(resultMap.get("noCount").toString())); |
| | | authStatisticsDO.setAuthSum(Integer.parseInt(resultMap.get("yesCount").toString())); |
| | | comEldersAuthStatisticsMapper.insert(authStatisticsDO); |
| | | } |
| | | }); |
| | | //重置所有人的认证状态 |
| | | comEldersAuthUserMapper.updateAuthStatus(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 检测上月所有视频认证记录,取最后一条记录为认证成功记录 |
| | | * @return 执行结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R timedTaskEldersRecordAuthJobHandler(){ |
| | | Date nowDate = new Date(); |
| | | //查询所有启用中社区 |
| | | List<ComActDO> actList = comActDAO.selectList(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getState,0)); |
| | | |
| | | actList.forEach(act -> { |
| | | //查询社区上月所有视频认证 |
| | | List<ComEldersAuthHistoryVO> authList = eldersAuthDAO.getEldersAuthRecords(act.getCommunityId()); |
| | | authList.forEach(auth -> { |
| | | if(auth.getUserId() != null){ |
| | | ComEldersAuthHistoryRecordDO authHistoryRecordDO = new ComEldersAuthHistoryRecordDO(); |
| | | authHistoryRecordDO.setCommunityId(auth.getCommunityId()); |
| | | authHistoryRecordDO.setCreateAt(auth.getCreateAt()); |
| | | authHistoryRecordDO.setAuthId(auth.getId()); |
| | | authHistoryRecordDO.setUserId(auth.getUserId()); |
| | | authHistoryRecordDO.setBrithday(auth.getBirthday()); |
| | | authHistoryRecordDO.setDomicile(auth.getDomicile()); |
| | | authHistoryRecordDO.setIdCard(auth.getIdCard()); |
| | | authHistoryRecordDO.setName(auth.getName()); |
| | | authHistoryRecordDO.setIsAuth(1); |
| | | try { |
| | | Integer age = IdcardUtil.getAgeByIdCard(auth.getIdCard()); |
| | | authHistoryRecordDO.setAge(age); |
| | | }catch (Exception e){ |
| | | log.error("年龄转换失败"); |
| | | } |
| | | comEldersAuthHistoryRecordMapper.insert(authHistoryRecordDO); |
| | | } |
| | | }); |
| | | }); |
| | | return R.ok(); |
| | | } |
| | | } |