|
@@ -44,6 +44,10 @@ public class ScheduleTask {
|
|
|
@Resource
|
|
|
private MQWGRZDJZQKService mqwgrzdjzqkService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private MQWGRYJSJService mqwgryjsjService;
|
|
|
+
|
|
|
+
|
|
|
@Value("${taiji.jgUrl}")
|
|
|
private String jgUrl;
|
|
|
|
|
@@ -202,6 +206,34 @@ public class ScheduleTask {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Scheduled(cron = "6 0 6 * * ?")
|
|
|
+ public void scheduleSix() throws Exception {
|
|
|
+ HttpClient client = new SSLClient();
|
|
|
+ HttpGet get = handleJgUrl(Constant.MQWGRYJSJ, null, 1);
|
|
|
+ HttpResponse res = client.execute(get);
|
|
|
+ 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");
|
|
|
+ for (int i=1;i<=total/200+1;i++){
|
|
|
+ Thread.sleep(10000);
|
|
|
+ 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");
|
|
|
+ List<VisaFreeWarningData> visaFreeWarningData = JSONObject.parseArray(rows, VisaFreeWarningData.class);
|
|
|
+ mqwgryjsjService.saveOrUpdateBatch(visaFreeWarningData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public HttpGet handleJgUrl(String qspBizId,String terms,int page){
|
|
|
StringBuffer param = new StringBuffer();
|