ソースを参照

生物防控人员

523096025 1 年間 前
コミット
7f971a79e5

+ 0 - 161
huimv-receive/src/main/java/com/huimv/receive/common/utils/HttpClientSSLUtils.java

@@ -1,161 +0,0 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by Fernflower decompiler)
-//
-
-package com.huimv.receive.common.utils;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.config.RequestConfig.Builder;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.conn.ssl.TrustStrategy;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.http.ssl.SSLContextBuilder;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSession;
-import java.security.GeneralSecurityException;
-import java.security.KeyStore;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-
-public class HttpClientSSLUtils {
-    private static HttpClient client = null;
-    protected static final Integer DEFAULT_CONNECTION_TIME_OUT = 100000;
-    protected static final Integer DEFAULT_SOCKET_TIME_OUT = 200000;
-    protected static final String DEFAULT_CHAR_SET = "UTF-8";
-
-    public HttpClientSSLUtils() {
-    }
-
-    public static String doPost(String url, String jsonText) throws Exception {
-        HttpClient client = null;
-        HttpPost post = new HttpPost(url);
-
-        String var6;
-        try {
-            if (jsonText != null && !jsonText.isEmpty()) {
-                StringEntity entity = new StringEntity(jsonText, ContentType.APPLICATION_JSON);
-                post.setEntity(entity);
-            }
-
-            Builder customReqConf = RequestConfig.custom();
-            customReqConf.setConnectTimeout(DEFAULT_CONNECTION_TIME_OUT);
-            customReqConf.setSocketTimeout(DEFAULT_CONNECTION_TIME_OUT);
-            post.setConfig(customReqConf.build());
-            HttpResponse res = null;
-            if (url.startsWith("https")) {
-                client = createSSLInsecureClient();
-                res = ((HttpClient)client).execute(post);
-            } else {
-                client = HttpClientSSLUtils.client;
-                res = ((HttpClient)client).execute(post);
-            }
-
-            var6 = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
-        } finally {
-            post.releaseConnection();
-            if (url.startsWith("https") && client != null && client instanceof CloseableHttpClient) {
-                ((CloseableHttpClient)client).close();
-            }
-
-        }
-
-        return var6;
-    }
-
-    public static String doGet(String url) throws Exception {
-        HttpClient client = null;
-        HttpGet get = new HttpGet(url);
-        String result = "";
-
-        try {
-            Builder customReqConf = RequestConfig.custom();
-            customReqConf.setConnectTimeout(DEFAULT_CONNECTION_TIME_OUT);
-            customReqConf.setSocketTimeout(DEFAULT_CONNECTION_TIME_OUT);
-            get.setConfig(customReqConf.build());
-            HttpResponse res = null;
-            if (url.startsWith("https")) {
-                client = createSSLInsecureClient();
-                res = ((HttpClient)client).execute(get);
-            } else {
-                client = HttpClientSSLUtils.client;
-                res = ((HttpClient)client).execute(get);
-            }
-
-            result = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
-        } finally {
-            get.releaseConnection();
-            if (url.startsWith("https") && client != null && client instanceof CloseableHttpClient) {
-                ((CloseableHttpClient)client).close();
-            }
-
-        }
-
-        return result;
-    }
-
-    private static CloseableHttpClient createSSLInsecureClient() throws GeneralSecurityException {
-        try {
-            SSLContext sslContext = (new SSLContextBuilder()).loadTrustMaterial((KeyStore)null, new TrustStrategy() {
-                public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
-                    return true;
-                }
-            }).build();
-            SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new HostnameVerifier() {
-                public boolean verify(String hostname, SSLSession session) {
-                    return true;
-                }
-            });
-            return HttpClients.custom().setSSLSocketFactory(sslsf).build();
-        } catch (GeneralSecurityException var2) {
-            throw var2;
-        }
-    }
-
-//    public static void main(String[] args) {
-//        String url = "https://10.33.39.8/webapi/service/base/getPlatAuthSubSystemList";
-//        String params = "appkey=f8524632&time=" + System.currentTimeMillis() + "&pageNo=1&pageSize=10";
-//        String urlString = url + "?" + params + "&token=" + Digests.buildToken(url + "?" + params, (String)null, "0a5a6558a06546088da645b5f9248a3a");
-//
-//        try {
-//            String output = new String(doGet(urlString));
-//            System.out.println(output);
-//        } catch (Exception var7) {
-//            var7.printStackTrace();
-//        }
-//
-//        url = "https://10.20.134.21/webapi/service/base/addPlatCard";
-//        Map<String, Object> map = new HashMap();
-//        map.put("appkey", "f8524632");
-//        map.put("time", System.currentTimeMillis());
-//        map.put("startCardNo", "16000");
-//        map.put("endCardNo", "16010");
-////        params = JsonUtils.object2Json(map);
-//        url = url + "?token=" + Digests.buildToken(url + "?" + params, (String)null, "0a5a6558a06546088da645b5f9248a3a");
-//
-//        try {
-//            System.out.println(doPost(url, params));
-//        } catch (Exception var6) {
-//            var6.printStackTrace();
-//        }
-//
-//    }
-
-    static {
-        PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
-        cm.setMaxTotal(128);
-        cm.setDefaultMaxPerRoute(128);
-        client = HttpClients.custom().setConnectionManager(cm).build();
-    }
-}

+ 0 - 58
huimv-receive/src/main/java/com/huimv/receive/common/utils/HttpUtils.java

@@ -1,58 +0,0 @@
-package com.huimv.receive.common.utils;
-
-import java.io.BufferedReader;
-import java.io.DataOutputStream;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-/**
- * http 工具类
- */
-public class HttpUtils {
-
-    public static String post(String requestUrl, String accessToken, String params) throws Exception {
-        String generalUrl = requestUrl + "?access_token=" + accessToken;
-        URL url = new URL(generalUrl);
-        // 打开和URL之间的连接
-        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-        connection.setRequestMethod("POST");
-        // 设置通用的请求属性
-        connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
-        connection.setRequestProperty("Connection", "Keep-Alive");
-        connection.setUseCaches(false);
-        connection.setDoOutput(true);
-        connection.setDoInput(true);
-
-        // 得到请求的输出流对象
-        DataOutputStream out = new DataOutputStream(connection.getOutputStream());
-        out.writeBytes(params);
-        out.flush();
-        out.close();
-
-        // 建立实际的连接
-        connection.connect();
-        // 获取所有响应头字段
-        Map<String, List<String>> headers = connection.getHeaderFields();
-        // 遍历所有的响应头字段
-        for (String key : headers.keySet()) {
-            System.out.println(key + "--->" + headers.get(key));
-        }
-        // 定义 BufferedReader输入流来读取URL的响应
-        BufferedReader in = null;
-        if (requestUrl.contains("nlp"))
-            in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "GBK"));
-        else
-            in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
-        String result = "";
-        String getLine;
-        while ((getLine = in.readLine()) != null) {
-            result += getLine;
-        }
-        in.close();
-        System.out.println("result:" + result);
-        return result;
-    }
-}

+ 47 - 0
huimv-receive/src/main/java/com/huimv/receive/timer/SafeTimer.java

@@ -0,0 +1,47 @@
+package com.huimv.receive.timer;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.huimv.receive.entity.BillIsolate;
+import com.huimv.receive.service.IBillIsolateService;
+import com.huimv.receive.service.IBillPcrService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@Configuration
+@EnableScheduling
+public class SafeTimer {
+
+
+    @Autowired
+    private IBillPcrService pcrService;
+    @Autowired
+    private IBillIsolateService isolateService;
+
+
+    @Scheduled(cron = "0 0/1 * * * ? ")
+    private void getShenChan() throws Exception {
+        QueryWrapper<BillIsolate> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("bill_status", 1);
+        List<BillIsolate> isolates = isolateService.list(queryWrapper);
+        Date date = new Date();
+        for (BillIsolate isolate : isolates) {
+            if (isolate.getIsolateEndDate().getTime() <= date.getTime()) {
+                isolate.setIsolateRealEndDate(date);
+                isolate.setIsolateRealDayNum(isolate.getIsolateDayNum());
+                isolate.setBillStatus(2);
+                isolate.setPassUserName("自然解除隔离");
+                isolate.setPassDate(date);
+                isolateService.updateById(isolate);
+            }
+        }
+    }
+
+}