From fb53a9997de491c3d0a30ed333a6bd3b24877b82 Mon Sep 17 00:00:00 2001
From: wang-hao-jie <1550036656@qq.com>
Date: 星期一, 27 十二月 2021 11:43:58 +0800
Subject: [PATCH] 违章记录

---
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java |   69 ++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 21 deletions(-)

diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java
index 0cdd96a..09fc5c3 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java
@@ -5,7 +5,9 @@
 import cn.exrick.xboot.core.common.utils.SecurityUtil;
 import cn.exrick.xboot.core.common.vo.PageVo;
 import cn.exrick.xboot.core.common.vo.Result;
+import cn.exrick.xboot.core.entity.Department;
 import cn.exrick.xboot.core.entity.User;
+import cn.exrick.xboot.core.service.DepartmentService;
 import cn.exrick.xboot.core.service.UserService;
 import cn.exrick.xboot.your.entity.*;
 import cn.exrick.xboot.your.service.*;
@@ -59,6 +61,12 @@
     @Autowired
     private ICarService iCarService;
 
+    @Autowired
+    private DepartmentService departmentService;
+
+    @Autowired
+    private IEventLogService iEventLogService;
+
     @RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
     @ApiOperation(value = "閫氳繃id鑾峰彇")
     public Result<OrderTask> get(@PathVariable String id) {
@@ -67,23 +75,29 @@
         return new ResultUtil<OrderTask>().setData(orderTask);
     }
 
-    @RequestMapping(value = "/getByUserId", method = RequestMethod.GET)
-    @ApiOperation(value = "鑾峰彇浠婃棩浠诲姟缁熻淇℃伅")
-    public Result<Object> getAll() {
+    public Area getArea(String userId){
         QueryWrapper<Area> wrapper = new QueryWrapper<Area>();
-        wrapper.eq("user_id",securityUtil.getCurrUser().getId());
+        wrapper.eq("user_id",userId);
         Area area = iAreaService.getOne(wrapper);
         if(area==null){
             QueryWrapper<Car> carQueryWrapper = new QueryWrapper<Car>();
-            carQueryWrapper.eq("user_id",securityUtil.getCurrUser().getId());
+            carQueryWrapper.eq("user_id",userId);
             Car one = iCarService.getOne(carQueryWrapper);
 
             QueryWrapper<Area> wrapper3 = new QueryWrapper<Area>();
             wrapper3.eq("user_id",one.getFollowUserId());
-            area = iAreaService.getOne(wrapper);
-            if(area==null){
-                return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾鐗囧尯閰嶉�佸憳");
-            }
+            area = iAreaService.getOne(wrapper3);
+            return area;
+        }
+        return area;
+    }
+
+    @RequestMapping(value = "/getByUserId", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇浠婃棩浠诲姟缁熻淇℃伅")
+    public Result<Object> getAll() {
+        Area area = getArea(securityUtil.getCurrUser().getId());
+        if(area==null){
+            return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾鐗囧尯閰嶉�佸憳");
         }
 
         QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>();
@@ -99,9 +113,11 @@
         map.put("sum",sum);
         map.put("name","");
         if(list.size()>0){
-            String areaSectionId = list.get(0).getAreaSectionId();
+            OrderTask orderTask = list.get(0);
+            String areaSectionId = orderTask.getAreaSectionId();
             AreaSection a = iAreaSectionService.getById(areaSectionId);
-            map.put("name",a.getName());
+            Area area2 = iAreaService.getById(orderTask.getAreaId());
+            map.put("name",area2.getName()+a.getName());
             list.clear();
         }
         return new ResultUtil<Object>().setData(map);
@@ -110,9 +126,7 @@
     @RequestMapping(value = "/getTodayOrder", method = RequestMethod.GET)
     @ApiOperation(value = "鑾峰彇浠婃棩浠诲姟璇︽儏")
     public Result<List<OrderTask>> getTodayOrder() {
-        QueryWrapper<Area> wrapper = new QueryWrapper<Area>();
-        wrapper.eq("user_id",securityUtil.getCurrUser().getId());
-        Area area = iAreaService.getOne(wrapper);
+        Area area = getArea(securityUtil.getCurrUser().getId());
         if(area==null){
             return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾鐗囧尯閰嶉�佸憳");
         }
@@ -136,9 +150,7 @@
                 return ResultUtil.error("姝ゅ晢鎴峰凡閰嶉��");
             }
         }else{
-            QueryWrapper<Area> wrapper = new QueryWrapper<Area>();
-            wrapper.eq("user_id",securityUtil.getCurrUser().getId());
-            Area area = iAreaService.getOne(wrapper);
+            Area area = getArea(securityUtil.getCurrUser().getId());
             if(area==null){
                 return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾鐗囧尯閰嶉�佸憳");
             }
@@ -169,9 +181,7 @@
     @ApiOperation(value = "鑾峰彇鍏跺畠淇℃伅")
     public Result<Object> getTodayOtherInfo() {
 
-        QueryWrapper<Area> wrapper = new QueryWrapper<Area>();
-        wrapper.eq("user_id",securityUtil.getCurrUser().getId());
-        Area area = iAreaService.getOne(wrapper);
+        Area area = getArea(securityUtil.getCurrUser().getId());
         if(area==null){
             return ResultUtil.error("璇疯仈绯荤鐞嗗憳缁戝畾鐗囧尯閰嶉�佸憳");
         }
@@ -219,6 +229,15 @@
             }
         }
         map.put("content",content);
+
+        map.put("lng","");
+        map.put("lat","");
+        String deptId = securityUtil.getCurrUser().getDepartmentId();
+        if(StrUtil.isNotEmpty(deptId)){
+            Department department = departmentService.get(deptId);
+            map.put("lng",department.getLng());
+            map.put("lat",department.getLat());
+        }
         return new ResultUtil<Object>().setData(map);
     }
 
@@ -233,7 +252,7 @@
 
     @RequestMapping(value = "/signFor", method = RequestMethod.POST)
     @ApiOperation(value = "绛炬敹")
-    public Object signFor(String orderId,int status,String content,String customerReceiveId) {
+    public Object signFor(String orderId,int status,String content,String customerReceiveId,int time) {
         if(status==1){
             if(StrUtil.isEmpty(customerReceiveId)){
                 return ResultUtil.error("姝e父绛炬敹锛屾帴璐т汉id蹇呭~");
@@ -242,6 +261,7 @@
         OrderTask orderTask = iOrderTaskService.getById(orderId);
         orderTask.setStatus(status);
         orderTask.setUserId(securityUtil.getCurrUser().getId());
+        orderTask.setTime(time);
         if(StrUtil.isNotEmpty(customerReceiveId)){
             orderTask.setCustomerReceiveId(customerReceiveId);
         }
@@ -254,6 +274,13 @@
             }
         }
         iOrderTaskService.saveOrUpdate(orderTask);
+
+        Car car = iCarService.getById(orderTask.getCarId());
+        EventLog eventLog = new EventLog();
+        eventLog.setCarNo(car.getCarNo());
+        eventLog.setRefId(orderId);
+        eventLog.setType(6);//6:閰嶉�佸畬鎴�
+        iEventLogService.saveOrUpdate(eventLog);
         return ResultUtil.success("娣诲姞鎴愬姛");
     }
 

--
Gitblit v1.9.1