|
@@ -22,7 +22,7 @@ import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
|
|
|
/**
|
|
|
- * 执法报备对接长春市接口
|
|
|
+ * 执法报备对接长春市接口(省平台工单接口)
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Component
|
|
@@ -40,6 +40,7 @@ public class EquipDataJob {
|
|
|
@Scheduled(cron = "0 0/10 * * * ?")
|
|
|
//@Scheduled(cron = "0/10 * * * * ?")
|
|
|
public void getEquipJobRecords() throws Exception {
|
|
|
+ log.info("定时任务调用省平台工单开始");
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date now = new Date();
|
|
|
String endTime = URLEncoder.encode(sdf.format(now), "UTF-8");
|
|
@@ -54,12 +55,14 @@ public class EquipDataJob {
|
|
|
for (int i = 1; i <= page; i++) {
|
|
|
String urlString = ip + "/dev-api/outData/getJobRecords?page=" + page + "&size=10&updateStartTime=" + startTime + "&updateEndTime=" + endTime;
|
|
|
// String urlString = "http://36.135.7.83:81/dev-api/outData/getJobRecords?page=" + page + "&size=5&updateStartTime=2024-05-20%2010:50:33&updateEndTime=2024-11-20%2010:50:33";
|
|
|
+ log.info("请求地址:{}", urlString);
|
|
|
try {
|
|
|
URL url = new URL(urlString);
|
|
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
|
|
connection.setRequestMethod("GET");
|
|
|
connection.setRequestProperty("access-key", accessKey);
|
|
|
int responseCode = connection.getResponseCode();
|
|
|
+ log.info("responseCode:{}", responseCode);
|
|
|
if (responseCode == HttpURLConnection.HTTP_OK) {
|
|
|
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
|
|
String inputLine;
|
|
@@ -69,14 +72,18 @@ public class EquipDataJob {
|
|
|
}
|
|
|
in.close();
|
|
|
JSONObject jsonObject = JSONObject.parseObject(response.toString());
|
|
|
+ log.info("jsonObject:{}", jsonObject);
|
|
|
page = (Integer) JSONObject.parseObject(jsonObject.get("data").toString()).get("pages");
|
|
|
JSONArray jsonArray = JSONObject.parseArray(JSONObject.parseObject(jsonObject.get("data").toString()).get("records").toString());
|
|
|
+ log.info("jsonArray:{}", jsonArray);
|
|
|
R<?> result = remoteLawenforcementBaseService.insertEnforceLawInfoByList(jsonArray);
|
|
|
+ log.info("result:{}", result);
|
|
|
if (result.getCode() == 200) {
|
|
|
log.info("推送成功");
|
|
|
} else {
|
|
|
log.error("推送失败");
|
|
|
}
|
|
|
+ log.info("定时任务调用省平台工单结束");
|
|
|
} else {
|
|
|
log.error("调用接口返回code代码:{}", responseCode);
|
|
|
}
|