Commit 5ce3372c6b04d4fff9cae9b090a60e9781a48abb

Authored by liujun001
1 parent 9eda1a12

蓝斯接口 模糊查询车辆车牌列表\司机获取当前工作的车辆钥匙信息

Showing 43 changed files with 1222 additions and 85 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
... ... @@ -8,6 +8,11 @@ import com.ruoyi.common.core.controller.BaseController;
8 8 import com.ruoyi.common.core.domain.ResponseResult;
9 9 import com.ruoyi.common.utils.DateUtils;
10 10 import com.ruoyi.domain.caiinfo.CarInfo;
  11 +import com.ruoyi.domain.driver.NewDriver;
  12 +import com.ruoyi.domain.dss.key.box.dto.KeyBasicSyncDTO;
  13 +import com.ruoyi.domain.dss.key.box.dto.SkipOperationDTO;
  14 +import com.ruoyi.domain.dss.key.box.dto.TakeKeyDTO;
  15 +import com.ruoyi.domain.dss.key.box.vo.*;
11 16 import com.ruoyi.domain.dss.key.location.dto.WorkPlateV2DTO;
12 17 import com.ruoyi.domain.dss.key.location.vo.WorkPlateV2Vo;
13 18 import com.ruoyi.domain.equipment.linke.log.LingangEquipmentLinkeLog;
... ... @@ -16,14 +21,19 @@ import com.ruoyi.domain.key.info.box.dto.KeyBoxQueryDTO;
16 21 import com.ruoyi.domain.key.info.box.vo.KeyBoxVo;
17 22 import com.ruoyi.domain.key.location.LinggangKeyWorkLocation;
18 23 import com.ruoyi.domain.scheduling.LinggangScheduling;
  24 +import com.ruoyi.equipment.domain.Equipment;
  25 +import com.ruoyi.equipment.service.IEquipmentService;
19 26 import com.ruoyi.service.carinfo.CarInfoService;
  27 +import com.ruoyi.service.driver.NewDriverService;
20 28 import com.ruoyi.service.dss.KeyBoxVoService;
21 29 import com.ruoyi.service.equipment.linke.log.LingangEquipmentLinkeLogService;
22 30 import com.ruoyi.service.key.info.KeyInfoService;
23 31 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
24 32 import com.ruoyi.service.scheduling.LinggangSchedulingService;
25 33 import io.swagger.annotations.Api;
  34 +import io.swagger.annotations.ApiModelProperty;
26 35 import io.swagger.annotations.ApiOperation;
  36 +import org.apache.commons.collections4.CollectionUtils;
27 37 import org.springframework.beans.factory.annotation.Autowired;
28 38 import org.springframework.validation.BindingResult;
29 39 import org.springframework.web.bind.annotation.PostMapping;
... ... @@ -33,8 +43,8 @@ import org.springframework.web.bind.annotation.RestController;
33 43  
34 44 import javax.validation.Valid;
35 45 import java.text.ParseException;
36   -import java.util.Date;
37   -import java.util.Objects;
  46 +import java.util.*;
  47 +import java.util.stream.Collectors;
38 48  
39 49  
40 50 /**
... ... @@ -59,10 +69,14 @@ public class KeyBoxController extends BaseController {
59 69 private KeyInfoService keyInfoService;
60 70 @Autowired
61 71 private CarInfoService carInfoService;
  72 + @Autowired
  73 + private IEquipmentService equipmentService;
  74 + @Autowired
  75 + private NewDriverService newDriverService;
62 76  
63 77 @PostMapping(value = "/keybox/findKey")
64 78 @ApiOperation("钥匙信息查询")
65   - public ResponseResult<KeyBoxVo> listSelect(@Valid @RequestBody KeyBoxQueryDTO request,BindingResult bindingResult) {
  79 + public ResponseResult<KeyBoxVo> listSelect(@Valid @RequestBody KeyBoxQueryDTO request, BindingResult bindingResult) {
66 80 if (bindingResult.hasErrors()) {
67 81 return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage());
68 82 }
... ... @@ -90,12 +104,12 @@ public class KeyBoxController extends BaseController {
90 104  
91 105 KeyInfo keyInfo = queryKeyInfo(scheduling.getKeyInfoId());
92 106 if (Objects.isNull(keyInfo)) {
93   - return ResponseResult.error(TipEnum.TIP_404.getCode(), TipEnum.TIP_404.getMsg());
  107 + return ResponseResult.error404();
94 108 }
95 109  
96 110 CarInfo carInfo = queryCarInfo(scheduling.getNbbm());
97 111 if (Objects.isNull(carInfo)) {
98   - return ResponseResult.error(TipEnum.TIP_404.getCode(), TipEnum.TIP_404.getMsg());
  112 + return ResponseResult.error404();
99 113 }
100 114  
101 115 WorkPlateV2Vo vo = convertWorkPlateV2Vo(scheduling, workLocation, keyInfo, carInfo);
... ... @@ -108,6 +122,94 @@ public class KeyBoxController extends BaseController {
108 122  
109 123 }
110 124  
  125 + @ApiOperation(value = "18.钥匙柜基础信息同步")
  126 + @PostMapping(value = "/Device/BasicSync")
  127 + public ResponseResult<BasicSyncVo> basicSync(@Valid @RequestBody KeyBasicSyncDTO dto, BindingResult bindingResult) {
  128 + if (bindingResult.hasErrors()) {
  129 + return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage());
  130 + }
  131 +
  132 + try {
  133 + List<LinggangKeyWorkLocation> workLocations = queryKeyWorkLocation(dto);
  134 + if (Objects.isNull(workLocations)) {
  135 + logger.info("根据DTO的数据无法查询钥匙存放信息:[{}]", dto);
  136 + return ResponseResult.error404();
  137 + }
  138 +
  139 + Set<Long> schedulingIds = workLocations.stream().map(LinggangKeyWorkLocation::getSchedulingId).collect(Collectors.toSet());
  140 + List<LinggangScheduling> schedulings = queryScheduling(schedulingIds);
  141 + if (CollectionUtils.isEmpty(schedulings)) {
  142 + logger.info("根据DTO的数据无法查询排班信息:[{}]", dto);
  143 + return ResponseResult.error404();
  144 + }
  145 +
  146 + Equipment equipment = queryEquipment(dto.getDevice());
  147 + if (Objects.isNull(equipment)) {
  148 + logger.info("根据DTO的数据无法查询设备信息:[{}]", dto);
  149 + return ResponseResult.error404();
  150 + }
  151 +
  152 + Set<Integer> keyInfoIds = workLocations.stream().map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet());
  153 + List<KeyInfo> keyInfos = queryKeyInfos(keyInfoIds);
  154 + if (CollectionUtils.isEmpty(keyInfos)) {
  155 + logger.info("根据DTO的数据无法查询钥匙信息:[{}]", dto);
  156 + return ResponseResult.error404();
  157 + }
  158 +
  159 + Set<String> jobCodes = schedulings.stream().map(LinggangScheduling::getJobCode).collect(Collectors.toSet());
  160 + List<NewDriver> drivers = queryDrive(jobCodes);
  161 + if (CollectionUtils.isEmpty(drivers)) {
  162 + logger.info("根据DTO的数据无法查询司机信息:[{}]", dto);
  163 + return ResponseResult.error404();
  164 + }
  165 +
  166 + Set<String> nbbms = schedulings.stream().map(LinggangScheduling::getNbbm).collect(Collectors.toSet());
  167 + List<CarInfo> carInfos = queryCarInfo(nbbms);
  168 + if (CollectionUtils.isEmpty(carInfos)) {
  169 + logger.info("根据DTO的数据无法查询车辆信息:[{}]", dto);
  170 + return ResponseResult.error404();
  171 + }
  172 +
  173 + BasicSyncVo vo = convertBasicSyncVo(workLocations, schedulings, keyInfos, drivers, carInfos, equipment);
  174 + return ResponseResult.success(vo);
  175 + } catch (ParseException e) {
  176 + logger.error("钥匙柜基础信息同步异常:[{}]", dto, e);
  177 + }
  178 + return ResponseResult.error();
  179 + }
  180 +
  181 + @PostMapping(value = "/Driver/SkipOperation")
  182 + @ApiOperation(value = "19.人员跳过钥匙柜操作")
  183 + public ResponseResult<SkipOperationVo> skipOperation(@Valid SkipOperationDTO dto, BindingResult bindingResult) {
  184 + if (bindingResult.hasErrors()) {
  185 + return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage());
  186 + }
  187 + Equipment equipment = queryEquipment(dto.getDevice());
  188 + if (Objects.isNull(equipment)) {
  189 + logger.info("根据DTO的数据无法查询设备信息:[{}]", dto);
  190 + return ResponseResult.error404();
  191 + }
  192 +
  193 + SkipOperationVo vo = convertSkipOperationVo(equipment);
  194 + return ResponseResult.success(vo);
  195 + }
  196 +
  197 + @PostMapping(value = "Driver/TakeKey")
  198 + @ApiModelProperty(value = "20.人员领取钥匙")
  199 + public ResponseResult<TakeKeyVo> takeKey(@Valid TakeKeyDTO dto, BindingResult bindingResult) {
  200 + if (bindingResult.hasErrors()) {
  201 + return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage());
  202 + }
  203 + List<LinggangKeyWorkLocation> locations = convert(dto);
  204 + ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations);
  205 + if (Objects.isNull(responseResult)) {
  206 + return ResponseResult.error();
  207 + }
  208 + TakeKeyVo vo = convertTakeKeyVo(dto, responseResult);
  209 +
  210 + return new ResponseResult<>(responseResult.getCode(), responseResult.getMsg(), vo);
  211 + }
  212 +
111 213 /***
112 214 * 查询排班
113 215 * @author liujun
... ... @@ -127,6 +229,14 @@ public class KeyBoxController extends BaseController {
127 229 return schedulingService.getOne(scheduling);
128 230 }
129 231  
  232 + private List<LinggangScheduling> queryScheduling(Collection<Long> ids) {
  233 + if (CollectionUtils.isEmpty(ids)) {
  234 + return Collections.emptyList();
  235 + }
  236 + return schedulingService.listByIds(ids);
  237 + }
  238 +
  239 +
130 240 /***
131 241 * 根据排班时间和钥匙ID查询钥匙
132 242 * @author liujun
... ... @@ -143,10 +253,29 @@ public class KeyBoxController extends BaseController {
143 253 return linggangKeyWorkLocationService.getOne(workLocation);
144 254 }
145 255  
  256 +
  257 + private List<LinggangKeyWorkLocation> queryKeyWorkLocation(KeyBasicSyncDTO dto) throws ParseException {
  258 + LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation();
  259 +
  260 + String dateStr = DateUtils.YYYY_MM_DD.format(dto.getTime());
  261 + workLocation.setScheduleDate(DateUtils.YYYY_MM_DD.parse(dateStr));
  262 + workLocation.setDevice(dto.getDevice());
  263 + workLocation.setDelFlag(Boolean.FALSE);
  264 +
  265 + return linggangKeyWorkLocationService.list(workLocation);
  266 + }
  267 +
146 268 private KeyInfo queryKeyInfo(Integer keyId) {
147 269 return keyInfoService.getById(keyId);
148 270 }
149 271  
  272 + private List<KeyInfo> queryKeyInfos(Collection<Integer> ids) {
  273 + if (CollectionUtils.isEmpty(ids)) {
  274 + return Collections.emptyList();
  275 + }
  276 + return keyInfoService.listByIds(ids);
  277 + }
  278 +
150 279 private CarInfo queryCarInfo(String nbbm) {
151 280 CarInfo carInfo = new CarInfo();
152 281 carInfo.setNbbm(nbbm);
... ... @@ -154,6 +283,24 @@ public class KeyBoxController extends BaseController {
154 283 return carInfoService.getOne(carInfo);
155 284 }
156 285  
  286 + private Equipment queryEquipment(String deviceId) {
  287 + return equipmentService.getOneByDeviceId(deviceId);
  288 + }
  289 +
  290 + private List<NewDriver> queryDrive(Collection<String> jobCods) {
  291 + if (CollectionUtils.isEmpty(jobCods)) {
  292 + return Collections.emptyList();
  293 + }
  294 + return newDriverService.list(jobCods);
  295 + }
  296 +
  297 + private List<CarInfo> queryCarInfo(Collection<String> nbbms) {
  298 + if (CollectionUtils.isEmpty(nbbms)) {
  299 + return Collections.emptyList();
  300 + }
  301 + return carInfoService.list(nbbms);
  302 + }
  303 +
157 304  
158 305 /***
159 306 * 保存链接日志
... ... @@ -183,4 +330,93 @@ public class KeyBoxController extends BaseController {
183 330  
184 331 return vo;
185 332 }
  333 +
  334 + private BasicSyncVo convertBasicSyncVo(List<LinggangKeyWorkLocation> workLocations, List<LinggangScheduling> schedulings,
  335 + List<KeyInfo> keyInfos, List<NewDriver> drivers, List<CarInfo> carInfos, Equipment equipment) {
  336 + BasicSyncVo vo = new BasicSyncVo();
  337 +
  338 + vo.setDevice(equipment.getDeviceId());
  339 + vo.setDeviceType(equipment.getPromise());
  340 + vo.setTime(workLocations.get(0).getScheduleDate());
  341 + vo.setYardName(equipment.getSiteName());
  342 +// vo.setKeyboxName()
  343 +
  344 + List<BasicSyncKeyboxVo> keybox = new ArrayList<>();
  345 + BasicSyncKeyboxVo boxvo = new BasicSyncKeyboxVo();
  346 + List<BasicSyncKeyboxKeyItemVo> keyItemVos = workLocations.stream().map(local -> {
  347 + Optional<KeyInfo> optional = keyInfos.stream().filter(k -> Objects.equals(k.getId(), local.getKeyInfoId())).findFirst();
  348 + String keyCode = optional.isPresent() ? optional.get().getName() : null;
  349 + return new BasicSyncKeyboxKeyItemVo(local.getCabinetNo(), keyCode);
  350 +
  351 + }).collect(Collectors.toList());
  352 + keybox.add(boxvo);
  353 + boxvo.setKeyItem(keyItemVos);
  354 +
  355 +
  356 + List<BasicSyncDriverWorkVo> driverWork = new ArrayList<>();
  357 + BasicSyncDriverWorkVo basicSyncDriverWorkVo = new BasicSyncDriverWorkVo();
  358 +
  359 + List<BasicSyncDriverWorkDriverPlanVo> driverPlanVos = schedulings.stream().map(sc -> {
  360 + BasicSyncDriverWorkDriverPlanVo driverPlanVo = new BasicSyncDriverWorkDriverPlanVo();
  361 + Optional<NewDriver> optional = drivers.stream().filter(d -> Objects.equals(d.getJobCode(), sc.getJobCode())).findFirst();
  362 + if (optional.isPresent()) {
  363 + driverPlanVo.setDriverCode(optional.get().getIcCardCode());
  364 + }
  365 +
  366 + driverPlanVo.setStaffCode(sc.getJobCode());
  367 +
  368 + BasicSyncDriverWorkDriverPlanTimePlateVo planTimePlateVo = new BasicSyncDriverWorkDriverPlanTimePlateVo();
  369 + planTimePlateVo.setKey(sc.getScheduleDate());
  370 + Optional<CarInfo> carInfoOptional = carInfos.stream().filter(c -> Objects.equals(c.getNbbm(), sc.getNbbm())).findFirst();
  371 + if (optional.isPresent()) {
  372 + planTimePlateVo.setValue(carInfoOptional.get().getPlateNum());
  373 + }
  374 +
  375 +
  376 + driverPlanVo.setTimePlate(planTimePlateVo);
  377 + return driverPlanVo;
  378 + }).collect(Collectors.toList());
  379 +
  380 + basicSyncDriverWorkVo.setDriverPlan(driverPlanVos);
  381 + driverWork.add(basicSyncDriverWorkVo);
  382 +
  383 + vo.setKeybox(keybox);
  384 + vo.setDriverWork(driverWork);
  385 +
  386 + return vo;
  387 + }
  388 +
  389 + private SkipOperationVo convertSkipOperationVo(Equipment equipment) {
  390 + SkipOperationVo vo = new SkipOperationVo();
  391 + vo.setDevice(equipment.getDeviceId());
  392 + vo.setTime(new Date());
  393 + vo.setDeviceType(equipment.getPromise());
  394 + vo.setResult(0);
  395 +
  396 + return vo;
  397 + }
  398 +
  399 + private List<LinggangKeyWorkLocation> convert(TakeKeyDTO dto) {
  400 + if (CollectionUtils.isEmpty(dto.getKeyItem())) {
  401 + return Collections.emptyList();
  402 + }
  403 +
  404 + return dto.getKeyItem().stream().map(item -> {
  405 + LinggangKeyWorkLocation location = new LinggangKeyWorkLocation();
  406 + location.setDevice(item.getDevice());
  407 + location.setEventType(item.getState());
  408 + location.setKey(item.getKey());
  409 + location.setScheduleDate(dto.getTime());
  410 +
  411 + return location;
  412 + }).collect(Collectors.toList());
  413 + }
  414 +
  415 + private TakeKeyVo convertTakeKeyVo(TakeKeyDTO dto, ResponseResult<Boolean> result) {
  416 + TakeKeyVo vo = new TakeKeyVo();
  417 + vo.setDevice(dto.getDevice());
  418 + vo.setTime(new Date());
  419 + vo.setResult(result.isSuccess() ? 0 : 1);
  420 + return vo;
  421 + }
186 422 }
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/dto/KeyBasicSyncDTO.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.dto;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +import lombok.EqualsAndHashCode;
  8 +import lombok.experimental.Accessors;
  9 +
  10 +import javax.validation.constraints.NotEmpty;
  11 +import javax.validation.constraints.NotNull;
  12 +import java.util.Date;
  13 +
  14 +/**
  15 + * @author liujun
  16 + * @date 2024年07月17日 9:20
  17 + */
  18 +@Data
  19 +@Accessors(chain = true)
  20 +@ApiModel(value = "钥匙柜基础信息同步")
  21 +@EqualsAndHashCode(callSuper = false)
  22 +public class KeyBasicSyncDTO {
  23 + @NotEmpty(message = "设备上线号 不能为空")
  24 + @ApiModelProperty(value = "设备上线号", required = true)
  25 + private String device;
  26 +
  27 + @NotEmpty(message = "设备类型 不能为空")
  28 + @ApiModelProperty(value = "设备类型", required = true)
  29 + private String deviceType;
  30 +
  31 + @NotNull(message = "时间不能为空")
  32 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  33 + @ApiModelProperty(value = "时间 格式为:yyyy-MM-dd HH:mm:ss", required = true)
  34 + private Date time;
  35 +
  36 + @ApiModelProperty(value = "场站车位邻近关系版本号 null或与服务器版本号不同时 服务器则下发数据")
  37 + private String yardVer;
  38 +
  39 + @ApiModelProperty(value = "钥匙柜信息版本号 null或与服务器版本号不同时 服务器则下发数据")
  40 + private String keyboxVer;
  41 +
  42 + @ApiModelProperty(value = "场站绑定的车牌号列表版本号 null或与服务器版本号不同时 服务器则下发新场站车辆列表")
  43 + private String yardVehiclesVer;
  44 +
  45 + @ApiModelProperty(value = "多日期排班计划列表版本号 null或与服务器版本号不同时 服务器则下发数据")
  46 + private String driverWorkVer;
  47 +
  48 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/dto/SkipOperationDTO.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.dto;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +import lombok.EqualsAndHashCode;
  8 +import lombok.experimental.Accessors;
  9 +
  10 +import javax.validation.constraints.NotEmpty;
  11 +import javax.validation.constraints.NotNull;
  12 +import java.util.Date;
  13 +
  14 +/**
  15 + * @author liujun
  16 + * @date 2024年07月17日 13:01
  17 + */
  18 +@Data
  19 +@Accessors(chain = true)
  20 +@ApiModel(value = "人员跳过钥匙柜操作")
  21 +@EqualsAndHashCode(callSuper = false)
  22 +public class SkipOperationDTO implements java.io.Serializable {
  23 +
  24 + private static final long serialVersionUID = -8021365015913776295L;
  25 +
  26 + @NotEmpty(message = "设备上线号 不能为空")
  27 + @ApiModelProperty(value = "设备上线号", required = true)
  28 + private String device;
  29 +
  30 + @NotEmpty(message = "设备类型 不能为空")
  31 + @ApiModelProperty(value = "设备类型", required = true)
  32 + private String deviceType;
  33 +
  34 + @NotEmpty(message = "卡号 不能为空")
  35 + @ApiModelProperty(value = "卡号", required = true)
  36 + private String driverCode;
  37 +
  38 + @NotNull(message = "设备时间 不能为空")
  39 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  40 + @ApiModelProperty(value = "设备时间", required = true)
  41 + private Date time;
  42 +
  43 + @NotNull(message = "操作类型 不能为空")
  44 + @ApiModelProperty(value = "操作类型 0:司机操作,16:管理员操作,17:紧急按键", required = true)
  45 + private Integer opeType;
  46 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/dto/TakeKeyDTO.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.dto;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +import lombok.EqualsAndHashCode;
  8 +import lombok.experimental.Accessors;
  9 +
  10 +import javax.validation.constraints.NotEmpty;
  11 +import javax.validation.constraints.NotNull;
  12 +import java.util.Date;
  13 +import java.util.List;
  14 +
  15 +/**
  16 + * @author liujun
  17 + * @date 2024年07月17日 13:21
  18 + */
  19 +@Data
  20 +@Accessors(chain = true)
  21 +@ApiModel(value = "人员领取钥匙 Vo")
  22 +@EqualsAndHashCode(callSuper = false)
  23 +public class TakeKeyDTO implements java.io.Serializable {
  24 +
  25 + private static final long serialVersionUID = 8333233216662578589L;
  26 +
  27 + @NotEmpty(message = "设备上线号 不能为空")
  28 + @ApiModelProperty(value = "设备上线号", required = true)
  29 + private String device;
  30 +
  31 + @NotEmpty(message = "设备类型 不能为空")
  32 + @ApiModelProperty(value = "设备类型", required = true)
  33 + private String deviceType;
  34 +
  35 + @NotEmpty(message = "卡号 不能为空")
  36 + @ApiModelProperty(value = "卡号", required = true)
  37 + private String driverCode;
  38 +
  39 + @NotNull(message = "时间不能为空")
  40 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  41 + @ApiModelProperty(value = "时间 个数:yyyy-MM-dd HH:mm:ss", required = true)
  42 + private Date time;
  43 +
  44 + @NotNull(message = "领取类型不能为空")
  45 + @ApiModelProperty(value = "领取类型;0:司机操作,16管理员操作,17紧急领取,18紧急按钮", required = true)
  46 + private Integer opeType;
  47 +
  48 + @NotEmpty(message = "选择的钥匙位车牌 不能为空")
  49 + @ApiModelProperty(value = "选择的钥匙位车牌", required = true)
  50 + private String checkPlate;
  51 + @ApiModelProperty(value = "领取钥匙信息集合")
  52 + private List<TakeKeyKeyItemDTO> keyItem;
  53 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/dto/TakeKeyKeyItemDTO.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.dto;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +import lombok.EqualsAndHashCode;
  7 +import lombok.experimental.Accessors;
  8 +
  9 +import javax.validation.constraints.NotEmpty;
  10 +import javax.validation.constraints.NotNull;
  11 +
  12 +/**
  13 + * @author liujun
  14 + * @date 2024年07月17日 13:23
  15 + */
  16 +@Data
  17 +@Accessors(chain = true)
  18 +@ApiModel(value = "人员领取钥匙-领取钥匙信息集合 Vo")
  19 +@EqualsAndHashCode(callSuper = false)
  20 +public class TakeKeyKeyItemDTO implements java.io.Serializable {
  21 +
  22 + private static final long serialVersionUID = -3382804090614784001L;
  23 +
  24 + @NotEmpty(message = "主机设备上线号 不能为空")
  25 + @ApiModelProperty(value = "主机设备上线号", required = true)
  26 + private String device;
  27 +
  28 + @NotEmpty(message = "钥匙柜名称 不能为空")
  29 + @ApiModelProperty(value = "钥匙柜名称", required = true)
  30 + private String name;
  31 +
  32 + @NotEmpty(message = "钥匙位编码 不能为空")
  33 + @ApiModelProperty(value = "钥匙位编码", required = true)
  34 + private String key;
  35 +
  36 + @NotEmpty(message = "车位编码 不能为空")
  37 + @ApiModelProperty(value = "车位编码", required = true)
  38 + private String parkCode;
  39 +
  40 + @NotEmpty(message = "车牌 不能为空")
  41 + @ApiModelProperty(value = "车牌", required = true)
  42 + private String plate;
  43 +
  44 + @NotNull(message = "领取状态 不能为空")
  45 + @ApiModelProperty(value = "领取状态;0:取出,16:钥匙未归还,255:异常", required = true)
  46 + private Integer state;
  47 +
  48 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/BasicSyncDriverWorkDriverPlanTimePlateVo.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.vo;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.AllArgsConstructor;
  7 +import lombok.Data;
  8 +import lombok.NoArgsConstructor;
  9 +import lombok.experimental.Accessors;
  10 +
  11 +import java.util.Date;
  12 +
  13 +/**
  14 + * @author liujun
  15 + * @date 2024年07月17日 9:44
  16 + */
  17 +@Data
  18 +@NoArgsConstructor
  19 +@AllArgsConstructor
  20 +@Accessors(chain = true)
  21 +@ApiModel(value = "钥匙柜基础信息同步-多日期排班计划列表-排班计划列表-司机的计划时间与车牌 VO")
  22 +public class BasicSyncDriverWorkDriverPlanTimePlateVo implements java.io.Serializable {
  23 +
  24 + private static final long serialVersionUID = 9045854142494361214L;
  25 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  26 + @ApiModelProperty(value = "时间")
  27 + private Date key;
  28 +
  29 + @ApiModelProperty(value = "车牌号")
  30 + private String value;
  31 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/BasicSyncDriverWorkDriverPlanVo.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +import lombok.NoArgsConstructor;
  8 +import lombok.experimental.Accessors;
  9 +
  10 +/**
  11 + * @author liujun
  12 + * @date 2024年07月17日 9:41
  13 + */
  14 +@Data
  15 +@NoArgsConstructor
  16 +@AllArgsConstructor
  17 +@Accessors(chain = true)
  18 +@ApiModel(value = "钥匙柜基础信息同步-多日期排班计划列表 VO")
  19 +public class BasicSyncDriverWorkDriverPlanVo implements java.io.Serializable {
  20 +
  21 + private static final long serialVersionUID = -1134646411841966899L;
  22 + @ApiModelProperty(value = "司机卡号")
  23 + private String driverCode;
  24 +
  25 + @ApiModelProperty(value = "司机工号")
  26 + private String staffCode;
  27 + @ApiModelProperty(value = "司机的计划时间与车牌")
  28 + private BasicSyncDriverWorkDriverPlanTimePlateVo timePlate;
  29 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/BasicSyncDriverWorkVo.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.vo;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.AllArgsConstructor;
  7 +import lombok.Data;
  8 +import lombok.NoArgsConstructor;
  9 +import lombok.experimental.Accessors;
  10 +
  11 +import java.util.Date;
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * @author liujun
  16 + * @date 2024年07月17日 9:37
  17 + */
  18 +@Data
  19 +@NoArgsConstructor
  20 +@AllArgsConstructor
  21 +@Accessors(chain = true)
  22 +@ApiModel(value = "钥匙柜基础信息同步-多日期排班计划列表 VO")
  23 +public class BasicSyncDriverWorkVo implements java.io.Serializable {
  24 +
  25 +
  26 + private static final long serialVersionUID = -7427446290039243578L;
  27 +
  28 + @JsonFormat(pattern = "yyyy-MM-dd")
  29 + @ApiModelProperty(value = "计划日期", required = true)
  30 + private Date planDate;
  31 +
  32 + @ApiModelProperty(value = "排班计划列表")
  33 + private List<BasicSyncDriverWorkDriverPlanVo> driverPlan;
  34 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/BasicSyncKeyboxKeyItemVo.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +import lombok.NoArgsConstructor;
  8 +import lombok.experimental.Accessors;
  9 +
  10 +/**
  11 + * @author liujun
  12 + * @date 2024年07月17日 9:31
  13 + */
  14 +@Data
  15 +@NoArgsConstructor
  16 +@AllArgsConstructor
  17 +@Accessors(chain = true)
  18 +@ApiModel(value = "钥匙柜基础信息同步-场站钥匙柜列表-钥匙位信息列表 VO")
  19 +public class BasicSyncKeyboxKeyItemVo {
  20 +
  21 + @ApiModelProperty(value = "钥匙位编码")
  22 + private String key;
  23 +
  24 + @ApiModelProperty(value = "绑定的场站车位编码")
  25 + private String parkCode;
  26 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/BasicSyncKeyboxVo.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +import lombok.NoArgsConstructor;
  8 +import lombok.experimental.Accessors;
  9 +
  10 +import javax.validation.constraints.NotEmpty;
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * @author liujun
  15 + * @date 2024年07月17日 9:30
  16 + */
  17 +@Data
  18 +@NoArgsConstructor
  19 +@AllArgsConstructor
  20 +@Accessors(chain = true)
  21 +@ApiModel(value = "钥匙柜基础信息同步-场站钥匙柜列表 VO")
  22 +public class BasicSyncKeyboxVo {
  23 + @ApiModelProperty(value = "钥匙柜名称")
  24 + private String name;
  25 +
  26 + @NotEmpty(message = "钥匙柜关联的设备上线号 不能为空")
  27 + @ApiModelProperty(value = "钥匙柜关联的设备上线号")
  28 + private String device;
  29 +
  30 + @ApiModelProperty(value = "钥匙位信息列表")
  31 + private List<BasicSyncKeyboxKeyItemVo> keyItem;
  32 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/BasicSyncVo.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.vo;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.AllArgsConstructor;
  7 +import lombok.Data;
  8 +import lombok.NoArgsConstructor;
  9 +import lombok.experimental.Accessors;
  10 +
  11 +import java.util.Date;
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * @author liujun
  16 + * @date 2024年07月17日 9:49
  17 + */
  18 +@Data
  19 +@NoArgsConstructor
  20 +@AllArgsConstructor
  21 +@Accessors(chain = true)
  22 +@ApiModel(value = "钥匙柜基础信息同步 VO")
  23 +public class BasicSyncVo implements java.io.Serializable {
  24 +
  25 + private static final long serialVersionUID = 4531393194482803710L;
  26 +
  27 + @ApiModelProperty(value = "设备上线号")
  28 + private String device;
  29 + @ApiModelProperty(value = "设备类型")
  30 + private String deviceType;
  31 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  32 + @ApiModelProperty(value = "时间")
  33 + private Date time;
  34 + @ApiModelProperty(value = "场站名称")
  35 + private String yardName;
  36 + @ApiModelProperty(value = "当前钥匙柜名称")
  37 + private String keyboxName;
  38 + @ApiModelProperty(value = "场站车位关系版本号 场站车位邻近关系MD5")
  39 + private String yardVer;
  40 + @ApiModelProperty(value = "钥匙柜信息版本号 场站钥匙柜列表MD5")
  41 + private String keyboxVer;
  42 + @ApiModelProperty(value = "场站车辆列表版本号 场站绑定的车牌号列表MD5")
  43 + private String yardVehiclesVer;
  44 + @ApiModelProperty(value = "司机工作内容版本号 多日期排班计划列表MD5")
  45 + private String driverWorkVer;
  46 + @ApiModelProperty(value = "场站车位邻近关系")
  47 + private List<BasicSyncYardVo> yard;
  48 +
  49 + @ApiModelProperty(value = "场站钥匙柜列表")
  50 + private List<BasicSyncKeyboxVo> keybox;
  51 +
  52 + @ApiModelProperty(value = "场站绑定的车牌号列表")
  53 + private List<String> yardVehicles;
  54 +
  55 + @ApiModelProperty(value = "多日期排班计划列表")
  56 + private List<BasicSyncDriverWorkVo> driverWork;
  57 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/BasicSyncYardVo.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +import lombok.NoArgsConstructor;
  8 +import lombok.experimental.Accessors;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * @author liujun
  14 + * @date 2024年07月17日 9:27
  15 + */
  16 +@Data
  17 +@NoArgsConstructor
  18 +@AllArgsConstructor
  19 +@Accessors(chain = true)
  20 +@ApiModel(value = "钥匙柜基础信息同步-场站车位邻近关系 VO")
  21 +public class BasicSyncYardVo implements java.io.Serializable{
  22 +
  23 + private static final long serialVersionUID = -2557495254945163383L;
  24 +
  25 + @ApiModelProperty(value = "车位编号")
  26 + private String parkCode;
  27 + @ApiModelProperty(value = "邻近的车位编号列表 用来紧急取出某车位附件车位的所有钥匙")
  28 + private List<String> conIndex;
  29 +
  30 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/SkipOperationVo.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.vo;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.AllArgsConstructor;
  7 +import lombok.Data;
  8 +import lombok.NoArgsConstructor;
  9 +import lombok.experimental.Accessors;
  10 +
  11 +import java.util.Date;
  12 +
  13 +/**
  14 + * @author liujun
  15 + * @date 2024年07月17日 13:06
  16 + */
  17 +@Data
  18 +@NoArgsConstructor
  19 +@AllArgsConstructor
  20 +@Accessors(chain = true)
  21 +@ApiModel(value = "人员跳过钥匙柜操作 VO")
  22 +public class SkipOperationVo implements java.io.Serializable {
  23 +
  24 + private static final long serialVersionUID = 5604059279128853933L;
  25 +
  26 + @ApiModelProperty(value = "设备上线号")
  27 + private String device;
  28 + @ApiModelProperty(value = "设备类型")
  29 + private String deviceType;
  30 +
  31 + @ApiModelProperty(value = "卡号")
  32 + private String driverCode;
  33 +
  34 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  35 + @ApiModelProperty(value = "服务器时间")
  36 + private Date time;
  37 +
  38 + @ApiModelProperty(value = "处理结果 0成功,1失败")
  39 + private Integer result;
  40 +
  41 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/TakeKeyVo.java 0 → 100644
  1 +package com.ruoyi.domain.dss.key.box.vo;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.AllArgsConstructor;
  7 +import lombok.Data;
  8 +import lombok.NoArgsConstructor;
  9 +import lombok.experimental.Accessors;
  10 +
  11 +import java.util.Date;
  12 +
  13 +/**
  14 + * @author liujun
  15 + * @date 2024年07月17日 13:38
  16 + */
  17 +@Data
  18 +@NoArgsConstructor
  19 +@AllArgsConstructor
  20 +@Accessors(chain = true)
  21 +@ApiModel(value = "人员领取钥匙 VO")
  22 +public class TakeKeyVo implements java.io.Serializable {
  23 +
  24 + private static final long serialVersionUID = -2870019612678673403L;
  25 +
  26 + @ApiModelProperty(value = "设备上线号")
  27 + private String device;
  28 +
  29 + @ApiModelProperty(value = "设备类型")
  30 + private String deviceType;
  31 +
  32 + @ApiModelProperty(value = "卡号")
  33 + private String driverCode;
  34 +
  35 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  36 + @ApiModelProperty(value = "时间")
  37 + private Date time;
  38 +
  39 + @ApiModelProperty(value = "服务应答 0处理成功,1处理失败")
  40 + private Integer result;
  41 +
  42 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/info/KeyInfo.java
1 1 package com.ruoyi.domain.key.info;
2 2  
3 3 import com.baomidou.mybatisplus.annotation.*;
  4 +import com.ruoyi.common.annotation.Excel;
4 5 import lombok.Data;
5   -import org.apache.commons.lang3.StringUtils;
6 6 import lombok.EqualsAndHashCode;
7 7 import lombok.experimental.Accessors;
8 8 import lombok.extern.slf4j.Slf4j;
9   -import com.ruoyi.common.annotation.Excel;
10 9  
11 10 @Data
12 11 @Slf4j
... ... @@ -80,6 +79,10 @@ public class KeyInfo {
80 79 @Excel(name = "车牌号")
81 80 private java.lang.String plateNum;
82 81  
  82 + /***钥匙编码*/
  83 + @Excel(name = "钥匙编码")
  84 + private java.lang.String keyCode;
  85 +
83 86  
84 87 @Override
85 88 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/info/dto/KeyInfoAddDTO.java
... ... @@ -54,6 +54,10 @@ public class KeyInfoAddDTO implements java.io.Serializable {
54 54 @ApiModelProperty(value = "车牌号")
55 55 private java.lang.String plateNum;
56 56  
  57 + /***钥匙编码*/
  58 + @ApiModelProperty(value="钥匙编码")
  59 + private java.lang.String keyCode;
  60 +
57 61 public void clearStrEmpty() {
58 62 if (org.apache.commons.lang3.StringUtils.isEmpty(this.name)) {
59 63 this.name = null;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/info/dto/KeyInfoQueryDTO.java
1 1 package com.ruoyi.domain.key.info.dto;
2 2  
3   -import com.ruoyi.domain.OrderEntity;
4 3 import io.swagger.annotations.ApiModel;
5 4 import io.swagger.annotations.ApiModelProperty;
6 5 import lombok.Data;
... ... @@ -53,6 +52,10 @@ public class KeyInfoQueryDTO implements java.io.Serializable {
53 52 @ApiModelProperty(value = "车牌号")
54 53 private java.lang.String plateNum;
55 54  
  55 + /***钥匙编码*/
  56 + @ApiModelProperty(value="钥匙编码")
  57 + private java.lang.String keyCode;
  58 +
56 59 public void clearStrEmpty() {
57 60 if (org.apache.commons.lang3.StringUtils.isEmpty(this.name)) {
58 61 this.name = null;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/info/dto/KeyInfoUpdateDTO.java
... ... @@ -54,6 +54,10 @@ public class KeyInfoUpdateDTO implements java.io.Serializable {
54 54 @ApiModelProperty(value="车牌号")
55 55 private java.lang.String plateNum;
56 56  
  57 + /***钥匙编码*/
  58 + @ApiModelProperty(value="钥匙编码")
  59 + private java.lang.String keyCode;
  60 +
57 61 public void clearStrEmpty(){
58 62 if(org.apache.commons.lang3.StringUtils.isEmpty(this.name)){
59 63 this.name = null;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/info/dto/KeyInfoUpdateStatusDTO.java
... ... @@ -54,6 +54,10 @@ public class KeyInfoUpdateStatusDTO implements java.io.Serializable {
54 54 @ApiModelProperty(value = "车牌号")
55 55 private java.lang.String plateNum;
56 56  
  57 + /***钥匙编码*/
  58 + @ApiModelProperty(value="钥匙编码")
  59 + private java.lang.String keyCode;
  60 +
57 61 public void clearStrEmpty() {
58 62 if (org.apache.commons.lang3.StringUtils.isEmpty(this.name)) {
59 63 this.name = null;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/info/vo/KeyInfoVO.java
... ... @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
8 8 import lombok.experimental.Accessors;
9 9  
10 10 @Data
11   -@ApiModel(value="钥匙信息的VO")
  11 +@ApiModel(value = "钥匙信息的VO")
12 12 @Accessors(chain = true)
13 13 @EqualsAndHashCode(callSuper = false)
14 14 public class KeyInfoVO implements java.io.Serializable {
... ... @@ -54,6 +54,10 @@ public class KeyInfoVO implements java.io.Serializable {
54 54 @ApiModelProperty(value = "车牌号")
55 55 private java.lang.String plateNum;
56 56  
  57 + /***钥匙编码*/
  58 + @ApiModelProperty(value = "钥匙编码")
  59 + private java.lang.String keyCode;
  60 +
57 61  
58 62 @Override
59 63 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/LinggangKeyWorkLocation.java
1 1 package com.ruoyi.domain.key.location;
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;
... ... @@ -11,6 +12,10 @@ import lombok.NoArgsConstructor;
11 12 import lombok.experimental.Accessors;
12 13 import lombok.extern.slf4j.Slf4j;
13 14  
  15 +import java.util.Arrays;
  16 +import java.util.Objects;
  17 +import java.util.Optional;
  18 +
14 19  
15 20 @Data
16 21 @Slf4j
... ... @@ -85,6 +90,55 @@ public class LinggangKeyWorkLocation {
85 90 @Excel(name = "排班时间")
86 91 private java.util.Date scheduleDate;
87 92  
  93 + /***排班ID*/
  94 + @Excel(name = "排班ID")
  95 + private Long schedulingId;
  96 +
  97 + /**
  98 + * 钥匙编码
  99 + */
  100 + @TableField(exist = false)
  101 + private String key;
  102 +
  103 +
  104 + public static enum LinggangKeyWorkLocationEventTypeEnum {
  105 + TAKE_OUT(0, "取出"),
  106 + REPAY(1, "归还"),
  107 + ADMINISTRATOR_OPERATION(16, "管理员操作"),
  108 + URGENT_COLLECTION(17, "紧急取出"),
  109 +
  110 + ;
  111 + private String label;
  112 + private Integer value;
  113 +
  114 + LinggangKeyWorkLocationEventTypeEnum(Integer value, String label) {
  115 + this.value = value;
  116 + this.label = label;
  117 + }
  118 +
  119 + public String getLabel() {
  120 + return label;
  121 + }
  122 +
  123 + public Integer getValue() {
  124 + return value;
  125 + }
  126 +
  127 + public static LinggangKeyWorkLocationEventTypeEnum getObj(Integer value) {
  128 + if (Objects.isNull(value)) {
  129 + return null;
  130 + }
  131 + Optional<LinggangKeyWorkLocationEventTypeEnum> optional = Arrays.stream(LinggangKeyWorkLocationEventTypeEnum.values())
  132 + .filter(l -> Objects.equals(l.getValue(), value)).findFirst();
  133 + return optional.isPresent() ? optional.get() : null;
  134 + }
  135 +
  136 + public static String getLabel(Integer value) {
  137 + LinggangKeyWorkLocationEventTypeEnum eventTypeEnum = getObj(value);
  138 + return Objects.isNull(eventTypeEnum) ? null : eventTypeEnum.getLabel();
  139 + }
  140 + }
  141 +
88 142  
89 143 @Override
90 144 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/dto/LinggangKeyWorkLocationAddDTO.java
... ... @@ -55,6 +55,10 @@ public class LinggangKeyWorkLocationAddDTO implements java.io.Serializable {
55 55 @ApiModelProperty(value="排班时间")
56 56 private java.util.Date scheduleDate;
57 57  
  58 + /***排班ID*/
  59 + @ApiModelProperty(value="排班ID")
  60 + private Long schedulingId;
  61 +
58 62 /***操作人员*/
59 63 @ApiModelProperty(value = "操作人员")
60 64 private String operator;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/dto/LinggangKeyWorkLocationQueryDTO.java
... ... @@ -51,6 +51,10 @@ public class LinggangKeyWorkLocationQueryDTO implements java.io.Serializable {
51 51 @ApiModelProperty(value = "钥匙ID", example = "1")
52 52 private Integer keyInfoId;
53 53  
  54 + /***排班ID*/
  55 + @ApiModelProperty(value="排班ID")
  56 + private Long schedulingId;
  57 +
54 58 /***排班时间*/
55 59 @ApiModelProperty(value="排班时间")
56 60 private java.util.Date scheduleDate;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/dto/LinggangKeyWorkLocationUpdateDTO.java
... ... @@ -54,6 +54,10 @@ public class LinggangKeyWorkLocationUpdateDTO implements java.io.Serializable {
54 54 /***排班时间*/
55 55 @ApiModelProperty(value="排班时间")
56 56 private java.util.Date scheduleDate;
  57 +
  58 + /***排班ID*/
  59 + @ApiModelProperty(value="排班ID")
  60 + private Long schedulingId;
57 61 /***操作人员*/
58 62 @ApiModelProperty(value = "操作人员")
59 63 private String operator;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/dto/LinggangKeyWorkLocationUpdateStatusDTO.java
... ... @@ -52,8 +52,12 @@ public class LinggangKeyWorkLocationUpdateStatusDTO implements java.io.Serializa
52 52 private Integer keyInfoId;
53 53  
54 54 /***排班时间*/
55   - @ApiModelProperty(value="排班时间")
  55 + @ApiModelProperty(value = "排班时间")
56 56 private java.util.Date scheduleDate;
  57 +
  58 + /***排班ID*/
  59 + @ApiModelProperty(value = "排班ID")
  60 + private Long schedulingId;
57 61 /***操作人员*/
58 62 @ApiModelProperty(value = "操作人员")
59 63 private String operator;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/vo/LinggangKeyWorkLocationVO.java
... ... @@ -60,6 +60,10 @@ public class LinggangKeyWorkLocationVO implements java.io.Serializable {
60 60 @ApiModelProperty(value = "排班时间")
61 61 private java.util.Date scheduleDate;
62 62  
  63 + /***排班ID*/
  64 + @ApiModelProperty(value = "排班ID")
  65 + private Long schedulingId;
  66 +
63 67  
64 68 @Override
65 69 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/LinggangScheduling.java
... ... @@ -26,7 +26,7 @@ public class LinggangScheduling {
26 26 /***主键*/
27 27 @TableId(value = "id", type = IdType.AUTO)
28 28 @Excel(name = "主键")
29   - private Integer id;
  29 + private Long id;
30 30  
31 31  
32 32 /***排班日期*/
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/dto/LinggangSchedulingAddDTO.java
... ... @@ -18,7 +18,7 @@ public class LinggangSchedulingAddDTO implements java.io.Serializable {
18 18  
19 19 /***主键*/
20 20 @ApiModelProperty(value = "主键", example = "1")
21   - private Integer id;
  21 + private Long id;
22 22 /***排班日期*/
23 23 @ApiModelProperty(value = "排班日期")
24 24 private Date scheduleDate;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/dto/LinggangSchedulingQueryDTO.java
... ... @@ -18,7 +18,7 @@ public class LinggangSchedulingQueryDTO implements java.io.Serializable {
18 18  
19 19 /***主键*/
20 20 @ApiModelProperty(value = "主键", example = "1")
21   - private Integer id;
  21 + private Long id;
22 22 /***排班日期*/
23 23 @ApiModelProperty(value = "排班日期")
24 24 private Date scheduleDate;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/dto/LinggangSchedulingUpdateDTO.java
... ... @@ -18,7 +18,7 @@ public class LinggangSchedulingUpdateDTO implements java.io.Serializable {
18 18  
19 19 /***主键*/
20 20 @ApiModelProperty(value = "主键", example = "1")
21   - private Integer id;
  21 + private Long id;
22 22 /***排班日期*/
23 23 @ApiModelProperty(value = "排班日期")
24 24 private Date scheduleDate;
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/vo/LinggangSchedulingVO.java
... ... @@ -23,7 +23,7 @@ public class LinggangSchedulingVO implements java.io.Serializable {
23 23  
24 24 /***主键*/
25 25 @ApiModelProperty(value = "主键", example = "1")
26   - private Integer id;
  26 + private Long id;
27 27 /***排班日期*/
28 28 @ApiModelProperty(value = "排班日期")
29 29 private Date scheduleDate;
... ...
Bsth-admin/src/main/java/com/ruoyi/mapper/key/location/LinggangKeyWorkLocationMapper.java
... ... @@ -3,6 +3,9 @@ package com.ruoyi.mapper.key.location;
3 3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4 import com.ruoyi.domain.key.location.LinggangKeyWorkLocation;
5 5 import org.apache.ibatis.annotations.Mapper;
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import java.util.List;
6 9  
7 10  
8 11 @Mapper
... ... @@ -12,4 +15,6 @@ public interface LinggangKeyWorkLocationMapper extends BaseMapper&lt;LinggangKeyWor
12 15 * 插入有值的列
13 16 */
14 17 int insertSelective(LinggangKeyWorkLocation name);
  18 +
  19 + List<LinggangKeyWorkLocation> listOfDeviceKeyIdScheduleDate(@Param("localtions") List<LinggangKeyWorkLocation> locations);
15 20 }
16 21 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/carinfo/CarInfoService.java
1 1 package com.ruoyi.service.carinfo;
2 2  
3   -import com.baomidou.mybatisplus.extension.service.IService;
4 3 import com.baomidou.mybatisplus.core.metadata.IPage;
  4 +import com.baomidou.mybatisplus.extension.service.IService;
5 5 import com.ruoyi.domain.OrderEntity;
6 6 import com.ruoyi.domain.caiinfo.CarInfo;
7 7  
... ... @@ -21,6 +21,8 @@ public interface CarInfoService extends IService&lt;CarInfo&gt; {
21 21 List<CarInfo> list(CarInfo entity);
22 22  
23 23 List<CarInfo> likePlateNumPlateNumTop30(CarInfo entity);
  24 + /**根据车辆自编号查询车辆信息*/
  25 + List<CarInfo> list(Collection<String> nbbms);
24 26  
25 27 /***
26 28 *用于页面选择
... ...
Bsth-admin/src/main/java/com/ruoyi/service/driver/NewDriverService.java
... ... @@ -6,6 +6,7 @@ import com.ruoyi.common.TipEnum;
6 6 import com.ruoyi.domain.OrderEntity;
7 7 import com.ruoyi.domain.driver.NewDriver;
8 8  
  9 +import java.util.Collection;
9 10 import java.util.List;
10 11  
11 12  
... ... @@ -20,6 +21,15 @@ public interface NewDriverService extends IService&lt;NewDriver&gt; {
20 21 */
21 22 List<NewDriver> list(NewDriver entity);
22 23  
  24 + /***
  25 + * 根据工号查询司机
  26 + * @author liujun
  27 + * @date 2024/7/17 11:22
  28 + * @param jobCodes
  29 + * @return java.util.List<com.ruoyi.domain.driver.NewDriver>
  30 + */
  31 + List<NewDriver> list(Collection<String> jobCodes);
  32 +
23 33 List<NewDriver> listOfIds(java.util.Collection<java.lang.String> ids);
24 34  
25 35 /***
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/carinfo/CarInfoServiceImpl.java
... ... @@ -9,9 +9,9 @@ import com.ruoyi.domain.OrderEntity;
9 9 import com.ruoyi.domain.caiinfo.CarInfo;
10 10 import com.ruoyi.mapper.carinfo.CarInfoMapper;
11 11 import com.ruoyi.service.carinfo.CarInfoService;
  12 +import org.apache.commons.collections4.CollectionUtils;
12 13 import org.springframework.beans.factory.annotation.Autowired;
13 14 import org.springframework.stereotype.Service;
14   -import org.springframework.util.CollectionUtils;
15 15  
16 16 import java.util.Collection;
17 17 import java.util.Collections;
... ... @@ -69,6 +69,16 @@ public class CarInfoServiceImpl extends ServiceImpl&lt;CarInfoMapper, CarInfo&gt; impl
69 69 }
70 70  
71 71 @Override
  72 + public List<CarInfo> list(Collection<String> nbbms) {
  73 + if (CollectionUtils.isEmpty(nbbms)) {
  74 + return Collections.emptyList();
  75 + }
  76 + LambdaQueryWrapper<CarInfo> wrapper = new LambdaQueryWrapper<>();
  77 + wrapper.in(CarInfo::getNbbm, nbbms);
  78 + return list(wrapper);
  79 + }
  80 +
  81 + @Override
72 82 public List<CarInfo> listOfSelect(CarInfo entity) {
73 83 LambdaQueryWrapper<CarInfo> wrapper = new LambdaQueryWrapper<>(entity);
74 84 wrapper.select(CarInfo::getId, CarInfo::getPlateNum);
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/driver/NewDriverServiceImpl.java
... ... @@ -64,6 +64,16 @@ public class NewDriverServiceImpl extends ServiceImpl&lt;NewDriverMapper, NewDriver
64 64 }
65 65  
66 66 @Override
  67 + public List<NewDriver> list(Collection<String> jobCodes) {
  68 + if (CollectionUtils.isEmpty(jobCodes)) {
  69 + return Collections.emptyList();
  70 + }
  71 + LambdaQueryWrapper<NewDriver> wrapper = new LambdaQueryWrapper<>();
  72 + wrapper.in(NewDriver::getJobCode, jobCodes);
  73 + return list(wrapper);
  74 + }
  75 +
  76 + @Override
67 77 public List<NewDriver> listOfIds(Collection<String> ids) {
68 78 if (CollectionUtils.isEmpty(ids)) {
69 79 return Collections.emptyList();
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/info/KeyInfoServiceImpl.java
... ... @@ -8,10 +8,12 @@ import com.github.pagehelper.PageHelper;
8 8 import com.ruoyi.domain.OrderEntity;
9 9 import com.ruoyi.domain.key.info.KeyInfo;
10 10 import com.ruoyi.service.key.info.KeyInfoService;
  11 +import org.apache.commons.collections4.CollectionUtils;
11 12 import org.apache.commons.lang3.StringUtils;
12 13 import org.springframework.beans.factory.annotation.Autowired;
13 14 import org.springframework.stereotype.Service;
14 15  
  16 +import java.util.Collection;
15 17 import java.util.Collections;
16 18 import java.util.List;
17 19  
... ... @@ -56,6 +58,16 @@ public class KeyInfoServiceImpl extends ServiceImpl&lt;com.ruoyi.mapper.key.info.Ke
56 58 }
57 59  
58 60 @Override
  61 + public List<KeyInfo> list(Collection<String> codes) {
  62 + if (CollectionUtils.isEmpty(codes)) {
  63 + return Collections.emptyList();
  64 + }
  65 + LambdaQueryWrapper<KeyInfo> wrapper = new LambdaQueryWrapper<>();
  66 + wrapper.in(KeyInfo::getKeyCode, codes);
  67 + return list(wrapper);
  68 + }
  69 +
  70 + @Override
59 71 public List<KeyInfo> listOfSelect(KeyInfo entity) {
60 72 LambdaQueryWrapper<KeyInfo> wrapper = new LambdaQueryWrapper<>(entity);
61 73 wrapper.select(KeyInfo::getId, KeyInfo::getName);
... ... @@ -175,7 +187,7 @@ public class KeyInfoServiceImpl extends ServiceImpl&lt;com.ruoyi.mapper.key.info.Ke
175 187 if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "plateNum")) {
176 188 wrapper.orderByDesc(KeyInfo::getPlateNum);
177 189 }
178   - }else{
  190 + } else {
179 191 wrapper.orderByDesc(KeyInfo::getCreateTime);
180 192 }
181 193  
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/location/LinggangKeyWorkLocationServiceImpl.java
1 1 package com.ruoyi.service.impl.key.location;
2 2  
  3 +import com.alibaba.fastjson2.JSON;
3 4 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  5 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
4 6 import com.baomidou.mybatisplus.core.metadata.IPage;
5 7 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 9 import com.github.pagehelper.PageHelper;
  10 +import com.ruoyi.common.TipEnum;
  11 +import com.ruoyi.common.core.domain.ResponseResult;
8 12 import com.ruoyi.domain.OrderEntity;
  13 +import com.ruoyi.domain.key.info.KeyInfo;
9 14 import com.ruoyi.domain.key.location.LinggangKeyWorkLocation;
10 15 import com.ruoyi.mapper.key.location.LinggangKeyWorkLocationMapper;
  16 +import com.ruoyi.service.key.info.KeyInfoService;
11 17 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
  18 +import lombok.extern.slf4j.Slf4j;
  19 +import org.apache.commons.collections4.CollectionUtils;
  20 +import org.apache.commons.lang3.StringUtils;
  21 +import org.apache.commons.lang3.time.DateUtils;
12 22 import org.springframework.beans.factory.annotation.Autowired;
13 23 import org.springframework.stereotype.Service;
14 24  
15   -import java.util.Collections;
16   -import java.util.List;
  25 +import java.text.MessageFormat;
  26 +import java.util.*;
  27 +import java.util.stream.Collectors;
17 28  
  29 +@Slf4j
18 30 @Service
19 31 /**钥匙存放地址 Service实现类*/
20 32 public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyWorkLocationMapper, LinggangKeyWorkLocation> implements LinggangKeyWorkLocationService {
21 33 @Autowired
22 34 private LinggangKeyWorkLocationMapper linggangKeyWorkLocationMapper;
  35 + @Autowired
  36 + private KeyInfoService keyInfoService;
  37 +
  38 + private static final String TAKE_KEY_MSG = "设备号:{0},钥匙编号:{1},在{2}的状态已经是:{3},无需在操作";
  39 + private static final String TAKE_KEY_SUCESS = "设备号:{0},钥匙编号:{1},在{2}的状已经更新成功";
  40 + private static final String TAKE_KEY_ERROR = "设备号:{0},钥匙编号:{1},在{2}的状更新失败";
23 41  
24 42 /**
25 43 * 分页查询
... ... @@ -70,6 +88,14 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
70 88 // return list(wrapper);
71 89 // }
72 90  
  91 +
  92 + List<LinggangKeyWorkLocation> listOfDeviceKeyIdScheduleDate(List<LinggangKeyWorkLocation> entities) {
  93 + if (CollectionUtils.isEmpty(entities)) {
  94 + return Collections.emptyList();
  95 + }
  96 + return linggangKeyWorkLocationMapper.listOfDeviceKeyIdScheduleDate(entities);
  97 + }
  98 +
73 99 @Override
74 100 public LinggangKeyWorkLocation getOne(LinggangKeyWorkLocation entity) {
75 101 return getOne(new LambdaQueryWrapper<>(entity));
... ... @@ -107,6 +133,55 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
107 133 return updateById(entity);
108 134 }
109 135  
  136 + @Override
  137 + public ResponseResult<Boolean> updateTakeKey(List<LinggangKeyWorkLocation> locations) {
  138 + if (CollectionUtils.isEmpty(locations)) {
  139 + return ResponseResult.success();
  140 + }
  141 +
  142 + ResponseResult<List<LinggangKeyWorkLocation>> responseResult = checkTaskKey(locations);
  143 + if (!responseResult.isSuccess()) {
  144 + return ResponseResult.error(responseResult.getCode(), responseResult.getMsg());
  145 + }
  146 + List<LinggangKeyWorkLocation> source = responseResult.getData();
  147 + StringBuilder resultStr = new StringBuilder();
  148 +
  149 + List<LinggangKeyWorkLocation> success = new ArrayList<>();
  150 + List<LinggangKeyWorkLocation> error = new ArrayList<>();
  151 + source.forEach(s -> {
  152 + boolean flag = update(s);
  153 + if (flag) {
  154 + success.add(s);
  155 + } else {
  156 + error.add(s);
  157 + }
  158 + });
  159 +
  160 + String msg = convertMsg(error, TAKE_KEY_ERROR);
  161 + if (StringUtils.isNotEmpty(msg)) {
  162 + resultStr.append(msg);
  163 + resultStr.append(";");
  164 + }
  165 +
  166 + msg = convertMsg(success, TAKE_KEY_SUCESS);
  167 + if (StringUtils.isNotEmpty(msg)) {
  168 + resultStr.append(msg);
  169 + resultStr.append(";");
  170 + return StringUtils.isEmpty(msg)?ResponseResult.success(resultStr.toString()):ResponseResult.error(resultStr.toString());
  171 + }
  172 +
  173 +
  174 + return ResponseResult.error(resultStr.toString());
  175 + }
  176 +
  177 + public boolean update(LinggangKeyWorkLocation location) {
  178 + LambdaUpdateWrapper<LinggangKeyWorkLocation> wrapper = new LambdaUpdateWrapper<>();
  179 + wrapper.set(LinggangKeyWorkLocation::getEventType, location.getEventType()).set(LinggangKeyWorkLocation::getUpdateTime,new Date());
  180 + wrapper.eq(LinggangKeyWorkLocation::getId, location.getId()).ne(LinggangKeyWorkLocation::getEventType, location.getEventType());
  181 +
  182 + return update(wrapper);
  183 + }
  184 +
110 185 /***根据主键删除数据*/
111 186 @Override
112 187 public boolean deleteById(Long id) {
... ... @@ -131,12 +206,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
131 206 if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "cabinetNo")) {
132 207 wrapper.orderByAsc(LinggangKeyWorkLocation::getCabinetNo);
133 208 }
134   - if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "parkingNo")) {
135   - wrapper.orderByAsc(LinggangKeyWorkLocation::getParkingNo);
136   - }
137   - if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "carInfoId")) {
138   - wrapper.orderByAsc(LinggangKeyWorkLocation::getCarInfoId);
139   - }
  209 +
140 210 if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "createBy")) {
141 211 wrapper.orderByAsc(LinggangKeyWorkLocation::getCreateBy);
142 212 }
... ... @@ -168,12 +238,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
168 238 if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "cabinetNo")) {
169 239 wrapper.orderByDesc(LinggangKeyWorkLocation::getCabinetNo);
170 240 }
171   - if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "parkingNo")) {
172   - wrapper.orderByDesc(LinggangKeyWorkLocation::getParkingNo);
173   - }
174   - if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "carInfoId")) {
175   - wrapper.orderByDesc(LinggangKeyWorkLocation::getCarInfoId);
176   - }
  241 +
177 242 if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "createBy")) {
178 243 wrapper.orderByDesc(LinggangKeyWorkLocation::getCreateBy);
179 244 }
... ... @@ -193,4 +258,150 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
193 258 wrapper.orderByDesc(LinggangKeyWorkLocation::getId);
194 259 }
195 260 }
  261 +
  262 + private ResponseResult<List<LinggangKeyWorkLocation>> checkTaskKey(List<LinggangKeyWorkLocation> locations) {
  263 + Set<String> keyCodes = locations.stream().map(LinggangKeyWorkLocation::getKey).collect(Collectors.toSet());
  264 + List<KeyInfo> keyInfos = keyInfoService.list(keyCodes);
  265 + if (CollectionUtils.isEmpty(keyInfos)) {
  266 + log.info("无法找到钥匙信息:[{}]", locations);
  267 + return ResponseResult.error404("无法找到钥匙信息");
  268 + }
  269 +
  270 + locations = locations.stream().map(lo -> {
  271 + Optional<KeyInfo> optional = keyInfos.stream().filter(k -> Objects.equals(k.getKeyCode(), lo.getKey())).findFirst();
  272 + if (optional.isPresent()) {
  273 + lo.setKeyInfoId(optional.get().getId());
  274 + }
  275 +
  276 + return lo;
  277 + }).collect(Collectors.toList());
  278 +
  279 + StringBuilder resultStr = new StringBuilder();
  280 + List<LinggangKeyWorkLocation> source = locations.stream().filter(l -> Objects.nonNull(l.getKeyInfoId())).collect(Collectors.toList());
  281 + List<LinggangKeyWorkLocation> target = locations.stream().filter(l -> Objects.isNull(l.getKeyInfoId())).collect(Collectors.toList());
  282 +
  283 + if (CollectionUtils.isNotEmpty(target)) {
  284 + String msg = convertMsgOfKeyInfo(target);
  285 + if (StringUtils.isNotEmpty(msg)) {
  286 + resultStr.append(msg);
  287 + resultStr.append(";");
  288 + }
  289 + }
  290 +
  291 + if (CollectionUtils.isEmpty(source)) {
  292 + return ResponseResult.error404(resultStr.toString());
  293 + }
  294 +
  295 + List<LinggangKeyWorkLocation> querySource = locations.stream().map(l -> {
  296 + LinggangKeyWorkLocation location = new LinggangKeyWorkLocation();
  297 + location.setDevice(l.getDevice());
  298 + location.setKeyInfoId(l.getKeyInfoId());
  299 + location.setScheduleDate(l.getScheduleDate());
  300 + return location;
  301 + }).collect(Collectors.toList());
  302 +
  303 + List<LinggangKeyWorkLocation> dataSource = listOfDeviceKeyIdScheduleDate(querySource);
  304 + if (CollectionUtils.isEmpty(dataSource)) {
  305 + log.info("无法找到钥匙存放信息:[{}][{}]", querySource, locations);
  306 + resultStr.append("无法找到钥匙存放信息");
  307 + resultStr.append(";");
  308 + return ResponseResult.error404(resultStr.toString());
  309 + }
  310 +
  311 + List<LinggangKeyWorkLocation> locationList = new ArrayList<>();
  312 + source = source.stream().map(l -> {
  313 + Optional<LinggangKeyWorkLocation> optional = dataSource.stream().filter(d -> Objects.equals(d.getKeyInfoId(), l.getKeyInfoId()) &&
  314 + Objects.equals(d.getDevice(), l.getDevice()) && DateUtils.isSameDay(d.getScheduleDate(), l.getScheduleDate())).findFirst();
  315 + if (optional.isPresent()) {
  316 + l.setId(optional.get().getId());
  317 + if (Objects.equals(l.getEventType(), optional.get().getEventType())) {
  318 + locationList.add(l);
  319 + return null;
  320 + }
  321 + }
  322 + return l;
  323 + }).filter(l -> Objects.nonNull(l)).collect(Collectors.toList());
  324 +
  325 + if (CollectionUtils.isNotEmpty(locationList)) {
  326 + String msg = convertMsgOfKeyInfoLocalEventType(locations);
  327 + if (StringUtils.isNotEmpty(msg)) {
  328 + resultStr.append(msg);
  329 + resultStr.append(";");
  330 + }
  331 + }
  332 +
  333 + if (CollectionUtils.isEmpty(source)) {
  334 + log.info("无法找到钥匙存放信息:[{}][{}]", locationList, locations);
  335 + return ResponseResult.error404(resultStr.toString());
  336 + }
  337 +
  338 + target = source.stream().filter(l -> Objects.isNull(l.getId())).collect(Collectors.toList());
  339 + if (CollectionUtils.isNotEmpty(target)) {
  340 + String msg = convertMsgOfKeyInfoLocal(target);
  341 + if (StringUtils.isNotEmpty(msg)) {
  342 + resultStr.append(msg);
  343 + resultStr.append(";");
  344 + }
  345 +
  346 + }
  347 + source = source.stream().filter(l -> Objects.nonNull(l.getId())).collect(Collectors.toList());
  348 + if (CollectionUtils.isEmpty(source)) {
  349 + return ResponseResult.error404(resultStr.toString());
  350 + }
  351 +
  352 + return ResponseResult.success(source);
  353 + }
  354 +
  355 + private String convertMsgOfKeyInfo(List<LinggangKeyWorkLocation> target) {
  356 + if (CollectionUtils.isEmpty(target)) {
  357 + return "";
  358 + }
  359 + Set<String> keyCodes = target.stream().map(LinggangKeyWorkLocation::getKey).collect(Collectors.toSet());
  360 + return MessageFormat.format(TipEnum.TIP_5.getMsg(), JSON.toJSONString(keyCodes));
  361 + }
  362 +
  363 + private String convertMsgOfKeyInfoLocal(List<LinggangKeyWorkLocation> target) {
  364 + if (CollectionUtils.isEmpty(target)) {
  365 + return "";
  366 + }
  367 + List<LinggangKeyWorkLocation> locations = target.stream().map(l -> {
  368 + LinggangKeyWorkLocation location = new LinggangKeyWorkLocation();
  369 + location.setKey(l.getKey());
  370 + location.setDevice(l.getDevice());
  371 + return location;
  372 + }).collect(Collectors.toList());
  373 + return MessageFormat.format(TipEnum.TIP_6.getMsg(), JSON.toJSONString(locations));
  374 + }
  375 +
  376 + private String convertMsgOfKeyInfoLocalEventType(List<LinggangKeyWorkLocation> target) {
  377 + if (CollectionUtils.isEmpty(target)) {
  378 + return "";
  379 + }
  380 +
  381 + StringBuilder builder = new StringBuilder();
  382 + target.stream().forEach(l -> {
  383 + String msg = MessageFormat.format(TAKE_KEY_MSG, l.getDevice(), l.getKey(), com.ruoyi.common.utils.DateUtils.YYYY_MM_DD.
  384 + format(l.getScheduleDate()), LinggangKeyWorkLocation.LinggangKeyWorkLocationEventTypeEnum.getLabel(l.getEventType()));
  385 + builder.append(msg);
  386 + builder.append(";");
  387 +
  388 +
  389 + });
  390 + return builder.toString();
  391 + }
  392 +
  393 + private String convertMsg(List<LinggangKeyWorkLocation> target, String info) {
  394 + if (CollectionUtils.isEmpty(target)) {
  395 + return "";
  396 + }
  397 + StringBuilder builder = new StringBuilder();
  398 + target.stream().forEach(l -> {
  399 + String msg = MessageFormat.format(info, l.getDevice(), l.getKey(), com.ruoyi.common.utils.DateUtils.YYYY_MM_DD.format(l.getScheduleDate()));
  400 + builder.append(msg);
  401 + builder.append(";");
  402 +
  403 +
  404 + });
  405 + return builder.toString();
  406 + }
196 407 }
197 408 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/key/info/KeyInfoService.java
... ... @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5 import com.ruoyi.domain.OrderEntity;
6 6 import com.ruoyi.domain.key.info.KeyInfo;
7 7  
  8 +import java.util.Collection;
8 9 import java.util.List;
9 10  
10 11  
... ... @@ -19,6 +20,8 @@ public interface KeyInfoService extends IService&lt;KeyInfo&gt; {
19 20 */
20 21 List<KeyInfo> list(KeyInfo entity);
21 22  
  23 + List<KeyInfo> list(Collection<String> codes);
  24 +
22 25 /***
23 26 *用于页面选择
24 27 */
... ...
Bsth-admin/src/main/java/com/ruoyi/service/key/location/LinggangKeyWorkLocationService.java
... ... @@ -2,6 +2,7 @@ package com.ruoyi.service.key.location;
2 2  
3 3 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4 import com.baomidou.mybatisplus.extension.service.IService;
  5 +import com.ruoyi.common.core.domain.ResponseResult;
5 6 import com.ruoyi.domain.OrderEntity;
6 7 import com.ruoyi.domain.key.location.LinggangKeyWorkLocation;
7 8  
... ... @@ -48,6 +49,15 @@ public interface LinggangKeyWorkLocationService extends IService&lt;LinggangKeyWork
48 49 */
49 50 boolean updateByPrimaryKey(LinggangKeyWorkLocation entity);
50 51  
  52 + /***
  53 + * 取钥匙
  54 + * @author liujun
  55 + * @date 2024/7/17 13:58
  56 + * @param locations
  57 + * @return com.ruoyi.common.core.domain.ResponseResult<T>
  58 + */
  59 + ResponseResult<Boolean> updateTakeKey(List<LinggangKeyWorkLocation> locations);
  60 +
51 61 boolean deleteById(Long id);
52 62  
53 63 }
54 64 \ No newline at end of file
... ...
Bsth-admin/src/main/resources/mapper/key/info/KeyInfoMapper.xml
... ... @@ -14,6 +14,7 @@
14 14 <result column="device_id" jdbcType="INTEGER" property="deviceId"/>
15 15 <result column="cabinetNo" jdbcType="INTEGER" property="cabinetno"/>
16 16 <result column="plate_Num" jdbcType="VARCHAR" property="plateNum"/>
  17 + <result column="key_code" jdbcType="VARCHAR" property="keyCode"/>
17 18 </resultMap>
18 19  
19 20 <insert id="insertSelective" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
... ... @@ -24,12 +25,12 @@
24 25  
25 26 <sql id="columns">
26 27 id
27   - , name , status , del_flag , create_By , create_Time , updateBy , update_Time , yard_Id , device_id , cabinetNo , plate_Num
  28 + , name , status , del_flag , create_By , create_Time , updateBy , update_Time , yard_Id , device_id , cabinetNo , plate_Num , key_code
28 29 </sql>
29 30  
30 31 <sql id="insert_columns">
31 32 id
32   - , name , status , del_flag , create_By , create_Time , updateBy , update_Time , yard_Id , device_id , cabinetNo , plate_Num
  33 + , name , status , del_flag , create_By , create_Time , updateBy , update_Time , yard_Id , device_id , cabinetNo , plate_Num , key_code
33 34 </sql>
34 35  
35 36 <sql id="insert_values">
... ... @@ -45,7 +46,8 @@
45 46 #{yardId},
46 47 #{deviceId},
47 48 #{cabinetno},
48   - #{plateNum}
  49 + #{plateNum},
  50 + #{keyCode}
49 51 </sql>
50 52  
51 53 <sql id="insertSelectiveColumn">
... ... @@ -62,6 +64,7 @@
62 64 <if test="null!=deviceId">device_id,</if>
63 65 <if test="null!=cabinetno">cabinetNo,</if>
64 66 <if test="null!=plateNum">plate_Num,</if>
  67 + <if test="null!=keyCode">key_code,</if>
65 68 </trim>
66 69 </sql>
67 70  
... ... @@ -79,6 +82,7 @@
79 82 <if test="null!=deviceId">#{deviceId,jdbcType=INTEGER},</if>
80 83 <if test="null!=cabinetno">#{cabinetno,jdbcType=INTEGER},</if>
81 84 <if test="null!=plateNum">#{plateNum,jdbcType=VARCHAR},</if>
  85 + <if test="null!=keyCode">#{keyCode,jdbcType=VARCHAR},</if>
82 86 </trim>
83 87 </sql>
84 88  
... ... @@ -96,6 +100,7 @@
96 100 <if test="null!=deviceId">device_id = #{deviceId,jdbcType=INTEGER},</if>
97 101 <if test="null!=cabinetno">cabinetNo = #{cabinetno,jdbcType=INTEGER},</if>
98 102 <if test="null!=plateNum">plate_Num = #{plateNum,jdbcType=VARCHAR},</if>
  103 + <if test="null!=keyCode">key_code = #{keyCode,jdbcType=VARCHAR},</if>
99 104 </set>
100 105 </sql>
101 106  
... ... @@ -112,5 +117,6 @@
112 117 <if test="null!=deviceId">AND device_id = #{deviceId,jdbcType=INTEGER},</if>
113 118 <if test="null!=cabinetno">AND cabinetNo = #{cabinetno,jdbcType=INTEGER},</if>
114 119 <if test="null!=plateNum">AND plate_Num = #{plateNum,jdbcType=VARCHAR},</if>
  120 + <if test="null!=keyCode">AND key_code = #{keyCode,jdbcType=VARCHAR},</if>
115 121 </sql>
116 122 </mapper>
117 123 \ No newline at end of file
... ...
Bsth-admin/src/main/resources/mapper/key/location/LinggangKeyWorkLocationMapper.xml
... ... @@ -15,22 +15,32 @@
15 15 <result column="event_Type" jdbcType="INTEGER" property="eventType"/>
16 16 <result column="key_info_id" jdbcType="INTEGER" property="keyInfoId"/>
17 17 <result column="schedule_date" jdbcType="TIMESTAMP" property="scheduleDate"/>
  18 + <result column="scheduling_id" jdbcType="VARCHAR" property="schedulingId"/>
18 19 </resultMap>
19 20  
20 21 <insert id="insertSelective" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
21 22 parameterType="com.ruoyi.domain.key.location.LinggangKeyWorkLocation">
22   - INSERT INTO key_work_location <include refid="insertSelectiveColumn"></include>
  23 + INSERT INTO key_work_location
  24 + <include refid="insertSelectiveColumn"></include>
23 25 <include refid="insertSelectiveValue"></include>
24 26 </insert>
  27 + <select id="listOfDeviceKeyIdScheduleDate" resultMap="BaseResultMap">
  28 + select <include refid="columns"></include> from key_work_location
  29 + where del_flag = 0 and(
  30 + <foreach collection="localtions" item="item" separator="or" open="(" close=")">
  31 + device=#{item.device} and key_info_id=#{item.keyInfoId} and schedule_date=#{item.scheduleDate}
  32 + </foreach>
  33 + )
  34 + </select>
25 35  
26 36 <sql id="columns">
27 37 id
28   - , yard_Id , yard_Name , device , cabinet_No , create_by , create_time , update_by , update_time , del_flag , event_Type , key_info_id , schedule_date
  38 + , yard_Id , yard_Name , device , cabinet_No , create_by , create_time , update_by , update_time , del_flag , event_Type , key_info_id , schedule_date , scheduling_id
29 39 </sql>
30 40  
31 41 <sql id="insert_columns">
32 42 id
33   - , yard_Id , yard_Name , device , cabinet_No , create_by , create_time , update_by , update_time , del_flag , event_Type , key_info_id , schedule_date
  43 + , yard_Id , yard_Name , device , cabinet_No , create_by , create_time , update_by , update_time , del_flag , event_Type , key_info_id , schedule_date , scheduling_id
34 44 </sql>
35 45  
36 46 <sql id="insert_values">
... ... @@ -47,7 +57,8 @@
47 57 #{delFlag},
48 58 #{eventType},
49 59 #{keyInfoId},
50   - #{scheduleDate}
  60 + #{scheduleDate},
  61 + #{schedulingId}
51 62 </sql>
52 63  
53 64 <sql id="insertSelectiveColumn">
... ... @@ -65,6 +76,7 @@
65 76 <if test="null!=eventType">event_Type,</if>
66 77 <if test="null!=keyInfoId">key_info_id,</if>
67 78 <if test="null!=scheduleDate">schedule_date,</if>
  79 + <if test="null!=schedulingId">scheduling_id,</if>
68 80 </trim>
69 81 </sql>
70 82  
... ... @@ -83,6 +95,7 @@
83 95 <if test="null!=eventType">#{eventType,jdbcType=INTEGER},</if>
84 96 <if test="null!=keyInfoId">#{keyInfoId,jdbcType=INTEGER},</if>
85 97 <if test="null!=scheduleDate">#{scheduleDate,jdbcType=TIMESTAMP},</if>
  98 + <if test="null!=schedulingId">#{schedulingId,jdbcType=VARCHAR},</if>
86 99 </trim>
87 100 </sql>
88 101  
... ... @@ -101,6 +114,7 @@
101 114 <if test="null!=eventType">event_Type = #{eventType,jdbcType=INTEGER},</if>
102 115 <if test="null!=keyInfoId">key_info_id = #{keyInfoId,jdbcType=INTEGER},</if>
103 116 <if test="null!=scheduleDate">schedule_date = #{scheduleDate,jdbcType=TIMESTAMP},</if>
  117 + <if test="null!=schedulingId">scheduling_id = #{schedulingId,jdbcType=VARCHAR},</if>
104 118 </set>
105 119 </sql>
106 120  
... ... @@ -118,5 +132,6 @@
118 132 <if test="null!=eventType">AND event_Type = #{eventType,jdbcType=INTEGER},</if>
119 133 <if test="null!=keyInfoId">AND key_info_id = #{keyInfoId,jdbcType=INTEGER},</if>
120 134 <if test="null!=scheduleDate">AND schedule_date = #{scheduleDate,jdbcType=TIMESTAMP},</if>
  135 + <if test="null!=schedulingId">AND scheduling_id = #{schedulingId,jdbcType=VARCHAR},</if>
121 136 </sql>
122 137 </mapper>
123 138 \ No newline at end of file
... ...
Bsth-common/src/main/java/com/ruoyi/common/core/domain/ResponseResult.java
... ... @@ -8,8 +8,8 @@ import java.util.Objects;
8 8 * @author liujun
9 9 * @date 2024年07月12日 11:33
10 10 */
11   -public class ResponseResult <T>{
12   - private int code= 500;
  11 +public class ResponseResult<T> {
  12 + private int code = 500;
13 13 private String msg;
14 14 private T data;
15 15  
... ... @@ -37,18 +37,16 @@ public class ResponseResult &lt;T&gt;{
37 37 this.data = data;
38 38 }
39 39  
40   - public ResponseResult()
41   - {
  40 + public ResponseResult() {
42 41 }
43 42  
44 43 /**
45 44 * 初始化一个新创建的 AjaxResult 对象
46 45 *
47 46 * @param code 状态码
48   - * @param msg 返回内容
  47 + * @param msg 返回内容
49 48 */
50   - public ResponseResult(int code, String msg)
51   - {
  49 + public ResponseResult(int code, String msg) {
52 50 this.code = code;
53 51 this.msg = msg;
54 52 }
... ... @@ -58,8 +56,7 @@ public class ResponseResult &lt;T&gt;{
58 56 *
59 57 * @param code 状态码
60 58 */
61   - public ResponseResult(int code)
62   - {
  59 + public ResponseResult(int code) {
63 60 this.code = code;
64 61 }
65 62  
... ... @@ -67,14 +64,13 @@ public class ResponseResult &lt;T&gt;{
67 64 * 初始化一个新创建的 AjaxResult 对象
68 65 *
69 66 * @param code 状态码
70   - * @param msg 返回内容
  67 + * @param msg 返回内容
71 68 * @param data 数据对象
72 69 */
73   - public ResponseResult(int code, String msg, T data)
74   - {
  70 + public ResponseResult(int code, String msg, T data) {
75 71 this.code = code;
76 72 this.msg = msg;
77   - this.data= data;
  73 + this.data = data;
78 74  
79 75 }
80 76  
... ... @@ -83,8 +79,7 @@ public class ResponseResult &lt;T&gt;{
83 79 *
84 80 * @return 成功消息
85 81 */
86   - public static <T>ResponseResult<T> success()
87   - {
  82 + public static <T> ResponseResult<T> success() {
88 83 return ResponseResult.success("操作成功");
89 84 }
90 85  
... ... @@ -93,8 +88,7 @@ public class ResponseResult &lt;T&gt;{
93 88 *
94 89 * @return 成功消息
95 90 */
96   - public static <T>ResponseResult<T> success(T data)
97   - {
  91 + public static <T> ResponseResult<T> success(T data) {
98 92 return ResponseResult.success("操作成功", data);
99 93 }
100 94  
... ... @@ -104,20 +98,18 @@ public class ResponseResult &lt;T&gt;{
104 98 * @param msg 返回内容
105 99 * @return 成功消息
106 100 */
107   - public static <T>ResponseResult<T> success(String msg)
108   - {
  101 + public static <T> ResponseResult<T> success(String msg) {
109 102 return ResponseResult.success(msg, null);
110 103 }
111 104  
112 105 /**
113 106 * 返回成功消息
114 107 *
115   - * @param msg 返回内容
  108 + * @param msg 返回内容
116 109 * @param data 数据对象
117 110 * @return 成功消息
118 111 */
119   - public static <T>ResponseResult<T> success(String msg, T data)
120   - {
  112 + public static <T> ResponseResult<T> success(String msg, T data) {
121 113 return new ResponseResult(HttpStatus.SUCCESS, msg, data);
122 114 }
123 115  
... ... @@ -127,20 +119,18 @@ public class ResponseResult &lt;T&gt;{
127 119 * @param msg 返回内容
128 120 * @return 警告消息
129 121 */
130   - public static <T>ResponseResult<T> warn(String msg)
131   - {
  122 + public static <T> ResponseResult<T> warn(String msg) {
132 123 return ResponseResult.warn(msg, null);
133 124 }
134 125  
135 126 /**
136 127 * 返回警告消息
137 128 *
138   - * @param msg 返回内容
  129 + * @param msg 返回内容
139 130 * @param data 数据对象
140 131 * @return 警告消息
141 132 */
142   - public static <T>ResponseResult<T> warn(String msg, Object data)
143   - {
  133 + public static <T> ResponseResult<T> warn(String msg, Object data) {
144 134 return new ResponseResult(HttpStatus.WARN, msg, data);
145 135 }
146 136  
... ... @@ -149,8 +139,7 @@ public class ResponseResult &lt;T&gt;{
149 139 *
150 140 * @return 错误消息
151 141 */
152   - public static <T>ResponseResult<T> error()
153   - {
  142 + public static <T> ResponseResult<T> error() {
154 143 return ResponseResult.error("操作失败");
155 144 }
156 145  
... ... @@ -160,20 +149,18 @@ public class ResponseResult &lt;T&gt;{
160 149 * @param msg 返回内容
161 150 * @return 错误消息
162 151 */
163   - public static <T>ResponseResult<T> error(String msg)
164   - {
  152 + public static <T> ResponseResult<T> error(String msg) {
165 153 return ResponseResult.error(msg, null);
166 154 }
167 155  
168 156 /**
169 157 * 返回错误消息
170 158 *
171   - * @param msg 返回内容
  159 + * @param msg 返回内容
172 160 * @param data 数据对象
173 161 * @return 错误消息
174 162 */
175   - public static <T>ResponseResult<T> error(String msg, Object data)
176   - {
  163 + public static <T> ResponseResult<T> error(String msg, Object data) {
177 164 return new ResponseResult(HttpStatus.ERROR, msg, data);
178 165 }
179 166  
... ... @@ -181,21 +168,31 @@ public class ResponseResult &lt;T&gt;{
181 168 * 返回错误消息
182 169 *
183 170 * @param code 状态码
184   - * @param msg 返回内容
  171 + * @param msg 返回内容
185 172 * @return 错误消息
186 173 */
187   - public static <T>ResponseResult<T> error(int code, String msg)
188   - {
  174 + public static <T> ResponseResult<T> error(int code, String msg) {
189 175 return new ResponseResult(code, msg, null);
190 176 }
191 177  
192 178 /**
  179 + * 返回错误消息
  180 + *
  181 + * @return 错误消息
  182 + */
  183 + public static <T> ResponseResult<T> error404() {
  184 + return error404("Not Found");
  185 + }
  186 + public static <T> ResponseResult<T> error404(String msg) {
  187 + return new ResponseResult(404, msg, null);
  188 + }
  189 +
  190 + /**
193 191 * 是否为成功消息
194 192 *
195 193 * @return 结果
196 194 */
197   - public boolean isSuccess()
198   - {
  195 + public boolean isSuccess() {
199 196 return Objects.equals(HttpStatus.SUCCESS, this.getCode());
200 197 }
201 198  
... ... @@ -204,9 +201,8 @@ public class ResponseResult &lt;T&gt;{
204 201 *
205 202 * @return 结果
206 203 */
207   - public boolean isWarn()
208   - {
209   - return Objects.equals(HttpStatus.WARN,this.getCode());
  204 + public boolean isWarn() {
  205 + return Objects.equals(HttpStatus.WARN, this.getCode());
210 206 }
211 207  
212 208 /**
... ... @@ -214,11 +210,9 @@ public class ResponseResult &lt;T&gt;{
214 210 *
215 211 * @return 结果
216 212 */
217   - public boolean isError()
218   - {
219   - return Objects.equals(HttpStatus.ERROR,this.getCode());
  213 + public boolean isError() {
  214 + return Objects.equals(HttpStatus.ERROR, this.getCode());
220 215 }
221 216  
222 217  
223   -
224 218 }
... ...