| | |
| | | private QrCodeDeliveryReplyService qrCodeDeliveryReplyService; |
| | | @Autowired |
| | | private SecurityDetectionService securityDetectionService; |
| | | @Autowired |
| | | private TCECPushUtil tcecPushUtil; |
| | | // @Autowired |
| | | // private TCECPushUtil tcecPushUtil; |
| | | |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | |
| | | pingService.save(ping); |
| | | //存储缓存中,5分钟有效 |
| | | redisTemplate.opsForValue().set("ping:" + ping.getCharging_pile_code() + ping.getCharging_gun_code(), ping, 5, TimeUnit.MINUTES); |
| | | ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | UpdateChargingPileStatusVo vo1 = new UpdateChargingPileStatusVo(); |
| | | vo1.setGun_code(pingMessage.getCharging_gun_code()); |
| | | vo1.setPile_code(pingMessage.getCharging_pile_code()); |
| | | vo1.setStatus(pingMessage.getCharging_gun_status()); |
| | | chargingPileClient.updateChargingPileStatus(vo1); |
| | | |
| | | try { |
| | | tcecPushUtil.pushSuperviseNotificationStationStatus(chargingGunClient.getChargingGunByFullNumber(pingMessage.getCharging_pile_code()+pingMessage.getCharging_gun_code()).getData()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.out.println("设备状态推送监管平台失败:"+e.getMessage()); |
| | | } |
| | | } |
| | | }); |
| | | UpdateChargingPileStatusVo vo1 = new UpdateChargingPileStatusVo(); |
| | | vo1.setGun_code(pingMessage.getCharging_gun_code()); |
| | | vo1.setPile_code(pingMessage.getCharging_pile_code()); |
| | | vo1.setStatus(pingMessage.getCharging_gun_status()); |
| | | chargingPileClient.updateChargingPileStatus(vo1); |
| | | |
| | | // ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | // threadPoolExecutor.execute(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // |
| | | // try { |
| | | //// tcecPushUtil.pushSuperviseNotificationStationStatus(chargingGunClient.getChargingGunByFullNumber(pingMessage.getCharging_pile_code()+pingMessage.getCharging_gun_code()).getData()); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // System.out.println("设备状态推送监管平台失败:"+e.getMessage()); |
| | | // } |
| | | // } |
| | | // }); |
| | | break; |
| | | case SendTagConstant.END_CHARGE: |
| | | EndChargeMessage endChargeMessage = message.getEndChargeMessage(); |
| | |
| | | EndCharge endCharge = new EndCharge(); |
| | | BeanUtils.copyProperties(endChargeMessage,endCharge); |
| | | endChargeService.create(endCharge); |
| | | ThreadPoolExecutor threadPoolExecutor1 = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor1.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // 业务处理 |
| | | chargingOrderClient.endCharge(endCharge.getTransaction_serial_number()); |
| | | try { |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderByCode(endCharge.getTransaction_serial_number()).getData(); |
| | | tcecPushUtil.pushSuperviseNotificationChargeOrderInfo(chargingOrder); |
| | | tcecPushUtil.pushSuperviseNotificationEquipChargeStatus(chargingOrder); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.out.println("充电结束推送监管平台失败:"+e.getMessage()); |
| | | } |
| | | } |
| | | }); |
| | | // 业务处理 |
| | | chargingOrderClient.endCharge(endCharge.getTransaction_serial_number()); |
| | | // ThreadPoolExecutor threadPoolExecutor1 = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | // threadPoolExecutor1.execute(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // try { |
| | | // TChargingOrder chargingOrder = chargingOrderClient.getOrderByCode(endCharge.getTransaction_serial_number()).getData(); |
| | | // tcecPushUtil.pushSuperviseNotificationChargeOrderInfo(chargingOrder); |
| | | // tcecPushUtil.pushSuperviseNotificationEquipChargeStatus(chargingOrder); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // System.out.println("充电结束推送监管平台失败:"+e.getMessage()); |
| | | // } |
| | | // } |
| | | // }); |
| | | break; |
| | | case SendTagConstant.ERROR_MESSAGE: |
| | | ErrorMessageMessage errorMessageMessage1 = message.getErrorMessageMessage(); |
| | |
| | | log.error("数据存储mongo失败"); |
| | | } |
| | | |
| | | ThreadPoolExecutor threadPoolExecutor2 = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor2.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // 业务处理 |
| | | UploadRealTimeMonitoringDataQuery query = new UploadRealTimeMonitoringDataQuery(); |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringData, query); |
| | | chargingOrderClient.chargeMonitoring(query); |
| | | chargingOrder.setEndSoc(uploadRealTimeMonitoringDataMessage.getSoc()+""); |
| | | |
| | | tcecPushUtil.pushSuperviseNotificationEquipChargeStatus(chargingOrder); |
| | | } |
| | | }); |
| | | // 业务处理 |
| | | UploadRealTimeMonitoringDataQuery query = new UploadRealTimeMonitoringDataQuery(); |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringData, query); |
| | | chargingOrderClient.chargeMonitoring(query); |
| | | // ThreadPoolExecutor threadPoolExecutor2 = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | // threadPoolExecutor2.execute(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // chargingOrder.setEndSoc(uploadRealTimeMonitoringDataMessage.getSoc()+""); |
| | | // |
| | | // tcecPushUtil.pushSuperviseNotificationEquipChargeStatus(chargingOrder); |
| | | // } |
| | | // }); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | MotorAbort motorAbort = new MotorAbort(); |
| | | BeanUtils.copyProperties(motorAbortMessage,motorAbort); |
| | | motorAbortService.create(motorAbort); |
| | | ThreadPoolExecutor threadPoolExecutor4 = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor4.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // 业务处理 |
| | | chargingOrderClient.excelEndCharge(motorAbort.getTransaction_serial_number()); |
| | | } |
| | | }); |
| | | // 业务处理 |
| | | chargingOrderClient.excelEndCharge(motorAbort.getTransaction_serial_number()); |
| | | break; |
| | | case SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION: |
| | | BmsDemandAndChargerExportationMessage bmsDemandAndChargerExportationMessage = message.getBmsDemandAndChargerExportationMessage(); |
| | |
| | | BmsDemandAndChargerExportation bmsDemandAndChargerExportation = new BmsDemandAndChargerExportation(); |
| | | BeanUtils.copyProperties(bmsDemandAndChargerExportationMessage,bmsDemandAndChargerExportation); |
| | | bmsDemandAndChargerExportationService.create(bmsDemandAndChargerExportation); |
| | | ThreadPoolExecutor threadPoolExecutor5 = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor5.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // 业务处理 |
| | | TChargingOrder chargingOrderBms = chargingOrderClient.getOrderByCode(bmsDemandAndChargerExportationMessage.getTransaction_serial_number()).getData(); |
| | | if(Objects.nonNull(chargingOrderBms)){ |
| | | chargingOrderBms.setNeedElec(bmsDemandAndChargerExportationMessage.getBms_current_requirements()); |
| | | chargingOrderClient.updateChargingOrder(chargingOrderBms); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 业务处理 |
| | | TChargingOrder chargingOrderBms = chargingOrderClient.getOrderByCode(bmsDemandAndChargerExportationMessage.getTransaction_serial_number()).getData(); |
| | | if(Objects.nonNull(chargingOrderBms)){ |
| | | chargingOrderBms.setNeedElec(bmsDemandAndChargerExportationMessage.getBms_current_requirements()); |
| | | chargingOrderClient.updateChargingOrder(chargingOrderBms); |
| | | } |
| | | break; |
| | | case SendTagConstant.BMS_INFORMATION: |
| | | BmsInformationMessage bmsInformationMessage = message.getBmsInformationMessage(); |
| | |
| | | PlatformStartChargingReply platformStartChargingReply = new PlatformStartChargingReply(); |
| | | BeanUtils.copyProperties(platformStartChargingReplyMessage,platformStartChargingReply); |
| | | platformStartChargingReplyService.create(platformStartChargingReply); |
| | | ThreadPoolExecutor threadPoolExecutor6 = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor6.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // 业务处理 |
| | | PlatformStartChargingReplyMessageVO message1 = new PlatformStartChargingReplyMessageVO(); |
| | | BeanUtils.copyProperties(platformStartChargingReplyMessage, message1); |
| | | chargingOrderClient.startChargeSuccessfully(message1); |
| | | } |
| | | }); |
| | | |
| | | // 业务处理 |
| | | PlatformStartChargingReplyMessageVO message1 = new PlatformStartChargingReplyMessageVO(); |
| | | BeanUtils.copyProperties(platformStartChargingReplyMessage, message1); |
| | | chargingOrderClient.startChargeSuccessfully(message1); |
| | | break; |
| | | case SendTagConstant.PLATFORM_STOP_CHARGING_REPLY: |
| | | PlatformStopChargingReplyMessage platformStopChargingReplyMessage = message.getPlatformStopChargingReplyMessage(); |
| | |
| | | PlatformStopChargingReply platformStopChargingReply = new PlatformStopChargingReply(); |
| | | BeanUtils.copyProperties(platformStopChargingReplyMessage,platformStopChargingReply); |
| | | platformStopChargingReplyService.create(platformStopChargingReply); |
| | | ThreadPoolExecutor threadPoolExecutor7 = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor7.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | PlatformStopChargingReplyVO platformStopChargingReply1 = new PlatformStopChargingReplyVO(); |
| | | BeanUtils.copyProperties(platformStopChargingReply, platformStopChargingReply1); |
| | | chargingOrderClient.terminateSuccessfulResponse(platformStopChargingReply1); |
| | | } |
| | | }); |
| | | |
| | | PlatformStopChargingReplyVO platformStopChargingReply1 = new PlatformStopChargingReplyVO(); |
| | | BeanUtils.copyProperties(platformStopChargingReply, platformStopChargingReply1); |
| | | chargingOrderClient.terminateSuccessfulResponse(platformStopChargingReply1); |
| | | break; |
| | | case SendTagConstant.TRANSACTION_RECORD: |
| | | TransactionRecordMessage transactionRecordMessage = message.getTransactionRecordMessage(); |
| | |
| | | TransactionRecord transactionRecord = new TransactionRecord(); |
| | | BeanUtils.copyProperties(transactionRecordMessage,transactionRecord); |
| | | transactionRecordService.create(transactionRecord); |
| | | ThreadPoolExecutor threadPoolExecutor8 = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor8.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // 业务处理 |
| | | TChargingOrder chargingOrderRecord = chargingOrderClient.getOrderByCode(transactionRecordMessage.getTransaction_serial_number()).getData(); |
| | | if(Objects.nonNull(chargingOrderRecord)){ |
| | | chargingOrderRecord.setTotalElectricity(transactionRecordMessage.getTotal_electricity()); |
| | | chargingOrderClient.updateChargingOrder(chargingOrderRecord); |
| | | } |
| | | //计算费用 |
| | | TransactionRecordMessageVO vo = new TransactionRecordMessageVO(); |
| | | BeanUtils.copyProperties(transactionRecordMessage,vo); |
| | | int code = chargingOrderClient.endChargeBillingCharge(vo).getCode(); |
| | | if(200 != code){ |
| | | //失败后添加到队列中继续处理数据 |
| | | redisTemplate.opsForSet().add(SendTagConstant.TRANSACTION_RECORD, transactionRecordMessage.getTransaction_serial_number()); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 业务处理 |
| | | TChargingOrder chargingOrderRecord = chargingOrderClient.getOrderByCode(transactionRecordMessage.getTransaction_serial_number()).getData(); |
| | | if(Objects.nonNull(chargingOrderRecord)){ |
| | | chargingOrderRecord.setTotalElectricity(transactionRecordMessage.getTotal_electricity()); |
| | | chargingOrderClient.updateChargingOrder(chargingOrderRecord); |
| | | } |
| | | //计算费用 |
| | | TransactionRecordMessageVO vo = new TransactionRecordMessageVO(); |
| | | BeanUtils.copyProperties(transactionRecordMessage,vo); |
| | | int code = chargingOrderClient.endChargeBillingCharge(vo).getCode(); |
| | | if(200 != code){ |
| | | //失败后添加到队列中继续处理数据 |
| | | redisTemplate.opsForSet().add(SendTagConstant.TRANSACTION_RECORD, transactionRecordMessage.getTransaction_serial_number()); |
| | | } |
| | | |
| | | |
| | | // 添加实时上传记录结束记录 |
| | |
| | | SecurityDetection securityDetection = new SecurityDetection(); |
| | | BeanUtils.copyProperties(securityDetectionMessage,securityDetection); |
| | | securityDetectionService.create(securityDetection); |
| | | ThreadPoolExecutor threadPoolExecutor9 = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor9.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | SecurityDetectionVO securityDetection1 = new SecurityDetectionVO(); |
| | | BeanUtils.copyProperties(securityDetection, securityDetection1); |
| | | chargingOrderClient.securityDetection(securityDetection1); |
| | | } |
| | | }); |
| | | |
| | | SecurityDetectionVO securityDetection1 = new SecurityDetectionVO(); |
| | | BeanUtils.copyProperties(securityDetection, securityDetection1); |
| | | chargingOrderClient.securityDetection(securityDetection1); |
| | | break; |
| | | default: |
| | | PlatformRemoteUpdateReplyMessage platformRemoteUpdateReplyMessage = message.getPlatformRemoteUpdateReplyMessage(); |