| | |
| | | */ |
| | | @Transactional |
| | | public void pushEvaluation(String startTime, String endTime) { |
| | | // 获取出租车需要推送的数据 |
| | | String taxiNumber = "taxi_"+startTime+"_"+endTime; |
| | | log.info("上报数据到考评系统-开始,上报数据条件为 : {}", taxiNumber); |
| | | |
| | | // 1.获取出租车需要推送的数据 |
| | | List<PushEvaluationLog> existTaxiLogList = this.baseMapper.queryBySerialNumber(taxiNumber); |
| | | if(CollectionUtils.isEmpty(existTaxiLogList)) { |
| | | List<Map<String, Object>> mapList = this.baseMapper.getTaxiOrderList(startTime, endTime); |
| | | List<PushEvaluationRequestDTO> taxiRequestList = PushEvaluationRequestDTO.convert(mapList); |
| | | if(CollectionUtils.isNotEmpty(taxiRequestList)) { |
| | | PushEvaluationLog evaluationLog = requestEvaluation(JSON.toJSONString(taxiRequestList)); |
| | | evaluationLog.setSerialNumber("taxi_"+startTime+"_"+endTime); |
| | | evaluationLog.setSerialNumber(taxiNumber); |
| | | // 记录日志 |
| | | this.insert(evaluationLog); |
| | | log.info("上报数据到考评系统-上报成功-上报数据流水号:{}, 上报数成功数条数:{}", taxiNumber, taxiRequestList.size()); |
| | | } |
| | | // 获取专车需要推送的数据 |
| | | } else { |
| | | log.info("上报数据到考评系统-校验结果为重复上报-该时间段的出租车订单数据已经上报无需重复上报,上报数据条件为 : {}", taxiNumber); |
| | | } |
| | | |
| | | // 2.获取专车需要推送的数据 |
| | | String privateCarNumber = "privateCar_"+startTime+"_"+endTime; |
| | | List<PushEvaluationLog> existPrivateCarLogList = this.baseMapper.queryBySerialNumber(privateCarNumber); |
| | | if(CollectionUtils.isEmpty(existPrivateCarLogList)) { |
| | | List<Map<String, Object>> mapPrivateList = this.baseMapper.getPrivateCarOrderList(startTime, endTime); |
| | | List<PushEvaluationRequestDTO> privateRequestList = PushEvaluationRequestDTO.convert(mapPrivateList); |
| | | if(CollectionUtils.isNotEmpty(privateRequestList)) { |
| | | PushEvaluationLog evaluationLog = requestEvaluation(JSON.toJSONString(privateRequestList)); |
| | | evaluationLog.setSerialNumber("privateCar_"+startTime+"_"+endTime); |
| | | evaluationLog.setSerialNumber(privateCarNumber); |
| | | // 记录日志 |
| | | this.insert(evaluationLog); |
| | | log.info("上报数据到考评系统-上报成功-上报数据流水号:{}, 上报数成功数条数:{}", privateCarNumber, privateRequestList.size()); |
| | | } |
| | | |
| | | |
| | | } else { |
| | | log.info("上报数据到考评系统-校验结果为重复上报-该时间段的专车订单数据已经上报无需重复上报,上报数据条件为 : {}", taxiNumber); |
| | | } |
| | | log.info("上报数据到考评系统-结束,上报数据条件为 : {}", taxiNumber); |
| | | } |
| | | |
| | | public PushEvaluationLog requestEvaluation(String requestData) { |
| | |
| | | try { |
| | | // 发送请求 |
| | | HttpEntity<String> entity = new HttpEntity<>(requestData, headers); |
| | | log.info("上报数据到考评系统-请求地址为:{},请求参数为 : {}", url, JSON.toJSONString(entity)); |
| | | log.debug("上报数据到考评系统-请求地址为:{},请求参数为 : {}", url, JSON.toJSONString(entity)); |
| | | ResponseEntity<PushEvaluationResponseDTO> responseEntity = restTemplate.exchange(url, HttpMethod.POST, entity, PushEvaluationResponseDTO.class); |
| | | // 返回数据 |
| | | response = responseEntity.getBody(); |