chenminghao 1 year ago
parent
commit
e34a8c16df

+ 1 - 1
mq-crj-service/src/main/java/cn/com/taiji/mqcrj/entity/AjxxBean.java

@@ -9,7 +9,7 @@ import lombok.Data;
  * @date 2023/8/7 15:35
  */
 @Data
-@TableName(value = "s_vg_")
+@TableName("v_sg_")
 public class AjxxBean {
     @TableField(value = "CASE_TYPE")
     private String CASE_TYPE;

+ 7 - 6
mq-crj-service/src/main/java/cn/com/taiji/mqcrj/task/OracleScheduleTask.java

@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 /**
  * @author chen mh
@@ -43,7 +44,7 @@ public class OracleScheduleTask {
     @Resource
     private MqwgrService mqwgrService;
 
-    @Scheduled(cron = "2 55 2 * * ?")
+    @Scheduled(cron = "2 25 2 * * ?")
     public void ajxyrTask() {
         log.info("执行定时任务 AjxyrTask -{}",DateUtil.date());
         Connection connection = JDBCUtils.getConnection();
@@ -210,10 +211,10 @@ public class OracleScheduleTask {
             }else {
                 return;
             }
-            for(int x = 0;x<count/10000+1;x++) {
-                int max = (x + 1) * 10000;
-                int min = x * 10000;
-                String sql = "select * from (select v.*,rownum rn from hndmc.v_sg_ajxx v where ROWNUM <= "+max+") where rn>"+min;
+            for(int x = 0;x<count/20000+1;x++) {
+                int max = (x + 1) * 20000;
+                int min = x * 20000;
+                String sql = "select * from (select v.*,rownum rn from hndmc.v_sg_ajxx v where TRANSACT_CASE_CODE is not null and ROWNUM <= "+max+") where rn>"+min;
                 preparedStatement = connection.prepareStatement(sql);
                 resultSet = preparedStatement.executeQuery();
 
@@ -221,7 +222,7 @@ public class OracleScheduleTask {
                 ResultSetMetaData md = resultSet.getMetaData();
                 int columnCount = md.getColumnCount();
                 // 将ResultSet对象的列名和值存到map中,再将map转换为json字符串,最后将json字符串转换为实体类对象
-                List<AjxxBean> ajxxBeans = new ArrayList<>();
+                List<AjxxBean> ajxxBeans = new CopyOnWriteArrayList<>();
                 Map<String, Object> rowData = new HashMap<>(16);
                 while (resultSet.next()) {
                     for (int i = 1; i <= columnCount; i++) {

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

@@ -60,14 +60,13 @@ public class ScheduleTask {
     /**
      * 每天六点执行一次  获取免签地区在岛人数
      */
-    @Scheduled(cron = "0 0 6 * * ?")
+    @Scheduled(cron = "0 40 5 * * ?")
     public void scheduleOne() throws Exception {
         log.info("免签-执行START时间-{}", DateUtil.date());
         HttpClient client = new SSLClient();
         HttpGet get = handleJgUrl(Constant.MQDQZDRS, null, 1);
         HttpResponse res = client.execute(get);
         if(res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
-            log.info(""+res.getStatusLine().getStatusCode());
             HttpEntity entity = res.getEntity();
             String result = EntityUtils.toString(entity);
             JSONObject jsonObject = JSONObject.parseObject(result);
@@ -88,11 +87,13 @@ public class ScheduleTask {
                 }
             }
         }
+
         log.info("免签-执行END时间-{}", DateUtil.date());
     }
 
     @Scheduled(cron = "1 0 6 * * ?")
     public void scheduleTwo() throws Exception {
+        log.info("执行START时间-{}", DateUtil.date());
         HttpClient client = new SSLClient();
         HttpGet get = handleJgUrl(Constant.MQDQCRJZDRS, null, 1);
         HttpResponse res = client.execute(get);
@@ -118,9 +119,10 @@ public class ScheduleTask {
                 }
             }
         }
+        log.info("执行END时间-{}", DateUtil.date());
     }
 
-    @Scheduled(cron = "2 0 6 * * ?")
+    @Scheduled(cron = "2 20 5 * * ?")
     public void scheduleThree() throws Exception {
         HttpClient client = new SSLClient();
         HttpGet get = handleJgUrl(Constant.MQWGRQZQK, null, 1);
@@ -148,7 +150,7 @@ public class ScheduleTask {
         }
     }
 
-    @Scheduled(cron = "3 0 6 * * ?")
+    @Scheduled(cron = "3 0 5 * * ?")
     public void scheduleFour() throws Exception {
         HttpClient client = new SSLClient();
         HttpGet get = handleJgUrl(Constant.MQWGRYJ, null, 1);
@@ -177,7 +179,7 @@ public class ScheduleTask {
         }
     }
 
-    @Scheduled(cron = "4 0 6 * * ?")
+    @Scheduled(cron = "4 20 4 * * ?")
     public void scheduleFive() throws Exception {
         HttpClient client = new SSLClient();
         HttpGet get = handleJgUrl(Constant.MQWGRZDJZQK, null, 1);
@@ -206,7 +208,7 @@ public class ScheduleTask {
     }
 
 
-    @Scheduled(cron = "6 0 6 * * ?")
+    @Scheduled(cron = "6 10 3 * * ?")
     public void scheduleSix() throws Exception {
         HttpClient client = new SSLClient();
         HttpGet get = handleJgUrl(Constant.MQWGRYJSJ, null, 1);

+ 1 - 0
mq-crj-service/src/main/resources/application-gaxxw.yml

@@ -12,6 +12,7 @@ mybatis-plus:
   #type-enums-package: cn.com.taiji.common.enums
   configuration:
     log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
+    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
 #境管局数据
 taiji:

+ 1 - 0
pom.xml

@@ -6,6 +6,7 @@
     <modules>
         <module>video</module>
         <module>mq-crj-service</module>
+        <module>zwww-service</module>
     </modules>
     <parent>
         <groupId>org.springframework.boot</groupId>

+ 59 - 0
zwww-service/pom.xml

@@ -0,0 +1,59 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>cn.com.taiji</groupId>
+        <artifactId>data-service</artifactId>
+        <version>1.0</version>
+    </parent>
+    <artifactId>zwww-service</artifactId>
+    <name>zwww-service</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <scope>runtime</scope>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+            <version>1.18.20</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.75</version>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.6.6</version>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.com.taiji</groupId>
+            <artifactId>apione-http-client</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>system</scope>
+            <systemPath>${basedir}/src/main/resources/lib/apione-http-client-1.0.0-SNAPSHOT.jar</systemPath>
+        </dependency>
+    </dependencies>
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+    </build>
+</project>

+ 17 - 0
zwww-service/src/main/java/cn/com/taiji/gjyzj/ZwwwServiceApplication.java

@@ -0,0 +1,17 @@
+package cn.com.taiji.gjyzj;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+/**
+ * @author chen mh
+ * @date 2023/8/14 9:50
+ */
+@SpringBootApplication
+@EnableScheduling
+public class ZwwwServiceApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(ZwwwServiceApplication.class,args);
+    }
+}

+ 82 - 0
zwww-service/src/main/java/cn/com/taiji/gjyzj/task/Schedule.java

@@ -0,0 +1,82 @@
+package cn.com.taiji.gjyzj.task;
+
+import cn.com.taiji.gjyzj.util.ApioneUtils;
+import com.alibaba.fastjson.JSON;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.ResponseBody;
+import org.springframework.stereotype.Component;
+
+import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 任务执行类
+ * @author chen mh
+ * @date 2023/8/14 10:07
+ */
+@Component
+@Slf4j
+public class Schedule {
+
+    String region="INTRA";
+    String requestUrl="https://api-one.digitalhainan.com.cn/apione";
+    String mediaType="application/json";
+
+
+    /**
+     * 国家邮政局_疑似涉私寄件快递信息(协查函)
+     */
+    public void gjyzjYsssjjkdxxXch() throws IOException {
+        String contentJson = "";
+        String ak="AKc7ab48f6470444fa83f55a56c407e2be";
+        String sk="SK60d3df8fe75f4ccf938da7fc22179eec";
+        String apiName="gjyzj_ysssjjkdxx_xch";
+        String path="";
+        Map<String, String> headerParamsMap=new HashMap<>();
+        headerParamsMap.put("Authorization","Bearer 7bee4ad2-1d1f-36e0-b9ab-625a7e495de2");
+        Map<String, String> queryParamsMap=new HashMap<>();
+
+        queryParamsMap.put("photo","");
+        queryParamsMap.put("photoName","");
+        queryParamsMap.put("operateOrg","");
+        queryParamsMap.put("operator","");
+
+        String call = ApioneUtils.call(contentJson,ak, sk, apiName, region, requestUrl, mediaType, path, headerParamsMap, queryParamsMap);
+
+        ResponseBody response = JSON.parseObject(call, ResponseBody.class);
+        InputStream in = response.byteStream();
+        File outputFile = new File("test.xlsx");
+        FileOutputStream outputStream = new FileOutputStream(outputFile);
+        byte[] buffer = new byte[1024];
+        int bytesRead;
+        while ((bytesRead = in.read(buffer)) != -1) {
+            outputStream.write(buffer, 0, bytesRead);
+        }
+
+        outputStream.close();
+        in.close();
+    }
+
+
+    /**
+     * 国家邮政局_疑似涉私寄件快递信息(结果下载)
+     */
+    public void gjyzjYsssjjkdxxjgxz(){
+        String contentJson = "{\"OPERATEORG\":\"海南省打私办\",\"OPERATOR\":\"王鹏\"}";
+        String ak="AKe8fbb21605e04a3f88d78e1110f63c28";
+        String sk="SKd7fd481703b64387bab49ff2368d3d5d";
+        String apiName="gjyzj_ysssjjkdxx_jgxz";
+
+        String path="";
+        Map<String, String> headerParamsMap=new HashMap<>();
+        headerParamsMap.put("Authorization","Bearer 7bee4ad2-1d1f-36e0-b9ab-625a7e495de2");
+        Map<String, String> queryParamsMap=new HashMap<>();
+
+        queryParamsMap.put("operateOrg","");
+        queryParamsMap.put("operator","");
+
+        String call = ApioneUtils.call(contentJson,ak, sk, apiName, region, requestUrl, mediaType, path, headerParamsMap, queryParamsMap);
+
+    }
+}