Parcourir la source

拿图片的接口做好了,绕过了https

yang il y a 3 ans
Parent
commit
ae0ec41db0

+ 20 - 0
huimv-farm-v2/huimv-produce-warning/pom.xml

@@ -62,6 +62,26 @@
             <groupId>org.springframework.data</groupId>
             <artifactId>spring-data-jpa</artifactId>
         </dependency>
+
+
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.13</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpmime</artifactId>
+            <version>4.5</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
         <!-- JPA -->
     </dependencies>
 

+ 1 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/icc/CommonConstant.java

@@ -2,6 +2,7 @@ package com.huimv.produce.dhicc.icc;
 
 public class CommonConstant {
 
+    public static final String IPAndPort = "https://36.26.62.70:447";
     //性别 0-女 1-男
     public static final Integer GENDER_FEMALE = 0;
     public static final Integer GENDER_MALE = 1;

+ 0 - 35
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/icc/ITtest.java

@@ -1,35 +0,0 @@
-package com.huimv.produce.dhicc.icc;
-
-
-import com.dahuatech.hutool.http.Method;
-import com.dahuatech.icc.exception.ClientException;
-import com.dahuatech.icc.oauth.http.DefaultClient;
-import com.dahuatech.icc.oauth.http.IClient;
-import com.dahuatech.icc.oauth.model.v202010.GeneralRequest;
-import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
-
-public class ITtest {
-
-
-        //1.测试获取门禁通行记录
-        public static void main(String[] args) throws ClientException {
-            IClient iClient = new DefaultClient();
-            /**
-             * 1、请求地址是统一网关入口,以 /evo-apigw 开头
-             * 2、方法参见 @see com.dahuatech.hutool.http.Method
-             */
-            GeneralRequest generalRequest = new GeneralRequest("evo-pic/1a78324a-fc4c-11eb-b5b5-6c1c71fd5d8c/20211026/1/dsf_7999c070-3618-11ec-8931-6c1c71fd5d8c_11620962_11649419.jpg?token=1:e506fe5a-67d2-421e-9057-adee542e4a6e&oss_addr=172.16.3.223:8925", Method.GET);
-            // set http post body
-            //generalRequest.body("json请求体");
-            // set http get method param 例如?name=xiao&mobile=1xxx
-            generalRequest.form("key", "value");
-            // set header
-
-            //设置map.获取数据
-
-           // generalRequest.setBody();
-            generalRequest.header("key", "value");
-            // 发起请求处理应答
-            GeneralResponse generalResponse =iClient.doAction(generalRequest, generalRequest.getResponseClass());
-    }
-}

+ 0 - 3
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/icc/IccUtil.java

@@ -16,7 +16,4 @@ public class IccUtil {
         System.out.println("获取到的Token为:"+token.getAccess_token());
         return token.getAccess_token() ;
     }
-
-
-
 }

+ 0 - 4
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/newcontroller/AccidentController.java

@@ -67,8 +67,4 @@ public class AccidentController {
         System.out.println("执行结束");
         return generalResponse;
     }
-
-
-
-
 }

+ 100 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/newcontroller/GetPicture.java

@@ -0,0 +1,100 @@
+package com.huimv.produce.dhicc.newcontroller;
+
+import com.dahuatech.icc.exception.ClientException;
+import com.dahuatech.icc.oauth.http.DefaultClient;
+import com.dahuatech.icc.oauth.http.IClient;
+import com.dahuatech.icc.oauth.http.IccTokenResponse;
+import com.dahuatech.icc.oauth.profile.IccProfile;
+import com.huimv.common.utils.StringUtilsWork;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLContextBuilder;
+import org.apache.http.conn.ssl.TrustStrategy;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import javax.net.ssl.SSLContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import static com.huimv.produce.dhicc.icc.CommonConstant.IPAndPort;
+
+@RestController
+@RequestMapping("/picture")
+public class GetPicture {
+    @RequestMapping("/get")
+    public  void   getCarRecord(HttpServletRequest request, HttpServletResponse response  ,
+                               @RequestParam(name = "fileUrl" ,required = false) String fileUrl,
+                               @RequestParam(name = "alarmPicture", required = false) String alarmPicture
+                          ) throws IOException, ClientException {
+        String url;
+        IClient iClient = new DefaultClient();
+        //如果 fileURL不为空  就认为是拿摄像头抓拍图片
+        if(StringUtilsWork.isNotEmpty(fileUrl)){
+            url =IPAndPort+"/evo-apigw/ipms/imageConvert/originalImage?fileUrl="+fileUrl;
+        }else {
+            //IccProfile 授权类型,根据你的初始化使用的password,client_credentials
+            IccTokenResponse.IccToken token = iClient.getAccessToken(IccProfile.grantType);
+            url =IPAndPort+"/evo-pic/"+alarmPicture+"?token="+token.getAccess_token()+"&oss_addr=172.16.3.223:8925";
+        }
+        HttpResponse httpResponse = null;
+        try {
+            CloseableHttpClient buildSSLCloseableHttpClient = buildSSLCloseableHttpClient();
+            System.setProperty("jsse.enableSNIExtension", "false");
+            HttpGet httpGet = new HttpGet(url);
+            httpResponse = buildSSLCloseableHttpClient.execute(httpGet);
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        System.out.println("返回图片");
+        //response.setContentLength(285390);
+        response.setHeader("Content-Type"," image/jpeg");
+        response.setHeader("Accept-Ranges","bytes");
+        InputStream content = httpResponse.getEntity().getContent();
+        OutputStream out = null;
+        try {
+            out = response.getOutputStream();
+            int len = 0;
+            byte[] b = new byte[1024];
+            while ((len = content.read(b)) != -1) {
+                out.write(b, 0, len);
+            }
+            out.flush();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private static CloseableHttpClient buildSSLCloseableHttpClient()
+            throws Exception {
+        SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null,
+                new TrustStrategy() {
+                    // 信任所有
+                    public boolean isTrusted(X509Certificate[] chain,
+                                             String authType) throws CertificateException {
+                        return true;
+                    }
+                }).build();
+        SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
+                sslContext, new String[] { "TLSv1.2" }, null,
+                SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+        return HttpClients.custom().setSSLSocketFactory(sslsf).build();
+    }
+
+}

+ 280 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/screen/ClientEventController.java

@@ -0,0 +1,280 @@
+package com.huimv.produce.dhicc.screen;
+
+
+import com.alibaba.fastjson.JSON;
+import com.dahuatech.hutool.http.Method;
+import com.dahuatech.icc.exception.ClientException;
+import com.dahuatech.icc.oauth.http.DefaultClient;
+import com.dahuatech.icc.oauth.http.IClient;
+import com.dahuatech.icc.oauth.model.v202010.GeneralRequest;
+import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
+import com.huimv.common.utils.StringUtilsWork;
+import com.huimv.produce.dhicc.result.R;
+import com.huimv.produce.dhicc.util.GetResponse;
+import com.huimv.produce.service.ISysTelecomEventService;
+import net.sf.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+@CrossOrigin
+@RestController
+@RequestMapping("/client/event")
+public class ClientEventController {
+
+
+
+
+
+
+    @Autowired
+    private ISysTelecomEventService sysTelecomEventService;
+
+     //
+    @RequestMapping("/ListAllEvent")
+    public R SiZhuList(@RequestBody Map<String, Object> params1) throws ClientException, ParseException {
+        return R.ok("请求成功").put("data", getAllKindEventList( params1  )).put("total" , CountTimes(params1));
+    }
+
+
+    //返回所有的事件 的集合  包括死猪和洗消和大门 --分页参数
+    public GeneralResponse getAllKindEventList( Map<String, Object> params1) throws ClientException {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar c = Calendar.getInstance();
+        Date date = new Date();
+        c.setTime(date);
+        c.set(Calendar.HOUR, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+        Date A = c.getTime();
+        String formatA = format.format(A);
+        c.set(Calendar.HOUR, +24);
+        Date d = c.getTime();
+        String formatD = format.format(d);
+        Map<String, Object> params = new HashMap<>();
+        params.put("alarmStartDateString",formatA);
+        params.put("alarmEndDateString",formatD);
+        if (StringUtilsWork.isNotEmpty( (String) params1.get("alarmStartDateString"))){
+            params.put("alarmStartDateString",(String) params1.get("alarmStartDateString"));
+            params.put("alarmEndDateString",(String) params1.get("alarmEndDateString"));
+        }
+        params.put("pageNum",(Integer)params1.get("pageNum"));
+        params.put("pageSize",(Integer)params1.get("pageSize"));
+        params.put("alarmType",303);
+        params.put("dbType",0);
+        params.put("deviceCategory",1);
+        String[]  nodeCodeList=  new String[68];
+        nodeCodeList[0]="1002874$1$0$0";
+        nodeCodeList[1]="1002875$1$0$0";
+        nodeCodeList[0]="1002876$1$0$0";
+        nodeCodeList[0]="1002877$1$0$0";
+        nodeCodeList[0]="1002878$1$0$0";
+        nodeCodeList[0]="1002879$1$0$0";
+        nodeCodeList[0]="1002880$1$0$0";
+        nodeCodeList[0]="1002881$1$0$0";
+        nodeCodeList[0]="1002882$1$0$0";
+        nodeCodeList[0]="1002883$1$0$0";
+        nodeCodeList[10]="1002884$1$0$0";
+        nodeCodeList[11]="1002885$1$0$0";
+        nodeCodeList[12]="1002886$1$0$0";
+        nodeCodeList[13]="1002887$1$0$0";
+        nodeCodeList[14]="1002888$1$0$0";
+        nodeCodeList[15]="1002889$1$0$0";
+        nodeCodeList[16]="1002890$1$0$0";
+        nodeCodeList[17]="1002891$1$0$0";
+        nodeCodeList[18]="1002892$1$0$0";
+        nodeCodeList[19]="1002893$1$0$0";
+        nodeCodeList[20]="1002894$1$0$0";
+        nodeCodeList[21]="1002895$1$0$0";
+        nodeCodeList[22]="1002896$1$0$0";
+        nodeCodeList[23]="1002897$1$0$0";
+        nodeCodeList[24]="1002898$1$0$0";
+        nodeCodeList[25]="1002899$1$0$0";
+        nodeCodeList[26]="1002900$1$0$0";
+        nodeCodeList[27]= "1002901$1$0$0";
+        nodeCodeList[28]="1002902$1$0$0";
+        nodeCodeList[29]="1002903$1$0$0";
+        nodeCodeList[30]="1002904$1$0$0";
+        nodeCodeList[31]="1002905$1$0$0";
+        nodeCodeList[32]="1002906$1$0$0";
+        nodeCodeList[33]="1002907$1$0$0";
+        nodeCodeList[34]="1002908$1$0$0";
+        nodeCodeList[35]="1002909$1$0$0";
+        nodeCodeList[36]="1002910$1$0$0";
+        nodeCodeList[37]="1002911$1$0$0";
+        nodeCodeList[38]="1002912$1$0$0";
+        nodeCodeList[39]="1002913$1$0$0";
+        nodeCodeList[40]="1002939$1$0$0";
+        nodeCodeList[41]="1002939$1$0$1";
+        nodeCodeList[42]="1002939$1$0$2";
+        nodeCodeList[43]="1002939$1$0$3";
+        nodeCodeList[44]="1002939$1$0$4";
+        nodeCodeList[45]="1002939$1$0$5";
+        nodeCodeList[46]="1002939$1$0$6";
+        nodeCodeList[47]="1002939$1$0$7";
+        nodeCodeList[48]="1002939$1$0$8";
+        nodeCodeList[49]="1002939$1$0$9";
+        nodeCodeList[50]="1002940$1$0$0";
+        nodeCodeList[51]="1002940$1$0$1";
+        nodeCodeList[52]="1002940$1$0$2";
+        nodeCodeList[53]="1002940$1$0$3";
+        nodeCodeList[54]="1002940$1$0$4";
+        nodeCodeList[55]="1002940$1$0$5";
+        nodeCodeList[56]="1002940$1$0$6";
+        nodeCodeList[57]="1002940$1$0$7";
+        nodeCodeList[58]="1002939$1$0$10";
+        nodeCodeList[59]="1002939$1$0$11";
+        nodeCodeList[60]="1002939$1$0$12";
+        nodeCodeList[61]="1002939$1$0$13";
+        nodeCodeList[62]="1002939$1$0$14";
+        nodeCodeList[63]="1002939$1$0$15";
+        //洗消
+        nodeCodeList[64]="1002871$1$0$0";
+        nodeCodeList[65]="1002872$1$0$0";
+        nodeCodeList[66]="1002873$1$0$0";
+        //大门
+        nodeCodeList[67]="1003442$1$0$0";
+
+
+        params.put("nodeCodeList",nodeCodeList);
+        // String URL = "/evo-apigw/evo-event/1.2.0/alarm-record/page"; //获取事件URL    post请求
+        String URL = "/evo-apigw/evo-event/1.2.0/alarm-record/page";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        String NewUrl = URL;
+        //这种已经在配置文件里面安排了账号ip以及密码
+        GeneralRequest generalRequest = new GeneralRequest(NewUrl, Method.POST);
+        System.out.println(NewUrl);
+        generalRequest.header("Content-Type", " application/json");
+        generalRequest.body(JSON.toJSONString(params));
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        return    generalResponse;
+    }
+
+
+    public String CountTimes(   Map<String, Object> params1 ) throws ClientException {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar c = Calendar.getInstance();
+        Date date = new Date();
+        c.setTime(date);
+        c.set(Calendar.HOUR, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+        Date A = c.getTime();
+        String formatA = format.format(A);
+        c.set(Calendar.HOUR, +24);
+        Date d = c.getTime();
+        String formatD = format.format(d);
+        Map<String, Object> params = new HashMap<>();
+        params.put("alarmStartDateString",formatA);
+        params.put("alarmEndDateString",formatD);
+        if (StringUtilsWork.isNotEmpty( (String) params1.get("alarmStartDateString"))){
+            params.put("alarmStartDateString",(String) params1.get("alarmStartDateString"));
+            params.put("alarmEndDateString",(String) params1.get("alarmEndDateString"));
+        }
+        params.put("alarmType",303);
+        params.put("dbType",0);
+        params.put("deviceCategory",1);
+        String[]  nodeCodeList=  new String[68];
+        nodeCodeList[0]="1002874$1$0$0";
+        nodeCodeList[1]="1002875$1$0$0";
+        nodeCodeList[0]="1002876$1$0$0";
+        nodeCodeList[0]="1002877$1$0$0";
+        nodeCodeList[0]="1002878$1$0$0";
+        nodeCodeList[0]="1002879$1$0$0";
+        nodeCodeList[0]="1002880$1$0$0";
+        nodeCodeList[0]="1002881$1$0$0";
+        nodeCodeList[0]="1002882$1$0$0";
+        nodeCodeList[0]="1002883$1$0$0";
+        nodeCodeList[10]="1002884$1$0$0";
+        nodeCodeList[11]="1002885$1$0$0";
+        nodeCodeList[12]="1002886$1$0$0";
+        nodeCodeList[13]="1002887$1$0$0";
+        nodeCodeList[14]="1002888$1$0$0";
+        nodeCodeList[15]="1002889$1$0$0";
+        nodeCodeList[16]="1002890$1$0$0";
+        nodeCodeList[17]="1002891$1$0$0";
+        nodeCodeList[18]="1002892$1$0$0";
+        nodeCodeList[19]="1002893$1$0$0";
+        nodeCodeList[20]="1002894$1$0$0";
+        nodeCodeList[21]="1002895$1$0$0";
+        nodeCodeList[22]="1002896$1$0$0";
+        nodeCodeList[23]="1002897$1$0$0";
+        nodeCodeList[24]="1002898$1$0$0";
+        nodeCodeList[25]="1002899$1$0$0";
+        nodeCodeList[26]="1002900$1$0$0";
+        nodeCodeList[27]= "1002901$1$0$0";
+        nodeCodeList[28]="1002902$1$0$0";
+        nodeCodeList[29]="1002903$1$0$0";
+        nodeCodeList[30]="1002904$1$0$0";
+        nodeCodeList[31]="1002905$1$0$0";
+        nodeCodeList[32]="1002906$1$0$0";
+        nodeCodeList[33]="1002907$1$0$0";
+        nodeCodeList[34]="1002908$1$0$0";
+        nodeCodeList[35]="1002909$1$0$0";
+        nodeCodeList[36]="1002910$1$0$0";
+        nodeCodeList[37]="1002911$1$0$0";
+        nodeCodeList[38]="1002912$1$0$0";
+        nodeCodeList[39]="1002913$1$0$0";
+        nodeCodeList[40]="1002939$1$0$0";
+        nodeCodeList[41]="1002939$1$0$1";
+        nodeCodeList[42]="1002939$1$0$2";
+        nodeCodeList[43]="1002939$1$0$3";
+        nodeCodeList[44]="1002939$1$0$4";
+        nodeCodeList[45]="1002939$1$0$5";
+        nodeCodeList[46]="1002939$1$0$6";
+        nodeCodeList[47]="1002939$1$0$7";
+        nodeCodeList[48]="1002939$1$0$8";
+        nodeCodeList[49]="1002939$1$0$9";
+        nodeCodeList[50]="1002940$1$0$0";
+        nodeCodeList[51]="1002940$1$0$1";
+        nodeCodeList[52]="1002940$1$0$2";
+        nodeCodeList[53]="1002940$1$0$3";
+        nodeCodeList[54]="1002940$1$0$4";
+        nodeCodeList[55]="1002940$1$0$5";
+        nodeCodeList[56]="1002940$1$0$6";
+        nodeCodeList[57]="1002940$1$0$7";
+        nodeCodeList[58]="1002939$1$0$10";
+        nodeCodeList[59]="1002939$1$0$11";
+        nodeCodeList[60]="1002939$1$0$12";
+        nodeCodeList[61]="1002939$1$0$13";
+        nodeCodeList[62]="1002939$1$0$14";
+        nodeCodeList[63]="1002939$1$0$15";
+        //洗消
+        nodeCodeList[64]="1002871$1$0$0";
+        nodeCodeList[65]="1002872$1$0$0";
+        nodeCodeList[66]="1002873$1$0$0";
+        //大门
+        nodeCodeList[67]="1003442$1$0$0";
+
+        params.put("nodeCodeList",nodeCodeList);
+        String URL = "/evo-apigw/evo-event/1.0.0/alarm-record/count-num";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        String NewUrl = URL ;
+        System.out.println("开始执行");
+        //这种已经在配置文件里面安排了账号ip以及密码
+        GeneralRequest generalRequest = new GeneralRequest(NewUrl, Method.POST);
+        System.out.println(NewUrl);
+        generalRequest.header("Content-Type", " application/json");
+        System.out.println(JSON.toJSONString(params));
+        //里面是
+        generalRequest.body(JSON.toJSONString(params));
+        //发起请求处理应答
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        System.out.println("执行结束");
+        JSONObject jsonObject = JSONObject.fromObject(generalResponse.getResult());
+        Object data = jsonObject.get("data");
+        JSONObject jsonObject1 = JSONObject.fromObject(data);
+        System.out.println(jsonObject1);
+        return jsonObject1.get("value").toString();
+    }
+}
+

+ 40 - 42
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/screen/ScreenSiZhuController.java

@@ -43,6 +43,8 @@ public class ScreenSiZhuController {
 
 
 
+
+
     /**
      * xuyao   直接都写在这里了
      *
@@ -58,8 +60,6 @@ public class ScreenSiZhuController {
     }
 
 
-
-
          //过去七天的值
         public String getPastSevenDay(  ) throws ClientException {
             GetResponse getResponse = new GetResponse();
@@ -228,42 +228,42 @@ public class ScreenSiZhuController {
         params.put("dbType",0);
         params.put("deviceCategory",1);
         String[]  nodeCodeList=  new String[64];
-        nodeCodeList[0]="1002874$1$0$0"    ;
-        nodeCodeList[1]="1002875$1$0$0"      ;
-        nodeCodeList[0]="1002876$1$0$0"     ;
-        nodeCodeList[0]="1002877$1$0$0"       ;
-        nodeCodeList[0]="1002878$1$0$0"      ;
-        nodeCodeList[0]="1002879$1$0$0"     ;
-        nodeCodeList[0]="1002880$1$0$0"      ;
-        nodeCodeList[0]="1002881$1$0$0"      ;
-        nodeCodeList[0]="1002882$1$0$0"     ;
-        nodeCodeList[0]="1002883$1$0$0"    ;
-        nodeCodeList[10]="1002884$1$0$0"   ;
-        nodeCodeList[11]="1002885$1$0$0"   ;
-        nodeCodeList[12]="1002886$1$0$0"      ;
-        nodeCodeList[13]="1002887$1$0$0"     ;
-        nodeCodeList[14]="1002888$1$0$0"     ;
-        nodeCodeList[15]="1002889$1$0$0"   ;
-        nodeCodeList[16]="1002890$1$0$0"   ;
-        nodeCodeList[17]="1002891$1$0$0"   ;
-        nodeCodeList[18]="1002892$1$0$0"   ;
-        nodeCodeList[19]="1002893$1$0$0"     ;
-        nodeCodeList[20]="1002894$1$0$0"     ;
-        nodeCodeList[21]="1002895$1$0$0"    ;
-        nodeCodeList[22]="1002896$1$0$0"      ;
-        nodeCodeList[23]="1002897$1$0$0"      ;
-        nodeCodeList[24]="1002898$1$0$0"   ;
-        nodeCodeList[25]="1002899$1$0$0"     ;
-        nodeCodeList[26]="1002900$1$0$0"      ;
-        nodeCodeList[27]= "1002901$1$0$0"     ;
-        nodeCodeList[28]="1002902$1$0$0"       ;
-        nodeCodeList[29]="1002903$1$0$0"     ;
-        nodeCodeList[30]="1002904$1$0$0"     ;
-        nodeCodeList[31]="1002905$1$0$0"    ;
-        nodeCodeList[32]="1002906$1$0$0"     ;
-        nodeCodeList[33]="1002907$1$0$0"     ;
-        nodeCodeList[34]="1002908$1$0$0"     ;
-        nodeCodeList[35]="1002909$1$0$0"    ;
+        nodeCodeList[0]="1002874$1$0$0";
+        nodeCodeList[1]="1002875$1$0$0";
+        nodeCodeList[0]="1002876$1$0$0";
+        nodeCodeList[0]="1002877$1$0$0";
+        nodeCodeList[0]="1002878$1$0$0";
+        nodeCodeList[0]="1002879$1$0$0";
+        nodeCodeList[0]="1002880$1$0$0";
+        nodeCodeList[0]="1002881$1$0$0";
+        nodeCodeList[0]="1002882$1$0$0";
+        nodeCodeList[0]="1002883$1$0$0";
+        nodeCodeList[10]="1002884$1$0$0";
+        nodeCodeList[11]="1002885$1$0$0";
+        nodeCodeList[12]="1002886$1$0$0";
+        nodeCodeList[13]="1002887$1$0$0";
+        nodeCodeList[14]="1002888$1$0$0";
+        nodeCodeList[15]="1002889$1$0$0";
+        nodeCodeList[16]="1002890$1$0$0";
+        nodeCodeList[17]="1002891$1$0$0";
+        nodeCodeList[18]="1002892$1$0$0";
+        nodeCodeList[19]="1002893$1$0$0";
+        nodeCodeList[20]="1002894$1$0$0";
+        nodeCodeList[21]="1002895$1$0$0";
+        nodeCodeList[22]="1002896$1$0$0";
+        nodeCodeList[23]="1002897$1$0$0";
+        nodeCodeList[24]="1002898$1$0$0";
+        nodeCodeList[25]="1002899$1$0$0";
+        nodeCodeList[26]="1002900$1$0$0";
+        nodeCodeList[27]= "1002901$1$0$0";
+        nodeCodeList[28]="1002902$1$0$0";
+        nodeCodeList[29]="1002903$1$0$0";
+        nodeCodeList[30]="1002904$1$0$0";
+        nodeCodeList[31]="1002905$1$0$0";
+        nodeCodeList[32]="1002906$1$0$0";
+        nodeCodeList[33]="1002907$1$0$0";
+        nodeCodeList[34]="1002908$1$0$0";
+        nodeCodeList[35]="1002909$1$0$0";
         nodeCodeList[36]="1002910$1$0$0"     ;
         nodeCodeList[37]="1002911$1$0$0"    ;
         nodeCodeList[38]="1002912$1$0$0"    ;
@@ -296,7 +296,7 @@ public class ScreenSiZhuController {
        // String URL = "/evo-apigw/evo-event/1.2.0/alarm-record/page"; //获取事件URL    post请求
         String URL = "/evo-apigw/evo-event/1.2.0/alarm-record/page";  //获取事件URL    post请求
         IClient iClient = new DefaultClient();
-        String NewUrl = URL ;
+        String NewUrl = URL;
         //这种已经在配置文件里面安排了账号ip以及密码
         GeneralRequest generalRequest = new GeneralRequest(NewUrl, Method.POST);
         System.out.println(NewUrl);
@@ -305,9 +305,7 @@ public class ScreenSiZhuController {
         GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
         return    generalResponse;
     }
-
-
-    }
+}
 
 
 

+ 124 - 179
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/util/GetResponse.java

@@ -9,9 +9,6 @@ import com.dahuatech.icc.oauth.model.v202010.GeneralRequest;
 import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
 import net.sf.json.JSONObject;
 import com.huimv.produce.dhicc.result.R;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
@@ -20,7 +17,6 @@ public class GetResponse {
 
 
 
-
     /**
      *  //查车辆通行数量的接口**不分进出
      * @param begin  开始时间
@@ -73,8 +69,10 @@ public class GetResponse {
 
 
 
+
+
     /**
-     *  //查车辆通行数量的接口**进入的记录
+     *  //查车辆通行数量的接口**进入的记录----车辆闸机
      * @param begin  开始时间
      * @param end  结束时间
      * @return
@@ -100,12 +98,8 @@ public class GetResponse {
 
 
 
-
-
-
-
     /**
-     *  //查人员通过过去几个小时的接口---正常通过
+     *  //查人员通过过去几个小时的接口---正常通过次数
      * @param begin   开始时间
      * @param end     结束时间
      * @return
@@ -140,12 +134,8 @@ public class GetResponse {
 
 
 
-
-
-
-
     /**
-     *  //查人员通过过去几个小时的接口---异常通过
+     *  //查人员通过过去几个小时的接口---异常通过次数接口
      * @param begin   开始时间
      * @param end     结束时间
      * @return
@@ -181,8 +171,6 @@ public class GetResponse {
 
 
 
-
-
     /**
      *  //查洗消 ---时间次数的接口-----
      * @param begin   开始时间
@@ -239,7 +227,7 @@ public class GetResponse {
         params.put("dbType",0);
         params.put("deviceCategory",1);
         String[]  nodeCodeList=  new String[1];
-        nodeCodeList[0]="1003442$1$0$0";
+        nodeCodeList[0]="1003442$1$0$0";   //大门的通道
         params.put("nodeCodeList",nodeCodeList);
         String URL = "/evo-apigw/evo-event/1.0.0/alarm-record/count-num";  //获取事件URL    post请求
         IClient iClient = new DefaultClient();
@@ -280,58 +268,58 @@ public class GetResponse {
         params.put("dbType",0);
         params.put("deviceCategory",1);
         String[]  nodeCodeList=  new String[64];
-        nodeCodeList[0]="1002874$1$0$0"    ;
-        nodeCodeList[1]="1002875$1$0$0"      ;
-        nodeCodeList[0]="1002876$1$0$0"     ;
-        nodeCodeList[0]="1002877$1$0$0"       ;
-        nodeCodeList[0]="1002878$1$0$0"      ;
-        nodeCodeList[0]="1002879$1$0$0"     ;
-        nodeCodeList[0]="1002880$1$0$0"      ;
-        nodeCodeList[0]="1002881$1$0$0"      ;
-        nodeCodeList[0]="1002882$1$0$0"     ;
-        nodeCodeList[0]="1002883$1$0$0"    ;
-        nodeCodeList[10]="1002884$1$0$0"   ;
-        nodeCodeList[11]="1002885$1$0$0"   ;
-        nodeCodeList[12]="1002886$1$0$0"      ;
-        nodeCodeList[13]="1002887$1$0$0"     ;
-        nodeCodeList[14]="1002888$1$0$0"     ;
-        nodeCodeList[15]="1002889$1$0$0"   ;
-        nodeCodeList[16]="1002890$1$0$0"   ;
-        nodeCodeList[17]="1002891$1$0$0"   ;
-        nodeCodeList[18]="1002892$1$0$0"   ;
-        nodeCodeList[19]="1002893$1$0$0"     ;
-        nodeCodeList[20]="1002894$1$0$0"     ;
-        nodeCodeList[21]="1002895$1$0$0"    ;
-        nodeCodeList[22]="1002896$1$0$0"      ;
-        nodeCodeList[23]="1002897$1$0$0"      ;
-        nodeCodeList[24]="1002898$1$0$0"   ;
-        nodeCodeList[25]="1002899$1$0$0"     ;
-        nodeCodeList[26]="1002900$1$0$0"      ;
-        nodeCodeList[27]= "1002901$1$0$0"     ;
-        nodeCodeList[28]="1002902$1$0$0"       ;
-        nodeCodeList[29]="1002903$1$0$0"     ;
-        nodeCodeList[30]="1002904$1$0$0"     ;
-        nodeCodeList[31]="1002905$1$0$0"    ;
-        nodeCodeList[32]="1002906$1$0$0"     ;
-        nodeCodeList[33]="1002907$1$0$0"     ;
-        nodeCodeList[34]="1002908$1$0$0"     ;
-        nodeCodeList[35]="1002909$1$0$0"    ;
-        nodeCodeList[36]="1002910$1$0$0"     ;
-        nodeCodeList[37]="1002911$1$0$0"    ;
-        nodeCodeList[38]="1002912$1$0$0"    ;
-        nodeCodeList[39]="1002913$1$0$0"    ;
-        nodeCodeList[40]="1002939$1$0$0"     ;
-        nodeCodeList[41]="1002939$1$0$1"   ;
-        nodeCodeList[42]="1002939$1$0$2"   ;
-        nodeCodeList[43]="1002939$1$0$3"    ;
-        nodeCodeList[44]="1002939$1$0$4"    ;
-        nodeCodeList[45]="1002939$1$0$5"     ;
-        nodeCodeList[46]="1002939$1$0$6"      ;
-        nodeCodeList[47]="1002939$1$0$7"   ;
-        nodeCodeList[48]="1002939$1$0$8"   ;
-        nodeCodeList[49]="1002939$1$0$9"    ;
-        nodeCodeList[50]="1002940$1$0$0"     ;
-        nodeCodeList[51]="1002940$1$0$1"   ;
+        nodeCodeList[0]="1002874$1$0$0";
+        nodeCodeList[1]="1002875$1$0$0";
+        nodeCodeList[0]="1002876$1$0$0";
+        nodeCodeList[0]="1002877$1$0$0";
+        nodeCodeList[0]="1002878$1$0$0";
+        nodeCodeList[0]="1002879$1$0$0";
+        nodeCodeList[0]="1002880$1$0$0";
+        nodeCodeList[0]="1002881$1$0$0";
+        nodeCodeList[0]="1002882$1$0$0";
+        nodeCodeList[0]="1002883$1$0$0";
+        nodeCodeList[10]="1002884$1$0$0";
+        nodeCodeList[11]="1002885$1$0$0";
+        nodeCodeList[12]="1002886$1$0$0";
+        nodeCodeList[13]="1002887$1$0$0";
+        nodeCodeList[14]="1002888$1$0$0";
+        nodeCodeList[15]="1002889$1$0$0";
+        nodeCodeList[16]="1002890$1$0$0";
+        nodeCodeList[17]="1002891$1$0$0";
+        nodeCodeList[18]="1002892$1$0$0";
+        nodeCodeList[19]="1002893$1$0$0";
+        nodeCodeList[20]="1002894$1$0$0";
+        nodeCodeList[21]="1002895$1$0$0";
+        nodeCodeList[22]="1002896$1$0$0";
+        nodeCodeList[23]="1002897$1$0$0";
+        nodeCodeList[24]="1002898$1$0$0";
+        nodeCodeList[25]="1002899$1$0$0";
+        nodeCodeList[26]="1002900$1$0$0";
+        nodeCodeList[27]="1002901$1$0$0";
+        nodeCodeList[28]="1002902$1$0$0";
+        nodeCodeList[29]="1002903$1$0$0";
+        nodeCodeList[30]="1002904$1$0$0";
+        nodeCodeList[31]="1002905$1$0$0";
+        nodeCodeList[32]="1002906$1$0$0";
+        nodeCodeList[33]="1002907$1$0$0";
+        nodeCodeList[34]="1002908$1$0$0";
+        nodeCodeList[35]="1002909$1$0$0";
+        nodeCodeList[36]="1002910$1$0$0";
+        nodeCodeList[37]="1002911$1$0$0";
+        nodeCodeList[38]="1002912$1$0$0";
+        nodeCodeList[39]="1002913$1$0$0";
+        nodeCodeList[40]="1002939$1$0$0";
+        nodeCodeList[41]="1002939$1$0$1";
+        nodeCodeList[42]="1002939$1$0$2";
+        nodeCodeList[43]="1002939$1$0$3";
+        nodeCodeList[44]="1002939$1$0$4";
+        nodeCodeList[45]="1002939$1$0$5";
+        nodeCodeList[46]="1002939$1$0$6";
+        nodeCodeList[47]="1002939$1$0$7";
+        nodeCodeList[48]="1002939$1$0$8";
+        nodeCodeList[49]="1002939$1$0$9";
+        nodeCodeList[50]="1002940$1$0$0";
+        nodeCodeList[51]="1002940$1$0$1";
         nodeCodeList[52]="1002940$1$0$2";
         nodeCodeList[53]="1002940$1$0$3";
         nodeCodeList[54]="1002940$1$0$4";
@@ -370,28 +358,8 @@ public class GetResponse {
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     /**
-     *  //查洗消时间次数的接口-----
+     *  //查洗消死猪事件的时间-----次数的接口-----
      * @param begin   开始时间
      * @param end     结束时间
      * @return
@@ -405,70 +373,71 @@ public class GetResponse {
         params.put("dbType",0);
         params.put("deviceCategory",1);
         String[]  nodeCodeList=  new String[64];
-        nodeCodeList[0]=     "1002874$1$0$0"    ;
-        nodeCodeList[1]=   "1002875$1$0$0"      ;
-        nodeCodeList[2]=    "1002876$1$0$0"     ;
-        nodeCodeList[3]=  "1002877$1$0$0"       ;
-        nodeCodeList[4]=   "1002878$1$0$0"      ;
-        nodeCodeList[5]=    "1002879$1$0$0"     ;
-        nodeCodeList[6]=   "1002880$1$0$0"      ;
-        nodeCodeList[7]=   "1002881$1$0$0"      ;
-        nodeCodeList[8]=    "1002882$1$0$0"     ;
-        nodeCodeList[9]=     "1002883$1$0$0"    ;
-        nodeCodeList[10]=      "1002884$1$0$0"   ;
-        nodeCodeList[11]=      "1002885$1$0$0"   ;
-        nodeCodeList[12]=   "1002886$1$0$0"      ;
-        nodeCodeList[13]=    "1002887$1$0$0"     ;
-        nodeCodeList[14]=    "1002888$1$0$0"     ;
-        nodeCodeList[15]=      "1002889$1$0$0"   ;
-        nodeCodeList[16]=      "1002890$1$0$0"   ;
-        nodeCodeList[17]=      "1002891$1$0$0"   ;
-        nodeCodeList[18]=      "1002892$1$0$0"   ;
-        nodeCodeList[19]=    "1002893$1$0$0"     ;
-        nodeCodeList[20]=    "1002894$1$0$0"     ;
-        nodeCodeList[21]=     "1002895$1$0$0"    ;
-        nodeCodeList[22]=   "1002896$1$0$0"      ;
-        nodeCodeList[23]=   "1002897$1$0$0"      ;
-        nodeCodeList[24]=      "1002898$1$0$0"   ;
-        nodeCodeList[25]=    "1002899$1$0$0"     ;
-        nodeCodeList[26]=   "1002900$1$0$0"      ;
-        nodeCodeList[27]=    "1002901$1$0$0"     ;
-        nodeCodeList[28]=  "1002902$1$0$0"       ;
-        nodeCodeList[29]=    "1002903$1$0$0"     ;
-        nodeCodeList[30]=    "1002904$1$0$0"     ;
-        nodeCodeList[31]=     "1002905$1$0$0"    ;
-        nodeCodeList[32]=    "1002906$1$0$0"     ;
-        nodeCodeList[33]=    "1002907$1$0$0"     ;
-        nodeCodeList[34]=    "1002908$1$0$0"     ;
-        nodeCodeList[35]=     "1002909$1$0$0"    ;
-        nodeCodeList[36]=    "1002910$1$0$0"     ;
-        nodeCodeList[37]=     "1002911$1$0$0"    ;
-        nodeCodeList[38]=     "1002912$1$0$0"    ;
-        nodeCodeList[39]=     "1002913$1$0$0"    ;
-        nodeCodeList[40]=  "1002939$1$0$0"     ;
-        nodeCodeList[41]=    "1002939$1$0$1"   ;
-        nodeCodeList[42]=    "1002939$1$0$2"   ;
-        nodeCodeList[43]=   "1002939$1$0$3"    ;
-        nodeCodeList[44]=   "1002939$1$0$4"    ;
-        nodeCodeList[45]=  "1002939$1$0$5"     ;
-        nodeCodeList[46]= "1002939$1$0$6"      ;
-        nodeCodeList[47]=    "1002939$1$0$7"   ;
-        nodeCodeList[48]=    "1002939$1$0$8"   ;
-        nodeCodeList[49]=   "1002939$1$0$9"    ;
-        nodeCodeList[50]=  "1002940$1$0$0"     ;
-        nodeCodeList[51]=    "1002940$1$0$1"   ;
-        nodeCodeList[52]= "1002940$1$0$2"      ;
-        nodeCodeList[53]=   "1002940$1$0$3"  ;
-        nodeCodeList[54]=   "1002940$1$0$4"  ;
-        nodeCodeList[55]=   "1002940$1$0$5"  ;
-        nodeCodeList[56]=   "1002940$1$0$6"  ;
-        nodeCodeList[57]=  "1002940$1$0$7"   ;
-        nodeCodeList[58]=    "1002939$1$0$10" ;
-        nodeCodeList[59]=  "1002939$1$0$11"   ;
-        nodeCodeList[60]=   "1002939$1$0$12"  ;
-        nodeCodeList[61]=     "1002939$1$0$13";
-        nodeCodeList[62]=  "1002939$1$0$14"   ;
-        nodeCodeList[63]=  "1002939$1$0$15"   ;
+        nodeCodeList[0]="1002874$1$0$0";
+        nodeCodeList[1]="1002875$1$0$0";
+        nodeCodeList[0]="1002876$1$0$0";
+        nodeCodeList[0]="1002877$1$0$0";
+        nodeCodeList[0]="1002878$1$0$0";
+        nodeCodeList[0]="1002879$1$0$0";
+        nodeCodeList[0]="1002880$1$0$0";
+        nodeCodeList[0]="1002881$1$0$0";
+        nodeCodeList[0]="1002882$1$0$0";
+        nodeCodeList[0]="1002883$1$0$0";
+        nodeCodeList[10]="1002884$1$0$0";
+        nodeCodeList[11]="1002885$1$0$0";
+        nodeCodeList[12]="1002886$1$0$0";
+        nodeCodeList[13]="1002887$1$0$0";
+        nodeCodeList[14]="1002888$1$0$0";
+        nodeCodeList[15]="1002889$1$0$0";
+        nodeCodeList[16]="1002890$1$0$0";
+        nodeCodeList[17]="1002891$1$0$0";
+        nodeCodeList[18]="1002892$1$0$0";
+        nodeCodeList[19]="1002893$1$0$0";
+        nodeCodeList[20]="1002894$1$0$0";
+        nodeCodeList[21]="1002895$1$0$0";
+        nodeCodeList[22]="1002896$1$0$0";
+        nodeCodeList[23]="1002897$1$0$0";
+        nodeCodeList[24]="1002898$1$0$0";
+        nodeCodeList[25]="1002899$1$0$0";
+        nodeCodeList[26]="1002900$1$0$0";
+        nodeCodeList[27]="1002901$1$0$0";
+        nodeCodeList[28]="1002902$1$0$0";
+        nodeCodeList[29]="1002903$1$0$0";
+        nodeCodeList[30]="1002904$1$0$0";
+        nodeCodeList[31]="1002905$1$0$0";
+        nodeCodeList[32]="1002906$1$0$0";
+        nodeCodeList[33]="1002907$1$0$0";
+        nodeCodeList[34]="1002908$1$0$0";
+        nodeCodeList[35]="1002909$1$0$0";
+        nodeCodeList[36]="1002910$1$0$0";
+        nodeCodeList[37]="1002911$1$0$0";
+        nodeCodeList[38]="1002912$1$0$0";
+        nodeCodeList[39]="1002913$1$0$0";
+        nodeCodeList[40]="1002939$1$0$0";
+        nodeCodeList[41]="1002939$1$0$1";
+        nodeCodeList[42]="1002939$1$0$2";
+        nodeCodeList[43]="1002939$1$0$3";
+        nodeCodeList[44]="1002939$1$0$4";
+        nodeCodeList[45]="1002939$1$0$5";
+        nodeCodeList[46]="1002939$1$0$6";
+        nodeCodeList[47]="1002939$1$0$7";
+        nodeCodeList[48]="1002939$1$0$8";
+        nodeCodeList[49]="1002939$1$0$9";
+        nodeCodeList[50]="1002940$1$0$0";
+        nodeCodeList[51]="1002940$1$0$1";
+        nodeCodeList[52]="1002940$1$0$2";
+        nodeCodeList[53]="1002940$1$0$3";
+        nodeCodeList[54]="1002940$1$0$4";
+        nodeCodeList[55]="1002940$1$0$5";
+        nodeCodeList[56]="1002940$1$0$6";
+        nodeCodeList[57]="1002940$1$0$7";
+        nodeCodeList[58]="1002939$1$0$10";
+        nodeCodeList[59]="1002939$1$0$11";
+        nodeCodeList[60]="1002939$1$0$12";
+        nodeCodeList[61]="1002939$1$0$13";
+        nodeCodeList[62]="1002939$1$0$14";
+        nodeCodeList[63]="1002939$1$0$15";
+
         params.put("nodeCodeList",nodeCodeList);
         String URL = "/evo-apigw/evo-event/1.0.0/alarm-record/count-num";  //获取事件URL    post请求
         IClient iClient = new DefaultClient();
@@ -495,30 +464,6 @@ public class GetResponse {
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     public Object SendMassagePost(String param , String Url , String chooseMethod   ) throws ClientException {
         IClient iClient = new DefaultClient();
         System.out.println("开始执行");

+ 376 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/util/HttpClient.java

@@ -0,0 +1,376 @@
+package com.huimv.produce.dhicc.util;
+
+
+import org.apache.commons.collections.MapUtils;
+import org.apache.http.*;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.*;
+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.entity.mime.HttpMultipartMode;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.protocol.HTTP;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.apache.http.util.EntityUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.net.ssl.SSLContext;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/*****
+ * @Author:  yangdi  hm
+ * @Description: entity
+ ****/
+public   class HttpClient {
+    private String url;
+    private Map<String, String> param;
+    private int statusCode;
+    private String content;
+    private String xmlParam;
+    private boolean isHttps;
+
+    public boolean isHttps() {
+        return isHttps;
+    }
+
+    public  void   setHttps(boolean isHttps) {
+        this.isHttps = isHttps;
+    }
+
+    public String getXmlParam() {
+        return xmlParam;
+    }
+
+    public void setXmlParam(String xmlParam) {
+        this.xmlParam = xmlParam;
+    }
+
+    public HttpClient(String url, Map<String, String> param) {
+        this.url = url;
+        this.param = param;
+    }
+
+
+
+    public HttpClient(String url) {
+        this.url = url;
+    }
+
+    public void setParameter(Map<String, String> map) {
+        param = map;
+    }
+
+
+
+    public void addParameter(String key, String value) {
+        if (param == null)
+            param = new HashMap<String, String>();
+        param.put(key, value);
+    }
+
+
+
+    public void post() throws ClientProtocolException, IOException {
+        HttpPost http = new HttpPost(url);
+        setEntity(http);
+        execute(http);
+    }
+
+    public void put() throws ClientProtocolException, IOException {
+        HttpPut http = new HttpPut(url);
+        setEntity(http);
+        execute(http);
+    }
+
+
+
+    public void get() throws ClientProtocolException, IOException {
+        if (param != null) {
+            StringBuilder url = new StringBuilder(this.url);
+            boolean isFirst = true;
+            for (String key : param.keySet()) {
+                if (isFirst) {
+                    url.append("?");
+                }else {
+                    url.append("&");
+                }
+                url.append(key).append("=").append(param.get(key));
+            }
+            this.url = url.toString();
+        }
+        HttpGet http = new HttpGet(url);
+        execute(http);
+    }
+
+    /**
+     * set http post,put param
+     */
+    private void setEntity(HttpEntityEnclosingRequestBase http) {
+        if (param != null) {
+            List<NameValuePair> nvps = new LinkedList<NameValuePair>();
+            for (String key : param.keySet()) {
+                nvps.add(new BasicNameValuePair(key, param.get(key))); // 参数
+            }
+            http.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); // 设置参数
+        }
+        if (xmlParam != null) {
+            http.setEntity(new StringEntity(xmlParam, Consts.UTF_8));
+        }
+    }
+
+    private void execute(HttpUriRequest http) throws ClientProtocolException,
+            IOException {
+        CloseableHttpClient httpClient = null;
+        try {
+            if (isHttps) {
+                SSLContext sslContext = new SSLContextBuilder()
+                        .loadTrustMaterial(null, new TrustStrategy() {
+                            // 信任所有
+                            @Override
+                            public boolean isTrusted(X509Certificate[] chain,
+                                                     String authType)
+                                    throws CertificateException {
+                                return true;
+                            }
+                        }).build();
+                SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
+                        sslContext);
+                httpClient = HttpClients.custom().setSSLSocketFactory(sslsf)
+                        .build();
+            } else {
+                httpClient = HttpClients.createDefault();
+            }
+            CloseableHttpResponse response = httpClient.execute(http);
+            try {
+                if (response != null) {
+                    if (response.getStatusLine() != null) {
+                        statusCode = response.getStatusLine().getStatusCode();
+                    }
+                    HttpEntity entity = response.getEntity();
+                    // 响应内容
+                    content = EntityUtils.toString(entity, Consts.UTF_8);
+                }
+            } finally {
+                response.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            httpClient.close();
+        }
+    }
+
+
+    public static String httpClientPostSetBody(String url, Map<String, String> parmaMap1) throws IOException {
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        String result = "";
+        HttpPost httpPost= new  HttpPost(url);
+        MultipartEntityBuilder builder = MultipartEntityBuilder.create();
+        ContentType contentType = ContentType.create(HTTP.PLAIN_TEXT_TYPE, HTTP.UTF_8);
+        builder.setCharset(Charset.forName("utf-8"));
+        builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
+        builder.setCharset(StandardCharsets.UTF_8);
+        if (MapUtils.isNotEmpty(parmaMap1)) {
+            for (Map.Entry<String, String> entry : parmaMap1.entrySet()) {
+                System.out.println(entry.getKey());
+                System.out.println(entry.getValue());
+                builder.addTextBody(entry.getKey(), entry.getValue(), contentType);
+                System.out.println("正在循环");
+            }
+        }
+        System.out.println(builder.toString());
+        HttpEntity entity = builder.build();
+        httpPost.setEntity(entity);
+        // 执行提交
+        HttpResponse response = httpClient.execute(httpPost);
+        HttpEntity responseEntity = response.getEntity();
+        if (responseEntity != null) {
+            // 将响应内容转换为字符串
+            result = EntityUtils.toString(responseEntity, StandardCharsets.UTF_8);
+        }
+        httpClient.close();
+        return result;
+    }
+
+
+
+
+
+
+    public static String httpClientUploadFilePut(String url, Map<String, String> parma1) throws IOException {
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        String result = "";
+
+          HttpPut httpPut = new  HttpPut(url);
+            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
+            //设置文本字符编码为UTF-8
+            //中间是格式
+            //ContentType contentType= ContentType.create("application/x-www-form-urlencoded", Charset.forName("UTF-8"));
+            ContentType contentType = ContentType.create(HTTP.PLAIN_TEXT_TYPE, HTTP.UTF_8);
+            builder.setCharset(Charset.forName("utf-8"));
+            builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
+            builder.setCharset(StandardCharsets.UTF_8);
+            // 文件流  应该写成可以复用的工具类
+            //builder.addBinaryBody("photo",file.getBytes());
+           // builder.addBinaryBody(file.getName(), file.getInputStream(), ContentType.MULTIPART_FORM_DATA, file.getName());// 文件流
+            System.out.println("获取文件成功");
+            //暂时无法封装成工具
+
+            System.out.println("name="+parma1.get("name"));
+            builder.addTextBody("id", parma1.get("id"),contentType);
+            builder.addTextBody("name",parma1.get("name"),contentType);
+            builder.addTextBody("mark",parma1.get("mark"),contentType);
+            System.out.println(builder.toString());
+            HttpEntity entity = builder.build();
+            httpPut.setEntity(entity);
+            // 执行提交
+            HttpResponse response = httpClient.execute(httpPut);
+            HttpEntity responseEntity = response.getEntity();
+            if (responseEntity != null) {
+                // 将响应内容转换为字符串
+                result = EntityUtils.toString(responseEntity, StandardCharsets.UTF_8);
+            }
+                httpClient.close();
+
+        return result;
+    }
+
+
+    public static String doDelete(String url) {
+
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        HttpDelete httpDelete = new HttpDelete(url);
+        RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(35000).setConnectionRequestTimeout(35000).setSocketTimeout(60000).build();
+        httpDelete.setConfig(requestConfig);
+        httpDelete.setHeader("Content-type", "application/json");
+        httpDelete.setHeader("DataEncoding", "UTF-8");
+       // httpDelete.setHeader("token", token);
+
+        CloseableHttpResponse httpResponse = null;
+        try {
+            httpResponse = httpClient.execute(httpDelete);
+            HttpEntity entity = httpResponse.getEntity();
+            String result = EntityUtils.toString(entity);
+            return result;
+        } catch (ClientProtocolException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } finally {
+            if (httpResponse != null) {
+                try {
+                    httpResponse.close();
+                } catch (IOException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+            if (null != httpClient) {
+                try {
+                    httpClient.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return null;
+    }
+
+
+
+
+
+
+
+
+    public static String httpClientUploadFilePost(String url, MultipartFile file, Map<String, String> header, Map<String, String> parma1) throws IOException {
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        String result = "";
+        try {
+
+            HttpPost httpPost = new HttpPost(url);
+            //请求头,women
+            if (MapUtils.isNotEmpty(header)) {
+                for (Map.Entry<String, String> entry : header.entrySet()) {
+                    httpPost.addHeader(entry.getKey(), entry.getValue());
+                }
+            }
+            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
+            System.out.println("jinlai");
+            //设置文本字符编码为UTF-8
+            //中间是格式
+            //ContentType contentType= ContentType.create("application/x-www-form-urlencoded", Charset.forName("UTF-8"));
+            ContentType contentType = ContentType.create(HTTP.PLAIN_TEXT_TYPE, HTTP.UTF_8);
+            builder.setCharset(Charset.forName("utf-8"));
+            builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
+            builder.setCharset(StandardCharsets.UTF_8);
+            // 文件流  应该写成可以复用的工具类
+            //builder.addBinaryBody("photo",file.getBytes());
+            builder.addBinaryBody(file.getName(), file.getInputStream(), ContentType.MULTIPART_FORM_DATA, file.getName());// 文件流
+            System.out.println("获取文件成功");
+            //暂时无法封装成工具
+             String group_id =parma1.get("group_id");
+             String name =parma1.get("name");
+             String idcard =parma1.get("idcard");
+            System.out.println("name="+parma1.get("name"));
+        builder.addTextBody("group_id", group_id);
+        builder.addTextBody("name",parma1.get("name"),contentType);
+        builder.addTextBody("idcard",idcard);
+
+            System.out.println(builder.toString());
+            HttpEntity entity = builder.build();
+            httpPost.setEntity(entity);
+            // 执行提交
+            HttpResponse response = httpClient.execute(httpPost);
+            HttpEntity responseEntity = response.getEntity();
+            if (responseEntity != null) {
+                // 将响应内容转换为字符串
+                result = EntityUtils.toString(responseEntity, StandardCharsets.UTF_8);
+            }
+
+        } catch (Exception e) {
+            System.out.println("baocuo");
+        } finally {
+            try {
+                httpClient.close();
+
+            } catch (IOException e) {
+                System.out.println("baocu");
+            }
+        }
+        return result;
+    }
+
+
+
+
+
+
+
+
+
+
+    public int getStatusCode() {
+        return statusCode;
+    }
+    public String getContent() throws ParseException, IOException {
+        return content;
+    }
+}

+ 43 - 58
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/timer/SaveEventFromEventTimmer.java

@@ -1,58 +1,43 @@
-//package com.huimv.produce.timer;
-//
-//
-//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-//import com.huimv.produce.entity.SysTelecom;
-//import com.huimv.produce.mapper.SysTelecomMapper;
-//import com.huimv.produce.service.ISysTelecomEventService;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.scheduling.annotation.Scheduled;
-//import org.springframework.stereotype.Component;
-//
-//import java.text.SimpleDateFormat;
-//
-//
-///**
-// * 从ICC将报警信息拿到本地数据库
-// */
-//@Component
-//public class SaveEventFromEventTimmer {
-//
-//
-//
-//    @Autowired
-//    private SysTelecomMapper sysTelecomMapper;
-//
-//    @Autowired
-//    private ISysTelecomEventService sysTelecomEventService;
-//
-//
-//
-//    //每小时执行一次
-////    @Scheduled(cron = " 0 */59 * * * ?")
-//    private void updateBox() {
-//
-//
-//        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//        LambdaQueryWrapper<SysTelecom> lambdaQueryWrapper =
-//                new LambdaQueryWrapper<>();
-//
-//
-//
-//    }
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//}
+package com.huimv.produce.timer;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.huimv.produce.entity.SysTelecom;
+import com.huimv.produce.mapper.SysTelecomMapper;
+import com.huimv.produce.service.ISysTelecomEventService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * 从ICC将报警信息拿到本地数据库
+ */
+@Component
+public class SaveEventFromEventTimmer {
+
+
+    @Autowired
+    private SysTelecomMapper sysTelecomMapper;
+
+    @Autowired
+    private ISysTelecomEventService sysTelecomEventService;
+
+
+    //每小时执行一次
+//    @Scheduled(cron = " 0 */59 * * * ?")
+    private void updateBox() {
+
+
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        LambdaQueryWrapper<SysTelecom> lambdaQueryWrapper =
+                new LambdaQueryWrapper<>();
+
+
+    }
+}
+

+ 3 - 3
huimv-farm-v2/huimv-produce-warning/src/main/resources/application-dev.yml

@@ -20,6 +20,6 @@ spring:
     port: 6379
     password: hm123456
 
-#mybatis-plus:
-#  configuration:
-#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+mybatis-plus:
+   configuration:
+     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl