|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
import com.sooka.sponest.dataexchange.remoteapi.service.center.data.RemoteDataBaseService;
|
|
|
+import com.sooka.sponest.dataexchange.remoteapi.service.center.lawenforcement.RemoteLawenforcementBaseService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
@@ -28,7 +29,7 @@ import java.util.Date;
|
|
|
public class EquipDataJob {
|
|
|
|
|
|
@Resource
|
|
|
- private RemoteDataBaseService remoteDataBaseService;
|
|
|
+ private RemoteLawenforcementBaseService remoteLawenforcementBaseService;
|
|
|
|
|
|
@Value("${equioData.accessKey}")
|
|
|
private String accessKey;
|
|
@@ -37,6 +38,7 @@ public class EquipDataJob {
|
|
|
private String ip;
|
|
|
|
|
|
@Scheduled(cron = "0 0/10 * * * ?")
|
|
|
+//@Scheduled(cron = "0/10 * * * * ?")
|
|
|
public void getEquipJobRecords() throws Exception {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date now = new Date();
|
|
@@ -51,7 +53,7 @@ public class EquipDataJob {
|
|
|
Integer page = 1;
|
|
|
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=1&size=10&updateStartTime=2024-05-20%2010:50:33&updateEndTime=2024-11-20%2010:50:33";
|
|
|
+// 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";
|
|
|
try {
|
|
|
URL url = new URL(urlString);
|
|
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
|
@@ -69,7 +71,7 @@ public class EquipDataJob {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(response.toString());
|
|
|
page = (Integer) JSONObject.parseObject(jsonObject.get("data").toString()).get("pages");
|
|
|
JSONArray jsonArray = JSONObject.parseArray(JSONObject.parseObject(jsonObject.get("data").toString()).get("records").toString());
|
|
|
- R<?> result = remoteDataBaseService.insertEnforceLawInfoByList(jsonArray);
|
|
|
+ R<?> result = remoteLawenforcementBaseService.insertEnforceLawInfoByList(jsonArray);
|
|
|
if (result.getCode() == 200) {
|
|
|
log.info("推送成功");
|
|
|
} else {
|