文件名从 src/main/java/com/ruoyi/project/tr/specialCheck/Test/TaskReportScheduleTest.java 修改 |
| | |
| | | package com.ruoyi.project.tr.specialCheck.Test; |
| | | package com.ruoyi.project.tr.specialCheck.scheduleLogTask; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | |
| | | import com.ruoyi.doublePrevention.entity.CJReport.CJdto.CJReportResultData; |
| | | import com.ruoyi.doublePrevention.entity.CJReport.CJdto.Data; |
| | | import com.ruoyi.doublePrevention.entity.CJReport.CJdto.ErrorMsgDetails; |
| | | import com.ruoyi.doublePrevention.entity.CJReport.CJdto.HandlerDO.*; |
| | | import com.ruoyi.doublePrevention.entity.CJReport.*; |
| | | import com.ruoyi.doublePrevention.entity.PreventReportConfig; |
| | | import com.ruoyi.doublePrevention.enums.CJReportEnum; |
| | | import com.ruoyi.doublePrevention.enums.SyncEnum; |
| | | import com.ruoyi.doublePrevention.repository.param.HandlerCJReportParam; |
| | | import com.ruoyi.doublePrevention.service.baseService.*; |
| | | import com.ruoyi.project.tr.report.service.ReportService; |
| | | import com.ruoyi.project.tr.riskList.service.IRiskListService; |
| | | import com.ruoyi.project.tr.specialCheck.domin.BO.HandlerSpecialCheckReportParam; |
| | | import com.ruoyi.project.tr.specialCheck.domin.DTO.SpecialCheckTaskLogReportDTO; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import java.util.*; |
| | | |
| | | @Component |
| | | public class TaskReportScheduleTest { |
| | | public class TaskReportSchedule { |
| | | |
| | | private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | |
| | | |
| | | @Transactional |
| | | // @Scheduled(cron = "0 0 23 * * ?") //每天晚上23点执行一次0 0 22,23 * * ? |
| | | // @Scheduled(cron = "0 0 22,23 * * ?") //每天晚上22、23点执行一次 |
| | | @Scheduled(cron = "35 12 12,23 * * ?") //每天晚上22、23点执行一次 |
| | | // @Scheduled(cron = "0 0/1 * * * ? ") // 分钟 |
| | | // @Scheduled(cron = "0 0/35 * * * ? ") // 分钟 |
| | | // @Scheduled(cron = "0/5 * * * * ?") |
| | | public void execReportDateSchedule() throws UnsupportedEncodingException { |
| | | logger.info("【####】上报数据开始..."); |
| | | logger.info("【####】TASKLOG上报数据开始..."); |
| | | |
| | | HttpURLConnection con = null; |
| | | BufferedReader buffer = null; |
| | |
| | | /** |
| | | * 1、任务上报 |
| | | * */ |
| | | System.out.println("【1】任务上报-处理数据..."); |
| | | logger.info("TASKLOG【1】任务上报-处理数据..."); |
| | | // List<TbSpecialCheckTaskLog> CJRiskAnaUnits = .listReportUnitDate(); |
| | | List<TbSpecialCheckTaskLog> taskLogLists = taskSpecialLogMapper.listTestReportTask(); |
| | | if (ObjectUtils.isNotEmpty(taskLogLists)){ |
| | |
| | | specialTaskLogReportDTO.setCheckDate(dateFormatCheckData.format(taskLog.getCheckDate())); |
| | | list.add(specialTaskLogReportDTO); |
| | | } |
| | | // logger.info("【【原始数据】】" + JSONObject.toJSONString(list)); |
| | | System.out.println("【【原始数据】】" + JSONObject.toJSONString(list)); |
| | | logger.info("TASKLOG【【原始数据】】" + JSONObject.toJSONString(list)); |
| | | //System.out.println("TASKLOG【【原始数据】】" + JSONObject.toJSONString(list)); |
| | | String AESReportUnitDate = encrypt(JSONObject.toJSONString(list), key.getBytes(), iv.getBytes()); |
| | | // logger.info("【【AES加密结果】】"+ AESReportUnitDate);{0JRK`$6X.jpg)min/Desktop/所有桌面文件存放/9}AM56M10$6WX){0JRK`$6X.jpg) |
| | | StringBuffer checkTaskResultBuffer = null; |
| | |
| | | OutputStream os = con.getOutputStream(); |
| | | Map paraMap = new HashMap(); |
| | | paraMap.put("data", AESReportUnitDate); /**封装数据*/ |
| | | System.out.println("【【加密请求体】】" + JSONArray.toJSON(paraMap).toString()); |
| | | logger.info("TASKLOG【【加密请求体】】" + JSONArray.toJSON(paraMap).toString()); |
| | | //组装入参,设置请求体 |
| | | os.write(JSON.toJSONString(paraMap).getBytes()); |
| | | |
| | |
| | | while ((line = buffer.readLine()) != null) { |
| | | checkTaskResultBuffer.append(line); |
| | | } |
| | | // logger.info("result:" + unitResultBuffer.toString()); |
| | | System.out.println("result:" + checkTaskResultBuffer.toString()); |
| | | logger.info("TASKLOG[]result:" + checkTaskResultBuffer.toString()); |
| | | // System.out.println("result:" + checkTaskResultBuffer.toString()); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | LocalDateTime nowDate = LocalDateTime.now(); |
| | | logger.info("【任务】数据上报结果:" + CJOverhaulLogResult.getCode()); |
| | | logger.info("TASKLOG【任务】数据上报结果:" + CJOverhaulLogResult.getCode()); |
| | | //设置所有数据上报成功 |
| | | if (CJOverhaulLogResult.getCode().equals(CJReportEnum.SUCCESS.getCode()) || CJOverhaulLogResult.getCode().equals(CJReportEnum.SUCESS_AND_FAIL.getCode())){ |
| | | for (TbSpecialCheckTaskLog taskLog : taskLogLists) { |
| | |
| | | |
| | | |
| | | // logger.info("【1】安全风险分析单元-数据处理完成"); |
| | | System.out.println("【任务】-数据处理完成"); |
| | | logger.info("TASKLOG【任务】-数据处理完成"); |
| | | }else { |
| | | // logger.info("【1】风险分析单元-无数据上报昌吉州"); |
| | | System.out.println("【任务】-无数据上报昌吉州"); |
| | | logger.info("TASKLOG【任务】-无数据上报昌吉州"); |
| | | } |
| | | |
| | | |