Browse Source

dhicc 模块

523096025 3 years ago
parent
commit
5ec1872b56
21 changed files with 1477 additions and 24 deletions
  1. 44 0
      huimv-farm-v2/huimv-common/src/main/java/com/huimv/common/utils/StringUtilsWork.java
  2. 211 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/controller/SysTelecomEventController.java
  3. 1 17
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/newcontroller/PersonManageController.java
  4. 72 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/screen/ScreenAlarmCountByDay.java
  5. 168 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/screen/ScreenCarController.java
  6. 22 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/screen/ScreenHongGnaController.java
  7. 115 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/screen/ScreenPersonController.java
  8. 192 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/screen/ScreenSiZhuController.java
  9. 24 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/util/GetPastTime.java
  10. 317 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/util/GetResponse.java
  11. 68 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/util/Result.java
  12. 41 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/util/ResultCode.java
  13. 40 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/entity/SysTelecomEvent.java
  14. 16 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/entity/dto/TelecomVo.java
  15. 11 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/mapper/SysTelecomEventMapper.java
  16. 2 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/mapper/SysTelecomMapper.java
  17. 14 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/service/ISysTelecomEventService.java
  18. 2 1
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/service/impl/SysDayWaterServiceImpl.java
  19. 27 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/service/impl/SysTelecomEventServiceImpl.java
  20. 82 0
      huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/timer/SysTelcomEnentTimmer.java
  21. 8 6
      huimv-farm-v2/huimv-produce-warning/src/main/resources/com/huimv/produce/mapper/SysDayWaterMapper.xml

+ 44 - 0
huimv-farm-v2/huimv-common/src/main/java/com/huimv/common/utils/StringUtilsWork.java

@@ -0,0 +1,44 @@
+package com.huimv.common.utils;
+
+/**
+ * @Author Anchor
+ * @Date 2021/7/30 13:17
+ * @Version 1.0.1
+ */
+public class StringUtilsWork {
+
+
+    public static boolean isEmpty(String str) {
+        return str == null || str.length() == 0;
+    }
+
+    public static boolean isNotEmpty(String str) {
+        return !isEmpty(str);
+    }
+
+    public static boolean isBlank(String str) {
+        int strLen;
+        if (str != null && (strLen = str.length()) != 0) {
+            for(int i = 0; i < strLen; ++i) {
+                if (!Character.isWhitespace(str.charAt(i))) {
+                    return false;
+                }
+            }
+
+            return true;
+        } else {
+            return true;
+        }
+    }
+
+    public static boolean isNotBlank(String str) {
+        return !isBlank(str);
+    }
+
+
+}
+
+
+
+
+

+ 211 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/controller/SysTelecomEventController.java

@@ -0,0 +1,211 @@
+package com.huimv.produce.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huimv.common.utils.Result;
+import com.huimv.common.utils.ResultCode;
+import com.huimv.common.utils.StringUtilsWork;
+import com.huimv.produce.entity.BaseTelecomRoom;
+import com.huimv.produce.entity.SysTelecom;
+import com.huimv.produce.entity.SysTelecomEvent;
+import com.huimv.produce.entity.TelecomVo;
+import com.huimv.produce.mapper.BaseTelecomRoomMapper;
+import com.huimv.produce.mapper.SysTelecomMapper;
+import com.huimv.produce.service.ISysTelecomEventService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/telecom")
+@CrossOrigin
+public class SysTelecomEventController {
+
+    @Autowired
+    private BaseTelecomRoomMapper baseTelecomRoomMapper;
+
+    @Autowired
+    private SysTelecomMapper sysTelecomMapper;
+
+    @Autowired
+    private ISysTelecomEventService sysTelecomEventService;
+
+    //传入机器编码  返回这个机器下的所有事件 带分页
+    @GetMapping("/listevent")
+    public Result list(@RequestParam(name = "deviceId", required = false) String deviceId    ,
+                       @RequestParam(name = "startTimeString", required = false) String startTimeString ,
+                       @RequestParam(name = "endTimeString", required = false) String endTimeString,
+                       @RequestParam(name = "current", required = false) Integer current,//当前页
+                       @RequestParam(name = "size", required = false) Long size,
+                       @RequestParam(name = "farmId") Integer farmId  //分页大小
+
+    ) throws ParseException {
+        DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date startTime = fmt.parse(startTimeString);
+        Date endTime = fmt.parse(endTimeString);
+        QueryWrapper<SysTelecomEvent> wrapper = new QueryWrapper<>();
+        wrapper.eq("farm_id", farmId);
+        if(StringUtilsWork.isNotBlank(deviceId)){
+            wrapper.eq("device_id", deviceId);
+        }
+        wrapper.between("event_time", startTime, endTime);
+        wrapper.orderByDesc( "id" );
+        Page<SysTelecomEvent> page = sysTelecomEventService.page(new Page< >(current, size), wrapper);
+        //本要写SQL 现在没时间  这样处理一下问题不大
+        List<SysTelecomEvent> records = page.getRecords();
+        List<TelecomVo> TelecomVoRecords = new ArrayList<>();
+        Page<TelecomVo> page1 = new Page< >(current, size);
+        page1.setTotal(page.getTotal());
+        for (SysTelecomEvent record : records) {
+            TelecomVo telecomVo = new TelecomVo();
+            telecomVo.setDeviceId(record.getDeviceId());
+            telecomVo.setEventTime(record.getEventTime());
+            //效率很低  暂且这样
+            LambdaQueryWrapper<BaseTelecomRoom> wrapper3 = Wrappers.lambdaQuery();
+            wrapper3.eq(BaseTelecomRoom::getDeviceId, record.getDeviceId());
+            BaseTelecomRoom baseTelecomRoom = baseTelecomRoomMapper.selectOne(wrapper3);
+            telecomVo.setLocation(baseTelecomRoom.getDeviceRoom());
+            TelecomVoRecords.add(telecomVo);
+        }
+        return new  Result(ResultCode.SUCCESS,page1.setRecords(TelecomVoRecords));
+    }
+        //判断时间   有传时间返回时间范围  没有时间
+
+    @GetMapping("/listeventdetail")
+    public Result listeventdetail(@RequestParam(name = "deviceId", required = false) String deviceId ,
+                                  @RequestParam(name = "eventTimeString", required = false) String eventTimeString
+    ) throws ParseException {
+        DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date eventTime = fmt.parse(eventTimeString);
+        Calendar c1 = Calendar.getInstance();
+        c1.setTime(eventTime);
+        c1.add(Calendar.MINUTE, -60);
+        Date began = c1.getTime();
+        String startTime = format.format(began);
+        c1.add(Calendar.MINUTE, +150);
+        Date endTime11 = c1.getTime();
+        String endTime = format.format(endTime11);
+        //这儿就直接拿温度了----还是不行的  温度和时间都是需要的
+        Map map1 = new HashMap();
+        List<String> timeList = new ArrayList<>();
+        List<String>  tempList = new ArrayList<>();
+        LambdaQueryWrapper<SysTelecom> lambdaQueryWrapper =
+                new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(SysTelecom::getDeviceId ,deviceId).between(SysTelecom::getTimestamp ,startTime,endTime);
+        List<SysTelecom> sysTelecoms = sysTelecomMapper.selectList(lambdaQueryWrapper);
+        for (SysTelecom sysTelecom : sysTelecoms) {
+            timeList.add(fmt.format(sysTelecom.getTimestamp()));
+            tempList.add(sysTelecom.getTemp());
+        }
+        map1.put("timeList",timeList);
+        map1.put("tempList",tempList);
+        return new  Result(ResultCode.SUCCESS,map1);
+    }
+
+    //过去几个小时的车辆烘干次数的----后面可以做成定时任务存表  防止断网就没数据
+    @GetMapping("/listeventByHoure")
+    public Result listeventByHoure( ) throws ParseException {
+        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",sysTelecomEventService.count(Wrappers.<SysTelecomEvent>lambdaQuery()
+                .between(SysTelecomEvent::getEventTime, formatB, formatA)));
+
+        Map map2  = new HashMap();
+        map2.put("time",splitTime(C));
+        map2.put("value",sysTelecomEventService.count(Wrappers.<SysTelecomEvent>lambdaQuery()
+                .between(SysTelecomEvent::getEventTime, formatC, formatB)));
+
+        Map map3  = new HashMap();
+        map3.put("time",splitTime(D));
+        map3.put("value",sysTelecomEventService.count(Wrappers.<SysTelecomEvent>lambdaQuery()
+                .between(SysTelecomEvent::getEventTime, formatD, formatC)));
+
+        Map map4  = new HashMap();
+        map4.put("time",splitTime(E));
+        map4.put("value",sysTelecomEventService.count(Wrappers.<SysTelecomEvent>lambdaQuery()
+                .between(SysTelecomEvent::getEventTime, formatE, formatD)));
+
+
+        Map map5  = new HashMap();
+        map5.put("time",splitTime(F));
+        map5.put("value",sysTelecomEventService.count(Wrappers.<SysTelecomEvent>lambdaQuery()
+                .between(SysTelecomEvent::getEventTime, formatF, formatE)));
+
+
+        Map map6  = new HashMap();
+        map6.put("time",splitTime(G));
+        map6.put("value",sysTelecomEventService.count(Wrappers.<SysTelecomEvent>lambdaQuery()
+                .between(SysTelecomEvent::getEventTime, formatG, formatF)));
+
+        Map map7  = new HashMap();
+        map7.put("time",splitTime(H));
+        map7.put("value",sysTelecomEventService.count(Wrappers.<SysTelecomEvent>lambdaQuery()
+                .between(SysTelecomEvent::getEventTime, 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  new  Result(ResultCode.SUCCESS,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;
+    }
+
+}

+ 1 - 17
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/dhicc/newcontroller/PersonManageController.java

@@ -25,7 +25,6 @@ public class PersonManageController {
     /**
      * 人员通行记录 ---测试通过  ---参数说明见大华官网 https://open-icc.dahuatech.com/#/
      * 此处只做了代理
-     *
      *pageNum              	是	Integer	当前页
      * pageSize	            是	Integer	分页大小
      * startSwingTime	    否	String	查询开始时间
@@ -39,12 +38,11 @@ public class PersonManageController {
      * cardNumber       	否	String	卡号
      * enterOrExit       	否	String	事件类型, null-全部, 1-进门, 2出门, 3-进/出门
      * openResult	        否	Integer	开门结果, null-全部, 1-成功, 0-失败
-     *
-     *
      * @param params
      * @return
      * @throws ClientException
      */
+
     @RequestMapping("/get_person_record")
     public GeneralResponse getAccidentRecord( @RequestBody Map<String, Object> params ) throws ClientException {
         String URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combined";  //获取事件URL    post请求
@@ -61,8 +59,6 @@ public class PersonManageController {
         System.out.println("执行结束");
         return generalResponse;
     }
-
-
    //总页数
     @RequestMapping("/get_person_record_totalpage")
     public GeneralResponse get_person_record_totalpage( @RequestBody Map<String, Object> params ) throws ClientException {
@@ -85,14 +81,6 @@ public class PersonManageController {
         return generalResponse;
     }
 
-
-
-
-
-
-
-
-
     @RequestMapping("/get_person_detail")
     public GeneralResponse getPersonDetail( @RequestBody Map<String, Object> params ) throws ClientException {
         String URL = "/evo-apigw/evo-accesscontrol/${version}/card/accessControl/swingCardRecord/19241";  //获取事件URL    post请求
@@ -107,8 +95,4 @@ public class PersonManageController {
         System.out.println("执行结束");
         return generalResponse;
     }
-
-
-
-
 }

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

@@ -0,0 +1,72 @@
+package com.huimv.produce.dhicc.screen;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.dahuatech.icc.exception.ClientException;
+
+import com.huimv.produce.dhicc.util.GetResponse;
+import com.huimv.produce.entity.SysTelecomEvent;
+import com.huimv.produce.mapper.SysTelecomEventMapper;
+import com.huimv.produce.service.ISysTelecomEventService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.huimv.produce.dhicc.result.R;
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+
+@RestController
+@RequestMapping("/screen/alarmCount")
+@CrossOrigin
+public class ScreenAlarmCountByDay {
+
+    @Autowired
+    private ISysTelecomEventService sysTelecomEventService;
+
+
+
+    @RequestMapping("/CountByDay")
+    public R AlarmCountByDay(HttpServletRequest request) 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);
+        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));
+        //人员通过一周---异常
+        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))+"");
+        result.add(map1);
+        result.add(map2);
+        result.add(map3);
+        result.add(map4);
+        //翻转
+        Collections.reverse(result);
+        return R.ok("请求成功").put("data", result);
+
+
+    }
+}

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

@@ -0,0 +1,168 @@
+package com.huimv.produce.dhicc.screen;
+
+
+import com.dahuatech.icc.exception.ClientException;
+
+import com.huimv.produce.dhicc.util.GetResponse;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import com.huimv.produce.dhicc.result.R;
+
+@RestController
+@RequestMapping("/screen/car")
+@CrossOrigin
+//没有连接ICC的数据库  所以操作比较麻烦
+public class ScreenCarController {
+
+    //过车的数据//这个是车辆闸机的过车数据
+    /**
+     * 应该优化一下放到表里面去  不然的话这样请求一整页的数据会很慢
+     * 保存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 ) 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.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;
+    }
+
+    public static void main(String[] args) {
+        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();
+        System.out.println(format.format(A));
+
+        c.add(Calendar.DATE, -1);
+        Date B = c.getTime();
+        System.out.println(format.format(B));
+
+        c.add(Calendar.DATE, -1);
+        Date C = c.getTime();
+        System.out.println(format.format(C));
+
+        c.add(Calendar.DATE, -1);
+        Date D = c.getTime();
+        System.out.println(format.format(D));
+
+        c.add(Calendar.DATE, -1);
+        Date E = c.getTime();
+        System.out.println(format.format(E));
+
+        c.add(Calendar.DATE, -1);
+        Date F = c.getTime();
+        System.out.println(format.format(F));
+
+        c.add(Calendar.DATE, -1);
+        Date G = c.getTime();
+        System.out.println(format.format(G));
+
+        c.add(Calendar.DATE, -1);
+        Date H = c.getTime();
+        System.out.println(format.format(H));
+
+    }
+
+}

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

@@ -0,0 +1,22 @@
+package com.huimv.produce.dhicc.screen;
+
+
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/screen/car")
+@CrossOrigin
+public class ScreenHongGnaController {
+
+
+
+
+
+
+
+
+
+
+}

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

@@ -0,0 +1,115 @@
+package com.huimv.produce.dhicc.screen;
+
+
+import com.dahuatech.icc.exception.ClientException;
+
+import com.huimv.produce.dhicc.util.GetResponse;
+import org.springframework.web.bind.annotation.CrossOrigin;
+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.*;
+import com.huimv.produce.dhicc.result.R;
+
+@RestController
+@RequestMapping("/screen/person")
+@CrossOrigin
+public class ScreenPersonController {
+
+    @RequestMapping("/count_person_record")
+    public  R  ddgetCarRecord(HttpServletRequest request ) throws ClientException, ParseException {
+        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, +2);
+        Date A = c.getTime();
+        String formatA = format.format(A);
+
+        c.add(Calendar.HOUR, -2);
+        Date B = c.getTime();
+        String formatB = format.format(B);
+
+        c.add(Calendar.HOUR, -2);
+        Date C = c.getTime();
+        String formatC = format.format(C);
+
+        c.add(Calendar.HOUR, -2);
+        Date D = c.getTime();
+        String formatD = format.format(D);
+
+        c.add(Calendar.HOUR, -2);
+        Date E = c.getTime();
+        String formatE = format.format(E);
+
+        c.add(Calendar.HOUR, -2);
+        Date F = c.getTime();
+        String formatF = format.format(F);
+
+        c.add(Calendar.HOUR, -2);
+        Date G = c.getTime();
+        String formatG = format.format(G);
+
+        c.add(Calendar.HOUR, -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 );
+    }
+
+    public String splitTimeByHoure(Date date) throws ParseException {
+        SimpleDateFormat df = new SimpleDateFormat("HH:mm");//设置日期格式,这里只取出小时和分钟
+        String format = df.format(date);
+        return format;
+    }
+
+}

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

@@ -0,0 +1,192 @@
+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.produce.dhicc.result.R;
+import com.huimv.produce.dhicc.util.GetResponse;
+import net.sf.json.JSONObject;
+import org.springframework.web.bind.annotation.CrossOrigin;
+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.*;
+
+@RestController
+@RequestMapping("/screen/sizhu")
+@CrossOrigin
+public class ScreenSiZhuController {
+        /**
+         * xuyao   直接都写在这里了
+         *
+         * @param request
+         * @return
+         * @throws ClientException
+         * @throws ParseException
+         */
+        @RequestMapping("/count_sizhu_record")
+        public R count_sizhu_record(HttpServletRequest request) throws ClientException, ParseException {
+
+            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);
+        }
+
+
+
+         //过去七天的值
+        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.SendMassageXixiaoPerson(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.SendMassageXixiaoPerson(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, 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",1);
+                 params.put("alarmType",303);
+                 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[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.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");
+                 JSONObject jsonObject1 = JSONObject.fromObject(jsondata.get("pageData").toString().substring(1, jsondata.get("pageData").toString().length() - 1));
+                 Object alarmDate = jsonObject1.get("alarmDate");
+                return alarmDate.toString();
+             }
+
+
+    }
+
+
+

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

@@ -0,0 +1,24 @@
+package com.huimv.produce.dhicc.util;
+
+import java.util.Date;
+
+public class GetPastTime {
+
+     //拿过去的时间  这个接口其实可以抽象出来
+    public Date getTimeBefor(       ){
+
+
+
+
+       return   new Date();
+
+    }
+
+
+
+
+
+
+
+
+}

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

@@ -0,0 +1,317 @@
+package com.huimv.produce.dhicc.util;
+
+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 net.sf.json.JSONObject;
+import com.huimv.produce.dhicc.result.R;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+public class GetResponse {
+
+
+    /**
+     *  //查车辆过去七天的接口
+     * @param begin  开始时间
+     * @param end  结束时间
+     * @return
+     * @throws ClientException
+     */
+    public String SendMassageGetPage(String begin, String end  ) throws ClientException {
+        String param = "queryTimeBegin=" + begin + "&queryTimeEnd=" + end;
+        String Url = "/evo-apigw/ipms/carcapture/find/conditions?";
+        IClient iClient = new DefaultClient();
+        System.out.println("开始执行");
+        String newUrl = Url + param;
+        System.out.println(newUrl);
+        GeneralRequest generalRequest = new GeneralRequest(newUrl, Method.GET);
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        System.out.println("执行结束");
+        JSONObject jsonObject = JSONObject.fromObject(generalResponse.getResult());
+        Object data = jsonObject.get("data");
+        JSONObject   bject = JSONObject.fromObject(data);
+        Object data1 = bject.get("totalRows"); //打印 2390
+        return data1.toString();
+
+    }
+
+
+
+
+    /**
+     *  //查人员通过过去几个小时的接口---正常通过
+     * @param begin   开始时间
+     * @param end     结束时间
+     * @return
+     * @throws ClientException
+     */
+    public String SendMassageGetPagePerson(String begin, String end  ) throws ClientException {
+        Map<String, Object> params = new HashMap<>();
+        params.put("startSwingTime",begin);
+        params.put("endSwingTime",end);
+        params.put("openType",61);
+        String URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combinedCount?systime=";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        String timestamp = String.valueOf((new Date()).getTime());
+        Long aLong = Long.valueOf(timestamp);
+        String NewUrl = URL + aLong;
+        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");
+        return data.toString();
+    }
+
+
+
+
+
+
+
+
+    /**
+     *  //查人员通过过去几个小时的接口---异常通过
+     * @param begin   开始时间
+     * @param end     结束时间
+     * @return
+     * @throws ClientException
+     */
+    public String SendMassageGetPagePersonAlarm(String begin, String end  ) throws ClientException {
+        Map<String, Object> params = new HashMap<>();
+        params.put("startSwingTime",begin);
+        params.put("endSwingTime",end);
+        params.put("containDomain","1");
+        params.put("openResult",0);
+        String URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combinedCount?systime=";  //获取事件URL    post请求
+        IClient iClient = new DefaultClient();
+        String timestamp = String.valueOf((new Date()).getTime());
+        Long aLong = Long.valueOf(timestamp);
+        String NewUrl = URL + aLong;
+        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");
+        return data.toString();
+    }
+
+
+
+
+
+
+    /**
+     *  //查洗消时间次数的接口-----
+     * @param begin   开始时间
+     * @param end     结束时间
+     * @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);
+        String[]  nodeCodeList=  new String[3];
+        nodeCodeList[0]=     "1002871$1$0$0"    ;
+        nodeCodeList[1]=   "1002872$1$0$0"      ;
+        nodeCodeList[2]=    "1002873$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();
+    }
+
+
+
+
+    /**
+     *  //查洗消时间次数的接口-----
+     * @param begin   开始时间
+     * @param end     结束时间
+     * @return
+     * @throws ClientException
+     */
+    public String SendMassageSiZhuRecord(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);
+        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"   ;
+        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();
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    public Object SendMassagePost(String param , String Url , String chooseMethod   ) throws ClientException {
+        IClient iClient = new DefaultClient();
+        System.out.println("开始执行");
+        String newUrl = Url + param;
+        //这种已经在配置文件里面安排了账号ip以及密码    现在变了
+        GeneralRequest generalRequest = new GeneralRequest(newUrl, Method.POST);
+        GeneralResponse generalResponse = iClient.doAction(generalRequest, generalRequest.getResponseClass());
+        System.out.println("执行结束");
+        return  R.ok("请求成功").put("token",generalResponse);
+
+    }
+
+
+
+
+
+
+
+}

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

@@ -0,0 +1,68 @@
+package com.huimv.produce.dhicc.util;
+
+import java.io.Serializable;
+
+public class Result implements Serializable {
+
+    private boolean success;
+    private Integer code;
+    private String message;
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+    }
+
+    private Object data;
+
+    //不需要返回数据时使用
+    public Result(ResultCode code) {
+        this.success = code.success;
+        this.code = code.code;
+        this.message = code.message;
+    }
+
+    public Result(ResultCode code, Object data) {
+        this.success = code.success;
+        this.code = code.code;
+        this.message = code.message;
+        this.data = data;
+    }
+
+    public Result(Integer code, String message, boolean success) {
+        this.code = code;
+        this.message = message;
+        this.success = success;
+    }
+
+    /*
+     * 调用ResultCode类封装常用的返回数据
+     */
+}

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

@@ -0,0 +1,41 @@
+package com.huimv.produce.dhicc.util;
+
+public enum ResultCode {
+    SUCCESS(true,10000,"操作成功!"),
+    //---系统错误返回码-----
+    FAIL(false,10001,"操作失败"),
+    UNAUTHENTICATED(false,10002,"您还未登录"),
+    UNAUTHORISE(false,10003,"权限不足"),
+    SERVER_ERROR(false,99999,"抱歉,系统繁忙,请稍后重试!"),
+
+    //---用户操作返回码  2xxxx----
+    MOBILEORPASSWORDERROR(false,20001,"用户名或密码错误");
+    //---企业操作返回码  3xxxx----
+    //---权限操作返回码----
+    //---其他操作返回码----
+
+    //操作是否成功
+    boolean success;
+    //操作代码
+    int code;
+    //提示信息
+    String message;
+
+    ResultCode(boolean success, int code, String message){
+        this.success = success;
+        this.code = code;
+        this.message = message;
+    }
+
+    public boolean success() {
+        return success;
+    }
+
+    public int code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+}

+ 40 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/entity/SysTelecomEvent.java

@@ -0,0 +1,40 @@
+package com.huimv.produce.entity;
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+
+//烘干事件生成的地方
+@Data
+@EqualsAndHashCode()
+@Accessors(chain = true)
+public class SysTelecomEvent {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    private Integer farmId;
+
+    private Integer eventId;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    private Date  eventTime;
+
+
+    private String deviceId;
+
+    private String remark;
+
+
+
+
+}

+ 16 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/entity/dto/TelecomVo.java

@@ -0,0 +1,16 @@
+package com.huimv.produce.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+@Data
+public class TelecomVo {
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    private Date eventTime;
+
+    private  String location;
+
+    private  String deviceId;
+
+
+}

+ 11 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/mapper/SysTelecomEventMapper.java

@@ -0,0 +1,11 @@
+package com.huimv.produce.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.produce.entity.SysTelecom;
+import com.huimv.produce.entity.SysTelecomEvent;
+
+
+public interface SysTelecomEventMapper extends BaseMapper<SysTelecomEvent> {
+
+
+}

+ 2 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/mapper/SysTelecomMapper.java

@@ -2,6 +2,7 @@ package com.huimv.produce.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.huimv.produce.entity.SysTelecom;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.huimv.produce.entity.SysTelecom;
  * @author astupidcoder
  * @since 2021-11-22
  */
+@Repository
 public interface SysTelecomMapper extends BaseMapper<SysTelecom> {
 
 }

+ 14 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/service/ISysTelecomEventService.java

@@ -0,0 +1,14 @@
+package com.huimv.produce.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.huimv.common.utils.Result;
+import com.huimv.produce.entity.SysTelecomEvent;
+
+import java.util.Map;
+
+
+public interface ISysTelecomEventService extends IService<SysTelecomEvent> {
+
+    Result listByRoom(Map map);
+
+}

+ 2 - 1
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/service/impl/SysDayWaterServiceImpl.java

@@ -72,6 +72,7 @@ public class SysDayWaterServiceImpl extends ServiceImpl<SysDayWaterMapper, SysDa
         //自定义
         if ("4".equals(type)){
             endDate= endDate+" 23:59:59";
+            startDate= startDate+" 00:00:00";
             wrapper.between("create_time", startDate, endDate);
             List<SysDayWater> dayWater = dayWaterMapper.listDay(wrapper);
             endMap.put("data",dayWater);
@@ -126,7 +127,7 @@ public class SysDayWaterServiceImpl extends ServiceImpl<SysDayWaterMapper, SysDa
         endMap.put("room",baseRoom.getAlias()+baseRoom.getRoomName());
 
         wrapper.clear();
-        wrapper.eq("room_id",roomId);
+        wrapper.eq("farm_id",farmId);
         DayWaterDto dayWaterDto = dayWaterMapper.countMonthAndWeek(wrapper);
 
         endMap.put("monthWater",dayWaterDto.getLastMonth());

+ 27 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/service/impl/SysTelecomEventServiceImpl.java

@@ -0,0 +1,27 @@
+package com.huimv.produce.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huimv.common.utils.Result;
+import com.huimv.common.utils.ResultCode;
+import com.huimv.produce.entity.SysTelecom;
+import com.huimv.produce.entity.SysTelecomEvent;
+import com.huimv.produce.mapper.SysTelecomEventMapper;
+import com.huimv.produce.service.ISysTelecomEventService;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+@Service
+public class SysTelecomEventServiceImpl extends ServiceImpl<SysTelecomEventMapper, SysTelecomEvent> implements ISysTelecomEventService {
+
+    @Override
+    public Result listByRoom(Map map) {
+        String deviceId = (String)map.get("deviceId");
+        QueryWrapper<SysTelecomEvent> wrapper = new QueryWrapper<>();
+        wrapper.eq("device_id",deviceId);
+        this.list(wrapper);
+        return new Result(ResultCode.SUCCESS,wrapper);
+    }
+
+}

+ 82 - 0
huimv-farm-v2/huimv-produce-warning/src/main/java/com/huimv/produce/timer/SysTelcomEnentTimmer.java

@@ -0,0 +1,82 @@
+package com.huimv.produce.timer;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.huimv.produce.entity.SysTelecom;
+import com.huimv.produce.entity.SysTelecomEvent;
+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.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+
+//主要用来生产烘干数据的 时间拿时间
+@Component
+public class SysTelcomEnentTimmer {
+    //首先尝试存储数据进新表
+
+    @Autowired
+    private SysTelecomMapper  sysTelecomMapper;
+
+    @Autowired
+    private ISysTelecomEventService sysTelecomEventService;
+
+       //每小时执行一次
+       @Scheduled(cron = " 0 */59 * * * ?")
+       private void updateBox() {
+           //有好几个基站需要报警数据   现在默认是 fff15aea9c2a4b749efb68db751eaace   //这一台  后面还会加其他的参数吧
+           //获得设备列表 查找烘干数据
+           SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+           LambdaQueryWrapper<SysTelecom> lambdaQueryWrapper =
+                   new LambdaQueryWrapper<>();
+           lambdaQueryWrapper
+                   .select(SysTelecom::getDeviceId);
+           List<String> collect = sysTelecomMapper.selectObjs(lambdaQueryWrapper).stream().map(o -> (String) o).collect(Collectors.toList());
+           for (String deviceId : collect) {
+               Calendar c = Calendar.getInstance();
+               c.setTime(new Date());
+               c.add(Calendar.HOUR, -2);
+               Date began1 = c.getTime();
+               String startTime1 = format.format(new Date());
+               String endTime1 = format.format(began1);
+               LambdaQueryWrapper<SysTelecom> wrapper = Wrappers.lambdaQuery();
+                   wrapper.eq(SysTelecom::getDeviceId, deviceId);
+                   wrapper.eq(SysTelecom::getFarmId, 1);
+                   wrapper.between(SysTelecom::getTimestamp, startTime1, endTime1);
+               List<SysTelecom> sysTelecoms = sysTelecomMapper.selectList(wrapper);
+               for (SysTelecom sysTelecom : sysTelecoms) {
+                    if( Double.parseDouble(sysTelecom.getTemp())>50){
+                        //产生时间段
+                        Calendar c1 = Calendar.getInstance();
+                        c1.setTime(sysTelecom.getTimestamp());
+                        c1.add(Calendar.MINUTE, -60);
+                        Date began = c.getTime();
+                        String startTime = format.format(began);
+                        c.add(Calendar.MINUTE, +110);
+                        Date endTime11 = c.getTime();
+                        String endTime = format.format(endTime11);
+                        //查询在大于50摄氏度这条记录的 前60分钟 后60分钟  时间里,有没有存储过报警事件  有就放弃  没有就加一条
+                        int count1 = sysTelecomEventService.count(Wrappers.<SysTelecomEvent>lambdaQuery()
+                                .eq(SysTelecomEvent::getDeviceId,sysTelecom.getDeviceId())
+                                .eq(SysTelecomEvent::getFarmId,sysTelecom.getFarmId())
+                                .between(SysTelecomEvent::getEventTime, startTime, endTime));
+                        if(count1==0){
+                            SysTelecomEvent sysTelecomEvent = new SysTelecomEvent();
+                            sysTelecomEvent.setDeviceId(sysTelecom.getDeviceId());
+                            sysTelecomEvent.setEventTime(sysTelecom.getTimestamp());
+                            sysTelecomEvent.setEventId(sysTelecom.getId());
+                            sysTelecomEvent.setFarmId(sysTelecom.getFarmId());
+                            sysTelecomEvent.setRemark(sysTelecom.getTemp());
+                            sysTelecomEventService.save(sysTelecomEvent);
+                        }
+                        System.out.println("抛弃");
+                    }
+               }
+           }
+       }
+}

+ 8 - 6
huimv-farm-v2/huimv-produce-warning/src/main/resources/com/huimv/produce/mapper/SysDayWaterMapper.xml

@@ -3,15 +3,15 @@
 <mapper namespace="com.huimv.produce.mapper.SysDayWaterMapper">
 
     <select id="countWater" resultType="java.lang.Double">
-        SELECT  ROUND(SUM(`value`),2)
-        FROM   `sys_day_water`
+        SELECT   ROUND(SUM(increase_value),2 )`value`
+        FROM   `sys_month_water`
         ${ew.customSqlSegment}
 
     </select>
     <select id="listAllWater" resultType="com.huimv.produce.entity.SysDayWater">
 
         SELECT
-        id,ROUND(SUM(`value`),2)'value' , create_time, room_id,day_water_id FROM `sys_day_water`
+       id , create_time ,room_id, ROUND(SUM(increase_value),2 )`value`  FROM `sys_month_water`
 
             ${ew.customSqlSegment}
 
@@ -20,15 +20,17 @@
     </select>
     <select id="listDay" resultType="com.huimv.produce.entity.SysDayWater">
 
-          SELECT * FROM `sys_day_water`
+          SELECT  id , create_time ,room_id, ROUND(SUM(increase_value),2 )`value`  FROM `sys_month_water`
         ${ew.customSqlSegment}
 
        GROUP BY DATE_FORMAT( `create_time`, '%m%d' )
     </select>
+
+
     <select id="countMonthAndWeek" resultType="com.huimv.produce.entity.dto.DayWaterDto">
                     SELECT
              (SELECT
-            IFNULL(SUM(`value`),0) monthQuantity
+             ROUND( IFNULL(SUM(`value`),0),2) monthQuantity
             FROM `sys_day_water`
                 ${ew.customSqlSegment} AND PERIOD_DIFF( DATE_FORMAT( NOW( ) , '%Y%m' ) , DATE_FORMAT( create_time, '%Y%m' ) ) =1 ) lastMonth,
 
@@ -40,7 +42,7 @@
 
 
             (SELECT
-            IFNULL(SUM(`value`),0) monthQuantity
+           ROUND( IFNULL(SUM(`value`),0) ,2)monthQuantity
             FROM `sys_day_water`
                ${ew.customSqlSegment} AND YEARWEEK(DATE_FORMAT(create_time,'%Y-%m-%d')) =YEARWEEK(NOW())-1 ) lastWeek,