| | |
| | | /** |
| | | * 每天的9点执行的任务 |
| | | */ |
| | | @Scheduled(cron = "0 0 9 * * *") |
| | | @Scheduled(cron = "0 0 12 * * *") |
| | | // @Scheduled(fixedRate = 60000) |
| | | public void taskDay(){ |
| | | try { |
| | |
| | | Date endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end); |
| | | // 查询所有的mango数据 |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringDataList = uploadRealTimeMonitoringDataService.getRangeTimeData(startTime, endTime); |
| | | System.out.println("查询所有的mango数据:"+uploadRealTimeMonitoringDataList.size()); |
| | | customthreadPoolExecutor.execute(() -> { |
| | | if (uploadRealTimeMonitoringDataList != null && uploadRealTimeMonitoringDataList.size() > 0) { |
| | | for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : uploadRealTimeMonitoringDataList) { |
| | | log.info("线程:{},办理业务", Thread.currentThread().getName()); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("device_code", uploadRealTimeMonitoringData.getCharging_pile_code()); |
| | | jsonObject.put("report_time", System.currentTimeMillis()); |
| | | jsonObject.put("properties", uploadRealTimeMonitoringData); |
| | | mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", uploadRealTimeMonitoringData.getCharging_pile_code()), jsonObject.toJSONString()); |
| | | log.info("数据:{}", uploadRealTimeMonitoringData.getCharging_pile_code()); |
| | | } |
| | | } |
| | | }); |