Commit cb1a916dac65a64c265085acc819dd05c98abfd9
1 parent
b73e485d
蓝斯二期
Showing
15 changed files
with
191 additions
and
80 deletions
Bsth-admin/sql/DDL.sql
| 1 | 1 | ALTER TABLE key_work_location ADD type1 INT NULL COMMENT '状态:1 是归还;0是借出;2是初始状态'; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -ALTER TABLE scheduling ADD alcohol_count INT DEFAULT 2 NULL COMMENT '酒测次数'; | |
| 5 | 4 | \ No newline at end of file |
| 5 | +ALTER TABLE scheduling ADD alcohol_count INT DEFAULT 2 NULL COMMENT '酒测次数'; | |
| 6 | + | |
| 7 | + | |
| 8 | +ALTER TABLE key_work_location ADD `time` DATETIME NULL; | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
| ... | ... | @@ -26,6 +26,8 @@ import com.ruoyi.domain.venue.info.LinggangVenueInfo; |
| 26 | 26 | import com.ruoyi.equipment.domain.Equipment; |
| 27 | 27 | import com.ruoyi.equipment.service.IEquipmentService; |
| 28 | 28 | import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; |
| 29 | +import com.ruoyi.scheduling.domain.SchedulingDateEntity; | |
| 30 | +import com.ruoyi.scheduling.service.SchedulingServiceV1; | |
| 29 | 31 | import com.ruoyi.service.carinfo.CarInfoService; |
| 30 | 32 | import com.ruoyi.service.driver.NewDriverService; |
| 31 | 33 | import com.ruoyi.service.dss.KeyBoxVoService; |
| ... | ... | @@ -83,6 +85,8 @@ public class KeyBoxController extends BaseController { |
| 83 | 85 | private NewDriverService newDriverService; |
| 84 | 86 | @Autowired |
| 85 | 87 | private LinggangVenueInfoService venueInfoService; |
| 88 | + @Autowired | |
| 89 | + private SchedulingServiceV1 schedulingServiceV1; | |
| 86 | 90 | |
| 87 | 91 | @PostMapping(value = "/keybox/findKey") |
| 88 | 92 | @ApiOperation("钥匙信息查询") |
| ... | ... | @@ -285,7 +289,7 @@ public class KeyBoxController extends BaseController { |
| 285 | 289 | // return ResponseResult.error404(); |
| 286 | 290 | // } |
| 287 | 291 | |
| 288 | - List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver, keyInfos,0); | |
| 292 | + List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver, keyInfos, 0); | |
| 289 | 293 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.TAKE_OUT); |
| 290 | 294 | if (Objects.isNull(responseResult)) { |
| 291 | 295 | return ResponseResult.error(); |
| ... | ... | @@ -335,7 +339,7 @@ public class KeyBoxController extends BaseController { |
| 335 | 339 | } |
| 336 | 340 | |
| 337 | 341 | |
| 338 | - List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver, keyInfos,1); | |
| 342 | + List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver, keyInfos, 1); | |
| 339 | 343 | // List<LinggangKeyWorkLocation> errorLocations = locations.stream().filter(l -> Objects.isNull(l.getKeyInfoId())).collect(Collectors.toList()); |
| 340 | 344 | // locations = locations.stream().filter(l -> Objects.nonNull(l.getKeyInfoId())).collect(Collectors.toList()); |
| 341 | 345 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.REPAY); |
| ... | ... | @@ -431,22 +435,6 @@ public class KeyBoxController extends BaseController { |
| 431 | 435 | } |
| 432 | 436 | |
| 433 | 437 | if (StringUtils.isNotEmpty(dto.getPlate())) { |
| 434 | -// CarInfo carInfo = new CarInfo(); | |
| 435 | -// carInfo.setNbbm(dto.getPlate()); | |
| 436 | -// List<CarInfo> carInfos = carInfoService.listLikeNbbs(carInfo); | |
| 437 | -// if (CollectionUtils.isEmpty(carInfos)) { | |
| 438 | -// keyInfoIds = new HashSet<>(); | |
| 439 | -// keyInfoIds.add(-10000); | |
| 440 | -// } else { | |
| 441 | -// Set<String> plateNums = carInfos.stream().map(CarInfo::getPlateNum).collect(Collectors.toSet()); | |
| 442 | -// keyInfos = keyInfoService.listPlateNums(plateNums); | |
| 443 | -// if (CollectionUtils.isNotEmpty(keyInfos)) { | |
| 444 | -// keyInfoIds = keyInfos.stream().map(KeyInfo::getId).collect(Collectors.toSet()); | |
| 445 | -// } else { | |
| 446 | -// keyInfoIds = new HashSet<>(); | |
| 447 | -// keyInfoIds.add(-10000); | |
| 448 | -// } | |
| 449 | -// } | |
| 450 | 438 | |
| 451 | 439 | KeyInfo keyInfo = new KeyInfo(); |
| 452 | 440 | keyInfo.setPlateNum(dto.getPlate()); |
| ... | ... | @@ -492,10 +480,6 @@ public class KeyBoxController extends BaseController { |
| 492 | 480 | locationEq.setKeyInfoIds(keyInfoIds); |
| 493 | 481 | locationEq.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(locationEq.getStartScheduleDate(), 1)); |
| 494 | 482 | |
| 495 | -// Set<Integer> types = new HashSet<>(); | |
| 496 | -// types.add(1); | |
| 497 | -// types.add(0); | |
| 498 | -// locationEq.setTypes(types); | |
| 499 | 483 | |
| 500 | 484 | IPage<LinggangKeyWorkLocation> page = linggangKeyWorkLocationService.pageList(new Page<>(dto.getPageNum(), dto.getPageSize()), locationEq, new OrderEntity()); |
| 501 | 485 | |
| ... | ... | @@ -505,20 +489,31 @@ public class KeyBoxController extends BaseController { |
| 505 | 489 | List<Equipment> yarnCabinetStateEqus = Collections.emptyList(); |
| 506 | 490 | |
| 507 | 491 | if (Objects.nonNull(page) && CollectionUtils.isNotEmpty(page.getRecords())) { |
| 492 | + Set<Integer> keyIds = page.getRecords().stream().map(LinggangKeyWorkLocation::getKeyInfoId).collect(Collectors.toSet()); | |
| 493 | + Collection<KeyInfo> keyInfos1 = keyInfoService.listByIds(keyIds); | |
| 494 | + if (CollectionUtils.isNotEmpty(keyInfos1)) { | |
| 495 | + Set<String> plateNums = keyInfos1.stream().map(KeyInfo::getPlateNum).collect(Collectors.toSet()); | |
| 496 | + carInfos = carInfoService.listPlateNums(plateNums); | |
| 497 | + if (CollectionUtils.isNotEmpty(carInfos)) { | |
| 498 | + Set<String> nbbms = carInfos.stream().map(CarInfo::getNbbm).collect(Collectors.toSet()); | |
| 499 | + SchedulingDateEntity schedulingDateEntity = schedulingServiceV1.switchSchedulingDate(new Date()); | |
| 500 | + | |
| 501 | + LinggangScheduling scheduling = new LinggangScheduling(); | |
| 502 | + scheduling.setStartScheduleDate(schedulingDateEntity.getStartDate()); | |
| 503 | + scheduling.setEndScheduleDate(schedulingDateEntity.getEndDate()); | |
| 504 | + | |
| 505 | + schedulings = schedulingService.listNbbm(scheduling, nbbms); | |
| 506 | + } | |
| 507 | + } | |
| 508 | 508 | |
| 509 | - | |
| 510 | - Set<String> deviceCodes = page.getRecords().stream().map(LinggangKeyWorkLocation::getDevice).collect(Collectors.toSet()); | |
| 511 | - yarnCabinetStateEqus = equipmentService.listNameAndIDBydeviceIds(deviceCodes); | |
| 512 | - | |
| 513 | - Set<Long> schedulingIds = page.getRecords().stream().map(LinggangKeyWorkLocation::getSchedulingId).collect(Collectors.toSet()); | |
| 514 | - schedulings = schedulingService.listByIds(schedulingIds); | |
| 515 | 509 | if (CollectionUtils.isNotEmpty(schedulings)) { |
| 516 | - Set<String> nbbm = schedulings.stream().map(LinggangScheduling::getNbbm).collect(Collectors.toSet()); | |
| 517 | - carInfos = carInfoService.list(nbbm); | |
| 518 | - | |
| 519 | 510 | Set<String> jobCode = schedulings.stream().map(LinggangScheduling::getJobCode).collect(Collectors.toSet()); |
| 520 | 511 | drivers = newDriverService.list(jobCode); |
| 521 | 512 | } |
| 513 | + | |
| 514 | + Set<String> deviceCodes = page.getRecords().stream().map(LinggangKeyWorkLocation::getDevice).collect(Collectors.toSet()); | |
| 515 | + yarnCabinetStateEqus = equipmentService.listNameAndIDBydeviceIds(deviceCodes); | |
| 516 | + | |
| 522 | 517 | } |
| 523 | 518 | YarnCabinetStatePageVO pageVO = conertYarnCabinetStatePageVO(locations, equipment, errorCount, depositCount, equipmentList, locationsOfEq, page, schedulings, dto, carInfos, drivers, yarnCabinetStateEqus); |
| 524 | 519 | return ResponseResult.success(pageVO); |
| ... | ... | @@ -756,7 +751,7 @@ public class KeyBoxController extends BaseController { |
| 756 | 751 | return vo; |
| 757 | 752 | } |
| 758 | 753 | |
| 759 | - private List<LinggangKeyWorkLocation> convert(TakeKeyDTO dto, List<LinggangKeyWorkLocation> schedulings, NewDriver driver, List<KeyInfo> keyInfos,int ty) { | |
| 754 | + private List<LinggangKeyWorkLocation> convert(TakeKeyDTO dto, List<LinggangKeyWorkLocation> schedulings, NewDriver driver, List<KeyInfo> keyInfos, int ty) { | |
| 760 | 755 | if (CollectionUtils.isEmpty(dto.getKeyItem())) { |
| 761 | 756 | return Collections.emptyList(); |
| 762 | 757 | } |
| ... | ... | @@ -771,6 +766,7 @@ public class KeyBoxController extends BaseController { |
| 771 | 766 | location.setPlate(item.getPlate()); |
| 772 | 767 | location.setTime(dto.getTime()); |
| 773 | 768 | location.setType1(ty); |
| 769 | + location.setJobCode(dto.getStaffCode()); | |
| 774 | 770 | if (CollectionUtils.isNotEmpty(schedulings)) { |
| 775 | 771 | Optional<LinggangKeyWorkLocation> opt = schedulings.stream().filter(s -> Objects.equals(item.getKey(), s.getCabinetNo())).findFirst(); |
| 776 | 772 | if (opt.isPresent()) { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/LinggangKeyWorkLocation.java
| ... | ... | @@ -116,13 +116,14 @@ public class LinggangKeyWorkLocation { |
| 116 | 116 | @TableField(exist = false) |
| 117 | 117 | private Set<Integer> types; |
| 118 | 118 | |
| 119 | - @TableField(exist = false) | |
| 120 | 119 | private Date time; |
| 121 | 120 | |
| 122 | 121 | @TableField(exist = false) |
| 123 | 122 | private Long zdsjT; |
| 124 | 123 | @TableField(exist = false) |
| 125 | 124 | private Collection<Integer> keyInfoIds; |
| 125 | + @TableField(exist = false) | |
| 126 | + private String jobCode; | |
| 126 | 127 | |
| 127 | 128 | public boolean importEquals(LinggangKeyWorkLocation location) { |
| 128 | 129 | if (Objects.isNull(location)) { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/job/KeyWorkLocalJob.java
| 1 | 1 | package com.ruoyi.job; |
| 2 | 2 | |
| 3 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | |
| 4 | +import com.ruoyi.service.driver.NewDriverService; | |
| 5 | +import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; | |
| 6 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | |
| 7 | +import com.ruoyi.utils.DateUtil; | |
| 8 | +import lombok.extern.slf4j.Slf4j; | |
| 9 | +import org.apache.commons.lang3.StringUtils; | |
| 10 | +import org.apache.commons.lang3.time.DateUtils; | |
| 11 | +import org.springframework.beans.factory.InitializingBean; | |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 13 | +import org.springframework.stereotype.Component; | |
| 14 | + | |
| 15 | +import java.text.ParseException; | |
| 16 | +import java.util.Date; | |
| 17 | +import java.util.List; | |
| 18 | +import java.util.Set; | |
| 19 | +import java.util.stream.Collectors; | |
| 20 | + | |
| 3 | 21 | /** |
| 4 | 22 | * @author liujun |
| 5 | 23 | * @date 2024年07月30日 15:12 |
| 6 | 24 | */ |
| 7 | -public class KeyWorkLocalJob { | |
| 25 | +@Component("KeyWorkLocalJob") | |
| 26 | +@Slf4j | |
| 27 | +public class KeyWorkLocalJob implements InitializingBean { | |
| 28 | + @Autowired | |
| 29 | + private NewDriverService newDriverService; | |
| 30 | + @Autowired | |
| 31 | + private LinggangSchedulingService linggangSchedulingService; | |
| 32 | + @Autowired | |
| 33 | + private LinggangKeyWorkLocationService keyWorkLocationService; | |
| 34 | + | |
| 35 | + public void insertKeyWorkLocalJob(){ | |
| 36 | + String dateStr = DateUtil.YYYY_MM_DD_LINK.format(new Date()); | |
| 37 | + Date date = null; | |
| 38 | + try { | |
| 39 | + date = DateUtil.YYYY_MM_DD_LINK.parse(dateStr); | |
| 40 | + } catch (ParseException e) { | |
| 41 | + throw new RuntimeException(e); | |
| 42 | + } | |
| 43 | + | |
| 44 | + LinggangScheduling scheduling = new LinggangScheduling(); | |
| 45 | + scheduling.setStartScheduleDate(DateUtil.shortDate(date)); | |
| 46 | + scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); | |
| 47 | + scheduling.setType(100); | |
| 48 | + | |
| 49 | + List<LinggangScheduling> linggangSchedulings = linggangSchedulingService.list(scheduling); | |
| 50 | + Set<Long> idSets = linggangSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet()); | |
| 51 | + keyWorkLocationService.insertJob(dateStr, null, idSets); | |
| 52 | + | |
| 53 | + log.info("钥匙存放信息处理完毕"); | |
| 54 | + } | |
| 55 | + @Override | |
| 56 | + public void afterPropertiesSet() throws Exception { | |
| 57 | + | |
| 58 | + } | |
| 8 | 59 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/job/NewDriverJob.java
| ... | ... | @@ -15,15 +15,11 @@ import java.util.Date; |
| 15 | 15 | public class NewDriverJob implements InitializingBean { |
| 16 | 16 | @Autowired |
| 17 | 17 | private NewDriverService newDriverService; |
| 18 | + | |
| 18 | 19 | @Transactional(rollbackFor = Exception.class) |
| 19 | 20 | public void syDriver() { |
| 20 | - Date date = new Date(); | |
| 21 | - | |
| 22 | - for (int i = 0; i < 2; i++) { | |
| 23 | - JwtAuthenticationTokenFilter.putMDC("job",JwtAuthenticationTokenFilter.getRandomValue()); | |
| 24 | - newDriverService.insertJob(); | |
| 25 | - } | |
| 26 | - | |
| 21 | + newDriverService.insertJob(); | |
| 22 | + log.info("人员信息同步完毕"); | |
| 27 | 23 | |
| 28 | 24 | } |
| 29 | 25 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/scheduling/domain/SchedulingDateEntity.java
0 → 100644
Bsth-admin/src/main/java/com/ruoyi/scheduling/service/SchedulingServiceV1.java
| ... | ... | @@ -2,6 +2,7 @@ package com.ruoyi.scheduling.service; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
| 4 | 4 | import com.ruoyi.scheduling.domain.DriverSchedulingV1; |
| 5 | +import com.ruoyi.scheduling.domain.SchedulingDateEntity; | |
| 5 | 6 | |
| 6 | 7 | import java.util.Date; |
| 7 | 8 | import java.util.List; |
| ... | ... | @@ -11,4 +12,6 @@ public interface SchedulingServiceV1 extends IService<DriverSchedulingV1> { |
| 11 | 12 | List<DriverSchedulingV1> queryByJobCodeAndSchedulingDate(String jobCode, Date date); |
| 12 | 13 | |
| 13 | 14 | List<DriverSchedulingV1> queryByNbbmAndDate(String nbbm, Date date); |
| 15 | + | |
| 16 | + SchedulingDateEntity switchSchedulingDate(Date date); | |
| 14 | 17 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/scheduling/service/impl/SchedulingServiceV1Impl.java
| ... | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 4 | 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 5 | 5 | import com.ruoyi.common.utils.DateUtils; |
| 6 | 6 | import com.ruoyi.scheduling.domain.DriverSchedulingV1; |
| 7 | +import com.ruoyi.scheduling.domain.SchedulingDateEntity; | |
| 7 | 8 | import com.ruoyi.scheduling.mapper.SchedulingMapperV1; |
| 8 | 9 | import com.ruoyi.scheduling.service.SchedulingServiceV1; |
| 9 | 10 | import org.apache.commons.lang3.StringUtils; |
| ... | ... | @@ -18,33 +19,47 @@ public class SchedulingServiceV1Impl extends ServiceImpl<SchedulingMapperV1, Dri |
| 18 | 19 | |
| 19 | 20 | @Override |
| 20 | 21 | public List<DriverSchedulingV1> queryByJobCodeAndSchedulingDate(String jobCode, Date date) { |
| 22 | + | |
| 23 | + LambdaQueryWrapper<DriverSchedulingV1> wrapper = new LambdaQueryWrapper<>(); | |
| 24 | + SchedulingDateEntity entity = switchSchedulingDate(date); | |
| 25 | + wrapper.eq(DriverSchedulingV1::getJobCode, jobCode); | |
| 26 | + wrapper.and(wr -> { | |
| 27 | + wr.eq(DriverSchedulingV1::getScheduleDate, date).or().between(DriverSchedulingV1::getFcsjT, entity.getStartDate().getTime(), entity.getEndDate().getTime()); | |
| 28 | + }); | |
| 29 | + wrapper.orderByAsc(DriverSchedulingV1::getFcsjT); | |
| 30 | + | |
| 31 | + return list(wrapper); | |
| 32 | + } | |
| 33 | + | |
| 34 | + @Override | |
| 35 | + public List<DriverSchedulingV1> queryByNbbmAndDate(String nbbm, Date date) { | |
| 36 | + LambdaQueryWrapper<DriverSchedulingV1> wrapper = new LambdaQueryWrapper<>(); | |
| 37 | + wrapper.eq(DriverSchedulingV1::getNbbm, nbbm).eq(DriverSchedulingV1::getScheduleDate, date); | |
| 38 | + | |
| 39 | + return list(wrapper); | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public SchedulingDateEntity switchSchedulingDate(Date date) { | |
| 21 | 44 | String dateStr = DateUtils.FAST_YYYY_MM_DD.format(org.apache.commons.lang3.time.DateUtils.addDays(date, 1)); |
| 22 | 45 | dateStr = StringUtils.join(dateStr, " 06:30:30"); |
| 23 | - LambdaQueryWrapper<DriverSchedulingV1> wrapper = new LambdaQueryWrapper<>(); | |
| 24 | 46 | try { |
| 25 | 47 | Date date1 = DateUtils.FAST_YYYY_MM_DDHHMMSS.parse(dateStr); |
| 26 | 48 | |
| 27 | -// dateStr = DateUtils.FAST_YYYY_MM_DD.format(org.apache.commons.lang3.time.DateUtils.addDays(date, -1)); | |
| 28 | 49 | dateStr = DateUtils.FAST_YYYY_MM_DD.format(date); |
| 29 | 50 | dateStr = StringUtils.join(dateStr, " 00:00:00"); |
| 30 | 51 | Date date2 = DateUtils.FAST_YYYY_MM_DDHHMMSS.parse(dateStr); |
| 31 | 52 | |
| 32 | - wrapper.eq(DriverSchedulingV1::getJobCode, jobCode); | |
| 33 | - wrapper.and(wr -> { | |
| 34 | - wr.eq(DriverSchedulingV1::getScheduleDate, date).or().between(DriverSchedulingV1::getFcsjT, date2.getTime(), date1.getTime()); | |
| 35 | - }); | |
| 36 | - wrapper.orderByAsc(DriverSchedulingV1::getFcsjT); | |
| 53 | + SchedulingDateEntity entity = new SchedulingDateEntity(); | |
| 54 | + entity.setStartDate(date2); | |
| 55 | + entity.setEndDate(date1); | |
| 56 | + | |
| 57 | + return entity; | |
| 37 | 58 | } catch (ParseException e) { |
| 38 | 59 | throw new RuntimeException(e); |
| 39 | 60 | } |
| 40 | - return list(wrapper); | |
| 61 | + | |
| 41 | 62 | } |
| 42 | 63 | |
| 43 | - @Override | |
| 44 | - public List<DriverSchedulingV1> queryByNbbmAndDate(String nbbm, Date date) { | |
| 45 | - LambdaQueryWrapper<DriverSchedulingV1> wrapper = new LambdaQueryWrapper<>(); | |
| 46 | - wrapper.eq(DriverSchedulingV1::getNbbm, nbbm).eq(DriverSchedulingV1::getScheduleDate, date); | |
| 47 | 64 | |
| 48 | - return list(wrapper); | |
| 49 | - } | |
| 50 | 65 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| ... | ... | @@ -544,8 +544,8 @@ public class ThreadJobService { |
| 544 | 544 | scheduling.setType(b.getType()); |
| 545 | 545 | |
| 546 | 546 | return scheduling; |
| 547 | - }).filter(s->!StringUtils.isBlank(s.getJobCode()) && !StringUtils.isBlank(s.getName()) && !StringUtils.equalsAnyIgnoreCase(s.getJobCode(),"null") | |
| 548 | - && !StringUtils.equalsAnyIgnoreCase(s.getName(),"null")).collect(Collectors.toList()); | |
| 547 | + }).filter(s -> !StringUtils.isBlank(s.getJobCode()) && !StringUtils.isBlank(s.getName()) && !StringUtils.equalsAnyIgnoreCase(s.getJobCode(), "null") | |
| 548 | + && !StringUtils.equalsAnyIgnoreCase(s.getName(), "null")).collect(Collectors.toList()); | |
| 549 | 549 | if (CollectionUtils.isNotEmpty(schedulings)) { |
| 550 | 550 | Map<String, List<LinggangScheduling>> distinctMap = new HashMap<>(); |
| 551 | 551 | schedulings.stream().forEach(s -> { |
| ... | ... | @@ -587,21 +587,21 @@ public class ThreadJobService { |
| 587 | 587 | if (CollectionUtils.isNotEmpty(sourceList)) { |
| 588 | 588 | |
| 589 | 589 | List<LinggangScheduling> schedulings1 = schedulings; |
| 590 | - List<LinggangScheduling> removeSchedulings = sourceList.stream().filter(s->{ | |
| 591 | - Optional<LinggangScheduling> opt = schedulings1.stream().filter(s1 -> s1.importEqus(s)).findFirst(); | |
| 592 | - if (!opt.isPresent()) { | |
| 593 | - log.debug("需要删除的排班数据:[{}]", s); | |
| 594 | - } | |
| 590 | + List<LinggangScheduling> removeSchedulings = sourceList.stream().filter(s -> { | |
| 591 | + Optional<LinggangScheduling> opt = schedulings1.stream().filter(s1 -> s1.importEqus(s) && Objects.nonNull(s1.getSignInId())).findFirst(); | |
| 592 | + if (!opt.isPresent()) { | |
| 593 | + log.debug("需要删除的排班数据:[{}]", s); | |
| 594 | + } | |
| 595 | 595 | return !opt.isPresent() && Objects.isNull(s.getSignInId()); |
| 596 | 596 | }).collect(Collectors.toList()); |
| 597 | - if(CollectionUtils.isNotEmpty(removeSchedulings)){ | |
| 598 | - Set<Long> ids = removeSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet()); | |
| 599 | - schedulingService.removeByIds(ids); | |
| 600 | - schedulings = schedulings1.stream().filter(s->{ | |
| 601 | - Optional<LinggangScheduling> opt = removeSchedulings.stream().filter(s1 -> s1.importEqus(s)).findFirst(); | |
| 602 | - return !opt.isPresent(); | |
| 603 | - }).collect(Collectors.toList()); | |
| 604 | - } | |
| 597 | + if (CollectionUtils.isNotEmpty(removeSchedulings)) { | |
| 598 | + Set<Long> ids = removeSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet()); | |
| 599 | + schedulingService.removeByIds(ids); | |
| 600 | + schedulings = schedulings1.stream().filter(s -> { | |
| 601 | + Optional<LinggangScheduling> opt = removeSchedulings.stream().filter(s1 -> s1.importEqus(s)).findFirst(); | |
| 602 | + return !opt.isPresent(); | |
| 603 | + }).collect(Collectors.toList()); | |
| 604 | + } | |
| 605 | 605 | |
| 606 | 606 | schedulings = schedulings.stream().filter(s -> { |
| 607 | 607 | Optional<LinggangScheduling> opt = sourceList.stream().filter(s1 -> s1.importEqus(s)).findFirst(); |
| ... | ... | @@ -613,10 +613,10 @@ public class ThreadJobService { |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | if (CollectionUtils.isNotEmpty(schedulings)) { |
| 616 | - List<LinggangScheduling> schedulings1 = schedulings.stream().filter(s->StringUtils.isBlank(s.getJobCode()) || StringUtils.isBlank(s.getName())).collect(Collectors.toList()); | |
| 617 | - if(CollectionUtils.isNotEmpty(schedulings1)){ | |
| 618 | - System.out.println("bbbbbbbbbbb"); | |
| 619 | - } | |
| 616 | + List<LinggangScheduling> schedulings1 = schedulings.stream().filter(s -> StringUtils.isBlank(s.getJobCode()) || StringUtils.isBlank(s.getName())).collect(Collectors.toList()); | |
| 617 | + if (CollectionUtils.isNotEmpty(schedulings1)) { | |
| 618 | + System.out.println("bbbbbbbbbbb"); | |
| 619 | + } | |
| 620 | 620 | for (LinggangScheduling linggangScheduling : schedulings) { |
| 621 | 621 | schedulingService.save(linggangScheduling); |
| 622 | 622 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/carinfo/CarInfoService.java
| ... | ... | @@ -25,6 +25,8 @@ public interface CarInfoService extends IService<CarInfo> { |
| 25 | 25 | List<CarInfo> likePlateNumPlateNumTop30(CarInfo entity); |
| 26 | 26 | /**根据车辆自编号查询车辆信息*/ |
| 27 | 27 | List<CarInfo> list(Collection<String> nbbms); |
| 28 | + | |
| 29 | + List<CarInfo> listPlateNums(Collection<String> plateNums); | |
| 28 | 30 | List<CarInfo> list(CarInfo carInfo,Collection<String> nbbms); |
| 29 | 31 | |
| 30 | 32 | /*** | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/carinfo/CarInfoServiceImpl.java
| ... | ... | @@ -92,6 +92,16 @@ public class CarInfoServiceImpl extends ServiceImpl<CarInfoMapper, CarInfo> impl |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | @Override |
| 95 | + public List<CarInfo> listPlateNums(Collection<String> plateNums) { | |
| 96 | + if (CollectionUtils.isEmpty(plateNums)) { | |
| 97 | + return Collections.emptyList(); | |
| 98 | + } | |
| 99 | + LambdaQueryWrapper<CarInfo> wrapper = new LambdaQueryWrapper<>(); | |
| 100 | + wrapper.in(CarInfo::getPlateNum, plateNums); | |
| 101 | + return list(wrapper); | |
| 102 | + } | |
| 103 | + | |
| 104 | + @Override | |
| 95 | 105 | public List<CarInfo> list(CarInfo carInfo, Collection<String> nbbms) { |
| 96 | 106 | LambdaQueryWrapper<CarInfo> wrapper = null; |
| 97 | 107 | if (Objects.isNull(carInfo)) { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/location/LinggangKeyWorkLocationServiceImpl.java
| ... | ... | @@ -21,6 +21,8 @@ import com.ruoyi.domain.scheduling.LinggangScheduling; |
| 21 | 21 | import com.ruoyi.domain.venue.info.LinggangVenueInfo; |
| 22 | 22 | import com.ruoyi.equipment.domain.Equipment; |
| 23 | 23 | import com.ruoyi.equipment.service.IEquipmentService; |
| 24 | +import com.ruoyi.in.domain.CalDriverScheduling; | |
| 25 | +import com.ruoyi.in.service.SignInServiceV1; | |
| 24 | 26 | import com.ruoyi.mapper.key.location.LinggangKeyWorkLocationMapper; |
| 25 | 27 | import com.ruoyi.service.carinfo.CarInfoService; |
| 26 | 28 | import com.ruoyi.service.equipment.heartbeat.LingangEquipmentHeartbeatService; |
| ... | ... | @@ -64,6 +66,8 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW |
| 64 | 66 | private CarInfoService carInfoService; |
| 65 | 67 | @Autowired |
| 66 | 68 | private LingangEquipmentHeartbeatService equipmentHeartbeatService; |
| 69 | + @Autowired | |
| 70 | + private SignInServiceV1 signInServiceV1; | |
| 67 | 71 | |
| 68 | 72 | private static final String TAKE_KEY_MSG = "设备号:{0},钥匙编号:{1},在{2}的状态已经是:{3},无需在操作"; |
| 69 | 73 | private static final String TAKE_KEY_SUCESS = "设备号:{0},钥匙编号:{1},在{2}的状已经更新成功"; |
| ... | ... | @@ -315,8 +319,8 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW |
| 315 | 319 | if (CollectionUtils.isNotEmpty(source)) { |
| 316 | 320 | locations = locations.stream().filter(l -> { |
| 317 | 321 | Optional<LinggangKeyWorkLocation> opt = source.stream().filter(s -> s.importEquals(l)).findFirst(); |
| 318 | - if(opt.isPresent()){ | |
| 319 | - log.debug("钥匙存放数据已经存在:[{}]",l); | |
| 322 | + if (opt.isPresent()) { | |
| 323 | + log.debug("钥匙存放数据已经存在:[{}]", l); | |
| 320 | 324 | } |
| 321 | 325 | return !opt.isPresent(); |
| 322 | 326 | }).collect(Collectors.toList()); |
| ... | ... | @@ -356,6 +360,14 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW |
| 356 | 360 | List<LinggangKeyWorkLocation> success = new ArrayList<>(); |
| 357 | 361 | List<LinggangKeyWorkLocation> error = new ArrayList<>(); |
| 358 | 362 | source.forEach(s -> { |
| 363 | + if (StringUtils.isNotEmpty(s.getJobCode()) && Objects.isNull(s.getSchedulingId())) { | |
| 364 | + Integer type = Objects.equals(typeEnum.getValue(), 0) ? 1 : 2; | |
| 365 | + CalDriverScheduling calDriverScheduling = signInServiceV1.findSchedulingByDateTime(s.getJobCode(), s.getTime(), type); | |
| 366 | + if (Objects.nonNull(calDriverScheduling) && Objects.nonNull(calDriverScheduling.getDriverScheduling())) { | |
| 367 | + s.setSchedulingId(calDriverScheduling.getDriverScheduling().getId()); | |
| 368 | + } | |
| 369 | + } | |
| 370 | + | |
| 359 | 371 | boolean flag = false; |
| 360 | 372 | if (Objects.isNull(s.getId())) { |
| 361 | 373 | flag = save(s); |
| ... | ... | @@ -824,7 +836,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW |
| 824 | 836 | location.setScheduleDate(sc.getScheduleDate()); |
| 825 | 837 | location.setSchedulingId(sc.getId()); |
| 826 | 838 | location.setType(2); |
| 827 | - if(Objects.equals(sc.getBcType(),BC_TYPE_OUT)){ | |
| 839 | + if (Objects.equals(sc.getBcType(), BC_TYPE_OUT)) { | |
| 828 | 840 | location.setType(3); |
| 829 | 841 | } |
| 830 | 842 | return location; | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/scheduling/LinggangSchedulingServiceImpl.java
| ... | ... | @@ -90,6 +90,15 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl<LinggangSchedulin |
| 90 | 90 | public List<LinggangScheduling> listByCZ(LinggangScheduling entity) { |
| 91 | 91 | return linggangSchedulingMapper.listByCZ(entity); |
| 92 | 92 | } |
| 93 | + | |
| 94 | + @Override | |
| 95 | + public List<LinggangScheduling> listNbbm(LinggangScheduling entity, Collection<String> nbbm) { | |
| 96 | + LambdaQueryWrapper<LinggangScheduling> wrapper = new LambdaQueryWrapper<>(entity); | |
| 97 | + switchScheduleDate(wrapper, entity); | |
| 98 | + wrapper.in(LinggangScheduling::getNbbm, nbbm); | |
| 99 | + | |
| 100 | + return list(wrapper); | |
| 101 | + } | |
| 93 | 102 | // @Override |
| 94 | 103 | // public List<LinggangScheduling> listOfSelect(LinggangScheduling entity) { |
| 95 | 104 | // LambdaQueryWrapper<LinggangScheduling> wrapper = new LambdaQueryWrapper<>(entity); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/scheduling/LinggangSchedulingService.java
| ... | ... | @@ -29,6 +29,8 @@ public interface LinggangSchedulingService extends IService<LinggangScheduling> |
| 29 | 29 | |
| 30 | 30 | List<LinggangScheduling> listByCZ(LinggangScheduling entity); |
| 31 | 31 | |
| 32 | + List<LinggangScheduling> listNbbm(LinggangScheduling entity,Collection<String> nbbm); | |
| 33 | + | |
| 32 | 34 | // List<LinggangScheduling> listOfIds(java.util.Collection<java.lang.Integer> ids); |
| 33 | 35 | // /*** |
| 34 | 36 | // *用于页面选择 | ... | ... |
Bsth-admin/src/main/resources/application-druid-dev.yml