Commit da3efa1fe230aca6bc914cfa1474568062c3ea7e
1 parent
a838eb45
修改打卡信息
Showing
2 changed files
with
42 additions
and
10 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
| ... | ... | @@ -189,6 +189,13 @@ public class KeyBoxController extends BaseController { |
| 189 | 189 | keyInfoIds = workLocations.stream().map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet()); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | + int hour = dto.getTime().getHours(); | |
| 193 | + | |
| 194 | + | |
| 195 | + if (hour < 3) { | |
| 196 | + dto.setTime(DateUtils.addDays(dto.getTime(), -1)); | |
| 197 | + } | |
| 198 | + | |
| 192 | 199 | List<KeyInfo> keyInfos = queryKeyInfos(keyInfoIds); |
| 193 | 200 | |
| 194 | 201 | LinggangScheduling scheduling = new LinggangScheduling(); |
| ... | ... | @@ -201,6 +208,7 @@ public class KeyBoxController extends BaseController { |
| 201 | 208 | Set<String> jobCodes = null; |
| 202 | 209 | Set<String> nbbms = null; |
| 203 | 210 | |
| 211 | + | |
| 204 | 212 | if (CollectionUtils.isNotEmpty(schedulings)) { |
| 205 | 213 | jobCodes = schedulings.stream().map(LinggangScheduling::getJobCode).collect(Collectors.toSet()); |
| 206 | 214 | nbbms = schedulings.stream().map(LinggangScheduling::getNbbm).collect(Collectors.toSet()); |
| ... | ... | @@ -444,11 +452,11 @@ public class KeyBoxController extends BaseController { |
| 444 | 452 | keyInfo.setPlateNum(dto.getPlate()); |
| 445 | 453 | keyInfos = keyInfoService.listLikePlate(keyInfo); |
| 446 | 454 | if (CollectionUtils.isNotEmpty(keyInfos)) { |
| 447 | - keyInfoIds = keyInfos.stream().map(KeyInfo::getId).collect(Collectors.toSet()); | |
| 448 | - } else { | |
| 449 | - keyInfoIds = new HashSet<>(); | |
| 450 | - keyInfoIds.add(-10000); | |
| 451 | - } | |
| 455 | + keyInfoIds = keyInfos.stream().map(KeyInfo::getId).collect(Collectors.toSet()); | |
| 456 | + } else { | |
| 457 | + keyInfoIds = new HashSet<>(); | |
| 458 | + keyInfoIds.add(-10000); | |
| 459 | + } | |
| 452 | 460 | |
| 453 | 461 | } |
| 454 | 462 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| ... | ... | @@ -546,7 +546,8 @@ public class ThreadJobService { |
| 546 | 546 | scheduling.setType(b.getType()); |
| 547 | 547 | |
| 548 | 548 | return scheduling; |
| 549 | - }).collect(Collectors.toList()); | |
| 549 | + }).filter(s->StringUtils.isBlank(s.getJobCode()) && StringUtils.isBlank(s.getName()) && !StringUtils.equalsAnyIgnoreCase(s.getJobCode(),"null") | |
| 550 | + && !StringUtils.equalsAnyIgnoreCase(s.getName(),"null")).collect(Collectors.toList()); | |
| 550 | 551 | if (CollectionUtils.isNotEmpty(schedulings)) { |
| 551 | 552 | Map<String, List<LinggangScheduling>> distinctMap = new HashMap<>(); |
| 552 | 553 | schedulings.stream().forEach(s -> { |
| ... | ... | @@ -586,16 +587,34 @@ public class ThreadJobService { |
| 586 | 587 | |
| 587 | 588 | List<LinggangScheduling> sourceList = schedulingService.list(scheduling); |
| 588 | 589 | if (CollectionUtils.isNotEmpty(sourceList)) { |
| 590 | + | |
| 591 | + List<LinggangScheduling> schedulings1 = schedulings; | |
| 592 | + List<LinggangScheduling> removeSchedulings = sourceList.stream().filter(s->{ | |
| 593 | + Optional<LinggangScheduling> opt = schedulings1.stream().filter(s1 -> s1.importEqus(s)).findFirst(); | |
| 594 | + if (!opt.isPresent()) { | |
| 595 | + log.debug("需要删除的排班数据:[{}]", s); | |
| 596 | + } | |
| 597 | + return !opt.isPresent() && Objects.isNull(s.getSignInId()); | |
| 598 | + }).collect(Collectors.toList()); | |
| 599 | + if(CollectionUtils.isNotEmpty(removeSchedulings)){ | |
| 600 | + Set<Long> ids = removeSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet()); | |
| 601 | + schedulingService.removeByIds(ids); | |
| 602 | + } | |
| 603 | + | |
| 589 | 604 | schedulings = schedulings.stream().filter(s -> { |
| 590 | 605 | Optional<LinggangScheduling> opt = sourceList.stream().filter(s1 -> s1.importEqus(s)).findFirst(); |
| 591 | - if(opt.isPresent()){ | |
| 592 | - log.debug("排班数据已经存在:[{}]",s); | |
| 606 | + if (opt.isPresent()) { | |
| 607 | + log.debug("排班数据已经存在:[{}]", s); | |
| 593 | 608 | } |
| 594 | 609 | return !opt.isPresent(); |
| 595 | 610 | }).filter(s -> Objects.nonNull(s)).collect(Collectors.toList()); |
| 596 | 611 | } |
| 597 | 612 | |
| 598 | - if(CollectionUtils.isNotEmpty(schedulings)) { | |
| 613 | + if (CollectionUtils.isNotEmpty(schedulings)) { | |
| 614 | + List<LinggangScheduling> schedulings1 = schedulings.stream().filter(s->StringUtils.isBlank(s.getJobCode()) || StringUtils.isBlank(s.getName())).collect(Collectors.toList()); | |
| 615 | + if(CollectionUtils.isNotEmpty(schedulings1)){ | |
| 616 | + System.out.println("bbbbbbbbbbb"); | |
| 617 | + } | |
| 599 | 618 | schedulingService.saveBatch(schedulings); |
| 600 | 619 | } |
| 601 | 620 | } |
| ... | ... | @@ -619,7 +638,12 @@ public class ThreadJobService { |
| 619 | 638 | schedulingService.removeByIds(idSets); |
| 620 | 639 | } |
| 621 | 640 | |
| 622 | - if(CollectionUtils.isNotEmpty(schedulings)) { | |
| 641 | + LinggangScheduling linggangScheduling = new LinggangScheduling(); | |
| 642 | + linggangScheduling.setStartScheduleDate(date); | |
| 643 | + linggangScheduling.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(date, 1)); | |
| 644 | + | |
| 645 | + | |
| 646 | + if (CollectionUtils.isNotEmpty(schedulings)) { | |
| 623 | 647 | keyWorkLocationService.insertJob(dateStr1, schedulings, null); |
| 624 | 648 | } |
| 625 | 649 | log.info("当天排班数据获取完毕,共:{}条", bcList.size()); | ... | ... |