Commit a31933a654e4dbe05a34ef3837a68a49c9be673f
1 parent
6141b055
酒测未通过审核
Showing
27 changed files
with
472 additions
and
123 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/TestController.java
| @@ -5,12 +5,15 @@ import com.ruoyi.job.DriverJob; | @@ -5,12 +5,15 @@ import com.ruoyi.job.DriverJob; | ||
| 5 | import com.ruoyi.service.driver.NewDriverService; | 5 | import com.ruoyi.service.driver.NewDriverService; |
| 6 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; | 6 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; |
| 7 | import io.swagger.annotations.ApiOperation; | 7 | import io.swagger.annotations.ApiOperation; |
| 8 | +import org.apache.commons.lang3.time.DateUtils; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.web.bind.annotation.GetMapping; | 10 | import org.springframework.web.bind.annotation.GetMapping; |
| 10 | import org.springframework.web.bind.annotation.RequestMapping; | 11 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | import org.springframework.web.bind.annotation.RequestParam; | 12 | import org.springframework.web.bind.annotation.RequestParam; |
| 12 | import org.springframework.web.bind.annotation.RestController; | 13 | import org.springframework.web.bind.annotation.RestController; |
| 13 | 14 | ||
| 15 | +import java.util.Date; | ||
| 16 | + | ||
| 14 | /** | 17 | /** |
| 15 | * @author liujun | 18 | * @author liujun |
| 16 | * @date 2024年07月30日 14:37 | 19 | * @date 2024年07月30日 14:37 |
| @@ -28,7 +31,18 @@ public class TestController { | @@ -28,7 +31,18 @@ public class TestController { | ||
| 28 | @GetMapping(value = "/test") | 31 | @GetMapping(value = "/test") |
| 29 | @ApiOperation("test") | 32 | @ApiOperation("test") |
| 30 | public ResponseResult<Boolean> test() { | 33 | public ResponseResult<Boolean> test() { |
| 31 | - driverJob.getSchedulingInfo("02:30:30"); | 34 | + // driverJob.getSchedulingInfo("02:30:30"); |
| 35 | +// Calendar calendar = Calendar.getInstance(); | ||
| 36 | +// calendar.setTime(new Date()); | ||
| 37 | +// calendar.set(Calendar.HOUR,2); | ||
| 38 | +// calendar.set(Calendar.MINUTE,30); | ||
| 39 | +// calendar.set(Calendar.SECOND,30); | ||
| 40 | +// Date date = calendar.getTime(); | ||
| 41 | + Date date = new Date(); | ||
| 42 | + for (int i = 0; i < 30; i++) { | ||
| 43 | + driverJob.getSchedulingInfo(DateUtils.addDays(date,i).getTime()); | ||
| 44 | + } | ||
| 45 | + | ||
| 32 | return ResponseResult.success(); | 46 | return ResponseResult.success(); |
| 33 | } | 47 | } |
| 34 | 48 |
Bsth-admin/src/main/java/com/ruoyi/controller/dss/DssDriverController.java
| @@ -23,6 +23,7 @@ import com.ruoyi.domain.dss.sign.dto.DssGetWineRecordDTO; | @@ -23,6 +23,7 @@ import com.ruoyi.domain.dss.sign.dto.DssGetWineRecordDTO; | ||
| 23 | import com.ruoyi.domain.dss.sign.dto.DssSignDTO; | 23 | import com.ruoyi.domain.dss.sign.dto.DssSignDTO; |
| 24 | import com.ruoyi.domain.dss.sign.dto.DssSignOutDTO; | 24 | import com.ruoyi.domain.dss.sign.dto.DssSignOutDTO; |
| 25 | import com.ruoyi.domain.dss.sign.resource.UpLoadPictureDTO; | 25 | import com.ruoyi.domain.dss.sign.resource.UpLoadPictureDTO; |
| 26 | +import com.ruoyi.domain.dss.sign.resource.UpLoadPicturePicDataDTO; | ||
| 26 | import com.ruoyi.domain.dss.sign.resource.UpLoadVideoDTO; | 27 | import com.ruoyi.domain.dss.sign.resource.UpLoadVideoDTO; |
| 27 | import com.ruoyi.domain.dss.sign.vo.DssSignVo; | 28 | import com.ruoyi.domain.dss.sign.vo.DssSignVo; |
| 28 | import com.ruoyi.domain.dss.sign.vo.GetWineRecordVo; | 29 | import com.ruoyi.domain.dss.sign.vo.GetWineRecordVo; |
| @@ -457,19 +458,25 @@ public class DssDriverController extends BaseController { | @@ -457,19 +458,25 @@ public class DssDriverController extends BaseController { | ||
| 457 | return Collections.emptyList(); | 458 | return Collections.emptyList(); |
| 458 | } | 459 | } |
| 459 | 460 | ||
| 460 | - return dto.getPicData().stream().map(pic -> { | 461 | + int size = CollectionUtils.size(dto.getPicData()); |
| 462 | + | ||
| 463 | + List<LinggangSignInResource> resources = new ArrayList<>(); | ||
| 464 | + | ||
| 465 | + for (int i = 0; i < size; i++) { | ||
| 466 | + UpLoadPicturePicDataDTO pic = dto.getPicData().get(i); | ||
| 467 | + int type = Objects.equals(pic.getIndex(), 0) ? 1 : 3; | ||
| 461 | LinggangSignInResource resource = new LinggangSignInResource(); | 468 | LinggangSignInResource resource = new LinggangSignInResource(); |
| 462 | resource.setSignId(dto.getTestId()); | 469 | resource.setSignId(dto.getTestId()); |
| 463 | resource.setIndex(pic.getIndex()); | 470 | resource.setIndex(pic.getIndex()); |
| 464 | - resource.setResourceType(1); | 471 | + resource.setResourceType(type); |
| 465 | resource.setTime(pic.getTime()); | 472 | resource.setTime(pic.getTime()); |
| 466 | resource.setCreateBy(getUserId()); | 473 | resource.setCreateBy(getUserId()); |
| 467 | resource.setCreateTime(new Date()); | 474 | resource.setCreateTime(new Date()); |
| 468 | resource.setDevice(dto.getDevice()); | 475 | resource.setDevice(dto.getDevice()); |
| 469 | resource.setContent(pic.getPic()); | 476 | resource.setContent(pic.getPic()); |
| 477 | + } | ||
| 470 | 478 | ||
| 471 | - return resource; | ||
| 472 | - }).collect(Collectors.toList()); | 479 | + return resources; |
| 473 | } | 480 | } |
| 474 | 481 | ||
| 475 | private LinggangSignInResource cconvertLinggangSignInResource(UpLoadVideoDTO dto) { | 482 | private LinggangSignInResource cconvertLinggangSignInResource(UpLoadVideoDTO dto) { |
| @@ -548,7 +555,7 @@ public class DssDriverController extends BaseController { | @@ -548,7 +555,7 @@ public class DssDriverController extends BaseController { | ||
| 548 | } | 555 | } |
| 549 | } | 556 | } |
| 550 | vo.setRouteName(scheduling.getLineName()); | 557 | vo.setRouteName(scheduling.getLineName()); |
| 551 | - vo.setFache(new Date(scheduling.getFcsjT()*100)); | 558 | + vo.setFache(new Date(scheduling.getFcsjT() * 100)); |
| 552 | 559 | ||
| 553 | return vo; | 560 | return vo; |
| 554 | }).collect(Collectors.toList()); | 561 | }).collect(Collectors.toList()); |
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
| @@ -12,10 +12,7 @@ import com.ruoyi.common.utils.DateUtils; | @@ -12,10 +12,7 @@ import com.ruoyi.common.utils.DateUtils; | ||
| 12 | import com.ruoyi.domain.OrderEntity; | 12 | import com.ruoyi.domain.OrderEntity; |
| 13 | import com.ruoyi.domain.caiinfo.CarInfo; | 13 | import com.ruoyi.domain.caiinfo.CarInfo; |
| 14 | import com.ruoyi.domain.driver.NewDriver; | 14 | import com.ruoyi.domain.driver.NewDriver; |
| 15 | -import com.ruoyi.domain.dss.key.box.dto.KeyBasicSyncDTO; | ||
| 16 | -import com.ruoyi.domain.dss.key.box.dto.SkipOperationDTO; | ||
| 17 | -import com.ruoyi.domain.dss.key.box.dto.TakeKeyDTO; | ||
| 18 | -import com.ruoyi.domain.dss.key.box.dto.YarnCabinetStatePageDTO; | 15 | +import com.ruoyi.domain.dss.key.box.dto.*; |
| 19 | import com.ruoyi.domain.dss.key.box.vo.*; | 16 | import com.ruoyi.domain.dss.key.box.vo.*; |
| 20 | import com.ruoyi.domain.dss.key.location.dto.WorkPlateV2DTO; | 17 | import com.ruoyi.domain.dss.key.location.dto.WorkPlateV2DTO; |
| 21 | import com.ruoyi.domain.dss.key.location.vo.WorkPlateV2Vo; | 18 | import com.ruoyi.domain.dss.key.location.vo.WorkPlateV2Vo; |
| @@ -41,6 +38,7 @@ import io.swagger.annotations.Api; | @@ -41,6 +38,7 @@ import io.swagger.annotations.Api; | ||
| 41 | import io.swagger.annotations.ApiOperation; | 38 | import io.swagger.annotations.ApiOperation; |
| 42 | import org.apache.commons.collections4.CollectionUtils; | 39 | import org.apache.commons.collections4.CollectionUtils; |
| 43 | import org.apache.commons.lang3.StringUtils; | 40 | import org.apache.commons.lang3.StringUtils; |
| 41 | +import org.springframework.beans.BeanUtils; | ||
| 44 | import org.springframework.beans.factory.annotation.Autowired; | 42 | import org.springframework.beans.factory.annotation.Autowired; |
| 45 | import org.springframework.validation.BindingResult; | 43 | import org.springframework.validation.BindingResult; |
| 46 | import org.springframework.web.bind.annotation.PostMapping; | 44 | import org.springframework.web.bind.annotation.PostMapping; |
| @@ -173,6 +171,7 @@ public class KeyBoxController extends BaseController { | @@ -173,6 +171,7 @@ public class KeyBoxController extends BaseController { | ||
| 173 | LinggangScheduling scheduling = new LinggangScheduling(); | 171 | LinggangScheduling scheduling = new LinggangScheduling(); |
| 174 | scheduling.setCzCode(venueInfo.getParkCode()); | 172 | scheduling.setCzCode(venueInfo.getParkCode()); |
| 175 | scheduling.setStartScheduleDate(DateUtil.shortDate(dto.getTime())); | 173 | scheduling.setStartScheduleDate(DateUtil.shortDate(dto.getTime())); |
| 174 | + scheduling.setType(1); | ||
| 176 | 175 | ||
| 177 | List<LinggangScheduling> schedulings = schedulingService.listByCZ(scheduling); | 176 | List<LinggangScheduling> schedulings = schedulingService.listByCZ(scheduling); |
| 178 | Set<String> jobCodes = null; | 177 | Set<String> jobCodes = null; |
| @@ -238,9 +237,19 @@ public class KeyBoxController extends BaseController { | @@ -238,9 +237,19 @@ public class KeyBoxController extends BaseController { | ||
| 238 | entity.setDevice(dto.getDevice()); | 237 | entity.setDevice(dto.getDevice()); |
| 239 | List<LinggangKeyWorkLocation> schedulings = linggangKeyWorkLocationService.list(entity); | 238 | List<LinggangKeyWorkLocation> schedulings = linggangKeyWorkLocationService.list(entity); |
| 240 | 239 | ||
| 241 | - NewDriver driver = newDriverService.getOne(dto.getDriverCode()); | 240 | + List<KeyInfo> keyInfos = null; |
| 241 | + if(CollectionUtils.isNotEmpty(dto.getKeyItem())){ | ||
| 242 | + Set<String> codes = dto.getKeyItem().stream().map(TakeKeyKeyItemDTO::getKeyCode).filter(obj->Objects.nonNull(obj)).collect(Collectors.toSet()); | ||
| 243 | + keyInfos = keyInfoService.list(codes); | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + NewDriver driver = newDriverService.getOne(dto.getStaffCode()); | ||
| 247 | +// if (Objects.isNull(driver)) { | ||
| 248 | +// logger.info("[{}]没有找到driver", dto); | ||
| 249 | +// return ResponseResult.error404(); | ||
| 250 | +// } | ||
| 242 | 251 | ||
| 243 | - List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver); | 252 | + List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver,keyInfos); |
| 244 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.TAKE_OUT); | 253 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.TAKE_OUT); |
| 245 | if (Objects.isNull(responseResult)) { | 254 | if (Objects.isNull(responseResult)) { |
| 246 | return ResponseResult.error(); | 255 | return ResponseResult.error(); |
| @@ -260,20 +269,47 @@ public class KeyBoxController extends BaseController { | @@ -260,20 +269,47 @@ public class KeyBoxController extends BaseController { | ||
| 260 | } | 269 | } |
| 261 | LinggangKeyWorkLocation entity = new LinggangKeyWorkLocation(); | 270 | LinggangKeyWorkLocation entity = new LinggangKeyWorkLocation(); |
| 262 | entity.setDevice(dto.getDevice()); | 271 | entity.setDevice(dto.getDevice()); |
| 272 | + entity.setType(2); | ||
| 273 | + entity.setStartScheduleDate(dto.getTime()); | ||
| 263 | List<LinggangKeyWorkLocation> schedulings = linggangKeyWorkLocationService.list(entity); | 274 | List<LinggangKeyWorkLocation> schedulings = linggangKeyWorkLocationService.list(entity); |
| 264 | 275 | ||
| 265 | - NewDriver driver = newDriverService.getOne(dto.getDriverCode()); | 276 | + NewDriver driver = newDriverService.getOne(dto.getStaffCode()); |
| 277 | + if (Objects.isNull(driver)) { | ||
| 278 | + logger.info("[{}]没有找到driver", dto); | ||
| 279 | + return ResponseResult.error404(); | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + List<KeyInfo> keyInfos = null; | ||
| 283 | + if(CollectionUtils.isNotEmpty(dto.getKeyItem())){ | ||
| 284 | + Set<String> codes = dto.getKeyItem().stream().map(TakeKeyKeyItemDTO::getKeyCode).filter(obj->Objects.nonNull(obj)).collect(Collectors.toSet()); | ||
| 285 | + keyInfos = keyInfoService.list(codes); | ||
| 286 | + | ||
| 287 | + if(CollectionUtils.isEmpty(keyInfos)){ | ||
| 288 | + codes = dto.getKeyItem().stream().map(TakeKeyKeyItemDTO::getPlate).filter(obj->Objects.nonNull(obj)).collect(Collectors.toSet()); | ||
| 289 | + keyInfos = keyInfoService.list(null,codes); | ||
| 290 | + } | ||
| 291 | + } | ||
| 266 | 292 | ||
| 267 | - List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver); | 293 | + |
| 294 | + | ||
| 295 | + List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver,keyInfos); | ||
| 296 | +// List<LinggangKeyWorkLocation> errorLocations = locations.stream().filter(l -> Objects.isNull(l.getKeyInfoId())).collect(Collectors.toList()); | ||
| 297 | +// locations = locations.stream().filter(l -> Objects.nonNull(l.getKeyInfoId())).collect(Collectors.toList()); | ||
| 268 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.REPAY); | 298 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.REPAY); |
| 269 | if (Objects.isNull(responseResult)) { | 299 | if (Objects.isNull(responseResult)) { |
| 270 | return ResponseResult.error(); | 300 | return ResponseResult.error(); |
| 271 | } | 301 | } |
| 272 | 302 | ||
| 273 | - if (responseResult.isSuccess()) { | 303 | + if (!responseResult.isSuccess()) { |
| 274 | return ResponseResult.error(responseResult.getCode(), responseResult.getMsg()); | 304 | return ResponseResult.error(responseResult.getCode(), responseResult.getMsg()); |
| 275 | } | 305 | } |
| 276 | 306 | ||
| 307 | +// if (CollectionUtils.isNotEmpty(errorLocations)) { | ||
| 308 | +// | ||
| 309 | +// Set<String> errorCode = errorLocations.stream().map(LinggangKeyWorkLocation::getKey).collect(Collectors.toSet()); | ||
| 310 | +// return ResponseResult.error(responseResult.getCode(), JSON.toJSONString(errorCode) + "归还失败,请归还到指定位置"); | ||
| 311 | +// } | ||
| 312 | + | ||
| 277 | 313 | ||
| 278 | Equipment equipment = equipmentService.getOneByDeviceId(dto.getDevice()); | 314 | Equipment equipment = equipmentService.getOneByDeviceId(dto.getDevice()); |
| 279 | TakeKeyVo vo = convertTakeKeyVo(dto, responseResult, equipment); | 315 | TakeKeyVo vo = convertTakeKeyVo(dto, responseResult, equipment); |
| @@ -281,6 +317,48 @@ public class KeyBoxController extends BaseController { | @@ -281,6 +317,48 @@ public class KeyBoxController extends BaseController { | ||
| 281 | return new ResponseResult<>(responseResult.getCode(), responseResult.getMsg(), vo); | 317 | return new ResponseResult<>(responseResult.getCode(), responseResult.getMsg(), vo); |
| 282 | } | 318 | } |
| 283 | 319 | ||
| 320 | + @PostMapping(value = "Driver/TurnKey/plan") | ||
| 321 | + @ApiOperation(value = "钥匙归还计划") | ||
| 322 | + public ResponseResult<List<TakeKeyPlanVo>> getKeyWorkLocaltionPlan(@Valid @RequestBody TakeKeyPlanDTO dto,BindingResult bindingResult){ | ||
| 323 | + if (bindingResult.hasErrors()) { | ||
| 324 | + return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage()); | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + LinggangKeyWorkLocation entity = new LinggangKeyWorkLocation(); | ||
| 328 | + entity.setDevice(dto.getDevice()); | ||
| 329 | + entity.setType(2); | ||
| 330 | + entity.setDelFlag(Boolean.FALSE); | ||
| 331 | + entity.setStartScheduleDate(dto.getTime()); | ||
| 332 | + entity.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(dto.getTime(),1)); | ||
| 333 | + | ||
| 334 | + List<LinggangKeyWorkLocation> schedulings = linggangKeyWorkLocationService.list(entity); | ||
| 335 | + if(CollectionUtils.isEmpty(schedulings)){ | ||
| 336 | + return ResponseResult.success(); | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + Set<Integer> keyIds = schedulings.stream().map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet()); | ||
| 340 | + | ||
| 341 | + List<KeyInfo> tempKeyInfos = null; | ||
| 342 | + if(CollectionUtils.isNotEmpty(keyIds)){ | ||
| 343 | + tempKeyInfos = keyInfoService.listByIds(keyIds); | ||
| 344 | + } | ||
| 345 | + List<KeyInfo> keyInfos = tempKeyInfos; | ||
| 346 | + int keyInfoSize = CollectionUtils.size(keyInfos); | ||
| 347 | + | ||
| 348 | + List<TakeKeyPlanVo> vos = schedulings.stream().map(s->{ | ||
| 349 | + TakeKeyPlanVo vo = convert(s); | ||
| 350 | + if(keyInfoSize > 0){ | ||
| 351 | + Optional<KeyInfo> optional = keyInfos.stream().filter(k->Objects.equals(k.getId(),s.getKeyInfoId())).findFirst(); | ||
| 352 | + if(optional.isPresent()){ | ||
| 353 | + vo.setKeyCode(optional.get().getKeyCode()); | ||
| 354 | + } | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + return vo; | ||
| 358 | + }).collect(Collectors.toList()); | ||
| 359 | + return ResponseResult.success(vos); | ||
| 360 | + } | ||
| 361 | + | ||
| 284 | @PostMapping(value = "/keybox/yarnCabinetState/page") | 362 | @PostMapping(value = "/keybox/yarnCabinetState/page") |
| 285 | @ApiOperation(value = "24.场站钥匙柜实况信息") | 363 | @ApiOperation(value = "24.场站钥匙柜实况信息") |
| 286 | public ResponseResult<YarnCabinetStatePageVO> yarnCabinetStatePage(@Valid @RequestBody YarnCabinetStatePageDTO dto, BindingResult bindingResult) { | 364 | public ResponseResult<YarnCabinetStatePageVO> yarnCabinetStatePage(@Valid @RequestBody YarnCabinetStatePageDTO dto, BindingResult bindingResult) { |
| @@ -590,7 +668,7 @@ public class KeyBoxController extends BaseController { | @@ -590,7 +668,7 @@ public class KeyBoxController extends BaseController { | ||
| 590 | return vo; | 668 | return vo; |
| 591 | } | 669 | } |
| 592 | 670 | ||
| 593 | - private List<LinggangKeyWorkLocation> convert(TakeKeyDTO dto, List<LinggangKeyWorkLocation> schedulings, NewDriver driver) { | 671 | + private List<LinggangKeyWorkLocation> convert(TakeKeyDTO dto, List<LinggangKeyWorkLocation> schedulings, NewDriver driver,List<KeyInfo> keyInfos) { |
| 594 | if (CollectionUtils.isEmpty(dto.getKeyItem())) { | 672 | if (CollectionUtils.isEmpty(dto.getKeyItem())) { |
| 595 | return Collections.emptyList(); | 673 | return Collections.emptyList(); |
| 596 | } | 674 | } |
| @@ -608,6 +686,17 @@ public class KeyBoxController extends BaseController { | @@ -608,6 +686,17 @@ public class KeyBoxController extends BaseController { | ||
| 608 | location.setKeyInfoId(opt.get().getKeyInfoId()); | 686 | location.setKeyInfoId(opt.get().getKeyInfoId()); |
| 609 | } | 687 | } |
| 610 | } | 688 | } |
| 689 | + if(Objects.nonNull(keyInfos)){ | ||
| 690 | + Optional<KeyInfo> optional = keyInfos.stream().filter(k->Objects.equals(k.getKeyCode(),item.getKeyCode())).findFirst(); | ||
| 691 | + if (optional.isPresent()) { | ||
| 692 | + location.setKeyInfoId(optional.get().getId()); | ||
| 693 | + }else{ | ||
| 694 | + optional = keyInfos.stream().filter(k->Objects.equals(k.getPlateNum(),item.getPlate())).findFirst(); | ||
| 695 | + if (optional.isPresent()) { | ||
| 696 | + location.setKeyInfoId(optional.get().getId()); | ||
| 697 | + } | ||
| 698 | + } | ||
| 699 | + } | ||
| 611 | 700 | ||
| 612 | if (Objects.nonNull(driver)) { | 701 | if (Objects.nonNull(driver)) { |
| 613 | location.setCreateBy(Convert.toLong(driver.getId())); | 702 | location.setCreateBy(Convert.toLong(driver.getId())); |
| @@ -615,7 +704,7 @@ public class KeyBoxController extends BaseController { | @@ -615,7 +704,7 @@ public class KeyBoxController extends BaseController { | ||
| 615 | location.setCreateTime(new Date()); | 704 | location.setCreateTime(new Date()); |
| 616 | 705 | ||
| 617 | return location; | 706 | return location; |
| 618 | - }).filter(obj -> Objects.nonNull(obj.getKeyInfoId())).collect(Collectors.toList()); | 707 | + }).collect(Collectors.toList()); |
| 619 | } | 708 | } |
| 620 | 709 | ||
| 621 | private TakeKeyVo convertTakeKeyVo(TakeKeyDTO dto, ResponseResult<Boolean> result, Equipment equipment) { | 710 | private TakeKeyVo convertTakeKeyVo(TakeKeyDTO dto, ResponseResult<Boolean> result, Equipment equipment) { |
| @@ -623,6 +712,7 @@ public class KeyBoxController extends BaseController { | @@ -623,6 +712,7 @@ public class KeyBoxController extends BaseController { | ||
| 623 | vo.setDevice(dto.getDevice()); | 712 | vo.setDevice(dto.getDevice()); |
| 624 | vo.setTime(new Date()); | 713 | vo.setTime(new Date()); |
| 625 | vo.setResult(result.isSuccess() ? 0 : 1); | 714 | vo.setResult(result.isSuccess() ? 0 : 1); |
| 715 | + vo.setStaffCode(dto.getStaffCode()); | ||
| 626 | if (Objects.nonNull(equipment)) { | 716 | if (Objects.nonNull(equipment)) { |
| 627 | vo.setDeviceType(equipment.getPromise()); | 717 | vo.setDeviceType(equipment.getPromise()); |
| 628 | vo.setDriverCode(equipment.getDeviceId()); | 718 | vo.setDriverCode(equipment.getDeviceId()); |
| @@ -734,4 +824,12 @@ public class KeyBoxController extends BaseController { | @@ -734,4 +824,12 @@ public class KeyBoxController extends BaseController { | ||
| 734 | } | 824 | } |
| 735 | return vo; | 825 | return vo; |
| 736 | } | 826 | } |
| 827 | + | ||
| 828 | + private TakeKeyPlanVo convert(LinggangKeyWorkLocation source) { | ||
| 829 | + return java.util.Optional.ofNullable(source).map(sc -> { | ||
| 830 | + TakeKeyPlanVo target = new TakeKeyPlanVo(); | ||
| 831 | + BeanUtils.copyProperties(source, target); | ||
| 832 | + return target; | ||
| 833 | + }).orElseGet(null); | ||
| 834 | + } | ||
| 737 | } | 835 | } |
Bsth-admin/src/main/java/com/ruoyi/domain/DriverScheduling.java
| @@ -40,4 +40,7 @@ public class DriverScheduling { | @@ -40,4 +40,7 @@ public class DriverScheduling { | ||
| 40 | private String zdzCode; | 40 | private String zdzCode; |
| 41 | /**终点站名字*/ | 41 | /**终点站名字*/ |
| 42 | private String zdzName; | 42 | private String zdzName; |
| 43 | + | ||
| 44 | + /***1:实际排班表;100为计划排班表*/ | ||
| 45 | + private java.lang.Integer type; | ||
| 43 | } | 46 | } |
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/dto/TakeKeyDTO.java
| @@ -33,10 +33,14 @@ public class TakeKeyDTO implements java.io.Serializable { | @@ -33,10 +33,14 @@ public class TakeKeyDTO implements java.io.Serializable { | ||
| 33 | @ApiModelProperty(value = "设备类型", required = true) | 33 | @ApiModelProperty(value = "设备类型", required = true) |
| 34 | private String deviceType; | 34 | private String deviceType; |
| 35 | 35 | ||
| 36 | - @NotEmpty(message = "卡号 不能为空") | 36 | +// @NotEmpty(message = "卡号 不能为空") |
| 37 | @ApiModelProperty(value = "卡号", required = true) | 37 | @ApiModelProperty(value = "卡号", required = true) |
| 38 | private String driverCode; | 38 | private String driverCode; |
| 39 | 39 | ||
| 40 | +// @NotEmpty(message = "工号 不能为空") | ||
| 41 | + @ApiModelProperty(value = "工号", required = true) | ||
| 42 | + private String staffCode; | ||
| 43 | + | ||
| 40 | @NotNull(message = "时间不能为空") | 44 | @NotNull(message = "时间不能为空") |
| 41 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 45 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 42 | @ApiModelProperty(value = "时间 个数:yyyy-MM-dd HH:mm:ss", required = true) | 46 | @ApiModelProperty(value = "时间 个数:yyyy-MM-dd HH:mm:ss", required = true) |
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/dto/TakeKeyKeyItemDTO.java
| @@ -46,6 +46,10 @@ public class TakeKeyKeyItemDTO implements java.io.Serializable { | @@ -46,6 +46,10 @@ public class TakeKeyKeyItemDTO implements java.io.Serializable { | ||
| 46 | @ApiModelProperty(value = "领取状态;0:取出,16:钥匙未归还,255:异常", required = true) | 46 | @ApiModelProperty(value = "领取状态;0:取出,16:钥匙未归还,255:异常", required = true) |
| 47 | private Integer state; | 47 | private Integer state; |
| 48 | 48 | ||
| 49 | + // @NotEmpty(message = "钥匙编码 不能为空") | ||
| 50 | + @ApiModelProperty(value = "钥匙编码", required = true) | ||
| 51 | + private String keyCode; | ||
| 52 | + | ||
| 49 | @Override | 53 | @Override |
| 50 | public String toString() { | 54 | public String toString() { |
| 51 | return JSON.toJSONString(this); | 55 | return JSON.toJSONString(this); |
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/dto/TakeKeyPlanDTO.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年08月13日 13:15 | ||
| 17 | + */ | ||
| 18 | +@Data | ||
| 19 | +@Accessors(chain = true) | ||
| 20 | +@ApiModel(value = "钥匙归还计划 DTO") | ||
| 21 | +@EqualsAndHashCode(callSuper = false) | ||
| 22 | +public class TakeKeyPlanDTO implements java.io.Serializable{ | ||
| 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 | +} |
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/TakeKeyPlanVo.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.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import lombok.experimental.Accessors; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @author liujun | ||
| 11 | + * @date 2024年08月13日 13:15 | ||
| 12 | + */ | ||
| 13 | +@Data | ||
| 14 | +@Accessors(chain = true) | ||
| 15 | +@ApiModel(value = "钥匙归还计划 Vo") | ||
| 16 | +@EqualsAndHashCode(callSuper = false) | ||
| 17 | +public class TakeKeyPlanVo implements java.io.Serializable { | ||
| 18 | + /***ID*/ | ||
| 19 | + @ApiModelProperty(value = "ID", example = "1") | ||
| 20 | + private Long id; | ||
| 21 | + /***场站ID*/ | ||
| 22 | + @ApiModelProperty(value = "场站ID", example = "1") | ||
| 23 | + private Integer yardId; | ||
| 24 | + /***场站名称*/ | ||
| 25 | + @ApiModelProperty(value = "场站名称") | ||
| 26 | + private String yardName; | ||
| 27 | + /***设备号*/ | ||
| 28 | + @ApiModelProperty(value = "设备号") | ||
| 29 | + private String device; | ||
| 30 | + /***钥匙位编号*/ | ||
| 31 | + @ApiModelProperty(value = "钥匙位编号") | ||
| 32 | + private String cabinetNo; | ||
| 33 | + /***是否删除;0为未删除,1已删除*/ | ||
| 34 | + @ApiModelProperty(value = "是否删除;0为未删除,1已删除") | ||
| 35 | + private Boolean delFlag; | ||
| 36 | + | ||
| 37 | + /***钥匙ID*/ | ||
| 38 | + @ApiModelProperty(value = "钥匙ID", example = "1") | ||
| 39 | + private Integer keyInfoId; | ||
| 40 | + @ApiModelProperty(value = "钥匙Code") | ||
| 41 | + private String keyCode; | ||
| 42 | + | ||
| 43 | + /***排班时间*/ | ||
| 44 | + @ApiModelProperty(value = "排班时间") | ||
| 45 | + private java.util.Date scheduleDate; | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + /***排班ID*/ | ||
| 50 | + @ApiModelProperty(value = "排班ID") | ||
| 51 | + private Long schedulingId; | ||
| 52 | +} |
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/vo/TakeKeyVo.java
| @@ -33,10 +33,13 @@ public class TakeKeyVo implements java.io.Serializable { | @@ -33,10 +33,13 @@ public class TakeKeyVo implements java.io.Serializable { | ||
| 33 | @ApiModelProperty(value = "卡号") | 33 | @ApiModelProperty(value = "卡号") |
| 34 | private String driverCode; | 34 | private String driverCode; |
| 35 | 35 | ||
| 36 | + @ApiModelProperty(value = "工号") | ||
| 37 | + private String staffCode; | ||
| 38 | + | ||
| 36 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 39 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 37 | @ApiModelProperty(value = "时间") | 40 | @ApiModelProperty(value = "时间") |
| 38 | private Date time; | 41 | private Date time; |
| 39 | - | 42 | + |
| 40 | @ApiModelProperty(value = "服务应答 0处理成功,1处理失败") | 43 | @ApiModelProperty(value = "服务应答 0处理成功,1处理失败") |
| 41 | private Integer result; | 44 | private Integer result; |
| 42 | 45 |
Bsth-admin/src/main/java/com/ruoyi/domain/key/info/box/vo/KeyBoxVo.java
| @@ -32,6 +32,8 @@ public class KeyBoxVo implements java.io.Serializable { | @@ -32,6 +32,8 @@ public class KeyBoxVo implements java.io.Serializable { | ||
| 32 | private String parkingNo; | 32 | private String parkingNo; |
| 33 | @ApiModelProperty(value = "车牌号") | 33 | @ApiModelProperty(value = "车牌号") |
| 34 | private String plateNum; | 34 | private String plateNum; |
| 35 | + @ApiModelProperty(value = "钥匙编号") | ||
| 36 | + private String keyCode; | ||
| 35 | 37 | ||
| 36 | @Override | 38 | @Override |
| 37 | public String toString() { | 39 | public String toString() { |
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/LinggangKeyWorkLocation.java
| @@ -111,6 +111,8 @@ public class LinggangKeyWorkLocation { | @@ -111,6 +111,8 @@ public class LinggangKeyWorkLocation { | ||
| 111 | private Date startScheduleDate; | 111 | private Date startScheduleDate; |
| 112 | @TableField(exist = false) | 112 | @TableField(exist = false) |
| 113 | private Date endScheduleDate; | 113 | private Date endScheduleDate; |
| 114 | + @TableField(exist = false) | ||
| 115 | + private String plate; | ||
| 114 | 116 | ||
| 115 | 117 | ||
| 116 | public enum LinggangKeyWorkLocationEventTypeEnum { | 118 | public enum LinggangKeyWorkLocationEventTypeEnum { |
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/LinggangScheduling.java
| @@ -143,6 +143,11 @@ public class LinggangScheduling { | @@ -143,6 +143,11 @@ public class LinggangScheduling { | ||
| 143 | @Excel(name = "终点站名字") | 143 | @Excel(name = "终点站名字") |
| 144 | private java.lang.String zdzname; | 144 | private java.lang.String zdzname; |
| 145 | 145 | ||
| 146 | + /***1:实际排班表;100为计划排班表*/ | ||
| 147 | + @Excel(name = "1:实际排班表;100为计划排班表") | ||
| 148 | + private java.lang.Integer type; | ||
| 149 | + | ||
| 150 | + | ||
| 146 | @TableField(exist = false) | 151 | @TableField(exist = false) |
| 147 | private String czCode; | 152 | private String czCode; |
| 148 | 153 | ||
| @@ -152,6 +157,8 @@ public class LinggangScheduling { | @@ -152,6 +157,8 @@ public class LinggangScheduling { | ||
| 152 | private Date endScheduleDate; | 157 | private Date endScheduleDate; |
| 153 | 158 | ||
| 154 | 159 | ||
| 160 | + | ||
| 161 | + | ||
| 155 | @Override | 162 | @Override |
| 156 | public String toString() { | 163 | public String toString() { |
| 157 | return com.alibaba.fastjson2.JSON.toJSONString(this); | 164 | return com.alibaba.fastjson2.JSON.toJSONString(this); |
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/dto/LinggangSchedulingAddDTO.java
| @@ -73,6 +73,11 @@ public class LinggangSchedulingAddDTO implements java.io.Serializable { | @@ -73,6 +73,11 @@ public class LinggangSchedulingAddDTO implements java.io.Serializable { | ||
| 73 | /***钥匙ID*/ | 73 | /***钥匙ID*/ |
| 74 | @ApiModelProperty(value = "钥匙ID", example = "1") | 74 | @ApiModelProperty(value = "钥匙ID", example = "1") |
| 75 | private Integer keyInfoId; | 75 | private Integer keyInfoId; |
| 76 | + | ||
| 77 | + /***1:实际排班表;100为计划排班表*/ | ||
| 78 | + @ApiModelProperty(value="1:实际排班表;100为计划排班表",example ="1") | ||
| 79 | + private java.lang.Integer type; | ||
| 80 | + | ||
| 76 | /***操作人员*/ | 81 | /***操作人员*/ |
| 77 | @ApiModelProperty(value = "操作人员") | 82 | @ApiModelProperty(value = "操作人员") |
| 78 | private String operator; | 83 | private String operator; |
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/dto/LinggangSchedulingQueryDTO.java
| @@ -74,6 +74,9 @@ public class LinggangSchedulingQueryDTO implements java.io.Serializable { | @@ -74,6 +74,9 @@ public class LinggangSchedulingQueryDTO implements java.io.Serializable { | ||
| 74 | @ApiModelProperty(value = "钥匙ID", example = "1") | 74 | @ApiModelProperty(value = "钥匙ID", example = "1") |
| 75 | private Integer keyInfoId; | 75 | private Integer keyInfoId; |
| 76 | 76 | ||
| 77 | + /***1:实际排班表;100为计划排班表*/ | ||
| 78 | + @ApiModelProperty(value="1:实际排班表;100为计划排班表",example ="1") | ||
| 79 | + private java.lang.Integer type; | ||
| 77 | 80 | ||
| 78 | @Override | 81 | @Override |
| 79 | public String toString() { | 82 | public String toString() { |
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/dto/LinggangSchedulingUpdateDTO.java
| @@ -73,6 +73,10 @@ public class LinggangSchedulingUpdateDTO implements java.io.Serializable { | @@ -73,6 +73,10 @@ public class LinggangSchedulingUpdateDTO implements java.io.Serializable { | ||
| 73 | /***钥匙ID*/ | 73 | /***钥匙ID*/ |
| 74 | @ApiModelProperty(value = "钥匙ID", example = "1") | 74 | @ApiModelProperty(value = "钥匙ID", example = "1") |
| 75 | private Integer keyInfoId; | 75 | private Integer keyInfoId; |
| 76 | + | ||
| 77 | + /***1:实际排班表;100为计划排班表*/ | ||
| 78 | + @ApiModelProperty(value="1:实际排班表;100为计划排班表",example ="1") | ||
| 79 | + private java.lang.Integer type; | ||
| 76 | /***操作人员*/ | 80 | /***操作人员*/ |
| 77 | @ApiModelProperty(value = "操作人员") | 81 | @ApiModelProperty(value = "操作人员") |
| 78 | private String operator; | 82 | private String operator; |
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/vo/LinggangSchedulingVO.java
| @@ -75,6 +75,11 @@ public class LinggangSchedulingVO implements java.io.Serializable { | @@ -75,6 +75,11 @@ public class LinggangSchedulingVO implements java.io.Serializable { | ||
| 75 | /***原因*/ | 75 | /***原因*/ |
| 76 | @ApiModelProperty(value = "原因") | 76 | @ApiModelProperty(value = "原因") |
| 77 | private String remark; | 77 | private String remark; |
| 78 | + | ||
| 79 | + /***1:实际排班表;100为计划排班表*/ | ||
| 80 | + @ApiModelProperty(value = "1:实际排班表;100为计划排班表", example = "1") | ||
| 81 | + private java.lang.Integer type; | ||
| 82 | + | ||
| 78 | /***钥匙ID*/ | 83 | /***钥匙ID*/ |
| 79 | @ApiModelProperty(value = "钥匙ID", example = "1") | 84 | @ApiModelProperty(value = "钥匙ID", example = "1") |
| 80 | private Integer keyInfoId; | 85 | private Integer keyInfoId; |
Bsth-admin/src/main/java/com/ruoyi/job/DriverJob.java
| @@ -24,8 +24,10 @@ import com.ruoyi.service.RuleAttendanceMainService; | @@ -24,8 +24,10 @@ import com.ruoyi.service.RuleAttendanceMainService; | ||
| 24 | import com.ruoyi.service.RuleNumSettingService; | 24 | import com.ruoyi.service.RuleNumSettingService; |
| 25 | import com.ruoyi.service.ThreadJobService; | 25 | import com.ruoyi.service.ThreadJobService; |
| 26 | import com.ruoyi.utils.ConstDateUtil; | 26 | import com.ruoyi.utils.ConstDateUtil; |
| 27 | +import com.ruoyi.utils.DateUtil; | ||
| 27 | import com.ruoyi.utils.ListUtils; | 28 | import com.ruoyi.utils.ListUtils; |
| 28 | import lombok.extern.slf4j.Slf4j; | 29 | import lombok.extern.slf4j.Slf4j; |
| 30 | +import org.apache.commons.lang3.time.DateUtils; | ||
| 29 | import org.springframework.beans.BeanUtils; | 31 | import org.springframework.beans.BeanUtils; |
| 30 | import org.springframework.beans.factory.InitializingBean; | 32 | import org.springframework.beans.factory.InitializingBean; |
| 31 | import org.springframework.beans.factory.annotation.Autowired; | 33 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -110,6 +112,9 @@ public class DriverJob implements InitializingBean { | @@ -110,6 +112,9 @@ public class DriverJob implements InitializingBean { | ||
| 110 | @Value("${api.url.getSchedulingInfoNew}") | 112 | @Value("${api.url.getSchedulingInfoNew}") |
| 111 | private String getSchedulingInfoUrl; | 113 | private String getSchedulingInfoUrl; |
| 112 | 114 | ||
| 115 | + @Value("${api.url.getSchedulingInfoPlan}") | ||
| 116 | + private String getSchedulingInfoPlan; | ||
| 117 | + | ||
| 113 | @Value("${api.config.password}") | 118 | @Value("${api.config.password}") |
| 114 | private String password; | 119 | private String password; |
| 115 | 120 | ||
| @@ -228,23 +233,29 @@ public class DriverJob implements InitializingBean { | @@ -228,23 +233,29 @@ public class DriverJob implements InitializingBean { | ||
| 228 | * 获取排班任务请求 | 233 | * 获取排班任务请求 |
| 229 | * 24小时执行一次 | 234 | * 24小时执行一次 |
| 230 | */ | 235 | */ |
| 231 | - public void getSchedulingInfo(String timeOut) { | 236 | + public void getSchedulingInfo(long timeLong) { |
| 232 | // TODO 获取当天的签到表 | 237 | // TODO 获取当天的签到表 |
| 233 | long timestamp = System.currentTimeMillis(); | 238 | long timestamp = System.currentTimeMillis(); |
| 234 | - String formatDate = ConstDateUtil.formatDate(timestamp); | 239 | + Date date = new Date(timeLong); |
| 240 | + String formatDate = DateUtil.YYYY_MM_DD.format(date); | ||
| 241 | + String timeOut = DateUtil.HH_MM_ss.format(date); | ||
| 235 | // String formatDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)); | 242 | // String formatDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)); |
| 236 | log.info("获取排班任务触发时间:{}", formatDate); | 243 | log.info("获取排班任务触发时间:{}", formatDate); |
| 237 | // 获取排班请求 | 244 | // 获取排班请求 |
| 238 | String getSchedulingInfoUrl = null; | 245 | String getSchedulingInfoUrl = null; |
| 239 | 246 | ||
| 240 | log.info("开始获取{}的排班数据", formatDate); | 247 | log.info("开始获取{}的排班数据", formatDate); |
| 248 | + boolean isSameDay = DateUtils.isSameDay(new Date(),date); | ||
| 249 | + String url = isSameDay?GET_SCHEDULING_INFO_URL:getSchedulingInfoPlan; | ||
| 250 | + int type = isSameDay?1:100; | ||
| 251 | +// String url = getSchedulingInfoPlan; | ||
| 241 | try { | 252 | try { |
| 242 | - getSchedulingInfoUrl = String.format(GET_SCHEDULING_INFO_URL, "99", formatDate, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp)))); | 253 | + getSchedulingInfoUrl = String.format(url, "77", formatDate, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp)))); |
| 243 | } catch (Exception e) { | 254 | } catch (Exception e) { |
| 244 | throw new RuntimeException(e); | 255 | throw new RuntimeException(e); |
| 245 | } | 256 | } |
| 246 | // 获取排班信息并存入redis | 257 | // 获取排班信息并存入redis |
| 247 | - saveSchedulingToRedis(getSchedulingInfoUrl, formatDate, timeOut); | 258 | + saveSchedulingToRedis(getSchedulingInfoUrl, formatDate, timeOut,date,type); |
| 248 | // 删除两天前排班信息 | 259 | // 删除两天前排班信息 |
| 249 | deleteScheduling(); | 260 | deleteScheduling(); |
| 250 | log.info("获取{}的排班数据完毕", formatDate); | 261 | log.info("获取{}的排班数据完毕", formatDate); |
| @@ -339,8 +350,8 @@ public class DriverJob implements InitializingBean { | @@ -339,8 +350,8 @@ public class DriverJob implements InitializingBean { | ||
| 339 | } | 350 | } |
| 340 | 351 | ||
| 341 | 352 | ||
| 342 | - public Map<String, List<ResponseSchedulingDto>> saveSchedulingToRedis(String getSchedulingInfoUrl, String dateKey, String timeOut) { | ||
| 343 | - log.info("开始拉取排班:{}", dateKey); | 353 | + public Map<String, List<ResponseSchedulingDto>> saveSchedulingToRedis(String getSchedulingInfoUrl, String dateKey, String timeOut,Date date,int type) { |
| 354 | + log.info("开始拉取排班:{};[{}]", dateKey,getSchedulingInfoUrl); | ||
| 344 | List<ResponseSchedulingDto> originSchedulingList = RESTTEMPLATE.exchange( | 355 | List<ResponseSchedulingDto> originSchedulingList = RESTTEMPLATE.exchange( |
| 345 | getSchedulingInfoUrl, | 356 | getSchedulingInfoUrl, |
| 346 | HttpMethod.GET, | 357 | HttpMethod.GET, |
| @@ -368,7 +379,7 @@ public class DriverJob implements InitializingBean { | @@ -368,7 +379,7 @@ public class DriverJob implements InitializingBean { | ||
| 368 | schedulingList.sort(Comparator.comparing(ResponseSchedulingDto::getFcsjT)); | 379 | schedulingList.sort(Comparator.comparing(ResponseSchedulingDto::getFcsjT)); |
| 369 | } | 380 | } |
| 370 | // 存入签到报表 | 381 | // 存入签到报表 |
| 371 | - THREAD_JOB_SERVICE.asyncComputedScheduling(driverSchedulingMap, timeOut); | 382 | + THREAD_JOB_SERVICE.asyncComputedScheduling(driverSchedulingMap, timeOut,date,type); |
| 372 | // 实时排班直接存入缓存 | 383 | // 实时排班直接存入缓存 |
| 373 | SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap); | 384 | SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap); |
| 374 | log.info("拉取排班完毕:{}", dateKey); | 385 | log.info("拉取排班完毕:{}", dateKey); |
Bsth-admin/src/main/java/com/ruoyi/mapper/key/location/LinggangKeyWorkLocationMapper.java
| @@ -5,6 +5,7 @@ import com.ruoyi.domain.key.location.LinggangKeyWorkLocation; | @@ -5,6 +5,7 @@ import com.ruoyi.domain.key.location.LinggangKeyWorkLocation; | ||
| 5 | import org.apache.ibatis.annotations.Mapper; | 5 | import org.apache.ibatis.annotations.Mapper; |
| 6 | import org.apache.ibatis.annotations.Param; | 6 | import org.apache.ibatis.annotations.Param; |
| 7 | 7 | ||
| 8 | +import java.util.Collection; | ||
| 8 | import java.util.List; | 9 | import java.util.List; |
| 9 | 10 | ||
| 10 | 11 | ||
| @@ -17,4 +18,6 @@ public interface LinggangKeyWorkLocationMapper extends BaseMapper<LinggangKeyWor | @@ -17,4 +18,6 @@ public interface LinggangKeyWorkLocationMapper extends BaseMapper<LinggangKeyWor | ||
| 17 | int insertSelective(LinggangKeyWorkLocation name); | 18 | int insertSelective(LinggangKeyWorkLocation name); |
| 18 | 19 | ||
| 19 | List<LinggangKeyWorkLocation> listOfDeviceKeyIdScheduleDate(@Param("localtions") List<LinggangKeyWorkLocation> locations); | 20 | List<LinggangKeyWorkLocation> listOfDeviceKeyIdScheduleDate(@Param("localtions") List<LinggangKeyWorkLocation> locations); |
| 21 | + | ||
| 22 | + List<LinggangKeyWorkLocation> listRecent(@Param("localtions") Collection<LinggangKeyWorkLocation> locations); | ||
| 20 | } | 23 | } |
| 21 | \ No newline at end of file | 24 | \ No newline at end of file |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| @@ -14,6 +14,7 @@ import com.ruoyi.common.utils.StringUtils; | @@ -14,6 +14,7 @@ import com.ruoyi.common.utils.StringUtils; | ||
| 14 | import com.ruoyi.common.utils.file.FileUploadUtils; | 14 | import com.ruoyi.common.utils.file.FileUploadUtils; |
| 15 | import com.ruoyi.config.domain.LineConfig; | 15 | import com.ruoyi.config.domain.LineConfig; |
| 16 | import com.ruoyi.config.service.ILineConfigService; | 16 | import com.ruoyi.config.service.ILineConfigService; |
| 17 | +import com.ruoyi.domain.DriverScheduling; | ||
| 17 | import com.ruoyi.domain.RuleAttendanceMain; | 18 | import com.ruoyi.domain.RuleAttendanceMain; |
| 18 | import com.ruoyi.domain.sign.in.exception.report.EquipmentExceptionReport; | 19 | import com.ruoyi.domain.sign.in.exception.report.EquipmentExceptionReport; |
| 19 | import com.ruoyi.driver.domain.Driver; | 20 | import com.ruoyi.driver.domain.Driver; |
| @@ -28,7 +29,6 @@ import com.ruoyi.errorScheduling.domain.ErrorJobcode; | @@ -28,7 +29,6 @@ import com.ruoyi.errorScheduling.domain.ErrorJobcode; | ||
| 28 | import com.ruoyi.errorScheduling.service.IErrorJobcodeService; | 29 | import com.ruoyi.errorScheduling.service.IErrorJobcodeService; |
| 29 | import com.ruoyi.in.domain.SignIn; | 30 | import com.ruoyi.in.domain.SignIn; |
| 30 | import com.ruoyi.job.DriverJob; | 31 | import com.ruoyi.job.DriverJob; |
| 31 | -import com.ruoyi.domain.DriverScheduling; | ||
| 32 | import com.ruoyi.pojo.GlobalIndex; | 32 | import com.ruoyi.pojo.GlobalIndex; |
| 33 | import com.ruoyi.pojo.response.ResponseSchedulingDto; | 33 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| 34 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; | 34 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; |
| @@ -36,6 +36,7 @@ import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportServic | @@ -36,6 +36,7 @@ import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportServic | ||
| 36 | import com.ruoyi.system.domain.SysNotice; | 36 | import com.ruoyi.system.domain.SysNotice; |
| 37 | import com.ruoyi.system.service.ISysNoticeService; | 37 | import com.ruoyi.system.service.ISysNoticeService; |
| 38 | import com.ruoyi.utils.ConstDateUtil; | 38 | import com.ruoyi.utils.ConstDateUtil; |
| 39 | +import com.ruoyi.utils.DateUtil; | ||
| 39 | import lombok.extern.slf4j.Slf4j; | 40 | import lombok.extern.slf4j.Slf4j; |
| 40 | import org.springframework.beans.BeanUtils; | 41 | import org.springframework.beans.BeanUtils; |
| 41 | import org.springframework.beans.factory.annotation.Autowired; | 42 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -51,9 +52,11 @@ import org.springframework.web.client.RestTemplate; | @@ -51,9 +52,11 @@ import org.springframework.web.client.RestTemplate; | ||
| 51 | import sun.misc.BASE64Decoder; | 52 | import sun.misc.BASE64Decoder; |
| 52 | 53 | ||
| 53 | import javax.annotation.Resource; | 54 | import javax.annotation.Resource; |
| 54 | -import java.io.*; | 55 | +import java.io.File; |
| 56 | +import java.io.FileOutputStream; | ||
| 57 | +import java.io.IOException; | ||
| 58 | +import java.io.InputStream; | ||
| 55 | import java.math.BigDecimal; | 59 | import java.math.BigDecimal; |
| 56 | -import java.text.SimpleDateFormat; | ||
| 57 | import java.time.LocalDate; | 60 | import java.time.LocalDate; |
| 58 | import java.util.*; | 61 | import java.util.*; |
| 59 | import java.util.stream.Collectors; | 62 | import java.util.stream.Collectors; |
| @@ -406,51 +409,39 @@ public class ThreadJobService { | @@ -406,51 +409,39 @@ public class ThreadJobService { | ||
| 406 | */ | 409 | */ |
| 407 | @Async | 410 | @Async |
| 408 | @Transactional(rollbackFor = {Exception.class}) | 411 | @Transactional(rollbackFor = {Exception.class}) |
| 409 | - public void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap, String timeOut) { | ||
| 410 | - if (StringUtils.isNotEmpty(timeOut)) { | ||
| 411 | - LocalDate date = LocalDate.now(); | ||
| 412 | - Date date2 = ConstDateUtil.dateAddition(date.toString(), timeOut); | ||
| 413 | - Date date1 = new Date(); | ||
| 414 | - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 415 | - // 如果当前日期小于设定时间就不获取固定排班 | ||
| 416 | - log.info("当前时间:{},设定时间:{}", simpleDateFormat.format(date1), simpleDateFormat.format(date2)); | ||
| 417 | - if (date1.compareTo(date2) < 0) { | ||
| 418 | - log.info("当前日期小于设定时间就不获取排班,当前时间:{},设定时间:{}", simpleDateFormat.format(date1), simpleDateFormat.format(date2)); | ||
| 419 | - return; | ||
| 420 | - } | ||
| 421 | - } | 412 | + public void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap, String timeOut,Date date,int type) { |
| 422 | //查询当天是否保存过考情表 如果不存在则保存 | 413 | //查询当天是否保存过考情表 如果不存在则保存 |
| 423 | - List<DriverScheduling> bcList = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd"), null, null, null); | 414 | + List<DriverScheduling> bcList = schedulingMapper.queryToDay(DateUtil.YYYY_MM_DD_LINK.format(date), null, null, null); |
| 424 | Map<String, List<DriverScheduling>> dto = nowSchedulingCache.getCacheScheduling(ConstDateUtil.formatDate(new Date())); | 415 | Map<String, List<DriverScheduling>> dto = nowSchedulingCache.getCacheScheduling(ConstDateUtil.formatDate(new Date())); |
| 425 | // 当天已有记录则不在保存 或者 调度记录为空则不在保存 | 416 | // 当天已有记录则不在保存 或者 调度记录为空则不在保存 |
| 426 | if ((CollectionUtil.isNotEmpty(dto) && CollectionUtil.isNotEmpty(bcList)) || originSchedulingMap.size() == 0) { | 417 | if ((CollectionUtil.isNotEmpty(dto) && CollectionUtil.isNotEmpty(bcList)) || originSchedulingMap.size() == 0) { |
| 427 | - log.info("调度最新数据:{}", originSchedulingMap.size()); | ||
| 428 | - log.info("当天获取数据:{}", bcList.size()); | 418 | + log.info("调度最新数据:{},当天获取数据:{},时间:[{}]", originSchedulingMap.size(),bcList.size(),date); |
| 429 | return; | 419 | return; |
| 430 | } | 420 | } |
| 431 | // TODO maybe delete | 421 | // TODO maybe delete |
| 432 | TempCache.resetMapStatus(); | 422 | TempCache.resetMapStatus(); |
| 433 | - bcList = getBcList(originSchedulingMap); | 423 | + bcList = getBcList(originSchedulingMap,type); |
| 434 | 424 | ||
| 435 | // 处理非司售人员的排班明细 | 425 | // 处理非司售人员的排班明细 |
| 436 | bcList.addAll(handleOtherPostsScheduling()); | 426 | bcList.addAll(handleOtherPostsScheduling()); |
| 437 | // 插入排班 | 427 | // 插入排班 |
| 438 | schedulingMapper.insertRoster(bcList); | 428 | schedulingMapper.insertRoster(bcList); |
| 429 | + String dateStr1 = DateUtil.YYYY_MM_DD_LINK.format(date); | ||
| 439 | // 异常数据过多,不通过自增获取id再次查询获取 | 430 | // 异常数据过多,不通过自增获取id再次查询获取 |
| 440 | - bcList = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd"), null, null, null); | 431 | + bcList = schedulingMapper.queryToDay(dateStr1, null, null, null); |
| 441 | // 处理缓存和错误排班 | 432 | // 处理缓存和错误排班 |
| 442 | - String date = ConstDateUtil.formatDate(new Date()); | 433 | + String dateStr = DateUtil.YYYY_MM_DD.format(date); |
| 443 | if (!CollectionUtil.isEmpty(bcList)) { | 434 | if (!CollectionUtil.isEmpty(bcList)) { |
| 444 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); | 435 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); |
| 445 | NowSchedulingCache.handlerResultMap(resultMap, bcList); | 436 | NowSchedulingCache.handlerResultMap(resultMap, bcList); |
| 446 | // 更新缓存 | 437 | // 更新缓存 |
| 447 | - nowSchedulingCache.setCacheScheduling(date, resultMap); | 438 | + nowSchedulingCache.setCacheScheduling(dateStr, resultMap); |
| 448 | // 获取错误排班 | 439 | // 获取错误排班 |
| 449 | List<ErrorJobcode> errorScheduling = getErrorScheduling(resultMap); | 440 | List<ErrorJobcode> errorScheduling = getErrorScheduling(resultMap); |
| 450 | // 插入错误排班 | 441 | // 插入错误排班 |
| 451 | errorJobcodeService.insertBatchErrorJobcode(errorScheduling); | 442 | errorJobcodeService.insertBatchErrorJobcode(errorScheduling); |
| 452 | } | 443 | } |
| 453 | - keyWorkLocationService.insertJob(ConstDateUtil.formatDate("yyyy-MM-dd")); | 444 | + keyWorkLocationService.insertJob(dateStr1); |
| 454 | log.info("当天排班数据获取完毕,共:{}条", bcList.size()); | 445 | log.info("当天排班数据获取完毕,共:{}条", bcList.size()); |
| 455 | } | 446 | } |
| 456 | 447 | ||
| @@ -524,7 +515,7 @@ public class ThreadJobService { | @@ -524,7 +515,7 @@ public class ThreadJobService { | ||
| 524 | return scheduling; | 515 | return scheduling; |
| 525 | } | 516 | } |
| 526 | 517 | ||
| 527 | - private List<DriverScheduling> getBcList(Map<String, List<ResponseSchedulingDto>> originSchedulingMap) { | 518 | + private List<DriverScheduling> getBcList(Map<String, List<ResponseSchedulingDto>> originSchedulingMap,int type) { |
| 528 | List<DriverScheduling> bcList = new ArrayList<>(1000); | 519 | List<DriverScheduling> bcList = new ArrayList<>(1000); |
| 529 | Map<String, LineConfig> configMap = lineConfigService.selectLineConfigList(null).stream().collect(Collectors.toMap(item -> item.getLineName() + item.getLpName(), item -> item)); | 520 | Map<String, LineConfig> configMap = lineConfigService.selectLineConfigList(null).stream().collect(Collectors.toMap(item -> item.getLineName() + item.getLpName(), item -> item)); |
| 530 | for (String key : originSchedulingMap.keySet()) { | 521 | for (String key : originSchedulingMap.keySet()) { |
| @@ -535,6 +526,7 @@ public class ThreadJobService { | @@ -535,6 +526,7 @@ public class ThreadJobService { | ||
| 535 | DriverScheduling scheduling = new DriverScheduling(); | 526 | DriverScheduling scheduling = new DriverScheduling(); |
| 536 | BeanUtils.copyProperties(item, scheduling, "id"); | 527 | BeanUtils.copyProperties(item, scheduling, "id"); |
| 537 | scheduling.setUpDown(Convert.toInt(item.getUpDown())); | 528 | scheduling.setUpDown(Convert.toInt(item.getUpDown())); |
| 529 | + scheduling.setType(type); | ||
| 538 | return scheduling; | 530 | return scheduling; |
| 539 | }) | 531 | }) |
| 540 | .sorted(Comparator.comparing(DriverScheduling::getFcsjT)) | 532 | .sorted(Comparator.comparing(DriverScheduling::getFcsjT)) |
Bsth-admin/src/main/java/com/ruoyi/service/impl/dss/KeyBoxVoServiceImpl.java
| @@ -96,6 +96,7 @@ public class KeyBoxVoServiceImpl implements KeyBoxVoService { | @@ -96,6 +96,7 @@ public class KeyBoxVoServiceImpl implements KeyBoxVoService { | ||
| 96 | // keyBoxVo.setYardName(Convert.toStr(keyInfo.getS())); | 96 | // keyBoxVo.setYardName(Convert.toStr(keyInfo.getS())); |
| 97 | keyBoxVo.setPlateNum(lingangScheduling.getNbbm()); | 97 | keyBoxVo.setPlateNum(lingangScheduling.getNbbm()); |
| 98 | keyBoxVo.setParkingNo(carInfo.getParkingNo()); | 98 | keyBoxVo.setParkingNo(carInfo.getParkingNo()); |
| 99 | + keyBoxVo.setKeyCode(keyInfo.getKeyCode()); | ||
| 99 | 100 | ||
| 100 | lingangEquipmentLinkeLogService.updateByPrimaryKey(linkeLog, null, HttpStatus.SUCCESS); | 101 | lingangEquipmentLinkeLogService.updateByPrimaryKey(linkeLog, null, HttpStatus.SUCCESS); |
| 101 | return ResponseResult.success(keyBoxVo); | 102 | return ResponseResult.success(keyBoxVo); |
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/location/LinggangKeyWorkLocationServiceImpl.java
| @@ -159,6 +159,24 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -159,6 +159,24 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 159 | return list(wrapper); | 159 | return list(wrapper); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | + private List<LinggangKeyWorkLocation> listRecent(Collection<LinggangKeyWorkLocation> locations) { | ||
| 163 | + if (CollectionUtils.isEmpty(locations)) { | ||
| 164 | + return Collections.emptyList(); | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + return linggangKeyWorkLocationMapper.listRecent(locations); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + private List<LinggangKeyWorkLocation> listRecentDates(Collection<Date> dates) { | ||
| 171 | + if (CollectionUtils.isEmpty(dates)) { | ||
| 172 | + return Collections.emptyList(); | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(); | ||
| 176 | + wrapper.in(LinggangKeyWorkLocation::getScheduleDate, dates); | ||
| 177 | + return list(wrapper); | ||
| 178 | + } | ||
| 179 | + | ||
| 162 | // @Override | 180 | // @Override |
| 163 | // public List<LinggangKeyWorkLocation> listOfSelect(LinggangKeyWorkLocation entity) { | 181 | // public List<LinggangKeyWorkLocation> listOfSelect(LinggangKeyWorkLocation entity) { |
| 164 | // LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity); | 182 | // LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity); |
| @@ -278,9 +296,9 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -278,9 +296,9 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 278 | resultStr.append(";"); | 296 | resultStr.append(";"); |
| 279 | } | 297 | } |
| 280 | 298 | ||
| 281 | - msg = convertMsg(success, TAKE_KEY_SUCESS); | ||
| 282 | - if (StringUtils.isNotEmpty(msg)) { | ||
| 283 | - resultStr.append(msg); | 299 | + String successMsg = convertMsg(success, TAKE_KEY_SUCESS); |
| 300 | + if (StringUtils.isNotEmpty(successMsg)) { | ||
| 301 | + resultStr.append(successMsg); | ||
| 284 | resultStr.append(";"); | 302 | resultStr.append(";"); |
| 285 | return StringUtils.isEmpty(msg) ? ResponseResult.success(resultStr.toString()) : ResponseResult.error(resultStr.toString()); | 303 | return StringUtils.isEmpty(msg) ? ResponseResult.success(resultStr.toString()) : ResponseResult.error(resultStr.toString()); |
| 286 | } | 304 | } |
| @@ -374,89 +392,138 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -374,89 +392,138 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 374 | } | 392 | } |
| 375 | } | 393 | } |
| 376 | 394 | ||
| 395 | + | ||
| 377 | private ResponseResult<List<LinggangKeyWorkLocation>> checkTaskKey(List<LinggangKeyWorkLocation> locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum typeEnum) { | 396 | private ResponseResult<List<LinggangKeyWorkLocation>> checkTaskKey(List<LinggangKeyWorkLocation> locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum typeEnum) { |
| 378 | - Set<Integer> keyCodes = locations.stream().map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet()); | ||
| 379 | - List<KeyInfo> keyInfos = keyInfoService.listByIds(keyCodes); | ||
| 380 | - if (CollectionUtils.isEmpty(keyInfos)) { | ||
| 381 | - log.info("无法找到钥匙信息:[{}]", locations); | ||
| 382 | - return ResponseResult.error404("无法找到钥匙信息"); | 397 | + Set<Integer> keyCodes = locations.stream().filter(l->Objects.nonNull(l.getKeyInfoId())).map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet()); |
| 398 | + | ||
| 399 | + List<KeyInfo> keyInfos = null; | ||
| 400 | + if(CollectionUtils.isNotEmpty(keyCodes)){ | ||
| 401 | + keyInfos = keyInfoService.listByIds(keyCodes); | ||
| 383 | } | 402 | } |
| 384 | 403 | ||
| 385 | - StringBuilder resultStr = new StringBuilder(); | ||
| 386 | - List<LinggangKeyWorkLocation> source = locations.stream().filter(l -> Objects.nonNull(l.getKeyInfoId())).collect(Collectors.toList()); | ||
| 387 | - List<LinggangKeyWorkLocation> target = locations.stream().filter(l -> Objects.isNull(l.getKeyInfoId())).collect(Collectors.toList()); | ||
| 388 | - | ||
| 389 | - if (CollectionUtils.isNotEmpty(target)) { | ||
| 390 | - String msg = convertMsgOfKeyInfo(target); | ||
| 391 | - if (StringUtils.isNotEmpty(msg)) { | ||
| 392 | - resultStr.append(msg); | ||
| 393 | - resultStr.append(";"); | ||
| 394 | - } | 404 | + Set<Date> dates = locations.stream().map(LinggangKeyWorkLocation::getScheduleDate).collect(Collectors.toSet()); |
| 405 | + | ||
| 406 | + List<LinggangKeyWorkLocation> sources = listRecentDates(dates).stream().filter(s -> !Objects.equals(s.getType(), typeEnum.getValue())).collect(Collectors.toList()); | ||
| 407 | + if (CollectionUtils.isEmpty(sources)) { | ||
| 408 | + return ResponseResult.error404("无法找到钥匙归还信息"); | ||
| 395 | } | 409 | } |
| 396 | 410 | ||
| 397 | - if (CollectionUtils.isEmpty(source)) { | ||
| 398 | - return ResponseResult.error404(resultStr.toString()); | 411 | + if (CollectionUtils.isEmpty(keyInfos)) { |
| 412 | + Set<Integer> keyInfoId = sources.stream().map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet()); | ||
| 413 | + keyInfos = keyInfoService.listByIds(keyInfoId); | ||
| 399 | } | 414 | } |
| 400 | 415 | ||
| 401 | - List<LinggangKeyWorkLocation> querySource = locations.stream().map(l -> { | ||
| 402 | - LinggangKeyWorkLocation location = new LinggangKeyWorkLocation(); | ||
| 403 | - location.setDevice(l.getDevice()); | ||
| 404 | - location.setKeyInfoId(l.getKeyInfoId()); | ||
| 405 | - location.setScheduleDate(l.getScheduleDate()); | ||
| 406 | - location.setType(typeEnum.getValue()); | ||
| 407 | - return location; | 416 | + List<KeyInfo> keyInfoList = keyInfos; |
| 417 | + int size = CollectionUtils.size(keyInfoList); | ||
| 418 | + | ||
| 419 | + sources = sources.stream().map(s -> { | ||
| 420 | + if (size > 0) { | ||
| 421 | + Optional<KeyInfo> optKey = keyInfoList.stream().filter(k -> Objects.equals(k.getId(), s.getKeyInfoId())).findFirst(); | ||
| 422 | + if (optKey.isPresent()) { | ||
| 423 | + s.setPlate(optKey.get().getPlateNum()); | ||
| 424 | + } | ||
| 425 | + } | ||
| 426 | + return s; | ||
| 408 | }).collect(Collectors.toList()); | 427 | }).collect(Collectors.toList()); |
| 409 | 428 | ||
| 410 | - List<LinggangKeyWorkLocation> dataSource = listOfDeviceKeyIdScheduleDate(querySource); | ||
| 411 | - if (CollectionUtils.isEmpty(dataSource)) { | ||
| 412 | - log.info("无法找到钥匙存放信息:[{}][{}]", querySource, locations); | ||
| 413 | - resultStr.append("无法找到钥匙存放信息"); | ||
| 414 | - resultStr.append(";"); | ||
| 415 | - return ResponseResult.error404(resultStr.toString()); | ||
| 416 | - } | 429 | + List<LinggangKeyWorkLocation> workLocations = sources; |
| 417 | 430 | ||
| 418 | - List<LinggangKeyWorkLocation> locationList = new ArrayList<>(); | ||
| 419 | - source = source.stream().map(l -> { | ||
| 420 | - Optional<LinggangKeyWorkLocation> optional = dataSource.stream().filter(d -> Objects.equals(d.getKeyInfoId(), l.getKeyInfoId()) && | ||
| 421 | - Objects.equals(d.getDevice(), l.getDevice()) && DateUtils.isSameDay(d.getScheduleDate(), l.getScheduleDate())).findFirst(); | 431 | + locations = locations.stream().map(l -> { |
| 432 | +// Optional<LinggangKeyWorkLocation> optional = workLocations.stream().filter(s -> DateUtils.isSameDay(s.getScheduleDate(), | ||
| 433 | +// l.getScheduleDate()) && Objects.equals(s.getPlate(), l.getPlate()) && Objects.equals(s.getDevice(), l.getDevice())).findFirst(); | ||
| 434 | + Optional<LinggangKeyWorkLocation> optional = workLocations.stream().filter(s -> DateUtils.isSameDay(s.getScheduleDate(), | ||
| 435 | + l.getScheduleDate()) && Objects.equals(s.getPlate(), l.getPlate())).findFirst(); | ||
| 422 | if (optional.isPresent()) { | 436 | if (optional.isPresent()) { |
| 423 | l.setId(optional.get().getId()); | 437 | l.setId(optional.get().getId()); |
| 424 | - if (Objects.equals(l.getType(), optional.get().getType())) { | ||
| 425 | - locationList.add(l); | ||
| 426 | - return null; | ||
| 427 | - } | ||
| 428 | } | 438 | } |
| 429 | return l; | 439 | return l; |
| 430 | - }).filter(l -> Objects.nonNull(l)).collect(Collectors.toList()); | ||
| 431 | - | ||
| 432 | - if (CollectionUtils.isNotEmpty(locationList)) { | ||
| 433 | - String msg = convertMsgOfKeyInfoLocalEventType(locations); | ||
| 434 | - if (StringUtils.isNotEmpty(msg)) { | ||
| 435 | - resultStr.append(msg); | ||
| 436 | - resultStr.append(";"); | ||
| 437 | - } | ||
| 438 | - } | ||
| 439 | - | ||
| 440 | - if (CollectionUtils.isEmpty(source)) { | ||
| 441 | - log.info("无法找到钥匙存放信息:[{}][{}]", locationList, locations); | ||
| 442 | - return ResponseResult.error404(resultStr.toString()); | ||
| 443 | - } | ||
| 444 | - | ||
| 445 | - target = source.stream().filter(l -> Objects.isNull(l.getId())).collect(Collectors.toList()); | ||
| 446 | - if (CollectionUtils.isNotEmpty(target)) { | ||
| 447 | - String msg = convertMsgOfKeyInfoLocal(target); | ||
| 448 | - if (StringUtils.isNotEmpty(msg)) { | ||
| 449 | - resultStr.append(msg); | ||
| 450 | - resultStr.append(";"); | ||
| 451 | - } | 440 | + }).collect(Collectors.toList()); |
| 452 | 441 | ||
| 453 | - } | ||
| 454 | - source = source.stream().filter(l -> Objects.nonNull(l.getId())).collect(Collectors.toList()); | ||
| 455 | - if (CollectionUtils.isEmpty(source)) { | ||
| 456 | - return ResponseResult.error404(resultStr.toString()); | ||
| 457 | - } | ||
| 458 | 442 | ||
| 459 | - return ResponseResult.success(source); | 443 | + return ResponseResult.success(locations); |
| 444 | + | ||
| 445 | +// StringBuilder resultStr = new StringBuilder(); | ||
| 446 | +// if (Objects.equals(typeEnum.getValue(), LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.TAKE_OUT.getValue())) { | ||
| 447 | +// List<LinggangKeyWorkLocation> source = locations.stream().filter(l -> Objects.equals(l.getType(), 1)).collect(Collectors.toList()); | ||
| 448 | +// return ResponseResult.success(source); | ||
| 449 | +// } | ||
| 450 | +// List<LinggangKeyWorkLocation> source = locations.stream().filter(l -> Objects.equals(l.getType(), 0)).collect(Collectors.toList()); | ||
| 451 | +// return ResponseResult.success(source); | ||
| 452 | + | ||
| 453 | +// List<LinggangKeyWorkLocation> source = locations.stream().filter(l -> Objects.nonNull(l.getKeyInfoId())).collect(Collectors.toList()); | ||
| 454 | +// List<LinggangKeyWorkLocation> target = locations.stream().filter(l -> Objects.isNull(l.getKeyInfoId())).collect(Collectors.toList()); | ||
| 455 | +// | ||
| 456 | +// if (CollectionUtils.isNotEmpty(target)) { | ||
| 457 | +// String msg = convertMsgOfKeyInfo(target); | ||
| 458 | +// if (StringUtils.isNotEmpty(msg)) { | ||
| 459 | +// resultStr.append(msg); | ||
| 460 | +// resultStr.append(";"); | ||
| 461 | +// } | ||
| 462 | +// } | ||
| 463 | +// | ||
| 464 | +// if (CollectionUtils.isEmpty(source)) { | ||
| 465 | +// return ResponseResult.error404(resultStr.toString()); | ||
| 466 | +// } | ||
| 467 | +// | ||
| 468 | +// List<LinggangKeyWorkLocation> querySource = locations.stream().map(l -> { | ||
| 469 | +// LinggangKeyWorkLocation location = new LinggangKeyWorkLocation(); | ||
| 470 | +// location.setDevice(l.getDevice()); | ||
| 471 | +// location.setKeyInfoId(l.getKeyInfoId()); | ||
| 472 | +// location.setScheduleDate(l.getScheduleDate()); | ||
| 473 | +// location.setType(typeEnum.getValue()); | ||
| 474 | +// return location; | ||
| 475 | +// }).collect(Collectors.toList()); | ||
| 476 | +// | ||
| 477 | +// List<LinggangKeyWorkLocation> dataSource = listOfDeviceKeyIdScheduleDate(querySource); | ||
| 478 | +// if (CollectionUtils.isEmpty(dataSource)) { | ||
| 479 | +// log.info("无法找到钥匙存放信息:[{}][{}]", querySource, locations); | ||
| 480 | +// resultStr.append("无法找到钥匙存放信息"); | ||
| 481 | +// resultStr.append(";"); | ||
| 482 | +// return ResponseResult.error404(resultStr.toString()); | ||
| 483 | +// } | ||
| 484 | +// | ||
| 485 | +// List<LinggangKeyWorkLocation> locationList = new ArrayList<>(); | ||
| 486 | +// source = source.stream().map(l -> { | ||
| 487 | +// Optional<LinggangKeyWorkLocation> optional = dataSource.stream().filter(d -> Objects.equals(d.getKeyInfoId(), l.getKeyInfoId()) && | ||
| 488 | +// Objects.equals(d.getDevice(), l.getDevice()) && DateUtils.isSameDay(d.getScheduleDate(), l.getScheduleDate())).findFirst(); | ||
| 489 | +// if (optional.isPresent()) { | ||
| 490 | +// l.setId(optional.get().getId()); | ||
| 491 | +// if (Objects.equals(l.getType(), optional.get().getType())) { | ||
| 492 | +// locationList.add(l); | ||
| 493 | +// return null; | ||
| 494 | +// } | ||
| 495 | +// } | ||
| 496 | +// return l; | ||
| 497 | +// }).filter(l -> Objects.nonNull(l)).collect(Collectors.toList()); | ||
| 498 | +// | ||
| 499 | +// if (CollectionUtils.isNotEmpty(locationList)) { | ||
| 500 | +// String msg = convertMsgOfKeyInfoLocalEventType(locations); | ||
| 501 | +// if (StringUtils.isNotEmpty(msg)) { | ||
| 502 | +// resultStr.append(msg); | ||
| 503 | +// resultStr.append(";"); | ||
| 504 | +// } | ||
| 505 | +// } | ||
| 506 | +// | ||
| 507 | +// if (CollectionUtils.isEmpty(source)) { | ||
| 508 | +// log.info("无法找到钥匙存放信息:[{}][{}]", locationList, locations); | ||
| 509 | +// return ResponseResult.error404(resultStr.toString()); | ||
| 510 | +// } | ||
| 511 | +// | ||
| 512 | +// target = source.stream().filter(l -> Objects.isNull(l.getId())).collect(Collectors.toList()); | ||
| 513 | +// if (CollectionUtils.isNotEmpty(target)) { | ||
| 514 | +// String msg = convertMsgOfKeyInfoLocal(target); | ||
| 515 | +// if (StringUtils.isNotEmpty(msg)) { | ||
| 516 | +// resultStr.append(msg); | ||
| 517 | +// resultStr.append(";"); | ||
| 518 | +// } | ||
| 519 | +// | ||
| 520 | +// } | ||
| 521 | +// source = source.stream().filter(l -> Objects.nonNull(l.getId())).collect(Collectors.toList()); | ||
| 522 | +// if (CollectionUtils.isEmpty(source)) { | ||
| 523 | +// return ResponseResult.error404(resultStr.toString()); | ||
| 524 | +// } | ||
| 525 | +// | ||
| 526 | +// return ResponseResult.success(source); | ||
| 460 | } | 527 | } |
| 461 | 528 | ||
| 462 | private String convertMsgOfKeyInfo(List<LinggangKeyWorkLocation> target) { | 529 | private String convertMsgOfKeyInfo(List<LinggangKeyWorkLocation> target) { |
| @@ -593,7 +660,8 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -593,7 +660,8 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 593 | continue; | 660 | continue; |
| 594 | } | 661 | } |
| 595 | if (Objects.isNull(equipment.getLatticeNumberSet())) { | 662 | if (Objects.isNull(equipment.getLatticeNumberSet())) { |
| 596 | - equipment.setLatticeNumberSet(combationLattice(equipment)); | 663 | +// equipment.setLatticeNumberSet(combationLattice(equipment)); |
| 664 | + equipment.setLatticeNumberSet(new HashSet<>()); | ||
| 597 | } | 665 | } |
| 598 | 666 | ||
| 599 | number = RandomUtils.nextInt(1, equipment.getLatticeNumber()); | 667 | number = RandomUtils.nextInt(1, equipment.getLatticeNumber()); |
| @@ -627,7 +695,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -627,7 +695,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 627 | location.setYardId(equipment.getYardId()); | 695 | location.setYardId(equipment.getYardId()); |
| 628 | location.setYardName(optional.get().getName()); | 696 | location.setYardName(optional.get().getName()); |
| 629 | location.setDevice(equipment.getDeviceId()); | 697 | location.setDevice(equipment.getDeviceId()); |
| 630 | - location.setCabinetNo(number.toString()); | 698 | +// location.setCabinetNo(number.toString()); |
| 631 | location.setEventType(0); | 699 | location.setEventType(0); |
| 632 | location.setDelFlag(Boolean.FALSE); | 700 | location.setDelFlag(Boolean.FALSE); |
| 633 | location.setKeyInfoId(carKeyInfo.get(0).getId()); | 701 | location.setKeyInfoId(carKeyInfo.get(0).getId()); |
Bsth-admin/src/main/java/com/ruoyi/service/impl/scheduling/LinggangSchedulingServiceImpl.java
| @@ -14,6 +14,7 @@ import org.springframework.stereotype.Service; | @@ -14,6 +14,7 @@ import org.springframework.stereotype.Service; | ||
| 14 | 14 | ||
| 15 | import java.util.Collections; | 15 | import java.util.Collections; |
| 16 | import java.util.List; | 16 | import java.util.List; |
| 17 | +import java.util.Objects; | ||
| 17 | 18 | ||
| 18 | @Service | 19 | @Service |
| 19 | /** Service实现类*/ | 20 | /** Service实现类*/ |
| @@ -83,6 +84,7 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl<LinggangSchedulin | @@ -83,6 +84,7 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl<LinggangSchedulin | ||
| 83 | @Override | 84 | @Override |
| 84 | public Integer countId(LinggangScheduling entity) { | 85 | public Integer countId(LinggangScheduling entity) { |
| 85 | LambdaQueryWrapper<LinggangScheduling> wrapper = new LambdaQueryWrapper<>(entity); | 86 | LambdaQueryWrapper<LinggangScheduling> wrapper = new LambdaQueryWrapper<>(entity); |
| 87 | + switchScheduleDate(wrapper,entity); | ||
| 86 | wrapper.select(LinggangScheduling::getId); | 88 | wrapper.select(LinggangScheduling::getId); |
| 87 | return count(wrapper); | 89 | return count(wrapper); |
| 88 | } | 90 | } |
| @@ -240,4 +242,14 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl<LinggangSchedulin | @@ -240,4 +242,14 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl<LinggangSchedulin | ||
| 240 | wrapper.orderByDesc(LinggangScheduling::getId); | 242 | wrapper.orderByDesc(LinggangScheduling::getId); |
| 241 | } | 243 | } |
| 242 | } | 244 | } |
| 245 | + | ||
| 246 | + private void switchScheduleDate(LambdaQueryWrapper<LinggangScheduling> wrapper,LinggangScheduling entity){ | ||
| 247 | + if(Objects.nonNull(entity.getStartScheduleDate()) && Objects.nonNull(entity.getEndScheduleDate())){ | ||
| 248 | + wrapper.between(LinggangScheduling::getScheduleDate,entity.getStartScheduleDate(),entity.getEndScheduleDate()); | ||
| 249 | + }else if(Objects.nonNull(entity.getStartScheduleDate())){ | ||
| 250 | + wrapper.ge(LinggangScheduling::getScheduleDate,entity.getStartScheduleDate()); | ||
| 251 | + }else if(Objects.nonNull(entity.getEndScheduleDate())){ | ||
| 252 | + wrapper.le(LinggangScheduling::getScheduleDate,entity.getEndScheduleDate()); | ||
| 253 | + } | ||
| 254 | + } | ||
| 243 | } | 255 | } |
| 244 | \ No newline at end of file | 256 | \ No newline at end of file |
Bsth-admin/src/main/java/com/ruoyi/utils/DateUtil.java
| @@ -17,9 +17,12 @@ public class DateUtil { | @@ -17,9 +17,12 @@ public class DateUtil { | ||
| 17 | 17 | ||
| 18 | public static FastDateFormat YYYY_MM_DD_LINK_HH_MM_SS = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss"); | 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"); | 19 | public static FastDateFormat YYYY_MM_DD_LINK = FastDateFormat.getInstance("yyyy-MM-dd"); |
| 20 | + public static FastDateFormat YYYY_MM_DD = FastDateFormat.getInstance("yyyyMMdd"); | ||
| 21 | + public static FastDateFormat HH_MM_ss = FastDateFormat.getInstance("HH:mm:ss"); | ||
| 20 | public static DateTimeFormatter YYYY_MM_DD_LINK_HH_MM_SS_Local_Date = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | 22 | public static DateTimeFormatter YYYY_MM_DD_LINK_HH_MM_SS_Local_Date = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| 21 | public static DateTimeFormatter YYYY_MM_DD_LINK_Local_Date = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | 23 | public static DateTimeFormatter YYYY_MM_DD_LINK_Local_Date = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| 22 | 24 | ||
| 25 | + | ||
| 23 | public static LocalDateTime parseLocalDateTime(String dateStr) { | 26 | public static LocalDateTime parseLocalDateTime(String dateStr) { |
| 24 | return StringUtils.isEmpty(dateStr) ? null : LocalDateTime.parse(dateStr, YYYY_MM_DD_LINK_HH_MM_SS_Local_Date); | 27 | return StringUtils.isEmpty(dateStr) ? null : LocalDateTime.parse(dateStr, YYYY_MM_DD_LINK_HH_MM_SS_Local_Date); |
| 25 | } | 28 | } |
Bsth-admin/src/main/resources/application-druid-dev.yml
| @@ -166,6 +166,7 @@ api: | @@ -166,6 +166,7 @@ api: | ||
| 166 | # 获取排班信息 | 166 | # 获取排班信息 |
| 167 | getSchedulingInfo: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s | 167 | getSchedulingInfo: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s |
| 168 | getSchedulingInfoNew: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s | 168 | getSchedulingInfoNew: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s |
| 169 | + getSchedulingInfoPlan: http://58.34.47.74:9089/webservice/rest/schedule/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s | ||
| 169 | config: | 170 | config: |
| 170 | password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464 | 171 | password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464 |
| 171 | # 随机字符串 | 172 | # 随机字符串 |
Bsth-admin/src/main/resources/application-druid-devTest.yml
| @@ -166,6 +166,7 @@ api: | @@ -166,6 +166,7 @@ api: | ||
| 166 | # 获取排班信息 | 166 | # 获取排班信息 |
| 167 | getSchedulingInfo: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s | 167 | getSchedulingInfo: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s |
| 168 | getSchedulingInfoNew: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s | 168 | getSchedulingInfoNew: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s |
| 169 | + getSchedulingInfoPlan: http://58.34.47.74:9089/webservice/rest/schedule/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s | ||
| 169 | config: | 170 | config: |
| 170 | password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464 | 171 | password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464 |
| 171 | # 随机字符串 | 172 | # 随机字符串 |
Bsth-admin/src/main/resources/mapper/driver_scheduling/DriverSchedulingMapper.xml
Bsth-admin/src/main/resources/mapper/key/location/LinggangKeyWorkLocationMapper.xml
| @@ -33,6 +33,14 @@ | @@ -33,6 +33,14 @@ | ||
| 33 | ) | 33 | ) |
| 34 | </select> | 34 | </select> |
| 35 | 35 | ||
| 36 | + <select id="listRecent" resultMap="BaseResultMap"> | ||
| 37 | + select <include refid="columns"></include> from key_work_location | ||
| 38 | + where 1=1 and | ||
| 39 | + <foreach collection="localtions" open="(" close=")" separator="or " item="item"> | ||
| 40 | + <include refid="where"></include> | ||
| 41 | + </foreach> | ||
| 42 | + </select> | ||
| 43 | + | ||
| 36 | <sql id="columns"> | 44 | <sql id="columns"> |
| 37 | id | 45 | id |
| 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 | 46 | , 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 |