双重预防项目-国泰新华二开定制版
heheng
2025-06-24 e98eeaaa5766511fdb8e6d5e412eb1c59d1f07ce
src/main/java/com/ruoyi/project/tr/specialCheck/scheduleLogTask/ItemDangerReportSchedule.java
文件名从 src/main/java/com/ruoyi/project/tr/specialCheck/Test/ItemDangerReportScheduleTest.java 修改
@@ -1,4 +1,4 @@
package com.ruoyi.project.tr.specialCheck.Test;
package com.ruoyi.project.tr.specialCheck.scheduleLogTask;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
@@ -9,13 +9,9 @@
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;
@@ -39,7 +35,7 @@
import java.util.*;
@Component
public class ItemDangerReportScheduleTest {
public class ItemDangerReportSchedule {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -80,12 +76,12 @@
    @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;
@@ -101,12 +97,12 @@
        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)){
@@ -122,7 +118,7 @@
                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);![](C:/Users/Ad![](C:/Users/Admin/Desktop/所有桌面文件存放/9}AM56M10$6WX){0JRK`$6X.jpg)min/Desktop/所有桌面文件存放/9}AM56M10$6WX){0JRK`$6X.jpg)
            StringBuffer itemDangerResultBuffer = null;
@@ -150,7 +146,7 @@
             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());
@@ -166,7 +162,7 @@
                        itemDangerResultBuffer.append(line);
                    }
//                    logger.info("result:" + unitResultBuffer.toString());
                    System.out.println("result:" + itemDangerResultBuffer.toString());
                    logger.info("scoreAndDangerLog【result】:" + itemDangerResultBuffer.toString());
                }
            } catch (Exception e) {
@@ -185,7 +181,7 @@
                }
            }
            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) {
@@ -212,10 +208,10 @@
//            logger.info("【1】安全风险分析单元-数据处理完成");
            System.out.println("【检查项与隐患】-数据处理完成");
            logger.info("scoreAndDangerLog【检查项与隐患】-数据处理完成");
        }else {
//            logger.info("【1】风险分析单元-无数据上报昌吉州");
            System.out.println("【检查项与隐患】-无数据上报昌吉州");
            logger.info("scoreAndDangerLog【检查项与隐患】-无数据上报昌吉州");
        }