From d9da603305a2b94bde78483fa8777a43ee352548 Mon Sep 17 00:00:00 2001
From: wang-hao-jie <1550036656@qq.com>
Date: 星期二, 18 一月 2022 08:22:49 +0800
Subject: [PATCH] 违章记录

---
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java |  109 +++++++++++++
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java |    5 
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java            |   12 +
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/UpdateAppMapper.java            |   14 +
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IUpdateAppServiceImpl.java |   26 +++
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/CustomerReceive.java            |    2 
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/HaiKangPost.java                  |   34 +++-
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java                         |   31 +++
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java  |    6 
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Equipment.java                  |    2 
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IUpdateAppService.java         |   14 +
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java         |    2 
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/AlarmVo.java                        |   12 +
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AddOilController.java       |    9 +
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java     |   50 ++++++
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java                      |    4 
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/UpdateApp.java                  |   36 ++++
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java |    2 
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java |   16 +
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/UpdateAppController.java    |   80 ++++++++++
 xboot-modules/xboot-your/src/main/resources/mapper/UpdateAppMapper.xml                             |    5 
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/ApplicationRunnerImpl.java        |    1 
 22 files changed, 445 insertions(+), 27 deletions(-)

diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AddOilController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AddOilController.java
index 8fd4cf0..590099c 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AddOilController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AddOilController.java
@@ -6,8 +6,10 @@
 import cn.exrick.xboot.core.common.vo.PageVo;
 import cn.exrick.xboot.core.common.vo.Result;
 import cn.exrick.xboot.your.entity.AddOil;
+import cn.exrick.xboot.your.entity.Car;
 import cn.exrick.xboot.your.service.IAddOilService;
 
+import cn.exrick.xboot.your.service.ICarService;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -42,6 +44,8 @@
 
     @Autowired
     private IAddOilService iAddOilService;
+    @Autowired
+    private ICarService iCarService;
 
     @RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
     @ApiOperation(value = "閫氳繃id鑾峰彇")
@@ -125,6 +129,11 @@
     @ApiOperation(value = "缂栬緫鎴栨洿鏂版暟鎹�")
     public Result<AddOil> saveOrUpdate(AddOil addOil) {
 
+        if(StrUtil.isNotEmpty(addOil.getCarId())&&StrUtil.isEmpty(addOil.getAddOilCode())){
+            Car byId = iCarService.getById(addOil.getCarId());
+            addOil.setAddOilCode(byId.getAddOilCode());
+        }
+
         if (iAddOilService.saveOrUpdate(addOil)) {
             return new ResultUtil<AddOil>().setData(addOil);
         }
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/UpdateAppController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/UpdateAppController.java
new file mode 100644
index 0000000..1900abf
--- /dev/null
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/UpdateAppController.java
@@ -0,0 +1,80 @@
+package cn.exrick.xboot.your.controller;
+
+import cn.exrick.xboot.core.common.utils.PageUtil;
+import cn.exrick.xboot.core.common.utils.ResultUtil;
+import cn.exrick.xboot.core.common.vo.PageVo;
+import cn.exrick.xboot.core.common.vo.Result;
+import cn.exrick.xboot.your.entity.UpdateApp;
+import cn.exrick.xboot.your.service.IUpdateAppService;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author whj
+ */
+@Slf4j
+@RestController
+@Api(tags = "app鐗堟湰鏇存柊绠$悊鎺ュ彛")
+@RequestMapping("/xboot/updateApp")
+@Transactional
+public class UpdateAppController {
+
+    @Autowired
+    private IUpdateAppService iUpdateAppService;
+
+    @RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
+    @ApiOperation(value = "閫氳繃id鑾峰彇")
+    public Result<UpdateApp> get(@PathVariable String id) {
+
+        UpdateApp updateApp = iUpdateAppService.getById(id);
+        return new ResultUtil<UpdateApp>().setData(updateApp);
+    }
+
+    @RequestMapping(value = "/getAll", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇鍏ㄩ儴鏁版嵁")
+    public Object getAll() {
+
+        List<UpdateApp> list = iUpdateAppService.list();
+        if(list.size()==0){
+            return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁存姢鏁版嵁");
+        }
+        return ResultUtil.data(list.get(0));
+    }
+
+    @RequestMapping(value = "/getByPage", method = RequestMethod.GET)
+    @ApiOperation(value = "鍒嗛〉鑾峰彇")
+    public Result<IPage<UpdateApp>> getByPage(PageVo page) {
+
+        IPage<UpdateApp> data = iUpdateAppService.page(PageUtil.initMpPage(page));
+        return new ResultUtil<IPage<UpdateApp>>().setData(data);
+    }
+
+    @RequestMapping(value = "/insertOrUpdate", method = RequestMethod.POST)
+    @ApiOperation(value = "缂栬緫鎴栨洿鏂版暟鎹�")
+    public Result<UpdateApp> saveOrUpdate(UpdateApp updateApp) {
+
+        if (iUpdateAppService.saveOrUpdate(updateApp)) {
+            return new ResultUtil<UpdateApp>().setData(updateApp);
+        }
+        return new ResultUtil<UpdateApp>().setErrorMsg("鎿嶄綔澶辫触");
+    }
+
+    @RequestMapping(value = "/delByIds", method = RequestMethod.POST)
+    @ApiOperation(value = "鎵归噺閫氳繃id鍒犻櫎")
+    public Result<Object> delAllByIds(@RequestParam String[] ids) {
+
+        for (String id : ids) {
+            iUpdateAppService.removeById(id);
+        }
+        return ResultUtil.success("鎵归噺閫氳繃id鍒犻櫎鏁版嵁鎴愬姛");
+    }
+}
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java
index 88a6fc6..9809a1d 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/face/FaceImgController.java
@@ -37,7 +37,7 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-
+//浜鸿劯姣斿妫�娴嬭溅鍘㈠紓甯稿紑鍚�
 @RestController
 @RequestMapping("/hk")
 public class FaceImgController {
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java
index ab3b00c..3f3936e 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java
@@ -8,7 +8,11 @@
 import cn.exrick.xboot.your.entity.*;
 import cn.exrick.xboot.your.service.*;
 import cn.exrick.xboot.your.util.HaiKangPost;
+import cn.exrick.xboot.your.vo.AlarmVo;
+import cn.exrick.xboot.your.vo.PreviewURLsVo;
+import cn.exrick.xboot.your.vo.TalkURLsVo;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -52,6 +56,12 @@
     @Autowired
     private IAreaSectionService iAreaSectionService;
 
+    @Autowired
+    private IEquipmentService iEquipmentService;
+
+    @Autowired
+    private IAlarmService iAlarmService;
+
     @RequestMapping(value = "/getIndex1", method = RequestMethod.GET)
     @ApiOperation(value = "鑾峰彇棣栭〉鏁版嵁")
     public Result<Object> getIndex1() {
@@ -91,10 +101,17 @@
     @ApiOperation(value = "鑾峰彇杞﹁締瀹氫綅淇℃伅")
     public Result<Object> getCars() {
         List<Car> list = iCarService.list();
-        String codes[] = new String[list.size()];
+        List<String> list2 = new ArrayList<>();
 
         for(int i=0;i<list.size();i++){
-            codes[i] = list.get(i).getCode();
+            if(!StrUtil.isEmpty(list.get(i).getCode())){
+                list2.add(list.get(i).getCode());
+            }
+        }
+
+        String codes[] = new String[list2.size()];
+        for(int i=0;i<list2.size();i++){
+            codes[i] = list2.get(i);
         }
         String latestGps = haiKangPost.findLatestGps(codes);
         return new ResultUtil<Object>().setData(JSONUtil.parseObj(latestGps));
@@ -153,6 +170,94 @@
         return new ResultUtil<Object>().setData(map);
     }
 
+    @RequestMapping(value = "/getOrderStatus", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇鏌愯締杞︾殑閰嶉�佹儏鍐�")
+    public Result<Object> getOrderStatus(String carNo) {
+
+        QueryWrapper<Car> wrapper = new QueryWrapper<>();
+        wrapper.eq("car_no",carNo);
+        Car car = iCarService.getOne(wrapper);
+
+        if(car==null){
+           return ResultUtil.error("杞﹁締涓嶅瓨鍦�,璇峰厛娣诲姞杞﹁締淇℃伅");
+        }
+
+        QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>();
+        String format = DateUtil.format(new Date(), "yyyy-MM-dd");
+        wrapper2.eq("a.send_date",format);
+        wrapper2.eq("a.car_id",car.getId());
+        List<OrderTask> list = iOrderTaskService.list4(wrapper2);
+
+        return new ResultUtil<Object>().setData(list);
+    }
+
+    @RequestMapping(value = "/getVideoByCarId", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇瑙嗛淇℃伅 1锛氬墠缃� 4锛氳溅鍐�")
+    public Result<Object> getVideoByCarId(String carCode,int type) {
+        QueryWrapper<Car> wrapper = new QueryWrapper<Car>();
+        wrapper.eq("code",carCode);
+        Car car = iCarService.getOne(wrapper);
+        if(car==null){
+            return ResultUtil.error("杞﹁締缂栧彿閿欒");
+        }
+
+        QueryWrapper<Equipment> wrapper1 = new QueryWrapper<>();
+        wrapper1.eq("car_id",car.getId());
+        wrapper1.eq("type",type);
+        Equipment one = iEquipmentService.getOne(wrapper1);
+        if(one==null){
+            return ResultUtil.error("璁惧鏈壘鍒�");
+        }
+
+        PreviewURLsVo previewURLsVo = new PreviewURLsVo();
+		previewURLsVo.setCameraIndexCode(one.getCode());
+        String s = haiKangPost.previewURLs(previewURLsVo);
+        return new ResultUtil<Object>().setData(JSONUtil.parseObj(s));
+    }
+
+    @RequestMapping(value = "/getYuYinByCarId", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇瀵硅淇℃伅")
+    public Result<Object> getYuYinByCarId(String carCode,int type,int transmode) {
+        QueryWrapper<Car> wrapper = new QueryWrapper<Car>();
+        wrapper.eq("code",carCode);
+        Car car = iCarService.getOne(wrapper);
+        if(car==null){
+            return ResultUtil.error("杞﹁締缂栧彿閿欒");
+        }
+
+        QueryWrapper<Equipment> wrapper1 = new QueryWrapper<>();
+        wrapper1.eq("car_id",car.getId());
+        wrapper1.eq("type",type);
+        Equipment one = iEquipmentService.getOne(wrapper1);
+        if(one==null){
+            return ResultUtil.error("璁惧鏈壘鍒�");
+        }
+
+        TalkURLsVo talkURLsVo =new TalkURLsVo();
+        talkURLsVo.setCameraIndexCode(one.getCode());
+        talkURLsVo.setTransmode(transmode);
+        String s = haiKangPost.talkURLs(talkURLsVo);
+        return new ResultUtil<Object>().setData(JSONUtil.parseObj(s));
+    }
+
+    @RequestMapping(value = "/getAlarmByCarId", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇鎶ヨ鍥剧墖")
+    public Result<Object> getAlarmByCarId(String alarmId) {
+        QueryWrapper<Alarm> wrapper = new QueryWrapper<Alarm>();
+        wrapper.eq("alarm_id",alarmId);
+        Alarm alarm = iAlarmService.getOne(wrapper);
+        if(alarm==null){
+            return ResultUtil.error("鎶ヨid閿欒");
+        }
+
+        AlarmVo alarmVo = new AlarmVo();
+        alarmVo.setAlarmId(alarm.getAlarmId());
+        String[] s1 = alarm.getAlarmTime().split(" ");
+        alarmVo.setAlarmTime(s1[0]+"T"+s1[1]+".000+08:00");
+        String s = haiKangPost.findPicturesByAlarmId(alarmVo);
+        return new ResultUtil<Object>().setData(JSONUtil.parseObj(s));
+    }
+
     public double trans2(double v2){
         return (double) Math.round(v2 * 100) / 100;
     }
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java
index 284354a..c7e2b16 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java
@@ -67,7 +67,7 @@
         String openid = SessionKeyOpenId.getStr("openid");
 
         if(StrUtil.isEmpty(openid)){
-            return ResultUtil.error(SessionKeyOpenId.toString());
+            return ResultUtil.error("error寰俊:"+SessionKeyOpenId.toString());
         }
 
         QueryWrapper<Customer> wrapper = new QueryWrapper<>();
@@ -96,6 +96,17 @@
     @RequestMapping(value = "/bindWx", method = RequestMethod.POST)
     @ApiOperation(value = "寰俊缁戝畾闆跺敭璁稿彲璇�")
     public Object bindWx(String licence,String openId){
+        QueryWrapper<Customer> wrapper2 = new QueryWrapper<>();
+        wrapper2.eq("open_id",openId);
+        Customer c = iCustomerService.getOne(wrapper2);
+        if(c==null){
+
+        }else {
+            System.out.println(c.getOpenId());
+            c.setOpenId("");
+            iCustomerService.saveOrUpdate(c);
+        }
+
         QueryWrapper<Customer> wrapper = new QueryWrapper<>();
         wrapper.eq("licence",licence);
         Customer one = iCustomerService.getOne(wrapper);
@@ -141,6 +152,9 @@
         wrapper2.eq("customer_id",customerId);
         wrapper2.eq("send_date",format);
         OrderTask orderTask = iOrderTaskService.getOne(wrapper2);
+        if(orderTask==null){
+            return ResultUtil.error("浠婃棩鏃犺鍗�");
+        }
         String carId = orderTask.getCarId();
         Car car = iCarService.getById(carId);
         String[] carids = new String[1];
@@ -166,6 +180,9 @@
     @ApiOperation(value = "鍔犳补鍔╁姏")
     public Object likes(String customerId){
         OrderTask order = getOrder(customerId);
+        if(order==null){
+            ResultUtil.error("浠婃棩鏃犺鍗�");
+        }
         order.setLikes(1);
         iOrderTaskService.saveOrUpdate(order);
         return ResultUtil.success("鍔╁姏鎴愬姛");
@@ -247,4 +264,35 @@
         }
         return new ResultUtil<CustomerReceive>().setErrorMsg("鎿嶄綔澶辫触");
     }
+
+    //14.鑾峰彇绛炬敹浜哄垪琛�
+    @RequestMapping(value = "/getCustomerReceive", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇绛炬敹浜�")
+    public Result<List<CustomerReceive>> getCustomerReceive(String customerId) {
+        PageVo page = new PageVo();
+        page.setPageSize(30);
+        page.setPageNumber(1);
+        page.setOrder("desc");
+        page.setSort("createTime");
+        QueryWrapper<CustomerReceive> wrapper = new QueryWrapper<>();
+        wrapper.eq("customer_id",customerId);
+        IPage<CustomerReceive> data = iCustomerReceiveService.page2(PageUtil.initMpPage(page),wrapper);
+        return new ResultUtil<List<CustomerReceive>>().setData(data.getRecords());
+    }
+
+    //15.鑾峰彇绛炬敹浜�
+    @RequestMapping(value = "/getCustomerReceiveById", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇绛炬敹浜�")
+    public Result<CustomerReceive> getCustomerReceiveById(String customerReceiveId) {
+        CustomerReceive byId = iCustomerReceiveService.getById(customerReceiveId);
+        return new ResultUtil<CustomerReceive>().setData(byId);
+    }
+
+    //16.鍒犻櫎鎺ヨ揣浜�
+    @RequestMapping(value = "/deleteReceive", method = RequestMethod.POST)
+    @ApiOperation(value = "鍒犻櫎鎺ヨ揣浜�")
+    public Object deleteReceive(String id) {
+        iCustomerReceiveService.removeById(id);
+        return ResultUtil.success("鍒犻櫎鎴愬姛");
+    }
 }
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java
index 0ca8451..8c389dd 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Alarm.java
@@ -56,4 +56,8 @@
 
     @ApiModelProperty(value = "寮傚父寮�鍚浘鐗�")
     private String alarmImg;
+
+    @ApiModelProperty(value = "鎶ヨ鏃堕棿")
+    private String alarmTime;
+
 }
\ No newline at end of file
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/CustomerReceive.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/CustomerReceive.java
index 219a2c5..79d8c7c 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/CustomerReceive.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/CustomerReceive.java
@@ -27,7 +27,7 @@
 
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value = "鍖哄煙id")
+    @ApiModelProperty(value = "鍟嗘埛id")
     private String customerId;
 
     @ApiModelProperty(value = "鍚嶇О")
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Equipment.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Equipment.java
index c066516..d3543f8 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Equipment.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/Equipment.java
@@ -28,7 +28,7 @@
 
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value = "0:杞︽満 1:鎽勫儚鏈� 2:鎶撴媿鏈� 3:pad")
+    @ApiModelProperty(value = "0:杞︽満 1:鍓嶇疆鎽勫儚鏈�  2:鎶撴媿鏈� 3:pad 4锛氳溅鍐呮憚鍍忔満")
     private int type;
 
     @ApiModelProperty(value = "缂栧彿")
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/UpdateApp.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/UpdateApp.java
new file mode 100644
index 0000000..be1b35e
--- /dev/null
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/UpdateApp.java
@@ -0,0 +1,36 @@
+package cn.exrick.xboot.your.entity;
+
+import cn.exrick.xboot.core.base.XbootBaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.hibernate.annotations.DynamicInsert;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import java.util.List;
+
+/**
+ * @author Exrick
+ */
+@Data
+@Entity
+@DynamicInsert
+@DynamicUpdate
+@Table(name = "t_update_app")
+@TableName("t_update_app")
+@ApiModel(value = "瀹㈡埛绔洿鏂�")
+public class UpdateApp extends XbootBaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    private String apkUrl;//apk涓嬭浇鍦板潃
+    private String updateTitle;//鏇存柊鏍囬
+    private String updateContent;//鏇存柊鍐呭
+    private String version;//鐗堟湰鍙�
+    private String versionName;//鐗堟湰
+}
\ No newline at end of file
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java
index f29b9c2..32c9a5a 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java
@@ -35,12 +35,13 @@
     @Select("SELECT count(id) FROM t_order_task where likes=1")
     int countLike();
 
-    @Select("select b.car_no as carNo1,c.name as name1,d.name as name2,count(a.area_section_id) as num1,sum(case when a.status=0 then 1 else 0 end) as num2 from t_order_task a LEFT JOIN t_car b on a.car_id=b.id LEFT JOIN t_area c on a.area_id=c.id LEFT JOIN t_area_ection d on a.area_section_id=d.id where DATE_FORMAT(a.send_date,'%Y-%m-%d')=#{date} GROUP BY a.area_section_id,b.car_no,c.name,d.name")
+    @Select("select b.car_no as carNo1,c.name as name1,d.name as name2,count(a.area_section_id) as num1,sum(case when a.status=0 then 1 else 0 end) as num2 ,sum(case when a.status=1 then 1 else 0 end) as num3 from t_order_task a LEFT JOIN t_car b on a.car_id=b.id LEFT JOIN t_area c on a.area_id=c.id LEFT JOIN t_area_ection d on a.area_section_id=d.id where DATE_FORMAT(a.send_date,'%Y-%m-%d')=#{date} GROUP BY a.area_section_id,b.car_no,c.name,d.name")
     @Results({@Result(column="carNo1", property="carNo", jdbcType = JdbcType.VARCHAR),
             @Result(column="name1", property="areaName", jdbcType = JdbcType.VARCHAR),
             @Result(column="name2", property="areaSectionName", jdbcType = JdbcType.VARCHAR),
             @Result(column="num1", property="num", jdbcType = JdbcType.INTEGER),
-            @Result(column="num2", property="level", jdbcType = JdbcType.INTEGER)})
+            @Result(column="num2", property="level", jdbcType = JdbcType.INTEGER),
+            @Result(column="num3", property="seq", jdbcType = JdbcType.INTEGER)})
     List<OrderTask> list3(String date);
 
     @Select("select sum(time) as time2,send_date from t_order_task where date_sub(curdate(), interval 1 month) <= date(send_date) and area_section_id=#{arg0} GROUP BY send_date")
@@ -71,4 +72,11 @@
             @Result(column="num2", property="num", jdbcType = JdbcType.INTEGER),
             @Result(column="num3", property="level", jdbcType = JdbcType.INTEGER)})
     List<OrderTask> groupByTime(String areaId, String selectId);
+
+    @Select("SELECT a.*,b.name as temp,c.name as temp2,b.lng as temp3,b.lat as temp4 FROM t_order_task a LEFT JOIN t_customer b ON a.customer_id=b.id LEFT JOIN t_customer_receive c ON a.customer_receive_id=c.id ${ew.customSqlSegment} ")
+    @Results({@Result(column="temp", property="customerName", jdbcType = JdbcType.VARCHAR),
+            @Result(column="temp2", property="code", jdbcType = JdbcType.VARCHAR),
+            @Result(column="temp3", property="areaName", jdbcType = JdbcType.VARCHAR),
+            @Result(column="temp4", property="areaSectionName", jdbcType = JdbcType.VARCHAR)})
+    List<OrderTask> list4(@Param(Constants.WRAPPER) QueryWrapper<OrderTask> wrapper2);
 }
\ No newline at end of file
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/UpdateAppMapper.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/UpdateAppMapper.java
new file mode 100644
index 0000000..2e7252c
--- /dev/null
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/UpdateAppMapper.java
@@ -0,0 +1,14 @@
+package cn.exrick.xboot.your.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import cn.exrick.xboot.your.entity.UpdateApp;
+
+import java.util.List;
+
+/**
+ * app鐗堟湰鏇存柊鏁版嵁澶勭悊灞�
+ * @author whj
+ */
+public interface UpdateAppMapper extends BaseMapper<UpdateApp> {
+
+}
\ No newline at end of file
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java
index fb63005..683ddf3 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderSynScheduleImpl.java
@@ -41,8 +41,8 @@
     @Autowired
     private ICustomerReceiveService iCustomerReceiveService;
 
-    //@Scheduled(cron="0 30 23 * * ?")//姣忔櫄鍑屾櫒1鐐规墽琛�
-    @Scheduled(cron="0 20 10 * * ?")//姣忔櫄鍑屾櫒1鐐规墽琛�
+    @Scheduled(cron="0 30 23 * * ?")//姣忔櫄鍑屾櫒1鐐规墽琛�
+    //@Scheduled(cron="0 22 11 * * ?")//姣忔櫄鍑屾櫒1鐐规墽琛�
     public void execute(){
         System.out.println("寮�濮嬪鐞嗚鍗�");
         QueryWrapper<OrderTaskOriginal> queryWrapper = new QueryWrapper<>();
@@ -71,7 +71,7 @@
             updateCustomerRecive(orderTask.getCustomerId(),original.getLinker(),original.getCustomerPhone());
 
             QueryWrapper<OrderDetailOriginal> wrapper = new QueryWrapper<>();
-            wrapper.between("create_time",dateStringFormat(new Date()),dateStringFormat2(new Date()));
+//            wrapper.between("create_time",dateStringFormat(new Date()),dateStringFormat2(new Date()));
             wrapper.eq("order_id",original.getId());
             List<OrderDetailOriginal> list1 = iOrderDetailOriginalService.list(wrapper);
             for(OrderDetailOriginal o:list1){
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java
index 2fae93d..7083ce9 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/StatisticScheduleImpl.java
@@ -57,8 +57,13 @@
                         one.setSafeDriving(0);//瀹夊叏椹鹃┒閲岀▼
                         one.setDriving(0);//椹鹃┒閲岀▼
                     }else{
-                        one.setSafeDriving(max-min);//瀹夊叏椹鹃┒閲岀▼
-                        one.setDriving(max-min);//椹鹃┒閲岀▼
+                        if(max==min){
+                            one.setSafeDriving(max);//瀹夊叏椹鹃┒閲岀▼
+                            one.setDriving(max);//椹鹃┒閲岀▼
+                        }else{
+                            one.setSafeDriving(max-min);//瀹夊叏椹鹃┒閲岀▼
+                            one.setDriving(max-min);//椹鹃┒閲岀▼
+                        }
                     }
 
                     QueryWrapper<DrivingRecord> wrapper2 = new QueryWrapper<>();
@@ -83,11 +88,14 @@
                 if(type2==1){
                     QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<>();
                     wrapper2.eq("user_id",user.getId());
+                    wrapper2.ne("status",0);
                     int count = iOrderTaskService.count(wrapper2);
                     one.setSends(count);//閰嶉�佹鏁�
 
-                    wrapper2.ne("status",0);
-                    int count2 = iOrderTaskService.count(wrapper2);
+                    QueryWrapper<OrderTask> wrapper22 = new QueryWrapper<>();
+                    wrapper22.eq("user_id",user.getId());
+                    wrapper22.eq("status",1);
+                    int count2 = iOrderTaskService.count(wrapper22);
                     one.setSends2(count2);//閫佽揪娆℃暟
 
                     QueryWrapper<Area> wrapper3 = new QueryWrapper<>();
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java
index 938dc10..9aeac79 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java
@@ -30,4 +30,6 @@
     List<OrderTask> sumTime(String id);
 
     List<OrderTask> groupByTime(String areaId, String selectId);
+
+    List<OrderTask> list4(QueryWrapper<OrderTask> wrapper2);
 }
\ No newline at end of file
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IUpdateAppService.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IUpdateAppService.java
new file mode 100644
index 0000000..541f22b
--- /dev/null
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IUpdateAppService.java
@@ -0,0 +1,14 @@
+package cn.exrick.xboot.your.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import cn.exrick.xboot.your.entity.UpdateApp;
+
+import java.util.List;
+
+/**
+ * app鐗堟湰鏇存柊鎺ュ彛
+ * @author whj
+ */
+public interface IUpdateAppService extends IService<UpdateApp> {
+
+}
\ No newline at end of file
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java
index 4843462..486712c 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java
@@ -71,6 +71,11 @@
     }
 
     @Override
+    public List<OrderTask> list4(QueryWrapper<OrderTask> wrapper2) {
+        return orderTaskMapper.list4(wrapper2);
+    }
+
+    @Override
     public Month getSendNum(int year){
         return orderTaskMapper.getSendNum(year);
     }
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IUpdateAppServiceImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IUpdateAppServiceImpl.java
new file mode 100644
index 0000000..73099de
--- /dev/null
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IUpdateAppServiceImpl.java
@@ -0,0 +1,26 @@
+package cn.exrick.xboot.your.serviceimpl;
+
+import cn.exrick.xboot.your.mapper.UpdateAppMapper;
+import cn.exrick.xboot.your.entity.UpdateApp;
+import cn.exrick.xboot.your.service.IUpdateAppService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * app鐗堟湰鏇存柊鎺ュ彛瀹炵幇
+ * @author whj
+ */
+@Slf4j
+@Service
+@Transactional
+public class IUpdateAppServiceImpl extends ServiceImpl<UpdateAppMapper, UpdateApp> implements IUpdateAppService {
+
+    @Autowired
+    private UpdateAppMapper updateAppMapper;
+}
\ No newline at end of file
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/ApplicationRunnerImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/ApplicationRunnerImpl.java
index 16887ff..318dd39 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/ApplicationRunnerImpl.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/ApplicationRunnerImpl.java
@@ -18,6 +18,7 @@
     @Override
     public void run(ApplicationArguments args) throws Exception {
         String topicInfo = haiKangPost.getTopicInfo();
+        System.out.println("璁㈤槄淇℃伅锛�"+topicInfo);
         JSONObject jsonObject = JSONUtil.parseObj(topicInfo);
         if(jsonObject.get("data")!=null){
             String data = jsonObject.get("data").toString();
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/HaiKangPost.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/HaiKangPost.java
index 2c9e0f1..bfc8a6f 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/HaiKangPost.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/HaiKangPost.java
@@ -3,10 +3,7 @@
 import java.math.BigDecimal;
 import java.util.*;
 
-import cn.exrick.xboot.your.vo.FindHistoryGpsRequest;
-import cn.exrick.xboot.your.vo.PlaybackURLsVo;
-import cn.exrick.xboot.your.vo.PreviewURLsVo;
-import cn.exrick.xboot.your.vo.TalkURLsVo;
+import cn.exrick.xboot.your.vo.*;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.hikvision.artemis.sdk.Client;
@@ -29,7 +26,8 @@
 	 * STEP2锛氳缃甇penAPI鎺ュ彛鐨勪笂涓嬫枃
 	 */
 	private static final String ARTEMIS_PATH = "/artemis";
-	private static final String HOST = "111.63.178.115:1443";
+	//private static final String HOST = "111.63.178.115:1443";
+	private static final String HOST = "10.10.101.1:1443";
 	private static final String APP_KEY = "28156526";
 	private static final String APP_SECRET = "MNkyjHuids4XxFONSOaL";
 
@@ -69,6 +67,7 @@
 		};
 		String body= JSONUtil.toJsonStr(previewURLsVo);
 		String result = doPostStringArtemis(path,body,null,null,"application/json");
+		System.out.println(result);
 		return result;
 	}
 
@@ -81,6 +80,19 @@
 			}
 		};
 		String body= JSONUtil.toJsonStr(playbackURLsVo);
+		String result = doPostStringArtemis(path,body,null,null,"application/json");
+		return result;
+	}
+
+	//鏍规嵁鎶ヨID鑾峰彇鍏宠仈鍥剧墖淇℃伅
+	public String findPicturesByAlarmId(AlarmVo alarmVo){
+		String findHistoryGpsDataApi = ARTEMIS_PATH +"/api/rtsm/v1/multimedia/findPicturesByAlarmId";
+		Map<String,String> path = new HashMap<String,String>(2){
+			{
+				put("https://",findHistoryGpsDataApi);
+			}
+		};
+		String body= JSONUtil.toJsonStr(alarmVo);
 		String result = doPostStringArtemis(path,body,null,null,"application/json");
 		return result;
 	}
@@ -165,7 +177,7 @@
 
 	public static void main(String[] args) {
 		HaiKangPost haiKangPost = new HaiKangPost();
-		haiKangPost.getTopicInfo();
+//		haiKangPost.getTopicInfo();
 
 //		FindHistoryGpsRequest findHistoryGpsRequest = new FindHistoryGpsRequest();
 //		findHistoryGpsRequest.setVehicleIndexCode("b279d865eabe497db465eb2f4d2cc87d");
@@ -177,10 +189,12 @@
 //		System.out.println(haiKangPost.findHistoryGps(findHistoryGpsRequest));
 
 //		String code[] = {"b279d865eabe497db465eb2f4d2cc87d"};
-//		System.out.println(findLatestGps(code));
+//		System.out.println(haiKangPost.findLatestGps(code));
 
-//		PreviewURLsVo previewURLsVo = new PreviewURLsVo();
-//		previewURLsVo.setCameraIndexCode("b279d865eabe497db465eb2f4d2cc87d");
-//		previewURLs(previewURLsVo);
+		PreviewURLsVo previewURLsVo = new PreviewURLsVo();
+		previewURLsVo.setCameraIndexCode("27760424aa8b486e84db8d6720b2a9bf");
+		previewURLsVo.setProtocol("rtmp");
+		haiKangPost.previewURLs(previewURLsVo);
+
 	}
 }
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java
index 390c107..db8c882 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java
@@ -2,8 +2,10 @@
 
 import cn.exrick.xboot.your.entity.Alarm;
 import cn.exrick.xboot.your.entity.Car;
+import cn.exrick.xboot.your.entity.EventLog;
 import cn.exrick.xboot.your.service.IAlarmService;
 import cn.exrick.xboot.your.service.ICarService;
+import cn.exrick.xboot.your.service.IEventLogService;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
@@ -13,12 +15,18 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.awt.*;
+
 @Component
 public class MQTT {
     @Autowired
     private IAlarmService iAlarmService;
     @Autowired
     private ICarService iCarService;
+    @Autowired
+    private HaiKangPost haiKangPost;
+    @Autowired
+    private IEventLogService iEventLogService;
 
     public static void main(String[] args) {
         MQTT mqtt = new MQTT();
@@ -26,7 +34,8 @@
     }
 
     public void event(String clientid,String userName,String passWord){
-        String HOST = "tcp://111.63.178.115:1883";
+        String HOST = "tcp://10.10.101.1:1883";
+        //String HOST = "tcp://111.63.178.115:1883";
         String TOPIC = "artemis/event_msa_alarm/5201154049/admin";
         int qos = 1;
 //            String clientid = "28156526";
@@ -51,6 +60,17 @@
             client.setCallback(new MqttCallback() {
                 public void connectionLost(Throwable cause) {
                     System.out.println("connectionLost");
+                    String topicInfo = haiKangPost.getTopicInfo();
+                    System.out.println("閲嶈繛-璁㈤槄淇℃伅锛�"+topicInfo);
+                    JSONObject jsonObject = JSONUtil.parseObj(topicInfo);
+                    if(jsonObject.get("data")!=null){
+                        String data = jsonObject.get("data").toString();
+                        JSONObject jsonObject2 = JSONUtil.parseObj(data);
+                        String clientId = jsonObject2.get("clientId").toString();
+                        String userName = jsonObject2.get("userName").toString();
+                        String password = jsonObject2.get("password").toString();
+                        event(clientId,userName,password);
+                    }
                 }
 
                 public void deliveryComplete(IMqttDeliveryToken token) {
@@ -87,6 +107,7 @@
                                     String eventType = jsonObject2.get("eventType").toString();
                                     String vehicleIndexCode = jsonObject2.get("vehicleIndexCode").toString();
                                     String alarmId = jsonObject2.get("alarmId").toString();
+                                    String alarmTime = jsonObject2.get("alarmTime").toString();
 
                                     Alarm alarm = new Alarm();
                                     if(eventType.equals("132371")){
@@ -117,8 +138,14 @@
                                     alarm.setCarNo(car.getCarNo());
                                     alarm.setCarUserId(car.getUserId());
                                     alarm.setFollowUserId(car.getFollowUserId());
-
+                                    alarm.setAlarmTime(alarmTime);
                                     iAlarmService.saveOrUpdate(alarm);
+
+                                    EventLog eventLog = new EventLog();
+                                    eventLog.setType(alarm.getType());
+                                    eventLog.setRefId(alarmId);
+                                    eventLog.setCarNo(car.getCarNo());
+                                    iEventLogService.saveOrUpdate(eventLog);
                                 }
                             }
                         }
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/AlarmVo.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/AlarmVo.java
new file mode 100644
index 0000000..d38c5c4
--- /dev/null
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/AlarmVo.java
@@ -0,0 +1,12 @@
+package cn.exrick.xboot.your.vo;
+
+import cn.exrick.xboot.your.entity.Car;
+import lombok.Data;
+
+@Data
+public class AlarmVo {
+
+    private String alarmId;
+    private String alarmTime;
+
+}
diff --git a/xboot-modules/xboot-your/src/main/resources/mapper/UpdateAppMapper.xml b/xboot-modules/xboot-your/src/main/resources/mapper/UpdateAppMapper.xml
new file mode 100644
index 0000000..c7cbeb6
--- /dev/null
+++ b/xboot-modules/xboot-your/src/main/resources/mapper/UpdateAppMapper.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.exrick.xboot.your.mapper.UpdateAppMapper">
+
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.1