|
@@ -63,9 +63,10 @@ public class ScheduleTask {
|
|
|
/**
|
|
|
* 每天六点执行一次 获取免签地区在岛人数
|
|
|
*/
|
|
|
- @Scheduled(cron = "0 40 6 * * ?")
|
|
|
+ @Scheduled(cron = "0 0 6 * * ?")
|
|
|
+ //@Scheduled(initialDelay = 5000,fixedDelay = 60*60*60)
|
|
|
public void scheduleOne() throws Exception {
|
|
|
- log.info("免签-执行START时间-{}", DateUtil.date());
|
|
|
+ log.info("{}-执行START时间-{}", Constant.MQDQZDRS,DateUtil.date());
|
|
|
HttpClient client = new SSLClient();
|
|
|
HttpGet get = handleJgUrl(Constant.MQDQZDRS, null, 1);
|
|
|
HttpResponse res = client.execute(get);
|
|
@@ -74,6 +75,7 @@ public class ScheduleTask {
|
|
|
String result = EntityUtils.toString(entity);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
Integer total = jsonObject.getInteger("total");
|
|
|
+ log.info("总数---{}",total);
|
|
|
for (int i=1;i<=total/200+1;i++){
|
|
|
Thread.sleep(1000);
|
|
|
HttpGet httpGet = handleJgUrl(Constant.MQDQZDRS, null, i);
|
|
@@ -92,27 +94,30 @@ public class ScheduleTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- log.info("免签-执行END时间-{}", DateUtil.date());
|
|
|
+ log.info("执行END时间-{}", DateUtil.date());
|
|
|
}
|
|
|
|
|
|
- @Scheduled(cron = "1 0 6 * * ?")
|
|
|
+ @Scheduled(cron = "1 10 6 * * ?")
|
|
|
public void scheduleTwo() throws Exception {
|
|
|
- log.info("执行START时间-{}", DateUtil.date());
|
|
|
+ log.info("{}==执行START时间-{}",Constant.MQDQCRJZDRS, DateUtil.date());
|
|
|
HttpClient client = new SSLClient();
|
|
|
HttpGet get = handleJgUrl(Constant.MQDQCRJZDRS, null, 1);
|
|
|
HttpResponse res = client.execute(get);
|
|
|
+ int count = 0;
|
|
|
if(res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
|
|
HttpEntity entity = res.getEntity();
|
|
|
String result = EntityUtils.toString(entity);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
|
|
Integer total = jsonObject.getInteger("total");
|
|
|
+ log.info("总数---{}",total);
|
|
|
if(total>0){
|
|
|
baseCreateNewTableMapper.delTable("jg_mqdqcrj_zdrs");
|
|
|
}
|
|
|
|
|
|
for (int i=1;i<=total/200+1;i++){
|
|
|
- Thread.sleep(1000);
|
|
|
+ count=i;
|
|
|
+ Thread.sleep(2000);
|
|
|
HttpGet httpGet = handleJgUrl(Constant.MQDQCRJZDRS, null, i);
|
|
|
HttpResponse response = client.execute(httpGet);
|
|
|
if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
|
@@ -120,19 +125,20 @@ public class ScheduleTask {
|
|
|
String resultPage = EntityUtils.toString(entityPage);
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(resultPage);
|
|
|
if (jsonObject1.getBoolean("success")) {
|
|
|
- String rows = jsonObject.getString("rows");
|
|
|
+ String rows = jsonObject1.getString("rows");
|
|
|
List<VisaFreeAreaEntryAndExitIslandPerson> visaFree = JSONObject.parseArray(rows, VisaFreeAreaEntryAndExitIslandPerson.class);
|
|
|
- mqdqcrjzdrsService.saveOrUpdateBatch(visaFree);
|
|
|
+ mqdqcrjzdrsService.saveBatch(visaFree);
|
|
|
}
|
|
|
}
|
|
|
httpGet.releaseConnection();
|
|
|
}
|
|
|
}
|
|
|
- log.info("执行END时间-{}", DateUtil.date());
|
|
|
+ log.info("执行END时间-{},执行次数-{}", DateUtil.date(),count);
|
|
|
}
|
|
|
|
|
|
- @Scheduled(cron = "2 50 6 * * ?")
|
|
|
+ @Scheduled(cron = "2 20 6 * * ?")
|
|
|
public void scheduleThree() throws Exception {
|
|
|
+ log.info("{}==执行START时间-{}",Constant.MQWGRQZQK, DateUtil.date());
|
|
|
HttpClient client = new SSLClient();
|
|
|
HttpGet get = handleJgUrl(Constant.MQWGRQZQK, null, 1);
|
|
|
HttpResponse res = client.execute(get);
|
|
@@ -141,6 +147,7 @@ public class ScheduleTask {
|
|
|
String result = EntityUtils.toString(entity);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
Integer total = jsonObject.getInteger("total");
|
|
|
+ log.info("总数---{}",total);
|
|
|
for (int i=1;i<=total/200+1;i++){
|
|
|
Thread.sleep(1000);
|
|
|
HttpGet httpGet = handleJgUrl(Constant.MQWGRQZQK, null, i);
|
|
@@ -158,10 +165,12 @@ public class ScheduleTask {
|
|
|
httpGet.releaseConnection();
|
|
|
}
|
|
|
}
|
|
|
+ log.info("执行END时间-{}", DateUtil.date());
|
|
|
}
|
|
|
|
|
|
- @Scheduled(cron = "3 0 6 * * ?")
|
|
|
+ @Scheduled(cron = "3 30 6 * * ?")
|
|
|
public void scheduleFour() throws Exception {
|
|
|
+ log.info("{}==执行START时间-{}",Constant.MQWGRYJ, DateUtil.date());
|
|
|
HttpClient client = new SSLClient();
|
|
|
HttpGet get = handleJgUrl(Constant.MQWGRYJ, null, 1);
|
|
|
HttpResponse res = client.execute(get);
|
|
@@ -171,6 +180,10 @@ public class ScheduleTask {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
|
|
Integer total = jsonObject.getInteger("total");
|
|
|
+ log.info("总数---{}",total);
|
|
|
+ if(total>0){
|
|
|
+ baseCreateNewTableMapper.delTable("jg_mqwgr_warning");
|
|
|
+ }
|
|
|
for (int i=1;i<=total/200+1;i++){
|
|
|
Thread.sleep(1000);
|
|
|
HttpGet httpGet = handleJgUrl(Constant.MQWGRYJ, null, i);
|
|
@@ -180,7 +193,7 @@ public class ScheduleTask {
|
|
|
String resultPage = EntityUtils.toString(entityPage);
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(resultPage);
|
|
|
if (jsonObject1.getBoolean("success")) {
|
|
|
- String rows = jsonObject.getString("rows");
|
|
|
+ String rows = jsonObject1.getString("rows");
|
|
|
List<VisaFreePersonWarning> visaFreePersonWarnings = JSONObject.parseArray(rows, VisaFreePersonWarning.class);
|
|
|
mqwgryjService.saveOrUpdateBatch(visaFreePersonWarnings);
|
|
|
}
|
|
@@ -188,10 +201,12 @@ public class ScheduleTask {
|
|
|
httpGet.releaseConnection();
|
|
|
}
|
|
|
}
|
|
|
+ log.info("执行END时间-{}", DateUtil.date());
|
|
|
}
|
|
|
|
|
|
- @Scheduled(cron = "4 20 6 * * ?")
|
|
|
+ @Scheduled(cron = "4 40 6 * * ?")
|
|
|
public void scheduleFive() throws Exception {
|
|
|
+ log.info("{}==执行START时间-{}",Constant.MQWGRZDJZQK, DateUtil.date());
|
|
|
HttpClient client = new SSLClient();
|
|
|
HttpGet get = handleJgUrl(Constant.MQWGRZDJZQK, null, 1);
|
|
|
HttpResponse res = client.execute(get);
|
|
@@ -200,6 +215,8 @@ public class ScheduleTask {
|
|
|
String result = EntityUtils.toString(entity);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
Integer total = jsonObject.getInteger("total");
|
|
|
+ log.info("总数---{}",total);
|
|
|
+
|
|
|
for (int i=1;i<=total/200+1;i++){
|
|
|
Thread.sleep(1000);
|
|
|
HttpGet httpGet = handleJgUrl(Constant.MQWGRZDJZQK, null, i);
|
|
@@ -209,7 +226,7 @@ public class ScheduleTask {
|
|
|
String resultPage = EntityUtils.toString(entityPage);
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(resultPage);
|
|
|
if (jsonObject1.getBoolean("success")) {
|
|
|
- String rows = jsonObject.getString("rows");
|
|
|
+ String rows = jsonObject1.getString("rows");
|
|
|
List<VisaFreePersonPutUpCondition> visaFreePersonPutUpConditions = JSONObject.parseArray(rows, VisaFreePersonPutUpCondition.class);
|
|
|
mqwgrzdjzqkService.saveOrUpdateBatch(visaFreePersonPutUpConditions);
|
|
|
}
|
|
@@ -217,36 +234,46 @@ public class ScheduleTask {
|
|
|
httpGet.releaseConnection();
|
|
|
}
|
|
|
}
|
|
|
+ log.info("执行END时间-{}", DateUtil.date());
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Scheduled(cron = "6 10 6 * * ?")
|
|
|
+ @Scheduled(cron = "6 50 6 * * ?")
|
|
|
public void scheduleSix() throws Exception {
|
|
|
+ log.info("{}==执行START时间-{}",Constant.MQWGRYJSJ, DateUtil.date());
|
|
|
HttpClient client = new SSLClient();
|
|
|
HttpGet get = handleJgUrl(Constant.MQWGRYJSJ, null, 1);
|
|
|
HttpResponse res = client.execute(get);
|
|
|
+ int count = 0;
|
|
|
if(res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
|
|
HttpEntity entity = res.getEntity();
|
|
|
String result = EntityUtils.toString(entity);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
Integer total = jsonObject.getInteger("total");
|
|
|
+ log.info("总数---{}",total);
|
|
|
+ if(total>0){
|
|
|
+ baseCreateNewTableMapper.delTable("jg_mqwgr_warning_data");
|
|
|
+ }
|
|
|
for (int i=1;i<=total/200+1;i++){
|
|
|
+ count=i;
|
|
|
+ Thread.sleep(3000);
|
|
|
HttpGet httpGet = handleJgUrl(Constant.MQWGRYJSJ, null, i);
|
|
|
HttpResponse response = client.execute(httpGet);
|
|
|
|
|
|
if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
|
|
HttpEntity entityPage = response.getEntity();
|
|
|
String resultPage = EntityUtils.toString(entityPage);
|
|
|
- JSONObject jsonObject1 = JSONObject.parseObject(resultPage);
|
|
|
- if (jsonObject1.getBoolean("success")) {
|
|
|
- String rows = jsonObject.getString("rows");
|
|
|
+ JSONObject objPage = JSONObject.parseObject(resultPage);
|
|
|
+ if (objPage.getBoolean("success")) {
|
|
|
+ String rows = objPage.getString("rows");
|
|
|
List<VisaFreeWarningData> visaFreeWarningData = JSONObject.parseArray(rows, VisaFreeWarningData.class);
|
|
|
- mqwgryjsjService.saveOrUpdateBatch(visaFreeWarningData);
|
|
|
+ mqwgryjsjService.saveBatch(visaFreeWarningData);
|
|
|
}
|
|
|
}
|
|
|
httpGet.releaseConnection();
|
|
|
}
|
|
|
}
|
|
|
+ log.info("执行END时间-{},执行次数-{}", DateUtil.date(),count);
|
|
|
}
|
|
|
|
|
|
|