Commit cc8441d5165b424f34c41597c747db5e4c1d4794
1 parent
60715fd8
feat: 正对特殊线路设置打卡时间
Showing
6 changed files
with
65 additions
and
26 deletions
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| ... | ... | @@ -24,7 +24,7 @@ import com.ruoyi.common.utils.file.MimeTypeUtils; |
| 24 | 24 | import com.ruoyi.equipment.mapper.EquipmentMapper; |
| 25 | 25 | import com.ruoyi.framework.config.ServerConfig; |
| 26 | 26 | import com.ruoyi.job.DriverJob; |
| 27 | -import com.ruoyi.pojo.DriverSignRecommendation; | |
| 27 | +import com.ruoyi.pojo.DriverSignInRecommendation; | |
| 28 | 28 | import com.ruoyi.domain.EquipmentDriverExpand; |
| 29 | 29 | import com.ruoyi.domain.DriverScheduling; |
| 30 | 30 | import com.ruoyi.pojo.request.DriverRequestVo; |
| ... | ... | @@ -57,7 +57,6 @@ import static com.ruoyi.common.ApiProperties.PERSONNEL_API_KEY; |
| 57 | 57 | import static com.ruoyi.common.ConstDriverProperties.*; |
| 58 | 58 | import static com.ruoyi.common.ConstSignInConstSignInProperties.*; |
| 59 | 59 | import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE; |
| 60 | -import static com.ruoyi.common.redispre.GlobalRedisPreName.REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW; | |
| 61 | 60 | |
| 62 | 61 | /** |
| 63 | 62 | * 驾驶员信息Service业务层处理 |
| ... | ... | @@ -130,10 +129,10 @@ public class DriverServiceImpl implements IDriverService { |
| 130 | 129 | return drivers; |
| 131 | 130 | } |
| 132 | 131 | |
| 133 | - private DriverSignRecommendation checkTime(List<DriverScheduling> dto, Long now) { | |
| 134 | - Map<Integer, DriverSignRecommendation> timeMap = new HashMap<>(); | |
| 132 | + private DriverSignInRecommendation checkTime(List<DriverScheduling> dto, Long now) { | |
| 133 | + Map<Integer, DriverSignInRecommendation> timeMap = new HashMap<>(); | |
| 135 | 134 | for (int i = 0; i < dto.size(); i++) { |
| 136 | - timeMap.put(i, new DriverSignRecommendation(dto.get(i), i)); | |
| 135 | + timeMap.put(i, new DriverSignInRecommendation(dto.get(i), i)); | |
| 137 | 136 | } |
| 138 | 137 | long minDiff = Long.MAX_VALUE; |
| 139 | 138 | Integer index = 0; |
| ... | ... | @@ -358,7 +357,7 @@ public class DriverServiceImpl implements IDriverService { |
| 358 | 357 | DriverResponseVo vo = null; |
| 359 | 358 | // 给出计划操作 |
| 360 | 359 | if (!CollectionUtil.isEmpty(dto)) { |
| 361 | - DriverSignRecommendation recommendation = checkTime(dto, now); | |
| 360 | + DriverSignInRecommendation recommendation = checkTime(dto, now); | |
| 362 | 361 | if (BC_TYPE_OUT.equals(recommendation.getBcType())) { |
| 363 | 362 | // 售票员无需酒精测试 |
| 364 | 363 | if (recommendation.getPosts().equals(PERSONNEL_POSTS_DRIVER)) | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| ... | ... | @@ -27,7 +27,7 @@ import com.ruoyi.driver.mapper.DriverMapper; |
| 27 | 27 | import com.ruoyi.equipment.domain.Equipment; |
| 28 | 28 | import com.ruoyi.equipment.mapper.EquipmentMapper; |
| 29 | 29 | import com.ruoyi.errorScheduling.service.IErrorJobcodeService; |
| 30 | -import com.ruoyi.pojo.DriverSignRecommendation; | |
| 30 | +import com.ruoyi.pojo.DriverSignInRecommendation; | |
| 31 | 31 | import com.ruoyi.pojo.GlobalIndex; |
| 32 | 32 | import com.ruoyi.domain.DriverScheduling; |
| 33 | 33 | import com.ruoyi.pojo.response.SignInResponseVo; |
| ... | ... | @@ -427,7 +427,7 @@ public class SignInServiceImpl implements ISignInService { |
| 427 | 427 | if (Objects.isNull(driver)) { |
| 428 | 428 | return true; |
| 429 | 429 | } |
| 430 | - // TODO 排班校验 和签到超时校验 非司售未作 | |
| 430 | + // 排班校验 和签到超时校验 | |
| 431 | 431 | result = checkWorkDay(now, dto, globalIndex, signIn, driver.getPosts()); |
| 432 | 432 | |
| 433 | 433 | // 酒精测试校验 确定 且员工工种是驾驶员 |
| ... | ... | @@ -518,7 +518,7 @@ public class SignInServiceImpl implements ISignInService { |
| 518 | 518 | private boolean driverCheckTimeOut(GlobalIndex globalIndex, SignIn signIn, List<DriverScheduling> dto, long now) { |
| 519 | 519 | try { |
| 520 | 520 | Boolean result = true; |
| 521 | - DriverSignRecommendation currentScheduling = schedulingService.computedTheCurrentClosestTimestamp(dto, now, 0); | |
| 521 | + DriverSignInRecommendation currentScheduling = schedulingService.computedTheCurrentClosestTimestamp(dto, now, 0); | |
| 522 | 522 | LocalDateTime endTime = ConstDateUtil.getLocalDateTimeByLongTime(currentScheduling.getTimestamps()); |
| 523 | 523 | LocalDateTime nowTime = ConstDateUtil.getLocalDateTimeByLongTime(now); |
| 524 | 524 | long nowBetween = ChronoUnit.MINUTES.between(endTime, nowTime); |
| ... | ... | @@ -530,7 +530,7 @@ public class SignInServiceImpl implements ISignInService { |
| 530 | 530 | if (!(Math.abs(nowBetween) <= 60)) { |
| 531 | 531 | // 签到一个逻辑 当前无记录 |
| 532 | 532 | if (currentScheduling.getBcType().equals(BC_TYPE_OUT) && Objects.isNull(currentScheduling.getSignInId())) { |
| 533 | - DriverSignRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1); | |
| 533 | + DriverSignInRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1); | |
| 534 | 534 | // 上一次无记|签到,type:签退 当前时间小于最近签到时间 -> 超时签退 |
| 535 | 535 | if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_OUT) && lastClosestTimestamp.getBcType().equals(BC_TYPE_IN)) { |
| 536 | 536 | signIn.setRemark(SIGN_OUT_TIMEOUT); |
| ... | ... | @@ -552,7 +552,7 @@ public class SignInServiceImpl implements ISignInService { |
| 552 | 552 | } |
| 553 | 553 | // 签退一个逻辑 当前无记录 |
| 554 | 554 | if (currentScheduling.getBcType().equals(BC_TYPE_IN) && Objects.isNull(currentScheduling.getSignInId())) { |
| 555 | - DriverSignRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1); | |
| 555 | + DriverSignInRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1); | |
| 556 | 556 | // 上一次无记|签退,type:签到 当前时间小于最近签退时间 -> 签到异常 |
| 557 | 557 | if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_IN)) { |
| 558 | 558 | signIn.setRemark(SIGN_IN_TIMEOUT); |
| ... | ... | @@ -583,7 +583,7 @@ public class SignInServiceImpl implements ISignInService { |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | private Boolean handlerExceptionRecord(List<DriverScheduling> dto, long now, GlobalIndex globalIndex, SignIn signIn) { |
| 586 | - DriverSignRecommendation currentScheduling = schedulingService.computedTheCurrentClosestTimestamp(dto, now, 0); | |
| 586 | + DriverSignInRecommendation currentScheduling = schedulingService.computedTheCurrentClosestTimestamp(dto, now, 0); | |
| 587 | 587 | LocalDateTime endTime = ConstDateUtil.getLocalDateTimeByLongTime(currentScheduling.getTimestamps()); |
| 588 | 588 | LocalDateTime nowTime = ConstDateUtil.getLocalDateTimeByLongTime(now); |
| 589 | 589 | long nowBetween = ChronoUnit.MINUTES.between(endTime, nowTime); | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
| ... | ... | @@ -39,6 +39,7 @@ import java.io.UnsupportedEncodingException; |
| 39 | 39 | import java.net.URLEncoder; |
| 40 | 40 | import java.nio.charset.StandardCharsets; |
| 41 | 41 | import java.security.MessageDigest; |
| 42 | +import java.time.LocalDate; | |
| 42 | 43 | import java.time.LocalDateTime; |
| 43 | 44 | import java.time.temporal.ChronoUnit; |
| 44 | 45 | import java.util.*; |
| ... | ... | @@ -333,8 +334,8 @@ public class DriverJob implements InitializingBean { |
| 333 | 334 | splitSaveScheduling(driverSchedulingMap, driverJobCode, driverName, item, PERSONNEL_POSTS_DRIVER); |
| 334 | 335 | splitSaveScheduling(driverSchedulingMap, salePersonJobCode, salePersonName, item, PERSONNEL_POSTS_SALES); |
| 335 | 336 | }); |
| 336 | - // TODO 处理跟班 | |
| 337 | - handleBcCopy(driverSchedulingMap); | |
| 337 | + // 处理跟班 | |
| 338 | + handlerBcCopy(driverSchedulingMap); | |
| 338 | 339 | // 排序 |
| 339 | 340 | List<String> keys = new ArrayList<>(driverSchedulingMap.keySet()); |
| 340 | 341 | for (String key : keys) { |
| ... | ... | @@ -349,15 +350,15 @@ public class DriverJob implements InitializingBean { |
| 349 | 350 | return driverSchedulingMap; |
| 350 | 351 | } |
| 351 | 352 | |
| 352 | - private void handleBcCopy(Map<String, List<ResponseSchedulingDto>> driverSchedulingMap) { | |
| 353 | + private void handlerBcCopy(Map<String, List<ResponseSchedulingDto>> driverSchedulingMap) { | |
| 353 | 354 | try { |
| 354 | - Date date = new Date(); | |
| 355 | + LocalDate localDate = LocalDate.now(); | |
| 355 | 356 | DriverSchedulingExpand qwExpand = new DriverSchedulingExpand(); |
| 356 | 357 | qwExpand.setStatus(STATUS_NORMAL.longValue()); |
| 357 | 358 | List<ExpandResponseVo> expandList = EXPAND_MAPPER.queryExpandListByEntity(qwExpand); |
| 358 | 359 | for (ExpandResponseVo expand : expandList) { |
| 359 | 360 | List<ResponseSchedulingDto> dtoList = driverSchedulingMap.get(expand.getMasterJobCode()); |
| 360 | - if (CollectionUtil.isNotEmpty(dtoList) && date.compareTo(expand.getEndDate()) < 0) { | |
| 361 | + if (CollectionUtil.isNotEmpty(dtoList) && localDate.compareTo(LocalDate.parse(ConstDateUtil.formatDate("yyyy-MM-dd", expand.getEndDate()))) <= 0) { | |
| 361 | 362 | List<ResponseSchedulingDto> list = ListUtils.deepCopy(dtoList); |
| 362 | 363 | list = list.stream().peek(item -> { |
| 363 | 364 | item.setJobCode(expand.getSlaveJobCode()); | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/pojo/DriverSignRecommendation.java renamed to ruoyi-admin/src/main/java/com/ruoyi/pojo/DriverSignInRecommendation.java
| ... | ... | @@ -11,7 +11,7 @@ import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT; |
| 11 | 11 | * @author 20412 |
| 12 | 12 | */ |
| 13 | 13 | @Data |
| 14 | -public class DriverSignRecommendation { | |
| 14 | +public class DriverSignInRecommendation { | |
| 15 | 15 | private Long id; |
| 16 | 16 | private String posts; |
| 17 | 17 | private String bcType; |
| ... | ... | @@ -23,10 +23,10 @@ public class DriverSignRecommendation { |
| 23 | 23 | private String lpName; |
| 24 | 24 | private String lineName; |
| 25 | 25 | |
| 26 | - public DriverSignRecommendation() { | |
| 26 | + public DriverSignInRecommendation() { | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public DriverSignRecommendation(DriverScheduling dto, Integer index) { | |
| 29 | + public DriverSignInRecommendation(DriverScheduling dto, Integer index) { | |
| 30 | 30 | this.setIndex(index); |
| 31 | 31 | this.setBcType(dto.getBcType()); |
| 32 | 32 | this.setTimestamps(BC_TYPE_OUT.equals(dto.getBcType()) ? dto.getFcsjT() : dto.getZdsjT()); | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/SchedulingService.java
| ... | ... | @@ -5,7 +5,7 @@ import com.ruoyi.common.cache.NowSchedulingCache; |
| 5 | 5 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 6 | 6 | import com.ruoyi.in.domain.SignIn; |
| 7 | 7 | import com.ruoyi.in.mapper.SignInMapper; |
| 8 | -import com.ruoyi.pojo.DriverSignRecommendation; | |
| 8 | +import com.ruoyi.pojo.DriverSignInRecommendation; | |
| 9 | 9 | import com.ruoyi.pojo.GlobalIndex; |
| 10 | 10 | import com.ruoyi.domain.DriverScheduling; |
| 11 | 11 | import com.ruoyi.pojo.request.ReportViewRequestVo; |
| ... | ... | @@ -83,10 +83,10 @@ public class SchedulingService { |
| 83 | 83 | * @param now |
| 84 | 84 | * @return |
| 85 | 85 | */ |
| 86 | - public DriverSignRecommendation computedTheCurrentClosestTimestamp(List<DriverScheduling> dto, Long now, Integer result) { | |
| 87 | - Map<Integer, DriverSignRecommendation> timeMap = new HashMap<>(); | |
| 86 | + public DriverSignInRecommendation computedTheCurrentClosestTimestamp(List<DriverScheduling> dto, Long now, Integer result) { | |
| 87 | + Map<Integer, DriverSignInRecommendation> timeMap = new HashMap<>(); | |
| 88 | 88 | for (int i = 0; i < dto.size(); i++) { |
| 89 | - timeMap.put(i, new DriverSignRecommendation(dto.get(i), i)); | |
| 89 | + timeMap.put(i, new DriverSignInRecommendation(dto.get(i), i)); | |
| 90 | 90 | } |
| 91 | 91 | long minDiff = Long.MAX_VALUE; |
| 92 | 92 | Integer index = 0; | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| ... | ... | @@ -182,7 +182,7 @@ public class ThreadJobService { |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | private void sendNotice(SignIn signIn, Driver driver, List<DriverScheduling> dto, GlobalIndex globalIndex) { |
| 185 | - if (SIGN_ALCOHOL_EX_NUM.equals(signIn.getExType())){ | |
| 185 | + if (SIGN_ALCOHOL_EX_NUM.equals(signIn.getExType())) { | |
| 186 | 186 | SysNotice notice = new SysNotice(); |
| 187 | 187 | notice.setCreateBy("system"); |
| 188 | 188 | notice.setUpdateBy("system"); |
| ... | ... | @@ -191,7 +191,7 @@ public class ThreadJobService { |
| 191 | 191 | if (CollectionUtil.isEmpty(dto)) { |
| 192 | 192 | item = new DriverScheduling(); |
| 193 | 193 | handlerNoScheduling(item, signIn, driver); |
| 194 | - }else { | |
| 194 | + } else { | |
| 195 | 195 | item = dto.get(globalIndex.getIndex()); |
| 196 | 196 | } |
| 197 | 197 | String jobCode = "工号:" + item.getJobCode() + "\n"; |
| ... | ... | @@ -210,6 +210,7 @@ public class ThreadJobService { |
| 210 | 210 | noticeService.insertNotice(notice); |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | + | |
| 213 | 214 | private String getResultString(BigDecimal alcoholIntake) { |
| 214 | 215 | if (alcoholIntake.compareTo(new BigDecimal(20)) >= 0 && alcoholIntake.compareTo(new BigDecimal(80)) < 0) |
| 215 | 216 | return "饮酒后驾驶机动车"; |
| ... | ... | @@ -485,11 +486,49 @@ public class ThreadJobService { |
| 485 | 486 | // 处理错误班次 |
| 486 | 487 | nowScheduling = handleErrorBc(schedulingList); |
| 487 | 488 | } |
| 489 | + // 处理松青线 | |
| 490 | + // 松1路牌 签到时间 07:20 |松2路牌 签到时间 07:40 |松3路牌 签到时间 08:35 |松4路牌 签到时间 10:30 | |
| 491 | + if (nowScheduling.get(0).getLineName().equals("松青线") && checkLpName(nowScheduling.get(0))) { | |
| 492 | + updateScheduling(nowScheduling); | |
| 493 | + } | |
| 488 | 494 | bcList.addAll(nowScheduling); |
| 489 | 495 | } |
| 490 | 496 | return bcList; |
| 491 | 497 | } |
| 492 | 498 | |
| 499 | + private void updateScheduling(List<DriverScheduling> nowScheduling) { | |
| 500 | + switch (nowScheduling.get(0).getLpName()){ | |
| 501 | + case "松1": | |
| 502 | + nowScheduling.get(0).setFcsjT(ConstDateUtil.dateAddition(ConstDateUtil.formatDate("yyyy-MM-dd",new Date(nowScheduling.get(0).getFcsjT())),"07:20:00").getTime()); | |
| 503 | + nowScheduling.get(nowScheduling.size() - 1).setZdsjT(ConstDateUtil.dateAddition(ConstDateUtil.formatDate("yyyy-MM-dd",new Date(nowScheduling.get(nowScheduling.size() - 1).getFcsjT())),"15:30:00").getTime()); | |
| 504 | + break; | |
| 505 | + case "松2": | |
| 506 | + nowScheduling.get(0).setFcsjT(ConstDateUtil.dateAddition(ConstDateUtil.formatDate("yyyy-MM-dd",new Date(nowScheduling.get(0).getFcsjT())),"07:40:00").getTime()); | |
| 507 | + nowScheduling.get(nowScheduling.size() - 1).setZdsjT(ConstDateUtil.dateAddition(ConstDateUtil.formatDate("yyyy-MM-dd",new Date(nowScheduling.get(nowScheduling.size() - 1).getFcsjT())),"19:00:00").getTime()); | |
| 508 | + break; | |
| 509 | + case "松3": | |
| 510 | + nowScheduling.get(0).setFcsjT(ConstDateUtil.dateAddition(ConstDateUtil.formatDate("yyyy-MM-dd",new Date(nowScheduling.get(0).getFcsjT())),"08:35:00").getTime()); | |
| 511 | + nowScheduling.get(nowScheduling.size() - 1).setZdsjT(ConstDateUtil.dateAddition(ConstDateUtil.formatDate("yyyy-MM-dd",new Date(nowScheduling.get(nowScheduling.size() - 1).getFcsjT())),"18:10:00").getTime()); | |
| 512 | + break; | |
| 513 | + case "松4": | |
| 514 | + nowScheduling.get(0).setFcsjT(ConstDateUtil.dateAddition(ConstDateUtil.formatDate("yyyy-MM-dd",new Date(nowScheduling.get(0).getFcsjT())),"10:30:00").getTime()); | |
| 515 | + nowScheduling.get(nowScheduling.size() - 1).setZdsjT(ConstDateUtil.dateAddition(ConstDateUtil.formatDate("yyyy-MM-dd",new Date(nowScheduling.get(nowScheduling.size() - 1).getFcsjT())),"18:35:00").getTime()); | |
| 516 | + break; | |
| 517 | + } | |
| 518 | + } | |
| 519 | + | |
| 520 | + private boolean checkLpName(DriverScheduling driverScheduling) { | |
| 521 | + switch (driverScheduling.getLpName()){ | |
| 522 | + case "松1": | |
| 523 | + case "松2": | |
| 524 | + case "松3": | |
| 525 | + case "松4": | |
| 526 | + return true; | |
| 527 | + default: | |
| 528 | + return false; | |
| 529 | + } | |
| 530 | + } | |
| 531 | + | |
| 493 | 532 | public static List<ErrorJobcode> getErrorScheduling(Map<String, List<DriverScheduling>> resultMap) { |
| 494 | 533 | List<ErrorJobcode> errorList = new ArrayList<>(); |
| 495 | 534 | // 循环处理 | ... | ... |