瀏覽代碼

图片地址

523096025 2 年之前
父節點
當前提交
0967a0cb00
共有 14 個文件被更改,包括 796 次插入40 次删除
  1. 0 3
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ClientController/ClientAllEventController.java
  2. 1 0
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ClientController/GetPicture.java
  3. 10 2
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ScreenController/ScreenAlarmCountByDay.java
  4. 12 3
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ScreenController/ScreenIndexDataController.java
  5. 12 0
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/icc/CommonConstant.java
  6. 82 0
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/ScreenTestController/ScreenAlarmCountByDayTest.java
  7. 133 0
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/ScreenTestController/ScreenCarTestController.java
  8. 88 0
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/ScreenTestController/ScreenIndexDataTestController.java
  9. 153 0
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/ScreenTestController/ScreenPersonTestController.java
  10. 196 0
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/ScreenTestController/ScreenSiZhuTestController.java
  11. 2 0
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/constant/Constant.java
  12. 0 3
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/request/ClientCarWhiteDeleteRequestCn.java
  13. 76 0
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/request/ClientSendMassageXixiaoPersonRequestSg.java
  14. 31 29
      huimv-farm-video/src/main/java/com/huimv/video/dhicc/util/GetResponse.java

+ 0 - 3
huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ClientController/ClientAllEventController.java

@@ -45,7 +45,6 @@ public class ClientAllEventController {
         return R.ok("请求成功").put("data", getEventList(params1)).put("total", CountTimes(params1));
     }
 
-
     //返回所有的事件 的集合  包括死猪和洗消和大门 --分页参数
     public GeneralResponse getEventList(Map<String, Object> params1) throws ClientException {
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -83,7 +82,6 @@ public class ClientAllEventController {
         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();
@@ -150,6 +148,5 @@ public class ClientAllEventController {
         return iClientAllEventService.getEventBySort(farmId, sort, startDateText, endDateText, pageNum, pageSize, request);
     }
 
-
 }
 

+ 1 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ClientController/GetPicture.java

@@ -131,6 +131,7 @@ public class GetPicture {
         SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null,
                 new TrustStrategy() {
                     // 信任所有
+                    @Override
                     public boolean isTrusted(X509Certificate[] chain,
                                              String authType) throws CertificateException {
                         return true;

+ 10 - 2
huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ScreenController/ScreenAlarmCountByDay.java

@@ -5,6 +5,9 @@ import com.dahuatech.icc.exception.ClientException;
 import com.huimv.video.dhicc.entity.SysTelecomEvent;
 import com.huimv.video.dhicc.result.R;
 import com.huimv.video.dhicc.service.ISysTelecomEventService;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo02;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo03;
 import com.huimv.video.dhicc.util.GetResponse;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,7 +23,12 @@ import java.util.*;
 @RequestMapping("/screen/alarmCount")
 
 public class ScreenAlarmCountByDay {
-
+    @Autowired
+    private OauthConfigBaseInfo oauthConfigBaseInfo;
+    @Autowired
+    private OauthConfigBaseInfo02 oauthConfigBaseInfo02;
+    @Autowired
+    private OauthConfigBaseInfo03 oauthConfigBaseInfo03;
     @Autowired
     private ISysTelecomEventService sysTelecomEventService;
 
@@ -47,7 +55,7 @@ public class ScreenAlarmCountByDay {
         //洗消 一周
         Map map1 = new HashMap();
         map1.put("name", "车辆洗消");
-        map1.put("value", getResponse.SendMassageXixiaoPerson(formatB, formatA));
+        map1.put("value", getResponse.SendMassageXixiaoPerson(formatB, formatA,farmId,oauthConfigBaseInfo));
         //人员通过一周---异常
         Map map2 = new HashMap();
         map2.put("name", "人员违规");

+ 12 - 3
huimv-farm-video/src/main/java/com/huimv/video/dhicc/controller/ScreenController/ScreenIndexDataController.java

@@ -4,7 +4,11 @@ package com.huimv.video.dhicc.controller.ScreenController;
 import com.dahuatech.icc.exception.ClientException;
 import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
 import com.huimv.video.dhicc.result.R;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo02;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo03;
 import com.huimv.video.dhicc.util.GetResponse;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -20,7 +24,12 @@ import java.util.Map;
 @RestController
 @RequestMapping("/screen/index")
 public class ScreenIndexDataController {
-
+    @Autowired
+    private OauthConfigBaseInfo oauthConfigBaseInfo;
+    @Autowired
+    private OauthConfigBaseInfo02 oauthConfigBaseInfo02;
+    @Autowired
+    private OauthConfigBaseInfo03 oauthConfigBaseInfo03;
     //返回大屏首页的数据
     @RequestMapping("/dataList")
     public R indexDataList(HttpServletRequest request, @RequestParam(name = "farmId") Integer farmId) throws ClientException, ParseException {
@@ -65,9 +74,9 @@ public class ScreenIndexDataController {
         //七日死猪事件
         map.put("SevenDaySiZhu", getResponse.SendCountSiZhu(formatC, formatA));
         //今日洗消
-        map.put("tadayXiXiao", getResponse.SendMassageXixiaoPerson(formatB, formatA));
+        map.put("tadayXiXiao", getResponse.SendMassageXixiaoPerson(formatB, formatA,farmId,oauthConfigBaseInfo));
         //七日洗消事件
-        map.put("SevenDayXIxiao", getResponse.SendMassageXixiaoPerson(formatC, formatA));
+        map.put("SevenDayXIxiao", getResponse.SendMassageXixiaoPerson(formatC, formatA,farmId,oauthConfigBaseInfo));
         //大门七日记录数
         map.put("SevenDayGate", getResponse.SendMassageGateCount(formatC, formatA));
         //大门今日记录数

+ 12 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/icc/CommonConstant.java

@@ -61,6 +61,18 @@ public class CommonConstant {
     // 事件图片
     public static final String shijian_oss_addr = "172.16.3.223:8925";
 
+    //海宁
+    //档案图片
+    public static final String hn_Document_oss_addr = "192.168.3.202:9876";
+    //    // 事件图片
+    public static final String hn_shijian_oss_addr = "192.168.3.202:8925";
+
+
+    //苍南
+    //档案图片
+    public static final String cn_Document_oss_addr = "192.168.2.202:9876";
+    //    // 事件图片
+    public static final String cn_shijian_oss_addr = "192.168.2.202:8925";
 
     //一页数据量
     public static final Integer PAGE_SIZE = 20;

+ 82 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/ScreenTestController/ScreenAlarmCountByDayTest.java

@@ -0,0 +1,82 @@
+package com.huimv.video.dhicc.test.ScreenTestController;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.dahuatech.icc.exception.ClientException;
+import com.huimv.video.dhicc.entity.SysTelecomEvent;
+import com.huimv.video.dhicc.result.R;
+import com.huimv.video.dhicc.service.ISysTelecomEventService;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo02;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo03;
+import com.huimv.video.dhicc.test.request.PersonListRequestSg;
+import com.huimv.video.dhicc.util.GetResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+
+@RestController
+@RequestMapping("/screen/alarmCount/test")
+public class ScreenAlarmCountByDayTest {
+
+
+    @Autowired
+    private OauthConfigBaseInfo oauthConfigBaseInfo;
+    @Autowired
+    private OauthConfigBaseInfo02 oauthConfigBaseInfo02;
+    @Autowired
+    private OauthConfigBaseInfo03 oauthConfigBaseInfo03;
+
+    @Autowired
+    private ISysTelecomEventService sysTelecomEventService;
+
+    //四种事件统计
+    @RequestMapping("/CountByDay")
+    public R AlarmCountByDay(HttpServletRequest request, @RequestParam(name = "farmId") Integer farmId) throws ClientException {
+        if (1 == farmId) {
+            System.out.println("曙光");
+            GetResponse getResponse = new GetResponse();
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Calendar c = Calendar.getInstance();
+            Date date = new Date();
+            c.setTime(date);
+            Date A = c.getTime();
+            String formatA = format.format(A);
+            c.add(Calendar.DATE, -7);
+            Date B = c.getTime();
+            String formatB = format.format(B);
+            List result = new ArrayList();
+
+            //洗消 一周
+            Map map1 = new HashMap();
+            map1.put("name", "车辆洗消");
+            map1.put("value", getResponse.SendMassageXixiaoPerson(formatB, formatA,farmId,oauthConfigBaseInfo));
+            //人员通过一周---异常
+            Map map2 = new HashMap();
+            map2.put("name", "人员违规");
+            map2.put("value", getResponse.SendMassageGetPagePersonAlarm(formatB, formatA));
+            //车辆一周
+            Map map3 = new HashMap();
+            map3.put("name", "死猪运输");
+            map3.put("value", getResponse.SendMassageSiZhuRecord(formatB, formatA));
+            //烘干事件一周
+            Map map4 = new HashMap();
+            map4.put("name", "车辆烘干");
+            map4.put("value", sysTelecomEventService.count(Wrappers.<SysTelecomEvent>lambdaQuery()
+                    .between(SysTelecomEvent::getEventTime, formatB, formatA).eq(SysTelecomEvent::getFarmId,farmId)) + "");
+            result.add(map1);
+            result.add(map2);
+            result.add(map3);
+            result.add(map4);
+            //翻转
+            Collections.reverse(result);
+            return R.ok("请求成功").put("data", result);
+        }
+        return null;
+    }
+}

+ 133 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/ScreenTestController/ScreenCarTestController.java

@@ -0,0 +1,133 @@
+package com.huimv.video.dhicc.test.ScreenTestController;
+
+
+import com.dahuatech.icc.exception.ClientException;
+import com.huimv.video.dhicc.result.R;
+import com.huimv.video.dhicc.util.GetResponse;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/screen/car/test")
+
+//没有连接ICC的数据库 所以操作比较麻烦
+public class ScreenCarTestController {
+
+
+    //过车的数据//这个是车辆闸机的过车数据
+
+    /**
+     * 应该优化一下放到表里面去  不然的话这样请求一整页的数据会很慢
+     * 保存ntamade
+     * 通过开始结束时间来查页数
+     * &queryTimeBegin=2021-12-01+00%3A00%3A00&
+     * queryTimeEnd=2021-12-01+23%3A59%3A59&
+     */
+    // https://36.26.62.70:447/evo-apigw/ipms/carcapture/find/conditions?pageNum=1&pageSize=10&queryTimeBegin=2021-12-01+00%3A00%3A00&queryTimeEnd=2021-12-01+23%3A59%3A59&_=1638356246174
+    @RequestMapping("/count_car_record")
+    public R ddgetCarRecord(HttpServletRequest request, @RequestParam(name = "farmId") Integer farmId) throws ClientException {
+
+        if (farmId != 1) {
+            //返回为空数据
+            return R.ok("当前牧场无设备").put("data", null);
+        }
+
+        GetResponse getResponse = new GetResponse();
+        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_OF_DAY, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+
+        c.add(Calendar.DATE, +1);
+        Date A = c.getTime();
+        String formatA = format.format(A);
+
+        c.add(Calendar.DATE, -1);
+        Date B = c.getTime();
+        String formatB = format.format(B);
+
+        c.add(Calendar.DATE, -1);
+        Date C = c.getTime();
+        String formatC = format.format(C);
+
+        c.add(Calendar.DATE, -1);
+        Date D = c.getTime();
+        String formatD = format.format(D);
+
+        c.add(Calendar.DATE, -1);
+        Date E = c.getTime();
+        String formatE = format.format(E);
+
+        c.add(Calendar.DATE, -1);
+        Date F = c.getTime();
+        String formatF = format.format(F);
+
+        c.add(Calendar.DATE, -1);
+        Date G = c.getTime();
+        String formatG = format.format(G);
+
+        c.add(Calendar.DATE, -1);
+        Date H = c.getTime();
+        String formatH = format.format(H);
+
+        List result = new ArrayList();
+
+        Map map1 = new HashMap();
+        map1.put("time", splitTime(B));
+        map1.put("value", getResponse.SendMassageGetPage(formatB, formatA));
+
+        Map map2 = new HashMap();
+        map2.put("time", splitTime(C));
+        map2.put("value", getResponse.SendMassageGetPage(formatC, formatB));
+
+        Map map3 = new HashMap();
+        map3.put("time", splitTime(D));
+        map3.put("value", getResponse.SendMassageGetPage(formatD, formatC));
+
+        Map map4 = new HashMap();
+        map4.put("time", splitTime(E));
+        map4.put("value", getResponse.SendMassageGetPage(formatE, formatD));
+
+
+        Map map5 = new HashMap();
+        map5.put("time", splitTime(F));
+        map5.put("value", getResponse.SendMassageGetPage(formatF, formatE));
+
+
+        Map map6 = new HashMap();
+        map6.put("time", splitTime(G));
+        map6.put("value", getResponse.SendMassageGetPage(formatG, formatF));
+
+        Map map7 = new HashMap();
+        map7.put("time", splitTime(H));
+        map7.put("value", getResponse.SendMassageGetPage(formatH, formatG));
+
+        result.add(map1);
+        result.add(map2);
+        result.add(map3);
+        result.add(map4);
+        result.add(map5);
+        result.add(map6);
+        result.add(map7);
+        //翻转
+        Collections.reverse(result);
+        return R.ok("请求成功").put("data", result);
+    }
+
+    public String splitTime(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        String date1 = calendar.get(Calendar.MONTH) + 1 + "/" + calendar.get(Calendar.DATE);
+        return date1;
+    }
+
+
+}

+ 88 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/ScreenTestController/ScreenIndexDataTestController.java

@@ -0,0 +1,88 @@
+package com.huimv.video.dhicc.test.ScreenTestController;
+
+
+import com.dahuatech.icc.exception.ClientException;
+import com.huimv.video.dhicc.result.R;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo02;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo03;
+import com.huimv.video.dhicc.util.GetResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+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;
+
+@RestController
+@RequestMapping("/screen/index/test")
+public class ScreenIndexDataTestController {
+
+    @Autowired
+    private OauthConfigBaseInfo oauthConfigBaseInfo;
+    @Autowired
+    private OauthConfigBaseInfo02 oauthConfigBaseInfo02;
+    @Autowired
+    private OauthConfigBaseInfo03 oauthConfigBaseInfo03;
+    //返回大屏首页的数据
+    @RequestMapping("/dataList")
+    public R indexDataList(HttpServletRequest request, @RequestParam(name = "farmId") Integer farmId) throws ClientException, ParseException {
+        if (farmId != 1) {
+            //返回为空数据
+            return R.ok("当前牧场无设备").put("data", null);
+        }
+
+        GetResponse getResponse = new GetResponse();
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Map map = new HashMap<>();
+        Calendar c = Calendar.getInstance();
+        Date date = new Date();
+        c.setTime(date);
+        c.set(Calendar.HOUR_OF_DAY, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+
+        c.add(Calendar.DATE, +1);
+        Date A = c.getTime();
+        String formatA = format.format(A);
+
+        c.add(Calendar.DATE, -1);
+        Date B = c.getTime();
+        String formatB = format.format(B);
+
+        c.add(Calendar.DATE, -6);
+        Date C = c.getTime();
+        String formatC = format.format(C);
+
+        System.out.println(formatA + formatB);
+        //人员刷脸成功
+        map.put("personPassSuccess", getResponse.SendMassageGetPagePerson(formatB, formatA));
+        //人员刷脸失败
+        map.put("personPassFail", getResponse.SendMassageGetPagePersonAlarm(formatB, formatA));
+        //车辆出数量统计
+        map.put("carPassOut", getResponse.SendMassageCarOut(formatB, formatA));
+        //车辆进
+        map.put("carPassIn", getResponse.SendMassageCarIn(formatB, formatA));
+        //死猪
+        map.put("tadaySiZhu", getResponse.SendCountSiZhu(formatB, formatA));
+        //七日死猪事件
+        map.put("SevenDaySiZhu", getResponse.SendCountSiZhu(formatC, formatA));
+        //今日洗消
+        map.put("tadayXiXiao", getResponse.SendMassageXixiaoPerson(formatB, formatA,farmId,oauthConfigBaseInfo));
+        //七日洗消事件
+        map.put("SevenDayXIxiao", getResponse.SendMassageXixiaoPerson(formatC, formatA,farmId,oauthConfigBaseInfo));
+        //大门七日记录数
+        map.put("SevenDayGate", getResponse.SendMassageGateCount(formatC, formatA));
+        //大门今日记录数
+        map.put("tadayGate", getResponse.SendMassageGateCount(formatB, formatA));
+
+        return R.ok("请求成功").put("data", map);
+
+    }
+}

+ 153 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/ScreenTestController/ScreenPersonTestController.java

@@ -0,0 +1,153 @@
+package com.huimv.video.dhicc.test.ScreenTestController;
+
+
+import com.dahuatech.icc.exception.ClientException;
+import com.huimv.video.dhicc.result.R;
+import com.huimv.video.dhicc.util.GetResponse;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/screen/person/test")
+public class ScreenPersonTestController {
+
+    //成功通行记录
+    @RequestMapping("/count_person_record")
+    public R ddgetCarRecord(HttpServletRequest request, @RequestParam(name = "farmId") Integer farmId) throws ClientException, ParseException {
+
+        if (farmId != 1) {
+            //返回为空数据
+            return R.ok("当前牧场无设备").put("data", null);
+        }
+
+        GetResponse getResponse = new GetResponse();
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar c = Calendar.getInstance();
+        Date date = new Date();
+        c.setTime(date);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+
+        c.add(Calendar.HOUR_OF_DAY, +2);
+        Date A = c.getTime();
+        String formatA = format.format(A);
+
+        c.add(Calendar.HOUR_OF_DAY, -2);
+        Date B = c.getTime();
+        String formatB = format.format(B);
+
+        c.add(Calendar.HOUR_OF_DAY, -2);
+        Date C = c.getTime();
+        String formatC = format.format(C);
+
+        c.add(Calendar.HOUR_OF_DAY, -2);
+        Date D = c.getTime();
+        String formatD = format.format(D);
+
+        c.add(Calendar.HOUR_OF_DAY, -2);
+        Date E = c.getTime();
+        String formatE = format.format(E);
+
+        c.add(Calendar.HOUR_OF_DAY, -2);
+        Date F = c.getTime();
+        String formatF = format.format(F);
+
+        c.add(Calendar.HOUR_OF_DAY, -2);
+        Date G = c.getTime();
+        String formatG = format.format(G);
+
+        c.add(Calendar.HOUR_OF_DAY, -2);
+        Date H = c.getTime();
+        String formatH = format.format(H);
+
+        List result = new ArrayList();
+
+        Map map1 = new HashMap();
+        map1.put("time", splitTimeByHoure(B));
+        map1.put("value", getResponse.SendMassageGetPage(formatB, formatA));
+
+        Map map2 = new HashMap();
+        map2.put("time", splitTimeByHoure(C));
+        map2.put("value", getResponse.SendMassageGetPage(formatC, formatB));
+
+        Map map3 = new HashMap();
+        map3.put("time", splitTimeByHoure(D));
+        map3.put("value", getResponse.SendMassageGetPage(formatD, formatC));
+
+        Map map4 = new HashMap();
+        map4.put("time", splitTimeByHoure(E));
+        map4.put("value", getResponse.SendMassageGetPage(formatE, formatD));
+
+        Map map5 = new HashMap();
+        map5.put("time", splitTimeByHoure(F));
+        map5.put("value", getResponse.SendMassageGetPage(formatF, formatE));
+
+
+        Map map6 = new HashMap();
+        map6.put("time", splitTimeByHoure(G));
+        map6.put("value", getResponse.SendMassageGetPage(formatG, formatF));
+
+        Map map7 = new HashMap();
+        map7.put("time", splitTimeByHoure(H));
+        map7.put("value", getResponse.SendMassageGetPage(formatH, formatG));
+
+        result.add(map1);
+        result.add(map2);
+        result.add(map3);
+        result.add(map4);
+        result.add(map5);
+        result.add(map6);
+        result.add(map7);
+        //翻转
+        Collections.reverse(result);
+        return R.ok("请求成功").put("data", result);
+    }
+
+
+    //人员正常通行与异常通行的数据
+    @RequestMapping("/count_person_record_fail_success")
+    public R count_person_record_fail_success(HttpServletRequest request, @RequestParam(name = "farmId") Integer farmId) throws ClientException, ParseException {
+
+        if (farmId != 1) {
+            //返回为空数据
+            return R.ok("当前牧场无设备").put("data", null);
+        }
+        GetResponse getResponse = new GetResponse();
+        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_OF_DAY, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+
+        c.add(Calendar.DATE, +1);
+        Date A = c.getTime();
+        String formatA = format.format(A);
+
+        c.add(Calendar.DATE, -1);
+        Date B = c.getTime();
+        String formatB = format.format(B);
+
+        Map map1 = new HashMap();
+        map1.put("value1", getResponse.SendMassageGetPagePerson(formatB, formatA));
+        map1.put("value2", getResponse.SendMassageGetPagePersonAlarm(formatB, formatA));
+
+        System.out.println();
+        return R.ok("请求成功").put("data", map1);
+
+    }
+
+    public String splitTimeByHoure(Date date) throws ParseException {
+        SimpleDateFormat df = new SimpleDateFormat("HH:mm");//设置日期格式,这里只取出小时和分钟
+        String format = df.format(date);
+        return format;
+    }
+
+}

+ 196 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/ScreenTestController/ScreenSiZhuTestController.java

@@ -0,0 +1,196 @@
+package com.huimv.video.dhicc.test.ScreenTestController;
+
+import cn.hutool.core.util.ObjectUtil;
+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.video.dhicc.icc.CommonConstant;
+import com.huimv.video.dhicc.result.R;
+import com.huimv.video.dhicc.util.GetResponse;
+import net.sf.json.JSONObject;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/screen/sizhu/test")
+public class ScreenSiZhuTestController {
+    /**
+     * xuyao   直接都写在这里了
+     *
+     * @param request
+     * @return
+     * @throws ClientException
+     * @throws ParseException
+     */
+    @RequestMapping("/count_sizhu_record")
+    public R count_sizhu_record(HttpServletRequest request, @RequestParam(name = "farmId") Integer farmId) throws ClientException, ParseException {
+        if (farmId != 1) {
+            return R.ok("当前牧场无设备").put("data", null);
+        }
+
+
+        List result = new ArrayList();
+        Map map1 = new HashMap();
+        map1.put("value1", getPastSevenDay());
+        map1.put("value2", getDay());
+        map1.put("value3", getLatestOne());
+        return R.ok("请求成功").put("data", map1);
+    }
+
+
+    /**
+     * xuyao   直接都写在这里了
+     *
+     * @param request
+     * @return 查询事件
+     * @throws ClientException
+     * @throws ParseException  写一个查左右的  事件都拿过来 存起来 建新的表来处理
+     */
+    @RequestMapping("/SiZhuList")
+    public R SiZhuList(HttpServletRequest request, @RequestParam(name = "farmId") Integer farmId) throws ClientException, ParseException {
+
+        if (farmId != 1) {
+            return R.ok("当前牧场无设备").put("data", null);
+        }
+
+        return R.ok("请求成功").put("data", getSiZhuList());
+    }
+
+
+    //过去七天的值
+    public String getPastSevenDay() throws ClientException {
+        GetResponse getResponse = new GetResponse();
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar c = Calendar.getInstance();
+        Date date = new Date();
+        c.setTime(date);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+
+        c.add(Calendar.DATE, 0);
+        Date A = c.getTime();
+        String formatA = format.format(A);
+        c.add(Calendar.DATE, -7);
+        Date B = c.getTime();
+        String formatB = format.format(B);
+        return getResponse.SendCountSiZhu(formatB, formatA);
+    }
+
+
+    //今天的数据
+    public String getDay() throws ClientException {
+        GetResponse getResponse = new GetResponse();
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar c = Calendar.getInstance();
+        Date date = new Date();
+        c.setTime(date);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+
+        c.add(Calendar.DATE, 0);
+        Date A = c.getTime();
+        String formatA = format.format(A);
+        c.add(Calendar.DATE, -1);
+        Date B = c.getTime();
+        String formatB = format.format(B);
+        return getResponse.SendCountSiZhu(formatB, formatA);
+    }
+
+
+    //最新一条的数据
+    public String getLatestOne() 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_OF_DAY, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+        Date A = c.getTime();
+        String formatA = format.format(A);
+        c.set(Calendar.HOUR_OF_DAY, +24);
+        Date d = c.getTime();
+        String formatD = format.format(d);
+        Map<String, Object> params = new HashMap<>();
+        params.put("alarmStartDateString", formatA);
+        params.put("alarmEndDateString", formatD);
+        params.put("pageNum", 1);
+        params.put("pageSize", 1);
+        params.put("alarmType", 303);
+        params.put("dbType", 0);
+        params.put("deviceCategory", 1);
+        //死猪通道
+        String[] nodeCodeList = CommonConstant.SIZhuChannle;
+        params.put("nodeCodeList", nodeCodeList);
+        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());
+
+
+        JSONObject jsondata = (JSONObject) JSONObject.fromObject(generalResponse.getResult()).get("data");
+        String substring = jsondata.get("pageData").toString().substring(1, jsondata.get("pageData").toString().length() - 1);
+        if (ObjectUtil.isNotEmpty(substring)){
+            JSONObject jsonObject1 = JSONObject.fromObject(substring);
+            Object alarmDate = jsonObject1.get("alarmDate");
+
+            return alarmDate.toString();
+        }
+        return null;
+
+    }
+
+
+    //返回所有的死猪事件
+    public GeneralResponse getSiZhuList() 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_OF_DAY, 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);
+        params.put("pageNum", 1);
+        params.put("pageSize", 10);
+        params.put("alarmType", 303);
+        params.put("dbType", 0);
+        params.put("deviceCategory", 1);
+        //死猪通道
+        String[] nodeCodeList = CommonConstant.SIZhuChannle;
+        params.put("nodeCodeList", nodeCodeList);
+        String URL = "/evo-apigw/evo-event/1.2.0/alarm-record/page";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        //这种已经在配置文件里面安排了账号ip以及密码
+        GeneralRequest generalRequest = new GeneralRequest(URL, Method.POST);
+        generalRequest.header("Content-Type", " application/json");
+        generalRequest.body(JSON.toJSONString(params));
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        return generalResponse;
+    }
+}
+
+
+

+ 2 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/constant/Constant.java

@@ -284,4 +284,6 @@ public class Constant {
 
     //event-count
     public static final String EVENT_COUNT_URL = "/evo-apigw/evo-event/1.0.0/alarm-record/count-num";
+
+    public static final String MASSAGE_XIXIAO_PERSION = "/evo-apigw/evo-event/1.0.0/alarm-record/count-num";
 }

+ 0 - 3
huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/request/ClientCarWhiteDeleteRequestCn.java

@@ -21,9 +21,6 @@ public class ClientCarWhiteDeleteRequestCn extends BaseRequest03<Object> {
 
 
 
-
-
-
     public ClientCarWhiteDeleteRequestCn() {
     }
 

+ 76 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/request/ClientSendMassageXixiaoPersonRequestSg.java

@@ -0,0 +1,76 @@
+package com.huimv.video.dhicc.test.request;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo;
+import com.huimv.video.dhicc.test.constant.Constant;
+import com.huimv.video.dhicc.test.utils.HttpURLConnectionUtil;
+import com.huimv.video.dhicc.test.utils.HttpsURLConnectionUtil;
+import com.huimv.video.dhicc.test.utils.UrlUtil;
+import lombok.Data;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Data
+public class ClientSendMassageXixiaoPersonRequestSg extends BaseRequest<Object>{
+
+
+    private String alarmStartDateString;
+
+    private String alarmEndDateString;
+    private Integer alarmType;
+    private Integer dbType;
+    private Integer deviceCategory;
+    private String[] nodeCodeList;
+
+//    private String method;
+//
+//    private Map<String,Object> data;
+
+
+    public ClientSendMassageXixiaoPersonRequestSg() {
+    }
+
+    public ClientSendMassageXixiaoPersonRequestSg(OauthConfigBaseInfo oauthConfigBaseInfo) {
+        super(oauthConfigBaseInfo, Constant.HTTP_POST, oauthConfigBaseInfo.getHttpConfigInfo().getPrefixUrl() + Constant.MASSAGE_XIXIAO_PERSION, true);
+    }
+
+    @Override
+    public String  doAction() {
+        //重置url信息,替换版本号
+        this.setUrl(UrlUtil.dealVersion(this.getUrl()));
+        //设置请求参数
+        setBody();
+        //发送请求
+        String res = isEnableHttpTest() ? HttpURLConnectionUtil.doPost(this.getUrl(), this.getBody(), this.getHeader()) : HttpsURLConnectionUtil.doPost(this.getUrl(), this.getBody(), this.getHeader());
+        System.out.println(res);
+        //获取响应
+//        JSONObject jsonObject = JSONObject.parseObject(res);
+//        Object data = jsonObject.get("data");
+//        GeneralResponse devicePageResponse = JSON.parseObject(res, GeneralResponse.class);
+//        System.out.println(data);
+        return res;
+    }
+
+    private void setBody() {
+        //设置请求参数
+        Map<String, Object> map = new HashMap<>();
+        map.put("alarmStartDateString", this.alarmStartDateString);
+        map.put("alarmEndDateString", this.alarmEndDateString);
+        map.put("alarmType", this.alarmType);
+        map.put("dbType", this.dbType);
+        map.put("deviceCategory", this.deviceCategory);
+        map.put("nodeCodeList", this.nodeCodeList);
+//        map.put("method", this.method);
+//        map.put("data", this.data);
+        this.setBody(JSON.toJSONString(map));
+
+    }
+
+
+    public boolean isEnableHttpTest() {
+        return super.getOauthConfigBaseInfo().getHttpConfigInfo().isEnableHttpTest();
+    }
+}

+ 31 - 29
huimv-farm-video/src/main/java/com/huimv/video/dhicc/util/GetResponse.java

@@ -11,7 +11,15 @@ import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
 import com.huimv.common.utils.StringUtilsWork;
 import com.huimv.video.dhicc.icc.CommonConstant;
 import com.huimv.video.dhicc.result.R;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo02;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo03;
+import com.huimv.video.dhicc.test.request.ClientCarListRequestSg;
+import com.huimv.video.dhicc.test.request.ClientSendMassageXixiaoPersonRequestSg;
+import jdk.nashorn.internal.ir.IfNode;
 import net.sf.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
@@ -178,7 +186,7 @@ public class GetResponse {
     }
 
 
-    public static void main(String[] args) throws ClientException {
+  /*  public static void main(String[] args) throws ClientException {
 
         Map<String, Object> params1 = new HashMap<>();
 
@@ -215,7 +223,7 @@ public class GetResponse {
         GetResponse getResponse = new GetResponse();
 
         System.out.println(jsonObject.toString() + getResponse.SendMassageGetPagePersonAlarm((String) params1.get("startSwingTime"), (String) params1.get("endSwingTime")));
-    }
+    }*/
 
 
     /**
@@ -226,33 +234,27 @@ public class GetResponse {
      * @return
      * @throws ClientException
      */
-    public String SendMassageXixiaoPerson(String begin, String end) throws ClientException {
-        Map<String, Object> params = new HashMap<>();
-        params.put("alarmStartDateString", begin);
-        params.put("alarmEndDateString", end);
-        params.put("alarmType", 303);
-        params.put("dbType", 0);
-        params.put("deviceCategory", 1);
-        params.put("nodeCodeList", CommonConstant.XixiaoChannle);
-        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();
+    public String SendMassageXixiaoPerson(String begin, String end,Integer farmId,OauthConfigBaseInfo oauthConfigBaseInfo) throws ClientException {
+        String res = "";
+        if(farmId ==1){
+            ClientSendMassageXixiaoPersonRequestSg requestSg = new ClientSendMassageXixiaoPersonRequestSg(oauthConfigBaseInfo);
+            requestSg.setAlarmStartDateString(begin);
+            requestSg.setAlarmEndDateString(end);
+            requestSg.setAlarmType(303);
+            requestSg.setDbType(0);
+            requestSg.setDeviceCategory(1);
+            requestSg.setNodeCodeList(CommonConstant.XixiaoChannle);
+            System.out.println(requestSg);
+             res = requestSg.doAction();
+            JSONObject jsonObject = JSONObject.fromObject(res);
+            Object data = jsonObject.get("data");
+            JSONObject jsonObject1 = JSONObject.fromObject(data);
+            System.out.println(jsonObject1);
+            return jsonObject1.get("value").toString();
+        }
+        return null;
+
+
     }