文件名从 src/main/java/com/ruoyi/project/tr/specialCheck/Test/ItemDangerReportScheduleTest.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.ErrorMsgDetails; |
| | | import com.ruoyi.doublePrevention.enums.CJReportEnum; |
| | | import com.ruoyi.doublePrevention.enums.SyncEnum; |
| | | 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.SpecialCheckItemDangerLogReportDTO; |
| | | import com.ruoyi.project.tr.specialCheck.domin.DTO.SpecialCheckTaskLogReportDTO; |
| | | import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckItemDangerLog; |
| | | import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckScoreAndDangerLog; |
| | | import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckTaskLog; |
| | | import com.ruoyi.project.tr.specialCheck.mapper.*; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.bouncycastle.crypto.engines.AESFastEngine; |
| | |
| | | import java.util.*; |
| | | |
| | | @Component |
| | | public class ItemDangerReportScheduleTest { |
| | | public class ItemDangerReportSchedule { |
| | | |
| | | 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 = "15 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("scoreAndDangerLog【####】上报数据开始..."); |
| | | |
| | | HttpURLConnection con = null; |
| | | BufferedReader buffer = null; |
| | |
| | | SimpleDateFormat tokenDate= new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String formatDate = tokenDate.format(date); |
| | | |
| | | logger.info("【token时间】" + formatDate); |
| | | logger.info("scoreAndDangerLog【token时间】" + formatDate); |
| | | |
| | | /** |
| | | * 1、检查项与隐患上报 |
| | | * */ |
| | | System.out.println("【2】检查项与隐患上报-处理数据..."); |
| | | logger.info("scoreAndDangerLog【2】检查项与隐患上报-处理数据..."); |
| | | // List<TbSpecialCheckTaskLog> CJRiskAnaUnits = .listReportUnitDate(); |
| | | List<TbSpecialCheckScoreAndDangerLog> scoreAndDangerLogs = scoreAndDangerLogMapper.listScoreAndDangerLogReportList(); |
| | | if (ObjectUtils.isNotEmpty(scoreAndDangerLogs)){ |
| | |
| | | list.add(specialCheckItemDangerLogReportDTO); |
| | | } |
| | | // logger.info("【【原始数据】】" + JSONObject.toJSONString(list)); |
| | | System.out.println("【【原始数据】】" + JSONObject.toJSONString(list)); |
| | | logger.info("scoreAndDangerLog【【原始数据】】" + 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 itemDangerResultBuffer = null; |
| | |
| | | OutputStream os = con.getOutputStream(); |
| | | Map paraMap = new HashMap(); |
| | | paraMap.put("data", AESReportUnitDate); /**封装数据*/ |
| | | System.out.println("【【加密请求体】】" + JSONArray.toJSON(paraMap).toString()); |
| | | logger.info("scoreAndDangerLog【【加密请求体】】" + JSONArray.toJSON(paraMap).toString()); |
| | | //组装入参,设置请求体 |
| | | os.write(JSON.toJSONString(paraMap).getBytes()); |
| | | |
| | |
| | | itemDangerResultBuffer.append(line); |
| | | } |
| | | // logger.info("result:" + unitResultBuffer.toString()); |
| | | System.out.println("result:" + itemDangerResultBuffer.toString()); |
| | | logger.info("scoreAndDangerLog【result】:" + itemDangerResultBuffer.toString()); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | LocalDateTime nowDate = LocalDateTime.now(); |
| | | logger.info("【检查项与隐患】数据上报结果:" + CJOverhaulLogResult.getCode()); |
| | | logger.info("scoreAndDangerLog【检查项与隐患】数据上报结果:" + CJOverhaulLogResult.getCode()); |
| | | //设置所有数据上报成功 |
| | | if (CJOverhaulLogResult.getCode().equals(CJReportEnum.SUCCESS.getCode()) || CJOverhaulLogResult.getCode().equals(CJReportEnum.SUCESS_AND_FAIL.getCode())){ |
| | | for (TbSpecialCheckScoreAndDangerLog itemDangerLo : scoreAndDangerLogs) { |
| | |
| | | |
| | | |
| | | // logger.info("【1】安全风险分析单元-数据处理完成"); |
| | | System.out.println("【检查项与隐患】-数据处理完成"); |
| | | logger.info("scoreAndDangerLog【检查项与隐患】-数据处理完成"); |
| | | }else { |
| | | // logger.info("【1】风险分析单元-无数据上报昌吉州"); |
| | | System.out.println("【检查项与隐患】-无数据上报昌吉州"); |
| | | logger.info("scoreAndDangerLog【检查项与隐患】-无数据上报昌吉州"); |
| | | } |
| | | |
| | | |