双重预防项目-国泰新华二开定制版
heheng
2025-06-24 e98eeaaa5766511fdb8e6d5e412eb1c59d1f07ce
src/main/java/com/ruoyi/project/tr/specialCheck/scheduleLogTask/TaskReportSchedule.java
文件名从 src/main/java/com/ruoyi/project/tr/specialCheck/Test/TaskReportScheduleTest.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;
@@ -7,14 +7,8 @@
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;
@@ -28,7 +22,6 @@
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;
@@ -43,7 +36,7 @@
import java.util.*;
@Component
public class TaskReportScheduleTest {
public class TaskReportSchedule {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -91,12 +84,12 @@
    @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;
@@ -117,7 +110,7 @@
        /**
         * 1、任务上报
         * */
        System.out.println("【1】任务上报-处理数据...");
        logger.info("TASKLOG【1】任务上报-处理数据...");
//        List<TbSpecialCheckTaskLog> CJRiskAnaUnits = .listReportUnitDate();
        List<TbSpecialCheckTaskLog> taskLogLists = taskSpecialLogMapper.listTestReportTask();
        if (ObjectUtils.isNotEmpty(taskLogLists)){
@@ -131,8 +124,8 @@
                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);![](C:/Users/Ad![](C:/Users/Admin/Desktop/所有桌面文件存放/9}AM56M10$6WX){0JRK`$6X.jpg)min/Desktop/所有桌面文件存放/9}AM56M10$6WX){0JRK`$6X.jpg)
            StringBuffer checkTaskResultBuffer = null;
@@ -160,7 +153,7 @@
             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());
@@ -175,8 +168,8 @@
                    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) {
@@ -196,7 +189,7 @@
                }
            }
            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) {
@@ -224,10 +217,10 @@
//            logger.info("【1】安全风险分析单元-数据处理完成");
            System.out.println("【任务】-数据处理完成");
            logger.info("TASKLOG【任务】-数据处理完成");
        }else {
//            logger.info("【1】风险分析单元-无数据上报昌吉州");
            System.out.println("【任务】-无数据上报昌吉州");
            logger.info("TASKLOG【任务】-无数据上报昌吉州");
        }