| | |
| | | import enumeration.general.WorkOrderStatusEnum; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.dao.DataAccessException; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | |
| | | * 海康取人脸车辆 |
| | | */ |
| | | public void randomDeductPic() { |
| | | try { |
| | | log.info("开始抽查图片完整状态"); |
| | | //这个月随机抽取一天 |
| | | Date date = getRandomDate(); |
| | | // Date date = getRandomDate(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.MONTH, -1); // 上个月 |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); // 设置为1号 |
| | | |
| | | int lastDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); |
| | | Random random = new Random(); |
| | | int randomDay = random.nextInt(lastDay) + 1; |
| | | |
| | | calendar.set(Calendar.DAY_OF_MONTH, randomDay); |
| | | Date date = calendar.getTime(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | //准备批量打分的集合 |
| | | List<ContractScore> contractScoreList = new ArrayList<>(); |
| | | //查询报备列表 |
| | | //查询报备列表 通过审核并且创建时间在当前日期的报备id列表 |
| | | List<String> reportNumbers = reportMapper.selectNumberList(AuditStatus_Pass, DateUtils.getDate()); |
| | | //查图片完整性规则 获取key为合同id,value为规则的map |
| | | Map<Integer, List<CalculateRuleVO>> contractMap = contractMapper.getCalculateRule(new Date()).stream() |
| | |
| | | } |
| | | contractScoreService.saveBatch(contractScoreList); |
| | | log.info("结束抽查图片完整状态"); |
| | | }catch (NullPointerException e) { |
| | | log.error("空指针异常,抽查图片完整状态失败: {}", e.getMessage(), e); |
| | | } catch (DataAccessException e) { |
| | | log.error("数据库访问异常,抽查图片完整状态失败: {}", e.getMessage(), e); |
| | | } catch (IllegalArgumentException e) { |
| | | log.error("参数不合法异常,抽查图片完整状态失败: {}", e.getMessage(), e); |
| | | } catch (Exception e) { |
| | | log.error("未知异常,抽查图片完整状态失败: ", e); // 注意这里使用逗号而不是+,可以打印完整堆栈 |
| | | // 如果需要可以抛出运行时异常 |
| | | throw new RuntimeException("抽查图片完整状态失败", e); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | * 优云取录像 |
| | | */ |
| | | public void randomDeductVideo() { |
| | | try{ |
| | | log.info("开始抽查录像完整状态"); |
| | | //这个月随机抽取一天 |
| | | Date date = getRandomDate(); |
| | |
| | | }); |
| | | } |
| | | contractScoreService.saveBatch(contractScoreList); |
| | | }catch (NullPointerException e) { |
| | | log.error("空指针异常,抽查图片完整状态失败: {}", e.getMessage(), e); |
| | | } catch (DataAccessException e) { |
| | | log.error("数据库访问异常,抽查图片完整状态失败: {}", e.getMessage(), e); |
| | | } catch (IllegalArgumentException e) { |
| | | log.error("参数不合法异常,抽查图片完整状态失败: {}", e.getMessage(), e); |
| | | } catch (Exception e) { |
| | | log.error("未知异常,抽查图片完整状态失败: ", e); // 注意这里使用逗号而不是+,可以打印完整堆栈 |
| | | // 如果需要可以抛出运行时异常 |
| | | throw new RuntimeException("抽查图片完整状态失败", e); |
| | | } |
| | | } |
| | | |
| | | private Date getRandomDate() { |