Browse Source

新增最新预警数据接口数据连接

chenminghao 1 year ago
parent
commit
ccb884ec6c

+ 23 - 0
mq-crj-service/src/main/java/cn/com/taiji/mqcrj/entity/VisaFreeWarningData.java

@@ -0,0 +1,23 @@
+package cn.com.taiji.mqcrj.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 1.7.6	免签外国人预警数据
+ * @author chen mh
+ * @date 2023/8/3 8:54
+ */
+@Data
+@TableName("jg_mqwgr_warning_data")
+public class VisaFreeWarningData {
+    private String id;
+    private String xm;
+    private String xb;
+    private String gjdq;
+    private String zjhm;
+    private String yjlx;
+    private String yjsj;
+
+    private String crjka;
+}

+ 14 - 0
mq-crj-service/src/main/java/cn/com/taiji/mqcrj/mapper/MQWGRYJSJMapper.java

@@ -0,0 +1,14 @@
+package cn.com.taiji.mqcrj.mapper;
+
+import cn.com.taiji.mqcrj.entity.VisaFreeWarningData;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 免签外国人预警数据
+ * @author chen mh
+ * @date 2023/7/26 16:37
+ */
+@Mapper
+public interface MQWGRYJSJMapper extends BaseMapper<VisaFreeWarningData> {
+}

+ 11 - 0
mq-crj-service/src/main/java/cn/com/taiji/mqcrj/service/MQWGRYJSJService.java

@@ -0,0 +1,11 @@
+package cn.com.taiji.mqcrj.service;
+
+import cn.com.taiji.mqcrj.entity.VisaFreeWarningData;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @author chen mh
+ * @date 2023/7/27 10:49
+ */
+public interface MQWGRYJSJService extends IService<VisaFreeWarningData> {
+}

+ 15 - 0
mq-crj-service/src/main/java/cn/com/taiji/mqcrj/service/impl/MQWGRYJSJServiceImpl.java

@@ -0,0 +1,15 @@
+package cn.com.taiji.mqcrj.service.impl;
+
+import cn.com.taiji.mqcrj.entity.VisaFreeWarningData;
+import cn.com.taiji.mqcrj.mapper.MQWGRYJSJMapper;
+import cn.com.taiji.mqcrj.service.MQWGRYJSJService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author chen mh
+ * @date 2023/7/27 10:49
+ */
+@Service
+public class MQWGRYJSJServiceImpl extends ServiceImpl<MQWGRYJSJMapper, VisaFreeWarningData> implements MQWGRYJSJService {
+}

+ 32 - 0
mq-crj-service/src/main/java/cn/com/taiji/mqcrj/task/ScheduleTask.java

@@ -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();

+ 2 - 0
mq-crj-service/src/main/java/cn/com/taiji/mqcrj/utils/Constant.java

@@ -15,4 +15,6 @@ public class Constant {
     public static final String MQWGRYJ = "10035";
 
     public static final String MQWGRZDJZQK = "10036";
+
+    public static final String MQWGRYJSJ = "10037";
 }