Commit 08088c357187184245449facb32e53293a8c6a16
1 parent
fac64741
酒测未通过审核
Showing
6 changed files
with
94 additions
and
46 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
| @@ -749,6 +749,7 @@ public class KeyBoxController extends BaseController { | @@ -749,6 +749,7 @@ public class KeyBoxController extends BaseController { | ||
| 749 | location.setScheduleDate(DateUtil.shortDate(dto.getTime())); | 749 | location.setScheduleDate(DateUtil.shortDate(dto.getTime())); |
| 750 | location.setType(item.getState()); | 750 | location.setType(item.getState()); |
| 751 | location.setPlate(item.getPlate()); | 751 | location.setPlate(item.getPlate()); |
| 752 | + location.setTime(dto.getTime()); | ||
| 752 | if (CollectionUtils.isNotEmpty(schedulings)) { | 753 | if (CollectionUtils.isNotEmpty(schedulings)) { |
| 753 | Optional<LinggangKeyWorkLocation> opt = schedulings.stream().filter(s -> Objects.equals(item.getKey(), s.getCabinetNo())).findFirst(); | 754 | Optional<LinggangKeyWorkLocation> opt = schedulings.stream().filter(s -> Objects.equals(item.getKey(), s.getCabinetNo())).findFirst(); |
| 754 | if (opt.isPresent()) { | 755 | if (opt.isPresent()) { |
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/LinggangKeyWorkLocation.java
| @@ -114,6 +114,12 @@ public class LinggangKeyWorkLocation { | @@ -114,6 +114,12 @@ public class LinggangKeyWorkLocation { | ||
| 114 | @TableField(exist = false) | 114 | @TableField(exist = false) |
| 115 | private Set<Integer> types; | 115 | private Set<Integer> types; |
| 116 | 116 | ||
| 117 | + @TableField(exist = false) | ||
| 118 | + private Date time; | ||
| 119 | + | ||
| 120 | + @TableField(exist = false) | ||
| 121 | + private Long zdsjT; | ||
| 122 | + | ||
| 117 | 123 | ||
| 118 | public enum LinggangKeyWorkLocationEventTypeEnum { | 124 | public enum LinggangKeyWorkLocationEventTypeEnum { |
| 119 | TAKE_OUT(0, "取出"), | 125 | TAKE_OUT(0, "取出"), |
Bsth-admin/src/main/java/com/ruoyi/job/DriverJob.java
| @@ -271,15 +271,6 @@ public class DriverJob implements InitializingBean { | @@ -271,15 +271,6 @@ public class DriverJob implements InitializingBean { | ||
| 271 | LinggangScheduling scheduling = new LinggangScheduling(); | 271 | LinggangScheduling scheduling = new LinggangScheduling(); |
| 272 | scheduling.setStartScheduleDate(DateUtil.shortDate(date)); | 272 | scheduling.setStartScheduleDate(DateUtil.shortDate(date)); |
| 273 | scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); | 273 | scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); |
| 274 | - scheduling.setType(type); | ||
| 275 | - if(Objects.isNull(schedulingService)){ | ||
| 276 | - schedulingService = SpringUtils.getBean(LinggangSchedulingService.class); | ||
| 277 | - } | ||
| 278 | - Integer count = schedulingService.countId(scheduling); | ||
| 279 | - if (Objects.nonNull(count) && count > 0) { | ||
| 280 | - log.info("[{}]排班数据已经存在", date); | ||
| 281 | - return; | ||
| 282 | - } | ||
| 283 | 274 | ||
| 284 | Set<Long> idSets = null; | 275 | Set<Long> idSets = null; |
| 285 | if (isSameDay) { | 276 | if (isSameDay) { |
| @@ -291,6 +282,18 @@ public class DriverJob implements InitializingBean { | @@ -291,6 +282,18 @@ public class DriverJob implements InitializingBean { | ||
| 291 | } | 282 | } |
| 292 | } | 283 | } |
| 293 | 284 | ||
| 285 | + scheduling.setType(type); | ||
| 286 | + if(Objects.isNull(schedulingService)){ | ||
| 287 | + schedulingService = SpringUtils.getBean(LinggangSchedulingService.class); | ||
| 288 | + } | ||
| 289 | + Integer count = schedulingService.countId(scheduling); | ||
| 290 | + if (Objects.nonNull(count) && count > 0) { | ||
| 291 | + log.info("[{}]排班数据已经存在", date); | ||
| 292 | + return; | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + | ||
| 296 | + | ||
| 294 | 297 | ||
| 295 | // String url = getSchedulingInfoPlan; | 298 | // String url = getSchedulingInfoPlan; |
| 296 | try { | 299 | try { |
Bsth-admin/src/main/java/com/ruoyi/mapper/key/location/LinggangKeyWorkLocationMapper.java
| @@ -6,7 +6,9 @@ import org.apache.ibatis.annotations.Mapper; | @@ -6,7 +6,9 @@ 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.Collection; |
| 9 | +import java.util.Date; | ||
| 9 | import java.util.List; | 10 | import java.util.List; |
| 11 | +import java.util.Map; | ||
| 10 | 12 | ||
| 11 | 13 | ||
| 12 | @Mapper | 14 | @Mapper |
| @@ -20,4 +22,6 @@ public interface LinggangKeyWorkLocationMapper extends BaseMapper<LinggangKeyWor | @@ -20,4 +22,6 @@ public interface LinggangKeyWorkLocationMapper extends BaseMapper<LinggangKeyWor | ||
| 20 | List<LinggangKeyWorkLocation> listOfDeviceKeyIdScheduleDate(@Param("localtions") List<LinggangKeyWorkLocation> locations); | 22 | List<LinggangKeyWorkLocation> listOfDeviceKeyIdScheduleDate(@Param("localtions") List<LinggangKeyWorkLocation> locations); |
| 21 | 23 | ||
| 22 | List<LinggangKeyWorkLocation> listRecent(@Param("localtions") Collection<LinggangKeyWorkLocation> locations); | 24 | List<LinggangKeyWorkLocation> listRecent(@Param("localtions") Collection<LinggangKeyWorkLocation> locations); |
| 25 | + | ||
| 26 | + List<LinggangKeyWorkLocation> listRecentDates(@Param("keyInfoIds") Collection<Integer> keyInfoIds, @Param("dates")List<Map<String, Date>> dates); | ||
| 23 | } | 27 | } |
| 24 | \ No newline at end of file | 28 | \ No newline at end of file |
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/location/LinggangKeyWorkLocationServiceImpl.java
| @@ -77,7 +77,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -77,7 +77,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 77 | LambdaQueryWrapper<LinggangKeyWorkLocation> countWrapper = new LambdaQueryWrapper<>(entity); | 77 | LambdaQueryWrapper<LinggangKeyWorkLocation> countWrapper = new LambdaQueryWrapper<>(entity); |
| 78 | countWrapper.select(LinggangKeyWorkLocation::getId); | 78 | countWrapper.select(LinggangKeyWorkLocation::getId); |
| 79 | switchTime(entity, countWrapper); | 79 | switchTime(entity, countWrapper); |
| 80 | - switchTypes(entity,countWrapper); | 80 | + switchTypes(entity, countWrapper); |
| 81 | int count = count(countWrapper); | 81 | int count = count(countWrapper); |
| 82 | 82 | ||
| 83 | List<LinggangKeyWorkLocation> lists = Collections.emptyList(); | 83 | List<LinggangKeyWorkLocation> lists = Collections.emptyList(); |
| @@ -85,7 +85,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -85,7 +85,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 85 | PageHelper.startPage((int) page.getCurrent(), (int) page.getSize(), false); | 85 | PageHelper.startPage((int) page.getCurrent(), (int) page.getSize(), false); |
| 86 | LambdaQueryWrapper<LinggangKeyWorkLocation> selectWrapper = new LambdaQueryWrapper<>(entity); | 86 | LambdaQueryWrapper<LinggangKeyWorkLocation> selectWrapper = new LambdaQueryWrapper<>(entity); |
| 87 | switchTime(entity, selectWrapper); | 87 | switchTime(entity, selectWrapper); |
| 88 | - switchTypes(entity,selectWrapper); | 88 | + switchTypes(entity, selectWrapper); |
| 89 | orderColumn(selectWrapper, orderEntity); | 89 | orderColumn(selectWrapper, orderEntity); |
| 90 | lists = list(selectWrapper); | 90 | lists = list(selectWrapper); |
| 91 | } | 91 | } |
| @@ -110,9 +110,9 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -110,9 +110,9 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | - private static void switchTypes(LinggangKeyWorkLocation entity, LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper){ | ||
| 114 | - if(CollectionUtils.isNotEmpty(entity.getTypes())){ | ||
| 115 | - wrapper.in(LinggangKeyWorkLocation::getType,entity.getTypes()); | 113 | + private static void switchTypes(LinggangKeyWorkLocation entity, LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper) { |
| 114 | + if (CollectionUtils.isNotEmpty(entity.getTypes())) { | ||
| 115 | + wrapper.in(LinggangKeyWorkLocation::getType, entity.getTypes()); | ||
| 116 | } | 116 | } |
| 117 | } | 117 | } |
| 118 | 118 | ||
| @@ -120,7 +120,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -120,7 +120,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 120 | public List<LinggangKeyWorkLocation> list(LinggangKeyWorkLocation entity) { | 120 | public List<LinggangKeyWorkLocation> list(LinggangKeyWorkLocation entity) { |
| 121 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity); | 121 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity); |
| 122 | switchTime(entity, wrapper); | 122 | switchTime(entity, wrapper); |
| 123 | - switchTypes(entity,wrapper); | 123 | + switchTypes(entity, wrapper); |
| 124 | return list(wrapper); | 124 | return list(wrapper); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| @@ -136,15 +136,15 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -136,15 +136,15 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 136 | @Override | 136 | @Override |
| 137 | public List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity, Collection<Long> schedulingIds) { | 137 | public List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity, Collection<Long> schedulingIds) { |
| 138 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = null; | 138 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = null; |
| 139 | - if(Objects.isNull(entity)){ | 139 | + if (Objects.isNull(entity)) { |
| 140 | wrapper = new LambdaQueryWrapper<>(); | 140 | wrapper = new LambdaQueryWrapper<>(); |
| 141 | - }else { | 141 | + } else { |
| 142 | wrapper = new LambdaQueryWrapper<>(entity); | 142 | wrapper = new LambdaQueryWrapper<>(entity); |
| 143 | } | 143 | } |
| 144 | switchTime(entity, wrapper); | 144 | switchTime(entity, wrapper); |
| 145 | 145 | ||
| 146 | - if(CollectionUtils.isNotEmpty(schedulingIds)){ | ||
| 147 | - wrapper.in(LinggangKeyWorkLocation::getSchedulingId,schedulingIds); | 146 | + if (CollectionUtils.isNotEmpty(schedulingIds)) { |
| 147 | + wrapper.in(LinggangKeyWorkLocation::getSchedulingId, schedulingIds); | ||
| 148 | } | 148 | } |
| 149 | return list(wrapper); | 149 | return list(wrapper); |
| 150 | } | 150 | } |
| @@ -192,22 +192,27 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -192,22 +192,27 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 192 | return linggangKeyWorkLocationMapper.listRecent(locations); | 192 | return linggangKeyWorkLocationMapper.listRecent(locations); |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | - private List<LinggangKeyWorkLocation> listRecentDates(Collection<Date> dates,Set<Integer> keyInfoIds) { | 195 | + private List<LinggangKeyWorkLocation> listRecentDates(Collection<Date> dates, Set<Integer> keyInfoIds) { |
| 196 | if (CollectionUtils.isEmpty(dates)) { | 196 | if (CollectionUtils.isEmpty(dates)) { |
| 197 | return Collections.emptyList(); | 197 | return Collections.emptyList(); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | - LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(); | ||
| 201 | - if(CollectionUtils.isNotEmpty(keyInfoIds)){ | ||
| 202 | - wrapper.in(LinggangKeyWorkLocation::getKeyInfoId,keyInfoIds); | 200 | + if (CollectionUtils.isEmpty(keyInfoIds)) { |
| 201 | + keyInfoIds = null; | ||
| 203 | } | 202 | } |
| 203 | + | ||
| 204 | + List<Map<String,Date>> dateMaps = new ArrayList<>(); | ||
| 204 | for (Date date : dates) { | 205 | for (Date date : dates) { |
| 205 | - Date endDate = DateUtils.addDays(date,1); | ||
| 206 | - wrapper.or().between(LinggangKeyWorkLocation::getScheduleDate,date,endDate); | 206 | + Date endDate = DateUtils.addDays(date, 1); |
| 207 | + | ||
| 208 | + Map<String,Date> maps = new HashMap<>(); | ||
| 209 | + maps.put("startDate",date); | ||
| 210 | + maps.put("endDate",endDate); | ||
| 211 | + dateMaps.add(maps); | ||
| 207 | 212 | ||
| 208 | } | 213 | } |
| 209 | 214 | ||
| 210 | - return list(wrapper); | 215 | + return linggangKeyWorkLocationMapper.listRecentDates(keyInfoIds,dateMaps); |
| 211 | } | 216 | } |
| 212 | 217 | ||
| 213 | // @Override | 218 | // @Override |
| @@ -268,22 +273,22 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -268,22 +273,22 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 268 | 273 | ||
| 269 | @Override | 274 | @Override |
| 270 | @Transactional(rollbackFor = Exception.class) | 275 | @Transactional(rollbackFor = Exception.class) |
| 271 | - public boolean insertJob(String timeStr,Set<Long> schedulingIds) { | 276 | + public boolean insertJob(String timeStr, Set<Long> schedulingIds) { |
| 272 | try { | 277 | try { |
| 273 | - if(CollectionUtils.isNotEmpty(schedulingIds)){ | ||
| 274 | - List<LinggangKeyWorkLocation> workLocations = listRecent(null,schedulingIds); | ||
| 275 | - if(CollectionUtils.isNotEmpty(workLocations)){ | ||
| 276 | - Set<Long> ids = workLocations.stream().map(LinggangKeyWorkLocation::getId).collect(Collectors.toSet()); | ||
| 277 | - if(CollectionUtils.isNotEmpty(ids)){ | ||
| 278 | - removeByIds(ids); | ||
| 279 | - } | ||
| 280 | - } | 278 | + if (CollectionUtils.isNotEmpty(schedulingIds)) { |
| 279 | + List<LinggangKeyWorkLocation> workLocations = listRecent(null, schedulingIds); | ||
| 280 | + if (CollectionUtils.isNotEmpty(workLocations)) { | ||
| 281 | + Set<Long> ids = workLocations.stream().map(LinggangKeyWorkLocation::getId).collect(Collectors.toSet()); | ||
| 282 | + if (CollectionUtils.isNotEmpty(ids)) { | ||
| 283 | + removeByIds(ids); | ||
| 284 | + } | ||
| 285 | + } | ||
| 281 | } | 286 | } |
| 282 | 287 | ||
| 283 | Date date = DateUtil.YYYY_MM_DD_LINK.parse(timeStr); | 288 | Date date = DateUtil.YYYY_MM_DD_LINK.parse(timeStr); |
| 284 | LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation(); | 289 | LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation(); |
| 285 | workLocation.setStartScheduleDate(date); | 290 | workLocation.setStartScheduleDate(date); |
| 286 | - workLocation.setEndScheduleDate(DateUtils.addDays(date,1)); | 291 | + workLocation.setEndScheduleDate(DateUtils.addDays(date, 1)); |
| 287 | Integer count = countId(workLocation); | 292 | Integer count = countId(workLocation); |
| 288 | if (Objects.nonNull(count) && count > 0) { | 293 | if (Objects.nonNull(count) && count > 0) { |
| 289 | log.error("当天的数据已经存在:[{}];[{}]", timeStr, count); | 294 | log.error("当天的数据已经存在:[{}];[{}]", timeStr, count); |
| @@ -353,8 +358,9 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -353,8 +358,9 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 353 | 358 | ||
| 354 | public boolean update(LinggangKeyWorkLocation location) { | 359 | public boolean update(LinggangKeyWorkLocation location) { |
| 355 | LambdaUpdateWrapper<LinggangKeyWorkLocation> wrapper = new LambdaUpdateWrapper<>(); | 360 | LambdaUpdateWrapper<LinggangKeyWorkLocation> wrapper = new LambdaUpdateWrapper<>(); |
| 356 | - wrapper.set(LinggangKeyWorkLocation::getEventType, location.getEventType()).set(LinggangKeyWorkLocation::getUpdateTime, new Date()).set(LinggangKeyWorkLocation::getType, location.getType()); | ||
| 357 | - wrapper.eq(LinggangKeyWorkLocation::getId, location.getId()).ne(LinggangKeyWorkLocation::getType, location.getType()); | 361 | + wrapper.set(LinggangKeyWorkLocation::getEventType, location.getEventType()).set(LinggangKeyWorkLocation::getUpdateTime, new Date()) |
| 362 | + .set(LinggangKeyWorkLocation::getType, location.getType()).set(LinggangKeyWorkLocation::getDevice,location.getDevice()); | ||
| 363 | + wrapper.eq(LinggangKeyWorkLocation::getId, location.getId()); | ||
| 358 | 364 | ||
| 359 | return update(wrapper); | 365 | return update(wrapper); |
| 360 | } | 366 | } |
| @@ -438,27 +444,26 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -438,27 +444,26 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 438 | 444 | ||
| 439 | 445 | ||
| 440 | private ResponseResult<List<LinggangKeyWorkLocation>> checkTaskKey(List<LinggangKeyWorkLocation> locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum typeEnum) { | 446 | private ResponseResult<List<LinggangKeyWorkLocation>> checkTaskKey(List<LinggangKeyWorkLocation> locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum typeEnum) { |
| 441 | - Set<Integer> keyCodes = locations.stream().filter(l->Objects.nonNull(l.getKeyInfoId())).map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet()); | 447 | + Set<Integer> keyCodes = locations.stream().filter(l -> Objects.nonNull(l.getKeyInfoId())).map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet()); |
| 442 | 448 | ||
| 443 | List<KeyInfo> keyInfos = null; | 449 | List<KeyInfo> keyInfos = null; |
| 444 | - if(CollectionUtils.isNotEmpty(keyCodes)){ | 450 | + if (CollectionUtils.isNotEmpty(keyCodes)) { |
| 445 | keyInfos = keyInfoService.listByIds(keyCodes); | 451 | keyInfos = keyInfoService.listByIds(keyCodes); |
| 446 | } | 452 | } |
| 447 | 453 | ||
| 448 | Set<Integer> keyIds = null; | 454 | Set<Integer> keyIds = null; |
| 449 | Set<String> plates = locations.stream().map(LinggangKeyWorkLocation::getPlate).collect(Collectors.toSet()); | 455 | Set<String> plates = locations.stream().map(LinggangKeyWorkLocation::getPlate).collect(Collectors.toSet()); |
| 450 | - if(CollectionUtils.isNotEmpty(plates)){ | 456 | + if (CollectionUtils.isNotEmpty(plates)) { |
| 451 | keyInfos = keyInfoService.listPlateNums(plates); | 457 | keyInfos = keyInfoService.listPlateNums(plates); |
| 452 | - if(CollectionUtils.isNotEmpty(keyInfos)){ | 458 | + if (CollectionUtils.isNotEmpty(keyInfos)) { |
| 453 | keyIds = keyInfos.stream().map(KeyInfo::getId).collect(Collectors.toSet()); | 459 | keyIds = keyInfos.stream().map(KeyInfo::getId).collect(Collectors.toSet()); |
| 454 | } | 460 | } |
| 455 | } | 461 | } |
| 456 | 462 | ||
| 457 | - | ||
| 458 | Set<Date> dates = locations.stream().map(LinggangKeyWorkLocation::getScheduleDate).collect(Collectors.toSet()); | 463 | Set<Date> dates = locations.stream().map(LinggangKeyWorkLocation::getScheduleDate).collect(Collectors.toSet()); |
| 459 | 464 | ||
| 460 | 465 | ||
| 461 | - List<LinggangKeyWorkLocation> sources = listRecentDates(dates,keyIds).stream().filter(s -> !Objects.equals(s.getType(), typeEnum.getValue())).collect(Collectors.toList()); | 466 | + List<LinggangKeyWorkLocation> sources = listRecentDates(dates, keyIds).stream().filter(s -> !Objects.equals(s.getType(), typeEnum.getValue())).collect(Collectors.toList()); |
| 462 | if (CollectionUtils.isEmpty(sources)) { | 467 | if (CollectionUtils.isEmpty(sources)) { |
| 463 | return ResponseResult.error404("无法找到钥匙归还信息"); | 468 | return ResponseResult.error404("无法找到钥匙归还信息"); |
| 464 | } | 469 | } |
| @@ -481,6 +486,13 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -481,6 +486,13 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 481 | return s; | 486 | return s; |
| 482 | }).collect(Collectors.toList()); | 487 | }).collect(Collectors.toList()); |
| 483 | 488 | ||
| 489 | + Set<Long> schedulingIds = sources.stream().map(LinggangKeyWorkLocation::getSchedulingId).collect(Collectors.toSet()); | ||
| 490 | + List<LinggangScheduling> schedulings = schedulingService.listByIds(schedulingIds); | ||
| 491 | + if (CollectionUtils.isEmpty(schedulings)) { | ||
| 492 | + return ResponseResult.error404("无法找到排班信息"); | ||
| 493 | + } | ||
| 494 | + | ||
| 495 | + | ||
| 484 | List<LinggangKeyWorkLocation> workLocations = sources; | 496 | List<LinggangKeyWorkLocation> workLocations = sources; |
| 485 | 497 | ||
| 486 | locations = locations.stream().map(l -> { | 498 | locations = locations.stream().map(l -> { |
| @@ -491,8 +503,14 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -491,8 +503,14 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 491 | if (optional.isPresent()) { | 503 | if (optional.isPresent()) { |
| 492 | l.setId(optional.get().getId()); | 504 | l.setId(optional.get().getId()); |
| 493 | } | 505 | } |
| 506 | + Optional<LinggangScheduling> scheOpt = schedulings.stream().filter(s1->Objects.equals(s1.getId(),l.getSchedulingId())).findFirst(); | ||
| 507 | + if(scheOpt.isPresent()){ | ||
| 508 | + if(l.getTime().getTime()<scheOpt.get().getZdsjT()){ | ||
| 509 | + return null; | ||
| 510 | + } | ||
| 511 | + } | ||
| 494 | return l; | 512 | return l; |
| 495 | - }).collect(Collectors.toList()); | 513 | + }).filter(obj->Objects.nonNull(obj)).collect(Collectors.toList()); |
| 496 | 514 | ||
| 497 | 515 | ||
| 498 | return ResponseResult.success(locations); | 516 | return ResponseResult.success(locations); |
| @@ -765,7 +783,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -765,7 +783,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 765 | private List<LinggangScheduling> querySchedulingByTiime(Date date) { | 783 | private List<LinggangScheduling> querySchedulingByTiime(Date date) { |
| 766 | LinggangScheduling scheduling = new LinggangScheduling(); | 784 | LinggangScheduling scheduling = new LinggangScheduling(); |
| 767 | scheduling.setStartScheduleDate(DateUtil.shortDate(date)); | 785 | scheduling.setStartScheduleDate(DateUtil.shortDate(date)); |
| 768 | - scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(),1)); | 786 | + scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); |
| 769 | scheduling.setBcType(BC_TYPE_OUT); | 787 | scheduling.setBcType(BC_TYPE_OUT); |
| 770 | List<LinggangScheduling> schedulings = schedulingService.list(scheduling); | 788 | List<LinggangScheduling> schedulings = schedulingService.list(scheduling); |
| 771 | if (CollectionUtils.isEmpty(schedulings)) { | 789 | if (CollectionUtils.isEmpty(schedulings)) { |
Bsth-admin/src/main/resources/mapper/key/location/LinggangKeyWorkLocationMapper.xml
| @@ -40,6 +40,22 @@ | @@ -40,6 +40,22 @@ | ||
| 40 | <include refid="where"></include> | 40 | <include refid="where"></include> |
| 41 | </foreach> | 41 | </foreach> |
| 42 | </select> | 42 | </select> |
| 43 | + <select id="listRecentDates" resultType="com.ruoyi.domain.key.location.LinggangKeyWorkLocation"> | ||
| 44 | + select <include refid="columns"></include> from key_work_location | ||
| 45 | + where 1=1 | ||
| 46 | + <if test="null != keyInfoIds"> | ||
| 47 | + and key_info_id in | ||
| 48 | + <foreach collection="keyInfoIds" item="item" separator="," open="(" close=")">#{item}</foreach> | ||
| 49 | + </if> | ||
| 50 | + | ||
| 51 | + <if test="null!=dates"> | ||
| 52 | + and ( | ||
| 53 | + <foreach collection="dates" item="item" separator="or " open="(" close=")"> | ||
| 54 | + schedule_date between #{item.startDate} and #{item.endDate} | ||
| 55 | + </foreach> | ||
| 56 | + ) | ||
| 57 | + </if> | ||
| 58 | + </select> | ||
| 43 | 59 | ||
| 44 | <sql id="columns"> | 60 | <sql id="columns"> |
| 45 | id | 61 | id |