|
|
@@ -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());
|