Commit 84f2b7d505dc80bf2c83387d4eec9ec5cdedf1b9

Authored by liujun001
1 parent b3b6a9d8

数据字典添加分别字符key

Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
... ... @@ -450,9 +450,9 @@ public class KeyBoxController extends BaseController {
450 450 if (CollectionUtils.isEmpty(locations)) {
451 451 return ResponseResult.success();
452 452 }
453   -
  453 + Date date = DateUtil.shortDate(new Date());
454 454 location.setType(255);
455   - location.setStartScheduleDate(locations.get(0).getScheduleDate());
  455 + location.setStartScheduleDate(DateUtil.shortDate(new Date()));
456 456 int errorCount = linggangKeyWorkLocationService.countId(location);
457 457  
458 458 location.setType(0);
... ... @@ -466,18 +466,18 @@ public class KeyBoxController extends BaseController {
466 466  
467 467 LinggangKeyWorkLocation locationEq = new LinggangKeyWorkLocation();
468 468 locationEq.setYardId(sourceEq.getYardId());
469   - locationEq.setStartScheduleDate(locations.get(0).getScheduleDate());
  469 + locationEq.setStartScheduleDate(date);
470 470 List<LinggangKeyWorkLocation> locationsOfEq = linggangKeyWorkLocationService.list(locationEq);
471 471  
472 472 locationEq = new LinggangKeyWorkLocation();
473 473 locationEq.setYardId(sourceEq.getYardId());
474   - locationEq.setStartScheduleDate(locations.get(0).getScheduleDate());
  474 + locationEq.setStartScheduleDate(date);
475 475 locationEq.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(locationEq.getStartScheduleDate(),1));
476 476  
477   - Set<Integer> types = new HashSet<>();
478   - types.add(1);
479   - types.add(0);
480   - locationEq.setTypes(types);
  477 +// Set<Integer> types = new HashSet<>();
  478 +// types.add(1);
  479 +// types.add(0);
  480 +// locationEq.setTypes(types);
481 481  
482 482 IPage<LinggangKeyWorkLocation> page = linggangKeyWorkLocationService.pageList(new Page<>(dto.getPageNum(), dto.getPageSize()), locationEq, new OrderEntity());
483 483  
... ... @@ -487,8 +487,7 @@ public class KeyBoxController extends BaseController {
487 487 List<Equipment> yarnCabinetStateEqus = Collections.emptyList();
488 488  
489 489 if (Objects.nonNull(page) && CollectionUtils.isNotEmpty(page.getRecords())) {
490   - Set<Long> driverIds = page.getRecords().stream().map(LinggangKeyWorkLocation::getCreateBy).collect(Collectors.toSet());
491   - drivers = newDriverService.listOfIdsLon(driverIds);
  490 +
492 491  
493 492 Set<String> deviceCodes = page.getRecords().stream().map(LinggangKeyWorkLocation::getDevice).collect(Collectors.toSet());
494 493 yarnCabinetStateEqus = equipmentService.listNameAndIDBydeviceIds(deviceCodes);
... ... @@ -498,6 +497,9 @@ public class KeyBoxController extends BaseController {
498 497 if (CollectionUtils.isNotEmpty(schedulings)) {
499 498 Set<String> nbbm = schedulings.stream().map(LinggangScheduling::getNbbm).collect(Collectors.toSet());
500 499 carInfos = carInfoService.list(nbbm);
  500 +
  501 + Set<String> jobCode = schedulings.stream().map(LinggangScheduling::getJobCode).collect(Collectors.toSet());
  502 + drivers = newDriverService.list(jobCode);
501 503 }
502 504 }
503 505 YarnCabinetStatePageVO pageVO = conertYarnCabinetStatePageVO(locations, equipment, errorCount, depositCount, equipmentList, locationsOfEq, page, schedulings, dto, carInfos, drivers, yarnCabinetStateEqus);
... ... @@ -869,16 +871,22 @@ public class KeyBoxController extends BaseController {
869 871 recordsVo.setPlate(optCar.get().getPlateNum());
870 872 }
871 873 }
  874 +
  875 + if (CollectionUtils.isNotEmpty(drivers)) {
  876 + Optional<NewDriver> opt = drivers.stream().filter(d -> Objects.equals(d.getJobCode(),optional.get().getJobCode())).findFirst();
  877 + if (opt.isPresent()) {
  878 + recordsVo.setStaffName(opt.get().getPersonnelName());
  879 + }
  880 + }
872 881 }
873 882 }
874 883  
875   - if (CollectionUtils.isNotEmpty(drivers)) {
876   - Optional<NewDriver> opt = drivers.stream().filter(d -> Objects.equals(Convert.toLong(d.getId()), l.getCreateBy())).findFirst();
877   - if (opt.isPresent()) {
878   - recordsVo.setStaffName(opt.get().getPersonnelName());
879   - }
  884 + if(Objects.nonNull(l.getUpdateTime())){
  885 + recordsVo.setTime(l.getUpdateTime());
  886 + }else if(Objects.nonNull(l.getCreateTime())){
  887 + recordsVo.setTime(l.getCreateTime());
880 888 }
881   - recordsVo.setTime(l.getCreateTime());
  889 +
882 890  
883 891 if (CollectionUtils.isNotEmpty(yarnCabinetStateEqus)) {
884 892 Optional<Equipment> opt = yarnCabinetStateEqus.stream().filter(ya -> Objects.equals(ya.getDeviceId(), l.getDevice())).findFirst();
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/key/location/LinggangKeyWorkLocationController.java
... ... @@ -11,9 +11,14 @@ import com.ruoyi.domain.key.location.dto.LinggangKeyWorkLocationQueryDTO;
11 11 import com.ruoyi.domain.key.location.dto.LinggangKeyWorkLocationUpdateDTO;
12 12 import com.ruoyi.domain.key.location.dto.LinggangKeyWorkLocationUpdateStatusDTO;
13 13 import com.ruoyi.domain.key.location.vo.LinggangKeyWorkLocationVO;
  14 +import com.ruoyi.domain.scheduling.LinggangScheduling;
14 15 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
  16 +import com.ruoyi.service.scheduling.LinggangSchedulingService;
  17 +import com.ruoyi.utils.DateUtil;
15 18 import io.swagger.annotations.Api;
16 19 import io.swagger.annotations.ApiOperation;
  20 +import org.apache.commons.collections4.CollectionUtils;
  21 +import org.apache.commons.lang3.time.DateUtils;
17 22 import org.springframework.beans.BeanUtils;
18 23 import org.springframework.beans.factory.annotation.Autowired;
19 24 import org.springframework.security.access.prepost.PreAuthorize;
... ... @@ -24,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
24 29 import javax.validation.Valid;
25 30 import java.util.Date;
26 31 import java.util.List;
  32 +import java.util.Optional;
27 33  
28 34 @RestController
29 35 @Api(tags = "钥匙存放地址")
... ... @@ -31,6 +37,8 @@ import java.util.List;
31 37 public class LinggangKeyWorkLocationController extends BaseController {
32 38 @Autowired
33 39 private LinggangKeyWorkLocationService linggangKeyWorkLocationService;
  40 + @Autowired
  41 + private LinggangSchedulingService schedulingService;
34 42  
35 43 @ApiOperation("分页查询")
36 44 @PreAuthorize("@ss.hasPermi('linggang:key:work:location:list:limit:page:limit')")
... ... @@ -105,6 +113,35 @@ public class LinggangKeyWorkLocationController extends BaseController {
105 113 return flag ? com.ruoyi.common.core.domain.ResponseResult.success(Boolean.TRUE) : com.ruoyi.common.core.domain.ResponseResult.error("修改数据失败,请稍后再试");
106 114 }
107 115  
  116 + private LinggangScheduling queryScheduling(LinggangKeyWorkLocationUpdateStatusDTO request){
  117 + LinggangScheduling scheduling = new LinggangScheduling();
  118 + scheduling.setJobCode(request.getJobCode());
  119 + scheduling.setStartScheduleDate(DateUtil.shortDate(request.getScheduleDate()));
  120 + scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(),1));
  121 +
  122 + List<LinggangScheduling> schedulings = schedulingService.list(scheduling);
  123 + int size = CollectionUtils.size(schedulings);
  124 +
  125 + if(size > 1){
  126 + Optional<LinggangScheduling> optional = schedulings.stream().filter(sc->request.getScheduleDate().getTime()-sc.getFcsjT()<300000).findFirst();
  127 + if(optional.isPresent()){
  128 + return optional.get();
  129 + }
  130 + optional = schedulings.stream().filter(sc->request.getScheduleDate().getTime()-sc.getZdsjT()<300000).findFirst();
  131 + if(optional.isPresent()){
  132 + return optional.get();
  133 + }
  134 +
  135 +
  136 + }
  137 + if(0 == size){
  138 + return null;
  139 + }else if(1 == size){
  140 + return schedulings.get(0);
  141 + }
  142 + return null;
  143 + }
  144 +
108 145 private LinggangKeyWorkLocation convert(LinggangKeyWorkLocationQueryDTO source) {
109 146 return java.util.Optional.ofNullable(source).map(sc -> {
110 147 LinggangKeyWorkLocation target = new LinggangKeyWorkLocation();
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/dto/LinggangKeyWorkLocationAddDTO.java
... ... @@ -68,6 +68,14 @@ public class LinggangKeyWorkLocationAddDTO implements java.io.Serializable {
68 68 @ApiModelProperty(value = "操作人员")
69 69 private String operator;
70 70  
  71 + @ApiModelProperty(value = "钥匙编号", example = "1")
  72 + private String keyCode;
  73 +
  74 + @ApiModelProperty(value="排班人员")
  75 + private String jobCode;
  76 + @ApiModelProperty(value="场站编码")
  77 + private String yardCode;
  78 +
71 79  
72 80 @Override
73 81 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/dto/LinggangKeyWorkLocationQueryDTO.java
... ... @@ -56,6 +56,8 @@ public class LinggangKeyWorkLocationQueryDTO implements java.io.Serializable {
56 56 @ApiModelProperty(value="排班ID")
57 57 private Long schedulingId;
58 58  
  59 +
  60 +
59 61 /***状态:1 是归还;0是借出*/
60 62 @Excel(name = "状态:1 是归还;0是借出")
61 63 private java.lang.Integer type;
... ... @@ -64,6 +66,14 @@ public class LinggangKeyWorkLocationQueryDTO implements java.io.Serializable {
64 66 @ApiModelProperty(value="排班时间")
65 67 private java.util.Date scheduleDate;
66 68  
  69 + @ApiModelProperty(value = "钥匙编号", example = "1")
  70 + private String keyCode;
  71 +
  72 + @ApiModelProperty(value="排班人员")
  73 + private String jobCode;
  74 + @ApiModelProperty(value="场站编码")
  75 + private String yardCode;
  76 +
67 77  
68 78 @Override
69 79 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/dto/LinggangKeyWorkLocationUpdateDTO.java
... ... @@ -67,6 +67,14 @@ public class LinggangKeyWorkLocationUpdateDTO implements java.io.Serializable {
67 67 @ApiModelProperty(value = "操作人员")
68 68 private String operator;
69 69  
  70 + @ApiModelProperty(value = "钥匙编号", example = "1")
  71 + private String keyCode;
  72 +
  73 + @ApiModelProperty(value="排班人员")
  74 + private String jobCode;
  75 + @ApiModelProperty(value="场站编码")
  76 + private String yardCode;
  77 +
70 78  
71 79 @Override
72 80 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/dto/LinggangKeyWorkLocationUpdateStatusDTO.java
... ... @@ -67,6 +67,14 @@ public class LinggangKeyWorkLocationUpdateStatusDTO implements java.io.Serializa
67 67 @ApiModelProperty(value = "操作人员")
68 68 private String operator;
69 69  
  70 + @ApiModelProperty(value = "钥匙编号", example = "1")
  71 + private String keyCode;
  72 +
  73 + @ApiModelProperty(value="排班人员")
  74 + private String jobCode;
  75 + @ApiModelProperty(value="场站编码")
  76 + private String yardCode;
  77 +
70 78  
71 79 @Override
72 80 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/vo/LinggangKeyWorkLocationVO.java
... ... @@ -68,6 +68,14 @@ public class LinggangKeyWorkLocationVO implements java.io.Serializable {
68 68 @ApiModelProperty(value = "排班ID")
69 69 private Long schedulingId;
70 70  
  71 + @ApiModelProperty(value = "钥匙编号", example = "1")
  72 + private String keyCode;
  73 +
  74 + @ApiModelProperty(value="排班人员")
  75 + private String jobCode;
  76 + @ApiModelProperty(value="场站编码")
  77 + private String yardCode;
  78 +
71 79  
72 80 @Override
73 81 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/LinggangScheduling.java
... ... @@ -153,6 +153,10 @@ public class LinggangScheduling {
153 153 private Date startScheduleDate;
154 154 @TableField(exist = false)
155 155 private Date endScheduleDate;
  156 + @TableField(exist = false)
  157 + private long fcsjTVal;
  158 + @TableField(exist = false)
  159 + private long zdsjTVal;
156 160  
157 161 public String getCheZhanCode(){
158 162 return StringUtils.join(qdzcode,"@",zdzcode,"@",jobCode,"@");
... ...