wenhongquan 1 жил өмнө
parent
commit
7571010e95

+ 8 - 0
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/controller/TblCarScheduleController.java

@@ -1,12 +1,14 @@
 package org.dromara.system.controller;
 
 import java.util.List;
+import java.util.stream.Collectors;
 
 import lombok.RequiredArgsConstructor;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.constraints.*;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import org.dromara.system.domain.bo.TblCarInfoBo;
+import org.dromara.system.domain.vo.TblCarInfoVo;
 import org.dromara.system.service.ISysDataScopeService;
 import org.dromara.system.service.ITblCarInfoService;
 import org.springframework.web.bind.annotation.*;
@@ -39,6 +41,8 @@ public class TblCarScheduleController extends TblBaseController {
 
     private final ITblCarScheduleService tblCarScheduleService;
 
+    private final ITblCarInfoService tblCarInfoService;
+
     private final ISysDataScopeService dataScopeService;
 
     /**
@@ -48,6 +52,10 @@ public class TblCarScheduleController extends TblBaseController {
     @GetMapping("/list")
     public TableDataInfo<TblCarScheduleVo> list(TblCarScheduleBo bo, PageQuery pageQuery) {
         getDepts(dataScopeService,bo);
+        TblCarInfoBo bo1 = new TblCarInfoBo();
+        bo1.setParams(bo.getParams());
+        List<TblCarInfoVo> cars = tblCarInfoService.queryList(bo1);
+        bo.getParams().put("cars", cars.stream().map(TblCarInfoVo::getCarNum).collect(Collectors.joining(",")));
         return tblCarScheduleService.queryPageList(bo, pageQuery);
     }
 

+ 6 - 0
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/controller/TblGpsDataController.java

@@ -5,6 +5,7 @@ import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.dromara.common.core.domain.R;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.mybatis.core.page.PageQuery;
@@ -34,6 +35,7 @@ import java.util.concurrent.atomic.AtomicReference;
 @Validated
 @RequiredArgsConstructor
 @RestController
+@Slf4j
 @RequestMapping("/system")
 public class TblGpsDataController extends BaseController {
 
@@ -201,12 +203,16 @@ public class TblGpsDataController extends BaseController {
                 }
             }
         });
+        log.info("{}",JSONUtil.toJsonStr(sitesMap));
         Map<String,Map<String,Object>> sitesc = new HashMap<>();
         sitesMap.forEach((key,value)->{
             AtomicReference<Integer> incount = new AtomicReference<>(0);
             AtomicReference<Integer> outcount = new AtomicReference<>(0);
             value.forEach((deviceCode,times)->{
                 times.forEach(time->{
+                    if(time.get("intime")==null||time.get("outtime")==null){
+                        return;
+                    }
                     CountDataBo bo2 = new CountDataBo();
                     bo2.getParams().put("starttime",time.get("intime"));
                     bo2.getParams().put("endtime",time.get("outtime"));

+ 20 - 0
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/service/impl/TblCarScheduleServiceImpl.java

@@ -1,5 +1,6 @@
 package org.dromara.system.service.impl;
 
+import cn.hutool.core.util.StrUtil;
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.dromara.common.core.utils.DateUtils;
 import org.dromara.common.core.utils.MapstructUtils;
@@ -19,6 +20,7 @@ import org.dromara.system.mapper.TblCarScheduleMapper;
 import org.dromara.system.service.ITblCarScheduleService;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 import static jt809.handle.JT809Packet0x1202Handle.convertToPinyin;
 
@@ -93,6 +95,22 @@ public class TblCarScheduleServiceImpl implements ITblCarScheduleService {
         lqw.like(StringUtils.isNotBlank(bo.getCarNum()), TblCarSchedule::getCarNum, bo.getCarNum());
         lqw.eq(bo.getScheduleDate() != null, TblCarSchedule::getScheduleDate, bo.getScheduleDate());
         if(bo.getParams()!=null && bo.getParams().keySet().size()>0){
+
+
+
+            try{
+                if(bo.getParams().get("cars")!=null&& StrUtil.isNotEmpty(bo.getParams().get("cars").toString())){
+                    String cars = Arrays.stream(bo.getParams().get("cars").toString().split(",")).map(deptId->{return StrUtil.format("'{}'",deptId); }).collect(Collectors.joining(","));
+                    lqw.apply(StringUtils.format("car_num in ({})",cars));
+                }
+            }catch (Exception e){}
+
+
+
+
+            if(bo.getParams().get("station")!=null){
+                lqw.like(bo.getParams().get("station")!=null, TblCarSchedule::getPathInfo, bo.getParams().get("station"));
+            }
             if(bo.getParams().get("station")!=null){
                 lqw.like(bo.getParams().get("station")!=null, TblCarSchedule::getPathInfo, bo.getParams().get("station"));
             }
@@ -123,6 +141,8 @@ public class TblCarScheduleServiceImpl implements ITblCarScheduleService {
             }
 
 
+
+
         }
         lqw.orderBy(true,true,TblCarSchedule::getScheduleDate);
         return lqw;