wenhongquan před 1 rokem
rodič
revize
0393a2303d

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

@@ -177,6 +177,18 @@ public class TblCarInfoServiceImpl implements ITblCarInfoService {
 
         //lqw.eq(StringUtils.isNotBlank(bo.getExt1()), TblCarInfo::getExt1, bo.getExt1());
         //lqw.eq(StringUtils.isNotBlank(bo.getExt2()), TblCarInfo::getExt2, bo.getExt2());
+        if(bo.getParams()!=null){
+            if(bo.getParams().keySet().size()>0){
+                for (String key:bo.getParams().keySet()) {
+                    if(key.contains("ext1")){
+                        lqw.apply(StringUtils.format("ext1->'$.{}'='{}'",key.split("\\$")[1],bo.getParams().get(key)));
+                    }
+                    if(key.contains("ext2")){
+                        lqw.apply(StringUtils.format("ext2->'$.{}'='{}'",key.split("\\$")[1],bo.getParams().get(key)));
+                    }
+                }
+            }
+        }
 
         if(bo.getParams()!=null && bo.getParams().get("driverInfo")!=null){
             lqw.apply(StringUtils.format("ext2->'$.driverInfo'={}",bo.getParams().get("driverInfo")));

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

@@ -90,8 +90,8 @@ public class TblCarScheduleServiceImpl implements ITblCarScheduleService {
                         start+=" 00:00:00";
                         end+=" 23:59:59";
                     }
-                    lqw.gt(bo.getParams().get("scheduleDate")!=null, TblCarSchedule::getScheduleDate, start);
-                    lqw.lt(bo.getParams().get("scheduleDate")!=null, TblCarSchedule::getScheduleDate, end);
+                    lqw.ge(bo.getParams().get("scheduleDate")!=null, TblCarSchedule::getScheduleDate, start);
+                    lqw.le(bo.getParams().get("scheduleDate")!=null, TblCarSchedule::getScheduleDate, end);
 
                 }catch (Exception e){}
             }

+ 42 - 0
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/util/CabinetUtil.java

@@ -1,5 +1,6 @@
 package org.dromara.util;
 
+import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DatePattern;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
@@ -17,10 +18,13 @@ import org.dromara.system.domain.GpsData;
 import org.dromara.system.domain.TblCarInfo;
 import org.dromara.system.domain.bo.SysDictDataBo;
 import org.dromara.system.domain.bo.TblCarInfoBo;
+import org.dromara.system.domain.bo.TblCarScheduleBo;
 import org.dromara.system.domain.vo.SysDictDataVo;
 import org.dromara.system.domain.vo.TblCarInfoVo;
+import org.dromara.system.domain.vo.TblCarScheduleVo;
 import org.dromara.system.service.ISysDictDataService;
 import org.dromara.system.service.impl.TblCarInfoServiceImpl;
+import org.dromara.system.service.impl.TblCarScheduleServiceImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -28,6 +32,7 @@ import org.springframework.stereotype.Component;
 
 import javax.crypto.Cipher;
 import java.security.Key;
+import java.text.DateFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -91,6 +96,43 @@ public class CabinetUtil {
 //        String text = SpringUtils.getBean(ISysConfigService.class).selectConfigByKey("sys.cabinet.account");
 //
 //    }
+
+
+    @Scheduled(fixedRate = 5*60*1000)
+    private void genScheduleList(){
+
+        TblCarScheduleBo bo =new TblCarScheduleBo();
+        bo.getParams().put("scheduleDate",DateUtil.format(DateUtil.date(),"yyyy-MM-dd"));
+        List<TblCarScheduleVo> scheduleVos = SpringUtils.getBean(TblCarScheduleServiceImpl.class).queryList(bo);
+        TblCarScheduleBo bo2 =new TblCarScheduleBo();
+        bo2.getParams().put("scheduleDate",DateUtil.format(DateUtil.date().offset(DateField.DAY_OF_MONTH,1),"yyyy-MM-dd"));
+        List<TblCarScheduleVo> scheduleVos2 = SpringUtils.getBean(TblCarScheduleServiceImpl.class).queryList(bo2);
+        Map<String,Object> map=new HashMap<>();
+        scheduleVos2.forEach(scheduleVo2->{
+            map.put(scheduleVo2.getCarNum()+DateUtil.format(scheduleVo2.getScheduleDate(),DatePattern.NORM_DATETIME_PATTERN),scheduleVo2);
+        });
+
+        for (TblCarScheduleVo scheduleVo : scheduleVos) {
+            if(StrUtil.isNotEmpty(scheduleVo.getExt2())){
+                try{
+                    if(JSONUtil.parseObj(scheduleVo.getExt2()).getBool("isauto") && map.get(scheduleVo.getCarNum()+DateUtil.format(scheduleVo.getScheduleDate(),DatePattern.NORM_DATETIME_PATTERN))==null){
+                        //copy
+                        TblCarScheduleBo bo1 =new TblCarScheduleBo();
+                        bo1.setCarNum(scheduleVo.getCarNum());
+                        bo1.setScheduleDate(DateUtil.offset(scheduleVo.getScheduleDate(),DateField.DAY_OF_MONTH,1));
+                        bo1.setPathInfo(scheduleVo.getPathInfo());
+                        bo1.setCreateTime(DateUtil.date());
+                        bo1.setExt2(scheduleVo.getExt2());
+                        bo1.setCreateDept(103100L);
+                        SpringUtils.getBean(TblCarScheduleServiceImpl.class).insertByBo(bo1);
+                    }
+                }catch (Exception e){
+
+                }
+            }
+        }
+
+    }
      @Scheduled(fixedRate = 5*60*1000)
      private void getGpsList(){
          List<TblCarInfoVo> carInfoVos = SpringUtils.getBean(TblCarInfoServiceImpl.class).queryList(new TblCarInfoBo());