双重预防项目-国泰新华二开定制版
kongzy
2024-08-14 135a322f44708b1187d37ea4b6859b5d82113e89
src/main/java/com/ruoyi/doublePrevention/scheduls/ExecCJReportDateSchedule.java
@@ -3,13 +3,12 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.BeanCopyUtils;
import com.ruoyi.doublePrevention.entity.CJReport.*;
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;
@@ -29,7 +28,6 @@
import org.springframework.transaction.annotation.Transactional;
import java.io.*;
import java.lang.reflect.Array;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
@@ -95,8 +93,9 @@
    @Transactional
//    @Scheduled(cron = "0 0 23 * * ?")    //每天晚上23点执行一次0 0 22,23 * * ?
//    @Scheduled(cron = "0 0 22,23 * * ?")    //每天晚上22、23点执行一次
    @Scheduled(cron = "0 0/10 * * * ? ")    // 分钟
//    @Scheduled(cron = "0/30 * * * * ?")
    // @Scheduled(cron = "0 0/5 * * * ? ")    // 分钟
   // @Scheduled(cron = "0 0/5 * * * ? ")
    @Scheduled(cron = "0 0/1 * * * ? ")
    public void execReportDateSchedule() throws UnsupportedEncodingException {
        logger.info("【####】上报数据开始...");
@@ -589,16 +588,22 @@
            //数据加密
            String AESReportRecordFromTask = encrypt(JSONObject.toJSONString(reportRecordFromTaskList), key.getBytes(), iv.getBytes());
            logger.info("【test】数据加密完成,开始上报数据");
            StringBuffer recordFromTaskResultBuffer = null;
            //上报数据
            try {
                URL url = new URL("http://120.71.182.198:9999/v1/data/receive/measuresTaskRecordMsg");
               // URL url = new URL("http://120.71.182.198:9999/v1/data/receive/measuresTaskRecordMsg");
                URL url = new URL("https://cjzjg.gtaq.com.cn:7004/v1/data/receive/measuresTaskRecordMsg");  //备用地址
                //得到连接对象
                con = (HttpURLConnection) url.openConnection();
                //设置请求类型
                con.setRequestMethod("POST");
                //设置Content-Type,此处根据实际情况确定
                con.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
            //    con.setRequestProperty(HTTP.CONN_DIRECTIVE,HTTP.CONN_CLOSE);
                con.setConnectTimeout(600000);
                con.setReadTimeout(600000);
                //允许写出
                con.setDoOutput(true);
                //允许读入
@@ -606,7 +611,7 @@
                //不使用缓存
                con.setUseCaches(false);
                //设置请求头
                con.setRequestProperty("X-Access-Token",token+formatDate.toString());
                con.setRequestProperty("X-Access-Token",token+tokenDate.format(new Date()).toString());
                OutputStream os = con.getOutputStream();
                Map paraMap = new HashMap();
                paraMap.put("data", AESReportRecordFromTask);/**封装数据*/