Commit ec4fb43cf4f7f237ac328a43441947d64266648d

Authored by liujun001
1 parent e0285cdd

设备和场地

Showing 25 changed files with 537 additions and 67 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/TestController.java 0 → 100644
  1 +package com.ruoyi.controller;
  2 +
  3 +import com.ruoyi.common.core.domain.ResponseResult;
  4 +import com.ruoyi.job.DriverJob;
  5 +import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
  6 +import io.swagger.annotations.ApiOperation;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.GetMapping;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +/**
  13 + * @author liujun
  14 + * @date 2024年07月30日 14:37
  15 + */
  16 +@RestController
  17 +@RequestMapping("/test")
  18 +public class TestController {
  19 + @Autowired
  20 + private DriverJob driverJob;
  21 + @Autowired
  22 + private LinggangKeyWorkLocationService keyWorkLocationService;
  23 +
  24 + @GetMapping(value = "/test")
  25 + @ApiOperation("test")
  26 + public ResponseResult<Boolean> test() {
  27 + driverJob.getSchedulingInfo("02:30:30");
  28 + return ResponseResult.success();
  29 + }
  30 +
  31 + @GetMapping(value = "/key/info/local")
  32 + @ApiOperation("/key/info/local")
  33 + public ResponseResult<Boolean> testKeyInfoLocal() {
  34 + keyWorkLocationService.insertJob("2024-07-30");
  35 + return ResponseResult.success();
  36 + }
  37 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
... ... @@ -25,6 +25,7 @@ import com.ruoyi.domain.key.info.box.dto.KeyBoxQueryDTO;
25 25 import com.ruoyi.domain.key.info.box.vo.KeyBoxVo;
26 26 import com.ruoyi.domain.key.location.LinggangKeyWorkLocation;
27 27 import com.ruoyi.domain.scheduling.LinggangScheduling;
  28 +import com.ruoyi.domain.venue.info.LinggangVenueInfo;
28 29 import com.ruoyi.equipment.domain.Equipment;
29 30 import com.ruoyi.equipment.service.IEquipmentService;
30 31 import com.ruoyi.service.carinfo.CarInfoService;
... ... @@ -35,6 +36,7 @@ import com.ruoyi.service.key.info.KeyInfoService;
35 36 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
36 37 import com.ruoyi.service.scheduling.LinggangSchedulingService;
37 38 import com.ruoyi.service.venue.info.LinggangVenueInfoService;
  39 +import com.ruoyi.utils.DateUtil;
38 40 import io.swagger.annotations.Api;
39 41 import io.swagger.annotations.ApiOperation;
40 42 import org.apache.commons.collections4.CollectionUtils;
... ... @@ -104,12 +106,12 @@ public class KeyBoxController extends BaseController {
104 106 if (Objects.isNull(scheduling)) {
105 107 return ResponseResult.error(TipEnum.TIP_3.getCode(), TipEnum.TIP_3.getMsg());
106 108 }
107   - LinggangKeyWorkLocation workLocation = queryKeyWorkLocation(scheduling.getKeyInfoId(), scheduling.getScheduleDate(), dto);
  109 + LinggangKeyWorkLocation workLocation = queryKeyWorkLocation(scheduling, dto);
108 110 if (Objects.isNull(workLocation)) {
109 111 return ResponseResult.error(TipEnum.TIP_4.getCode(), TipEnum.TIP_4.getMsg());
110 112 }
111 113  
112   - KeyInfo keyInfo = queryKeyInfo(scheduling.getKeyInfoId());
  114 + KeyInfo keyInfo = queryKeyInfo(workLocation.getKeyInfoId());
113 115 if (Objects.isNull(keyInfo)) {
114 116 return ResponseResult.error404();
115 117 }
... ... @@ -119,7 +121,12 @@ public class KeyBoxController extends BaseController {
119 121 return ResponseResult.error404();
120 122 }
121 123  
122   - WorkPlateV2Vo vo = convertWorkPlateV2Vo(scheduling, workLocation, keyInfo, carInfo);
  124 + Equipment equipment = queryEquipment(dto.getDevice());
  125 + LinggangVenueInfo venueInfo = null;
  126 + if (Objects.nonNull(equipment)) {
  127 + venueInfo = venueInfoService.getById(equipment.getYardId());
  128 + }
  129 + WorkPlateV2Vo vo = convertWorkPlateV2Vo(scheduling, workLocation, keyInfo, carInfo, equipment, venueInfo);
123 130 return ResponseResult.success(vo);
124 131 } catch (ParseException e) {
125 132 logger.error("司机获取当前工作的车辆钥匙信息异常:[{}]", dto, e);
... ... @@ -143,12 +150,6 @@ public class KeyBoxController extends BaseController {
143 150 return ResponseResult.error404();
144 151 }
145 152  
146   - Set<Long> schedulingIds = workLocations.stream().map(LinggangKeyWorkLocation::getSchedulingId).collect(Collectors.toSet());
147   - List<LinggangScheduling> schedulings = queryScheduling(schedulingIds);
148   - if (CollectionUtils.isEmpty(schedulings)) {
149   - logger.info("根据DTO的数据无法查询排班信息:[{}]", dto);
150   - return ResponseResult.error404();
151   - }
152 153  
153 154 Equipment equipment = queryEquipment(dto.getDevice());
154 155 if (Objects.isNull(equipment)) {
... ... @@ -156,6 +157,17 @@ public class KeyBoxController extends BaseController {
156 157 return ResponseResult.error404();
157 158 }
158 159  
  160 + Equipment eq = new Equipment();
  161 + eq.setYardId(equipment.getYardId());
  162 + eq.setStatus(1);
  163 +
  164 + List<Equipment> equipmentList = equipmentService.list(eq);
  165 + LinggangVenueInfo venueInfo = venueInfoService.getById(equipment.getYardId());
  166 + if(Objects.isNull(venueInfo)){
  167 + logger.info("根据DTO的数据无法查询场站信息:[{}]", dto);
  168 + return ResponseResult.error404();
  169 + }
  170 +
159 171 Set<Integer> keyInfoIds = workLocations.stream().map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet());
160 172 List<KeyInfo> keyInfos = queryKeyInfos(keyInfoIds);
161 173 if (CollectionUtils.isEmpty(keyInfos)) {
... ... @@ -163,6 +175,16 @@ public class KeyBoxController extends BaseController {
163 175 return ResponseResult.error404();
164 176 }
165 177  
  178 + LinggangScheduling scheduling = new LinggangScheduling();
  179 + scheduling.setCzCode(venueInfo.getParkCode());
  180 + scheduling.setStartScheduleDate(DateUtil.shortDate(dto.getTime()));
  181 +
  182 + List<LinggangScheduling> schedulings = schedulingService.listByCZ(scheduling);
  183 + if (CollectionUtils.isEmpty(schedulings)) {
  184 + logger.info("根据DTO的数据无法查询排班信息:[{}]", dto);
  185 + return ResponseResult.error404();
  186 + }
  187 +
166 188 Set<String> jobCodes = schedulings.stream().map(LinggangScheduling::getJobCode).collect(Collectors.toSet());
167 189 List<NewDriver> drivers = queryDrive(jobCodes);
168 190 if (CollectionUtils.isEmpty(drivers)) {
... ... @@ -177,7 +199,7 @@ public class KeyBoxController extends BaseController {
177 199 return ResponseResult.error404();
178 200 }
179 201  
180   - BasicSyncVo vo = convertBasicSyncVo(workLocations, schedulings, keyInfos, drivers, carInfos, equipment);
  202 + BasicSyncVo vo = convertBasicSyncVo(workLocations, schedulings, keyInfos, drivers, carInfos, equipment, venueInfo,equipmentList);
181 203 return ResponseResult.success(vo);
182 204 } catch (ParseException e) {
183 205 logger.error("钥匙柜基础信息同步异常:[{}]", dto, e);
... ... @@ -324,7 +346,8 @@ public class KeyBoxController extends BaseController {
324 346  
325 347 String dateStr = DateUtils.YYYY_MM_DD.format(dto.getTime());
326 348 scheduling.setScheduleDate(DateUtils.YYYY_MM_DD.parse(dateStr));
327   - String bcType = Objects.equals(0, dto.getEventType()) ? ConstDriverProperties.BC_TYPE_OUT : Objects.equals(1, dto.getEventType()) ? ConstDriverProperties.BC_TYPE_IN : "other";
  349 +// String bcType = Objects.equals(0, dto.getEventType()) ? ConstDriverProperties.BC_TYPE_OUT : Objects.equals(1, dto.getEventType()) ? ConstDriverProperties.BC_TYPE_IN : "other";
  350 + String bcType = ConstDriverProperties.BC_TYPE_IN;
328 351 scheduling.setBcType(bcType);
329 352  
330 353 return schedulingService.getOne(scheduling);
... ... @@ -347,10 +370,10 @@ public class KeyBoxController extends BaseController {
347 370 * @param dto
348 371 * @return com.ruoyi.domain.key.location.LinggangKeyWorkLocation
349 372 */
350   - private LinggangKeyWorkLocation queryKeyWorkLocation(Integer keyId, Date scheduleDate, WorkPlateV2DTO dto) {
  373 + private LinggangKeyWorkLocation queryKeyWorkLocation(LinggangScheduling scheduling, WorkPlateV2DTO dto) {
351 374 LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation();
352   - workLocation.setKeyInfoId(keyId);
353   - workLocation.setScheduleDate(scheduleDate);
  375 + workLocation.setKeyInfoId(scheduling.getKeyInfoId());
  376 + workLocation.setSchedulingId(scheduling.getId());
354 377 return linggangKeyWorkLocationService.getOne(workLocation);
355 378 }
356 379  
... ... @@ -421,8 +444,17 @@ public class KeyBoxController extends BaseController {
421 444 return linkeLog;
422 445 }
423 446  
424   - private WorkPlateV2Vo convertWorkPlateV2Vo(LinggangScheduling scheduling, LinggangKeyWorkLocation workLocation, KeyInfo keyInfo, CarInfo carInfo) {
  447 + private WorkPlateV2Vo convertWorkPlateV2Vo(LinggangScheduling scheduling, LinggangKeyWorkLocation workLocation, KeyInfo keyInfo, CarInfo carInfo,
  448 + Equipment equipment, LinggangVenueInfo venueInfo) {
425 449 WorkPlateV2Vo vo = new WorkPlateV2Vo();
  450 + if (Objects.nonNull(venueInfo)) {
  451 + vo.setYardId(Convert.toStr(venueInfo.getId()));
  452 + vo.setYardName(venueInfo.getName());
  453 + }
  454 +
  455 + if (Objects.nonNull(equipment)) {
  456 + vo.setDeviceName(equipment.getName());
  457 + }
426 458 // vo.setYardName(keyInfo.getY)
427 459 vo.setDevice(workLocation.getDevice());
428 460 vo.setCabinetNo(workLocation.getCabinetNo());
... ... @@ -432,55 +464,72 @@ public class KeyBoxController extends BaseController {
432 464 }
433 465  
434 466 private BasicSyncVo convertBasicSyncVo(List<LinggangKeyWorkLocation> workLocations, List<LinggangScheduling> schedulings,
435   - List<KeyInfo> keyInfos, List<NewDriver> drivers, List<CarInfo> carInfos, Equipment equipment) {
  467 + List<KeyInfo> keyInfos, List<NewDriver> drivers, List<CarInfo> carInfos, Equipment equipment,
  468 + LinggangVenueInfo venueInfo, List<Equipment> equipmentList) {
436 469 BasicSyncVo vo = new BasicSyncVo();
437 470  
438 471 vo.setDevice(equipment.getDeviceId());
439 472 vo.setDeviceType(equipment.getPromise());
440 473 vo.setTime(workLocations.get(0).getScheduleDate());
441   - vo.setYardName(equipment.getName());
442   -// vo.setKeyboxName()
443   -
444   - List<BasicSyncKeyboxVo> keybox = new ArrayList<>();
445   - BasicSyncKeyboxVo boxvo = new BasicSyncKeyboxVo();
446   - List<BasicSyncKeyboxKeyItemVo> keyItemVos = workLocations.stream().map(local -> {
447   - Optional<KeyInfo> optional = keyInfos.stream().filter(k -> Objects.equals(k.getId(), local.getKeyInfoId())).findFirst();
448   - String keyCode = optional.isPresent() ? optional.get().getName() : null;
449   - return new BasicSyncKeyboxKeyItemVo(local.getCabinetNo(), keyCode);
  474 + if(Objects.nonNull(venueInfo)) {
  475 + vo.setYardName(venueInfo.getName());
  476 + }
  477 + vo.setKeyboxName(equipment.getName());
450 478  
451   - }).collect(Collectors.toList());
452   - keybox.add(boxvo);
453   - boxvo.setKeyItem(keyItemVos);
454 479  
  480 + if (CollectionUtils.isNotEmpty(equipmentList)) {
  481 + List<BasicSyncKeyboxVo> keyboxVos = equipmentList.stream().map(eq -> {
  482 + BasicSyncKeyboxVo keyboxVo = new BasicSyncKeyboxVo();
  483 + keyboxVo.setName(eq.getName());
  484 + keyboxVo.setDevice(eq.getDeviceId());
  485 + if (Objects.nonNull(eq.getLatticeNumber()) && eq.getLatticeNumber() > 0) {
  486 + List<BasicSyncKeyboxKeyItemVo> itemVos = new ArrayList<>(eq.getLatticeNumber());
  487 + for (int i = 0; i < eq.getLatticeNumber(); i++) {
  488 + itemVos.add(new BasicSyncKeyboxKeyItemVo(Convert.toStr(i + 1), null));
  489 + }
  490 + keyboxVo.setKeyItem(itemVos);
  491 + }
  492 + return keyboxVo;
  493 + }).collect(Collectors.toList());
  494 + vo.setKeybox(keyboxVos);
  495 + }
455 496  
456 497 List<BasicSyncDriverWorkVo> driverWork = new ArrayList<>();
457   - BasicSyncDriverWorkVo basicSyncDriverWorkVo = new BasicSyncDriverWorkVo();
458   -
459   - List<BasicSyncDriverWorkDriverPlanVo> driverPlanVos = schedulings.stream().map(sc -> {
460   - BasicSyncDriverWorkDriverPlanVo driverPlanVo = new BasicSyncDriverWorkDriverPlanVo();
461   - Optional<NewDriver> optional = drivers.stream().filter(d -> Objects.equals(d.getJobCode(), sc.getJobCode())).findFirst();
462   - if (optional.isPresent()) {
463   - driverPlanVo.setDriverCode(optional.get().getIcCardCode());
464   - }
  498 + if (CollectionUtils.isNotEmpty(schedulings)) {
  499 + Map<Date, List<LinggangScheduling>> schedulingMap = schedulings.stream().collect(Collectors.groupingBy(LinggangScheduling::getScheduleDate));
  500 + schedulingMap.forEach((key, schedulingList) -> {
  501 + BasicSyncDriverWorkVo driverPlanVo = new BasicSyncDriverWorkVo();
  502 + driverPlanVo.setPlanDate(key);
  503 + if (CollectionUtils.isNotEmpty(schedulingList)) {
  504 + List<BasicSyncDriverWorkDriverPlanVo> planVos = schedulingList.stream().map(sc -> {
  505 + BasicSyncDriverWorkDriverPlanVo planVo = new BasicSyncDriverWorkDriverPlanVo();
  506 + Optional<NewDriver> optional = drivers.stream().filter(d -> Objects.equals(d.getJobCode(), sc.getJobCode())).findFirst();
  507 + if (!optional.isPresent()) {
  508 + return null;
  509 + }
465 510  
466   - driverPlanVo.setStaffCode(sc.getJobCode());
  511 + Optional<CarInfo> carInfoOptional = carInfos.stream().filter(c -> Objects.equals(c.getNbbm(), sc.getNbbm())).findFirst();
  512 + if (!optional.isPresent()) {
  513 + return null;
467 514  
468   - BasicSyncDriverWorkDriverPlanTimePlateVo planTimePlateVo = new BasicSyncDriverWorkDriverPlanTimePlateVo();
469   - planTimePlateVo.setKey(sc.getScheduleDate());
470   - Optional<CarInfo> carInfoOptional = carInfos.stream().filter(c -> Objects.equals(c.getNbbm(), sc.getNbbm())).findFirst();
471   - if (optional.isPresent()) {
472   - planTimePlateVo.setValue(carInfoOptional.get().getPlateNum());
473   - }
  515 + }
  516 + planVo.setDriverCode(optional.get().getIcCardCode());
  517 + planVo.setStaffCode(sc.getJobCode());
474 518  
  519 + BasicSyncDriverWorkDriverPlanTimePlateVo planTimePlateVo = new BasicSyncDriverWorkDriverPlanTimePlateVo();
  520 + planTimePlateVo.setKey(sc.getScheduleDate());
475 521  
476   - driverPlanVo.setTimePlate(planTimePlateVo);
477   - return driverPlanVo;
478   - }).collect(Collectors.toList());
  522 + planTimePlateVo.setValue(carInfoOptional.get().getPlateNum());
  523 + planVo.setTimePlate(planTimePlateVo);
479 524  
480   - basicSyncDriverWorkVo.setDriverPlan(driverPlanVos);
481   - driverWork.add(basicSyncDriverWorkVo);
  525 + return planVo;
  526 + }).filter(obj->Objects.nonNull(obj)).collect(Collectors.toList());
482 527  
483   - vo.setKeybox(keybox);
  528 + driverPlanVo.setDriverPlan(planVos);
  529 + }
  530 + driverWork.add(driverPlanVo);
  531 + });
  532 + }
484 533 vo.setDriverWork(driverWork);
485 534  
486 535 return vo;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/DriverScheduling.java
1 1 package com.ruoyi.domain;
2 2  
3 3 import lombok.Data;
4   -import org.apache.poi.hpsf.Decimal;
5 4  
6 5 import java.math.BigDecimal;
7 6 import java.util.Date;
... ... @@ -31,4 +30,14 @@ public class DriverScheduling {
31 30 * 不是当前表的属性
32 31 */
33 32 private String fleetName;
  33 + /**上下行*/
  34 + private Integer upDown;
  35 + /**起点站code*/
  36 + private String qdzCode;
  37 + /**起点站名字*/
  38 + private String qdzName;
  39 + /**终点站code*/
  40 + private String zdzCode;
  41 + /**终点站名字*/
  42 + private String zdzName;
34 43 }
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/LinggangKeyWorkLocation.java
... ... @@ -101,7 +101,7 @@ public class LinggangKeyWorkLocation {
101 101 @TableField(exist = false)
102 102 private String key;
103 103 /***状态:1 是归还;0是借出*/
104   - @Excel(name = "状态:1 是归还;0是借出")
  104 + @Excel(name = "状态:1 是归还;0是借出;2是初始状态")
105 105 private java.lang.Integer type;
106 106  
107 107 @TableField(exist = false)
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/LinggangScheduling.java
1 1 package com.ruoyi.domain.scheduling;
2 2  
3 3 import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
4 5 import com.baomidou.mybatisplus.annotation.TableId;
5 6 import com.baomidou.mybatisplus.annotation.TableName;
6 7 import com.ruoyi.common.annotation.Excel;
... ... @@ -118,6 +119,38 @@ public class LinggangScheduling {
118 119 @Excel(name = "钥匙ID")
119 120 private Integer keyInfoId;
120 121  
  122 + /***上下行*/
  123 + @Excel(name = "上下行")
  124 + private java.lang.Integer updown;
  125 +
  126 +
  127 + /***起点站code*/
  128 + @Excel(name = "起点站code")
  129 + private java.lang.String qdzcode;
  130 +
  131 +
  132 + /***起点站名字*/
  133 + @Excel(name = "起点站名字")
  134 + private java.lang.String qdzname;
  135 +
  136 +
  137 + /***终点站code*/
  138 + @Excel(name = "终点站code")
  139 + private java.lang.String zdzcode;
  140 +
  141 +
  142 + /***终点站名字*/
  143 + @Excel(name = "终点站名字")
  144 + private java.lang.String zdzname;
  145 +
  146 + @TableField(exist = false)
  147 + private String czCode;
  148 +
  149 + @TableField(exist = false)
  150 + private Date startScheduleDate;
  151 + @TableField(exist = false)
  152 + private Date endScheduleDate;
  153 +
121 154  
122 155 @Override
123 156 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/equipment/domain/Equipment.java
... ... @@ -8,6 +8,8 @@ import com.ruoyi.common.core.domain.BaseEntity;
8 8 import io.swagger.annotations.ApiModel;
9 9 import lombok.Data;
10 10  
  11 +import java.util.Set;
  12 +
11 13 /**
12 14 * 设备信息对象 equipment
13 15 *
... ... @@ -107,6 +109,9 @@ public class Equipment extends BaseEntity {
107 109 @TableField(exist = false)
108 110 private String yardName;
109 111  
  112 + @TableField(exist = false)
  113 + private Set<Integer> latticeNumberSet;
  114 +
110 115  
111 116  
112 117 @Override
... ...
Bsth-admin/src/main/java/com/ruoyi/equipment/service/IEquipmentService.java
... ... @@ -63,6 +63,8 @@ public interface IEquipmentService extends IService&lt;Equipment&gt; {
63 63  
64 64 List<Equipment> listNameAndIDBydeviceIds(Collection<String> deviceIds);
65 65  
  66 + List<Equipment> listByEntityAndYardIds(Equipment entity,Collection<Integer> yardIds);
  67 +
66 68 /**
67 69 * 查询设备信息列表
68 70 *
... ...
Bsth-admin/src/main/java/com/ruoyi/equipment/service/impl/EquipmentServiceImpl.java
... ... @@ -98,6 +98,22 @@ public class EquipmentServiceImpl extends ServiceImpl&lt;EquipmentMapper, Equipment
98 98 return list(wrapper);
99 99 }
100 100  
  101 + @Override
  102 + public List<Equipment> listByEntityAndYardIds(Equipment entity, Collection<Integer> yardIds) {
  103 + LambdaQueryWrapper<Equipment> wrapper = null;
  104 + if (Objects.isNull(entity)) {
  105 + wrapper = new LambdaQueryWrapper<>();
  106 + } else {
  107 + wrapper = new LambdaQueryWrapper<>(entity);
  108 + }
  109 +
  110 + if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(yardIds)) {
  111 + wrapper.in(Equipment::getYardId, yardIds);
  112 + }
  113 +
  114 + return list(wrapper);
  115 + }
  116 +
101 117 /**
102 118 * 查询设备信息列表
103 119 *
... ...
Bsth-admin/src/main/java/com/ruoyi/job/KeyWorkLocalJob.java 0 → 100644
  1 +package com.ruoyi.job;
  2 +
  3 +/**
  4 + * @author liujun
  5 + * @date 2024年07月30日 15:12
  6 + */
  7 +public class KeyWorkLocalJob {
  8 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/mapper/scheduling/LinggangSchedulingMapper.java
... ... @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4 import com.ruoyi.domain.scheduling.LinggangScheduling;
5 5 import org.apache.ibatis.annotations.Mapper;
6 6  
  7 +import java.util.List;
  8 +
7 9  
8 10 @Mapper
9 11 /** Mapper接口*/
... ... @@ -12,4 +14,6 @@ public interface LinggangSchedulingMapper extends BaseMapper&lt;LinggangScheduling&gt;
12 14 * 插入有值的列
13 15 */
14 16 int insertSelective(LinggangScheduling name);
  17 +
  18 + List<LinggangScheduling> listByCZ(LinggangScheduling entity);
15 19 }
16 20 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
... ... @@ -29,6 +29,7 @@ import com.ruoyi.job.DriverJob;
29 29 import com.ruoyi.domain.DriverScheduling;
30 30 import com.ruoyi.pojo.GlobalIndex;
31 31 import com.ruoyi.pojo.response.ResponseSchedulingDto;
  32 +import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
32 33 import com.ruoyi.system.domain.SysNotice;
33 34 import com.ruoyi.system.service.ISysNoticeService;
34 35 import com.ruoyi.utils.ConstDateUtil;
... ... @@ -111,6 +112,8 @@ public class ThreadJobService {
111 112  
112 113 @Autowired
113 114 private RestTemplate restTemplate;
  115 + @Autowired
  116 + private LinggangKeyWorkLocationService keyWorkLocationService;
114 117  
115 118  
116 119 /**
... ... @@ -436,6 +439,7 @@ public class ThreadJobService {
436 439 // 插入错误排班
437 440 errorJobcodeService.insertBatchErrorJobcode(errorScheduling);
438 441 }
  442 + keyWorkLocationService.insertJob(ConstDateUtil.formatDate("yyyy-MM-dd"));
439 443 log.info("当天排班数据获取完毕,共:{}条", bcList.size());
440 444 }
441 445  
... ...
Bsth-admin/src/main/java/com/ruoyi/service/carinfo/CarInfoService.java
... ... @@ -23,6 +23,7 @@ public interface CarInfoService extends IService&lt;CarInfo&gt; {
23 23 List<CarInfo> likePlateNumPlateNumTop30(CarInfo entity);
24 24 /**根据车辆自编号查询车辆信息*/
25 25 List<CarInfo> list(Collection<String> nbbms);
  26 + List<CarInfo> list(CarInfo carInfo,Collection<String> nbbms);
26 27  
27 28 /***
28 29 *用于页面选择
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/carinfo/CarInfoServiceImpl.java
... ... @@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
16 16 import java.util.Collection;
17 17 import java.util.Collections;
18 18 import java.util.List;
  19 +import java.util.Objects;
19 20  
20 21 @Service
21 22 public class CarInfoServiceImpl extends ServiceImpl<CarInfoMapper, CarInfo> implements CarInfoService {
... ... @@ -79,6 +80,21 @@ public class CarInfoServiceImpl extends ServiceImpl&lt;CarInfoMapper, CarInfo&gt; impl
79 80 }
80 81  
81 82 @Override
  83 + public List<CarInfo> list(CarInfo carInfo, Collection<String> nbbms) {
  84 + LambdaQueryWrapper<CarInfo> wrapper = null;
  85 + if(Objects.isNull(carInfo)) {
  86 + wrapper = new LambdaQueryWrapper<>();
  87 + }else{
  88 + wrapper = new LambdaQueryWrapper<>(carInfo);
  89 + }
  90 +
  91 + if (CollectionUtils.isNotEmpty(nbbms)) {
  92 + wrapper.in(CarInfo::getNbbm, nbbms);
  93 + }
  94 + return list(wrapper);
  95 + }
  96 +
  97 + @Override
82 98 public List<CarInfo> listOfSelect(CarInfo entity) {
83 99 LambdaQueryWrapper<CarInfo> wrapper = new LambdaQueryWrapper<>(entity);
84 100 wrapper.select(CarInfo::getId, CarInfo::getPlateNum);
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/info/KeyInfoServiceImpl.java
... ... @@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
16 16 import java.util.Collection;
17 17 import java.util.Collections;
18 18 import java.util.List;
  19 +import java.util.Objects;
19 20  
20 21  
21 22 @Service
... ... @@ -68,6 +69,21 @@ public class KeyInfoServiceImpl extends ServiceImpl&lt;com.ruoyi.mapper.key.info.Ke
68 69 }
69 70  
70 71 @Override
  72 + public List<KeyInfo> list(KeyInfo entity, Collection<String> plateNums) {
  73 + LambdaQueryWrapper<KeyInfo> wrapper = null;
  74 + if(Objects.isNull(entity)){
  75 + wrapper = new LambdaQueryWrapper<>();
  76 + }else{
  77 + wrapper = new LambdaQueryWrapper<>(entity);
  78 + }
  79 +
  80 + if(CollectionUtils.isNotEmpty(plateNums)){
  81 + wrapper.in(KeyInfo::getPlateNum,plateNums);
  82 + }
  83 + return list(wrapper);
  84 + }
  85 +
  86 + @Override
71 87 public List<KeyInfo> listOfSelect(KeyInfo entity) {
72 88 LambdaQueryWrapper<KeyInfo> wrapper = new LambdaQueryWrapper<>(entity);
73 89 wrapper.select(KeyInfo::getId, KeyInfo::getName);
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/location/LinggangKeyWorkLocationServiceImpl.java
... ... @@ -10,23 +10,37 @@ import com.github.pagehelper.PageHelper;
10 10 import com.ruoyi.common.TipEnum;
11 11 import com.ruoyi.common.core.domain.ResponseResult;
12 12 import com.ruoyi.domain.OrderEntity;
  13 +import com.ruoyi.domain.caiinfo.CarInfo;
13 14 import com.ruoyi.domain.key.info.KeyInfo;
14 15 import com.ruoyi.domain.key.location.LinggangKeyWorkLocation;
  16 +import com.ruoyi.domain.scheduling.LinggangScheduling;
  17 +import com.ruoyi.domain.venue.info.LinggangVenueInfo;
  18 +import com.ruoyi.equipment.domain.Equipment;
  19 +import com.ruoyi.equipment.service.IEquipmentService;
15 20 import com.ruoyi.mapper.key.location.LinggangKeyWorkLocationMapper;
  21 +import com.ruoyi.service.carinfo.CarInfoService;
16 22 import com.ruoyi.service.key.info.KeyInfoService;
17 23 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
  24 +import com.ruoyi.service.scheduling.LinggangSchedulingService;
  25 +import com.ruoyi.service.venue.info.LinggangVenueInfoService;
  26 +import com.ruoyi.utils.DateUtil;
18 27 import lombok.extern.slf4j.Slf4j;
19 28 import org.apache.commons.collections4.CollectionUtils;
20 29 import org.apache.commons.collections4.MapUtils;
  30 +import org.apache.commons.lang3.RandomUtils;
21 31 import org.apache.commons.lang3.StringUtils;
22 32 import org.apache.commons.lang3.time.DateUtils;
23 33 import org.springframework.beans.factory.annotation.Autowired;
24 34 import org.springframework.stereotype.Service;
  35 +import org.springframework.transaction.annotation.Transactional;
25 36  
26 37 import java.text.MessageFormat;
  38 +import java.text.ParseException;
27 39 import java.util.*;
28 40 import java.util.stream.Collectors;
29 41  
  42 +import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_IN;
  43 +
30 44 @Slf4j
31 45 @Service
32 46 /**钥匙存放地址 Service实现类*/
... ... @@ -35,6 +49,14 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
35 49 private LinggangKeyWorkLocationMapper linggangKeyWorkLocationMapper;
36 50 @Autowired
37 51 private KeyInfoService keyInfoService;
  52 + @Autowired
  53 + private LinggangSchedulingService schedulingService;
  54 + @Autowired
  55 + private LinggangVenueInfoService venueInfoService;
  56 + @Autowired
  57 + private IEquipmentService equipmentService;
  58 + @Autowired
  59 + private CarInfoService carInfoService;
38 60  
39 61 private static final String TAKE_KEY_MSG = "设备号:{0},钥匙编号:{1},在{2}的状态已经是:{3},无需在操作";
40 62 private static final String TAKE_KEY_SUCESS = "设备号:{0},钥匙编号:{1},在{2}的状已经更新成功";
... ... @@ -69,12 +91,12 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
69 91 return returnPage;
70 92 }
71 93  
72   - private static void switchTime( LinggangKeyWorkLocation entity, LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper) {
73   - if(Objects.nonNull(entity.getStartScheduleDate()) && Objects.nonNull(entity.getEndScheduleDate())){
  94 + private static void switchTime(LinggangKeyWorkLocation entity, LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper) {
  95 + if (Objects.nonNull(entity.getStartScheduleDate()) && Objects.nonNull(entity.getEndScheduleDate())) {
74 96 wrapper.between(LinggangKeyWorkLocation::getScheduleDate, entity.getStartScheduleDate(), entity.getEndScheduleDate());
75   - }else if(Objects.nonNull(entity.getStartScheduleDate())){
  97 + } else if (Objects.nonNull(entity.getStartScheduleDate())) {
76 98 wrapper.ge(LinggangKeyWorkLocation::getScheduleDate, entity.getStartScheduleDate());
77   - }else if(Objects.nonNull(entity.getEndScheduleDate())){
  99 + } else if (Objects.nonNull(entity.getEndScheduleDate())) {
78 100 wrapper.le(LinggangKeyWorkLocation::getScheduleDate, entity.getEndScheduleDate());
79 101 }
80 102 }
... ... @@ -183,6 +205,31 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
183 205 return save(entity);
184 206 }
185 207  
  208 + @Override
  209 + @Transactional(rollbackFor = Exception.class)
  210 + public boolean insertJob(String timeStr) {
  211 + try {
  212 + Date date = DateUtil.YYYY_MM_DD_LINK.parse(timeStr);
  213 + LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation();
  214 + workLocation.setScheduleDate(date);
  215 + Integer count = countId(workLocation);
  216 + if (Objects.nonNull(count) && count > 0) {
  217 + log.error("当天的数据已经存在:[{}];[{}]", timeStr, count);
  218 + return false;
  219 + }
  220 +
  221 + List<LinggangKeyWorkLocation> locations = computeKeyLocal(date);
  222 + if (CollectionUtils.isNotEmpty(locations)) {
  223 + return saveBatch(locations);
  224 + }
  225 + return true;
  226 + } catch (ParseException e) {
  227 + log.error("转换日期异常:[{}]", timeStr, e);
  228 + }
  229 +
  230 + return false;
  231 + }
  232 +
186 233 /**
187 234 * 根据主键修改数据
188 235 */
... ... @@ -496,4 +543,169 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
496 543  
497 544 return source;
498 545 }
  546 +
  547 + private List<LinggangKeyWorkLocation> computeKeyLocal(Date date) {
  548 +
  549 +
  550 + List<LinggangScheduling> schedulings = querySchedulingByTiime(date);
  551 + if (schedulings == null) return null;
  552 +
  553 + List<LinggangVenueInfo> venueInfos = queryVenueInfo(schedulings);
  554 + if (venueInfos == null) return null;
  555 +
  556 + List<CarInfo> carInfos = queryCarInfo(schedulings);
  557 + if (carInfos == null) return null;
  558 +
  559 + List<KeyInfo> keyInfos = queryKeyInfo(carInfos);
  560 + if (keyInfos == null) return null;
  561 +
  562 + List<Equipment> equipmentList = queryEquipment(venueInfos);
  563 + if (equipmentList == null) return null;
  564 +
  565 +
  566 + return schedulings.stream().map(sc -> {
  567 + Optional<LinggangVenueInfo> optional = venueInfos.stream().filter(v -> Objects.equals(v.getParkCode(), sc.getZdzcode())).findFirst();
  568 + if (!optional.isPresent()) {
  569 + log.info("[{}]没有找到对应的场站", sc);
  570 + return null;
  571 + }
  572 +
  573 + List<Equipment> equipmentList1 = equipmentList.stream().filter(eq -> Objects.equals(eq.getYardId(), optional.get().getId())).collect(Collectors.toList());
  574 + int size = CollectionUtils.size(equipmentList1);
  575 + if (0 == size) {
  576 + log.info("场站[{}]没有找到对应钥匙柜,排班数据为:[{}]", optional.get(), sc);
  577 + return null;
  578 + }
  579 +
  580 + Equipment equipment = null;
  581 + Integer number = null;
  582 + int i = 0;
  583 + do {
  584 + i++;
  585 + int index = RandomUtils.nextInt(0, size);
  586 + if (index == size) {
  587 + index = size - 1;
  588 + }
  589 + equipment = equipmentList1.get(index);
  590 + if (Objects.isNull(equipment) || Objects.isNull(equipment.getLatticeNumber())) {
  591 + log.info("没有存放钥匙的格子:[{}]", equipment);
  592 + continue;
  593 + }
  594 + if (Objects.isNull(equipment.getLatticeNumberSet())) {
  595 + equipment.setLatticeNumberSet(new HashSet<>(equipment.getLatticeNumber()));
  596 + }
  597 +
  598 + number = RandomUtils.nextInt(1, equipment.getLatticeNumber());
  599 + if (equipment.getLatticeNumberSet().contains(number)) {
  600 + log.info("此格子已经被占用;[{}][{}]", equipment, number);
  601 + continue;
  602 + }
  603 + break;
  604 + } while (i < 10000);
  605 +
  606 + if (Objects.isNull(equipment) || Objects.isNull(number)) {
  607 + log.info("没有找到存放的格子:[{}]", equipment);
  608 + return null;
  609 + }
  610 +
  611 + Optional<CarInfo> optOfCar = carInfos.stream().filter(c -> Objects.equals(c.getNbbm(), sc.getNbbm())).findFirst();
  612 + if (!optOfCar.isPresent()) {
  613 + log.info("没有找到对应的车辆信息:[{}]", sc);
  614 + return null;
  615 + }
  616 + List<KeyInfo> carKeyInfo = keyInfos.stream().filter(k -> Objects.equals(k.getPlateNum(), optOfCar.get().getPlateNum())).collect(Collectors.toList());
  617 + int keySize = CollectionUtils.size(carKeyInfo);
  618 + if (keySize == 0) {
  619 + log.info("根据车辆信息[{}]没有找到对应的钥匙", optOfCar.get());
  620 + return null;
  621 + } else if (keySize > 1) {
  622 + carKeyInfo = carKeyInfo.stream().sorted(Comparator.comparing(KeyInfo::getId)).collect(Collectors.toList());
  623 + }
  624 +
  625 + LinggangKeyWorkLocation location = new LinggangKeyWorkLocation();
  626 + location.setYardId(equipment.getYardId());
  627 + location.setYardName(optional.get().getName());
  628 + location.setDevice(equipment.getDeviceId());
  629 + location.setCabinetNo(number.toString());
  630 + location.setEventType(0);
  631 + location.setDelFlag(Boolean.FALSE);
  632 + location.setKeyInfoId(carKeyInfo.get(0).getId());
  633 + location.setScheduleDate(sc.getScheduleDate());
  634 + location.setSchedulingId(sc.getId());
  635 + location.setType(2);
  636 + return location;
  637 +
  638 + }).filter(obj -> Objects.nonNull(obj)).collect(Collectors.toList());
  639 + }
  640 +
  641 + private List<LinggangScheduling> querySchedulingByTiime(Date date) {
  642 + LinggangScheduling scheduling = new LinggangScheduling();
  643 + scheduling.setScheduleDate(date);
  644 + scheduling.setBcType(BC_TYPE_IN);
  645 + List<LinggangScheduling> schedulings = schedulingService.list(scheduling);
  646 + if (CollectionUtils.isEmpty(schedulings)) {
  647 + log.info("没有查到排班信息:[{}]", date);
  648 + return null;
  649 + }
  650 + return schedulings;
  651 + }
  652 +
  653 + private List<LinggangVenueInfo> queryVenueInfo(List<LinggangScheduling> schedulings) {
  654 + Set<String> zdzCode = schedulings.stream().map(LinggangScheduling::getZdzcode).collect(Collectors.toSet());
  655 + List<LinggangVenueInfo> venueInfos = venueInfoService.listOfCodes(zdzCode);
  656 + if (CollectionUtils.isEmpty(venueInfos)) {
  657 + log.info("查询场站数据为空:[{}]", zdzCode);
  658 + return null;
  659 + }
  660 + return venueInfos;
  661 + }
  662 +
  663 + private List<CarInfo> queryCarInfo(List<LinggangScheduling> schedulings) {
  664 + Set<String> nbbms = schedulings.stream().map(LinggangScheduling::getNbbm).collect(Collectors.toSet());
  665 + if (CollectionUtils.isEmpty(nbbms)) {
  666 + log.info("车辆自编号为空:[{}]", schedulings);
  667 + return null;
  668 + }
  669 + List<CarInfo> carInfos = carInfoService.list(nbbms);
  670 + if (CollectionUtils.isEmpty(carInfos)) {
  671 + log.info("查询车辆数据为空:[{}]", carInfos);
  672 + return null;
  673 + }
  674 + return carInfos;
  675 + }
  676 +
  677 + private List<KeyInfo> queryKeyInfo(List<CarInfo> carInfos) {
  678 + Set<String> plateNums = carInfos.stream().map(CarInfo::getPlateNum).collect(Collectors.toSet());
  679 + if (CollectionUtils.isEmpty(plateNums)) {
  680 + log.info("车牌数据为空:[{}]", carInfos);
  681 + return null;
  682 + }
  683 + KeyInfo keyInfo = new KeyInfo();
  684 + keyInfo.setDelFlag(Boolean.FALSE);
  685 + List<KeyInfo> keyInfos = keyInfoService.list(keyInfo, plateNums);
  686 + if (CollectionUtils.isEmpty(keyInfos)) {
  687 + log.info("查询钥匙数据为空:[{}]", plateNums);
  688 + return null;
  689 + }
  690 + return keyInfos;
  691 + }
  692 +
  693 + private List<Equipment> queryEquipment(List<LinggangVenueInfo> venueInfos) {
  694 + Set<Integer> venuInfoIds = venueInfos.stream().map(LinggangVenueInfo::getId).collect(Collectors.toSet());
  695 + Equipment equipment = new Equipment();
  696 + equipment.setStatus(1);
  697 + List<Equipment> equipmentList = equipmentService.listByEntityAndYardIds(equipment, venuInfoIds);
  698 + if (CollectionUtils.isEmpty(equipmentList)) {
  699 + log.info("查询设备数据为空:[{}]", venuInfoIds);
  700 + return null;
  701 + }
  702 +
  703 + List<Equipment> equipmentList2 = equipmentList.stream().filter(eq -> StringUtils.startsWith(eq.getPromise(), "4,") || StringUtils.endsWith(eq.getPromise(), ",4") ||
  704 + StringUtils.indexOf(eq.getPromise(), ",4,") > -1).collect(Collectors.toList());
  705 + if (CollectionUtils.isEmpty(equipmentList)) {
  706 + log.info("查询钥匙柜数据为空:[{}]", equipmentList);
  707 + return null;
  708 + }
  709 + return equipmentList2;
  710 + }
499 711 }
500 712 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/scheduling/LinggangSchedulingServiceImpl.java
... ... @@ -52,6 +52,11 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl&lt;LinggangSchedulin
52 52 public List<LinggangScheduling> list(LinggangScheduling entity) {
53 53 return list(new LambdaQueryWrapper<>(entity));
54 54 }
  55 +
  56 + @Override
  57 + public List<LinggangScheduling> listByCZ(LinggangScheduling entity) {
  58 + return linggangSchedulingMapper.listByCZ(entity);
  59 + }
55 60 // @Override
56 61 // public List<LinggangScheduling> listOfSelect(LinggangScheduling entity) {
57 62 // LambdaQueryWrapper<LinggangScheduling> wrapper = new LambdaQueryWrapper<>(entity);
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/venue/info/LinggangVenueInfoServiceImpl.java
... ... @@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
13 13 import org.springframework.beans.factory.annotation.Autowired;
14 14 import org.springframework.stereotype.Service;
15 15  
  16 +import java.util.Collection;
16 17 import java.util.Collections;
17 18 import java.util.List;
18 19  
... ... @@ -74,11 +75,28 @@ public class LinggangVenueInfoServiceImpl extends ServiceImpl&lt;LinggangVenueInfoM
74 75 }
75 76  
76 77 @Override
  78 + public List<LinggangVenueInfo> listOfCodes(Collection<String> codes) {
  79 + if (org.springframework.util.CollectionUtils.isEmpty(codes)) {
  80 + return java.util.Collections.emptyList();
  81 + }
  82 + LambdaQueryWrapper<LinggangVenueInfo> wrapper = new LambdaQueryWrapper<>();
  83 + wrapper.in(LinggangVenueInfo::getParkCode, codes);
  84 + return list(wrapper);
  85 + }
  86 +
  87 + @Override
77 88 public LinggangVenueInfo getOne(LinggangVenueInfo entity) {
78 89 return getOne(new LambdaQueryWrapper<>(entity));
79 90 }
80 91  
81 92 @Override
  93 + public LinggangVenueInfo getOne(String parkCode) {
  94 + LambdaQueryWrapper<LinggangVenueInfo> wrapper = new LambdaQueryWrapper<>();
  95 + wrapper.eq(LinggangVenueInfo::getParkCode, parkCode);
  96 + return getOne(wrapper);
  97 + }
  98 +
  99 + @Override
82 100 public Integer countId(LinggangVenueInfo entity) {
83 101 LambdaQueryWrapper<LinggangVenueInfo> wrapper = new LambdaQueryWrapper<>(entity);
84 102 wrapper.select(LinggangVenueInfo::getId);
... ...
Bsth-admin/src/main/java/com/ruoyi/service/key/info/KeyInfoService.java
... ... @@ -22,6 +22,8 @@ public interface KeyInfoService extends IService&lt;KeyInfo&gt; {
22 22  
23 23 List<KeyInfo> list(Collection<String> codes);
24 24  
  25 + List<KeyInfo> list(KeyInfo entity,Collection<String> plateNums);
  26 +
25 27 /***
26 28 *用于页面选择
27 29 */
... ...
Bsth-admin/src/main/java/com/ruoyi/service/key/location/LinggangKeyWorkLocationService.java
... ... @@ -57,6 +57,8 @@ public interface LinggangKeyWorkLocationService extends IService&lt;LinggangKeyWork
57 57 /***插入数据*/
58 58 boolean insert(LinggangKeyWorkLocation entity);
59 59  
  60 + boolean insertJob(String timeStr);
  61 +
60 62 /**
61 63 * 根据主键修改数据
62 64 */
... ...
Bsth-admin/src/main/java/com/ruoyi/service/scheduling/LinggangSchedulingService.java
... ... @@ -22,6 +22,8 @@ public interface LinggangSchedulingService extends IService&lt;LinggangScheduling&gt;
22 22 */
23 23 List<LinggangScheduling> list(LinggangScheduling entity);
24 24  
  25 + List<LinggangScheduling> listByCZ(LinggangScheduling entity);
  26 +
25 27 // List<LinggangScheduling> listOfIds(java.util.Collection<java.lang.Integer> ids);
26 28 // /***
27 29 // *用于页面选择
... ...
Bsth-admin/src/main/java/com/ruoyi/service/venue/info/LinggangVenueInfoService.java
... ... @@ -22,6 +22,7 @@ public interface LinggangVenueInfoService extends IService&lt;LinggangVenueInfo&gt; {
22 22 List<LinggangVenueInfo> list(LinggangVenueInfo entity);
23 23  
24 24 List<LinggangVenueInfo> listOfIds(java.util.Collection<java.lang.Integer> ids);
  25 + List<LinggangVenueInfo> listOfCodes(java.util.Collection<java.lang.String> codes);
25 26  
26 27 /***
27 28 *用于页面选择
... ... @@ -33,6 +34,8 @@ public interface LinggangVenueInfoService extends IService&lt;LinggangVenueInfo&gt; {
33 34 */
34 35 LinggangVenueInfo getOne(LinggangVenueInfo entity);
35 36  
  37 + LinggangVenueInfo getOne(String parkCode);
  38 +
36 39 Integer countId(LinggangVenueInfo entity);
37 40  
38 41 /**
... ...
Bsth-admin/src/main/java/com/ruoyi/utils/DateUtil.java
... ... @@ -3,9 +3,11 @@ package com.ruoyi.utils;
3 3 import org.apache.commons.lang3.StringUtils;
4 4 import org.apache.commons.lang3.time.FastDateFormat;
5 5  
  6 +import java.text.ParseException;
6 7 import java.time.LocalDate;
7 8 import java.time.LocalDateTime;
8 9 import java.time.format.DateTimeFormatter;
  10 +import java.util.Date;
9 11  
10 12 /**
11 13 * @author liujun
... ... @@ -14,6 +16,7 @@ import java.time.format.DateTimeFormatter;
14 16 public class DateUtil {
15 17  
16 18 public static FastDateFormat YYYY_MM_DD_LINK_HH_MM_SS = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss");
  19 + public static FastDateFormat YYYY_MM_DD_LINK = FastDateFormat.getInstance("yyyy-MM-dd");
17 20 public static DateTimeFormatter YYYY_MM_DD_LINK_HH_MM_SS_Local_Date = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
18 21 public static DateTimeFormatter YYYY_MM_DD_LINK_Local_Date = DateTimeFormatter.ofPattern("yyyy-MM-dd");
19 22  
... ... @@ -24,4 +27,17 @@ public class DateUtil {
24 27 public static LocalDate parseLocalDate(String dateStr) {
25 28 return StringUtils.isEmpty(dateStr) ? null : LocalDate.parse(dateStr, YYYY_MM_DD_LINK_Local_Date);
26 29 }
  30 +
  31 + public static Date today() {
  32 + return shortDate(new Date());
  33 + }
  34 +
  35 + public static Date shortDate(Date date) {
  36 + try {
  37 + return YYYY_MM_DD_LINK.parse(YYYY_MM_DD_LINK.format(date));
  38 + } catch (ParseException e) {
  39 + throw new RuntimeException(e);
  40 + }
  41 + }
  42 +
27 43 }
... ...
Bsth-admin/src/main/resources/mapper/driver_scheduling/DriverSchedulingMapper.xml
... ... @@ -24,6 +24,11 @@
24 24 <result column="alcohol_intake" property="alcoholIntake"/>
25 25 <result column="sign_type" property="signType"></result>
26 26 <result column="remark" property="remark"></result>
  27 + <result column="upDown" property="upDown"></result>
  28 + <result column="qdzCode" property="qdzCode"></result>
  29 + <result column="qdzName" property="qdzName"></result>
  30 + <result column="zdzCode" property="zdzCode"></result>
  31 +
27 32 </resultMap>
28 33  
29 34 <sql id="selectColumn">
... ... @@ -32,20 +37,12 @@
32 37  
33 38  
34 39 <insert id="insertRoster" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
35   - insert into scheduling (schedule_date,line_name,job_code,`name`,posts,lp_name,nbbm,bc_type,fcsj_t,zdsj_t)
  40 + insert into scheduling (schedule_date,line_name,job_code,`name`,posts,lp_name,nbbm,bc_type,fcsj_t,zdsj_t,upDown,qdzCode,qdzName,zdzCode,zdzName)
36 41 values
37 42 <foreach collection="list" item="item" separator=",">
38 43 (
39   - #{item.scheduleDate},
40   - #{item.lineName},
41   - #{item.jobCode},
42   - #{item.name},
43   - #{item.posts},
44   - #{item.lpName},
45   - #{item.nbbm},
46   - #{item.bcType},
47   - #{item.fcsjT},
48   - #{item.zdsjT}
  44 + #{item.scheduleDate}, #{item.lineName}, #{item.jobCode}, #{item.name}, #{item.posts}, #{item.lpName}, #{item.nbbm},
  45 + #{item.bcType},#{item.fcsjT},#{item.zdsjT},#{item.upDown},#{item.qdzCode},#{item.qdzName},#{item.zdzCode},#{item.zdzName}
49 46 )
50 47 </foreach>
51 48 on duplicate key update
... ...
Bsth-admin/src/main/resources/mapper/scheduling/LinggangSchedulingMapper.xml
... ... @@ -29,6 +29,19 @@
29 29 <include refid="insertSelectiveColumn"></include>
30 30 <include refid="insertSelectiveValue"></include>
31 31 </insert>
  32 + <select id="listByCZ" resultMap="BaseResultMap">
  33 + select <include refid="columns"></include> from scheduling
  34 + <where >
  35 + <include refid="where"></include>
  36 + <if test="null != czCode"> and (qdzcode = #{czCode} OR zdzcode = #{czCode}) </if>
  37 + <choose>
  38 + <when test="null !=startScheduleDate and null !=endScheduleDate"> and schedule_date BETWEEN #{startScheduleDate} and #{endScheduleDate} </when>
  39 + <when test="null !=startScheduleDate">and schedule_date &gt;= #{startScheduleDate}</when>
  40 + <when test="null !=endScheduleDate">and schedule_date &lt;= #{endScheduleDate}</when>
  41 + </choose>
  42 +
  43 + </where>
  44 + </select>
32 45  
33 46 <sql id="columns">
34 47 id
... ...
Bsth-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
... ... @@ -117,7 +117,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
117 117 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
118 118 .antMatchers("/big/view/queryNumberByType","/big/view/queryLineInfo/*","/big/view/querySignDetails","/report/list/**","/system/dict/data/**",
119 119 "/app/version/check/**","/app/checkDeviceHeart","/app/download","/driver/**","/in/**","/eexception/**","/equipment/**",
120   - "/report/**","/login", "/register", "/captchaImage","/dss/Driver/Auth").permitAll()
  120 + "/report/**","/login", "/register", "/captchaImage","/dss/Driver/Auth","/test/**").permitAll()
121 121 // 静态资源,可匿名访问
122 122 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
123 123 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
... ...