| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | | @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("【####】上报数据开始...");
|
| | |
|
| | |
| | | //数据加密
|
| | | 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);
|
| | | //允许读入
|
| | |
| | | //不使用缓存
|
| | | 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);/**封装数据*/
|