Commit 0a25c13ed15a90b1884b4603dd267ac350936021

Authored by guzijian
1 parent bf58e609

feat: 修改金高签到逻辑

Bsth-admin/src/main/java/com/ruoyi/common/ErrorTypeProperties.java
@@ -10,6 +10,10 @@ public interface ErrorTypeProperties { @@ -10,6 +10,10 @@ public interface ErrorTypeProperties {
10 String ALCOHOL_SIGN_IN_ERROR = "酒精测试超标,"; 10 String ALCOHOL_SIGN_IN_ERROR = "酒精测试超标,";
11 String WORK_DAY_ERROR = "当天没有排班,"; 11 String WORK_DAY_ERROR = "当天没有排班,";
12 String SIGN_IN_TIMEOUT = "没有在规定时间内签到,"; 12 String SIGN_IN_TIMEOUT = "没有在规定时间内签到,";
13 - String SIGN_OUT_TIMEOUT = "没有在规定时间内签退,"; 13 +// String SIGN_OUT_TIMEOUT = "没有在规定时间内签退,";
  14 + /**
  15 + * 金高没有签退
  16 + */
  17 + String SIGN_OUT_TIMEOUT = "没有在规定时间内签到,";
14 18
15 } 19 }
Bsth-admin/src/main/java/com/ruoyi/common/cache/NowSchedulingCache.java
@@ -40,9 +40,9 @@ public class NowSchedulingCache { @@ -40,9 +40,9 @@ public class NowSchedulingCache {
40 List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null); 40 List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null);
41 handlerResultMap(resultMap, schedulingList); 41 handlerResultMap(resultMap, schedulingList);
42 // 获取错误排班 42 // 获取错误排班
43 - List<ErrorJobcode> errorScheduling = ThreadJobService.getErrorScheduling(resultMap); 43 +// List<ErrorJobcode> errorScheduling = ThreadJobService.getErrorScheduling(resultMap);
44 // 插入错误排班 44 // 插入错误排班
45 - errorJobcodeService.insertBatchErrorJobcode(errorScheduling); 45 +// errorJobcodeService.insertBatchErrorJobcode(errorScheduling);
46 // 更新缓存 46 // 更新缓存
47 cacheNowDayScheduling.put(date, resultMap); 47 cacheNowDayScheduling.put(date, resultMap);
48 } 48 }
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
@@ -73,7 +73,7 @@ import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE @@ -73,7 +73,7 @@ import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE
73 @Service 73 @Service
74 public class DriverServiceImpl implements IDriverService { 74 public class DriverServiceImpl implements IDriverService {
75 75
76 - private Logger log = LoggerFactory.getLogger(DriverServiceImpl.class); 76 + private static final Logger log = LoggerFactory.getLogger(DriverServiceImpl.class);
77 77
78 @Autowired 78 @Autowired
79 private ISysNoticeService noticeService; 79 private ISysNoticeService noticeService;
@@ -164,9 +164,9 @@ public class DriverServiceImpl implements IDriverService { @@ -164,9 +164,9 @@ public class DriverServiceImpl implements IDriverService {
164 LocalDateTime endTime = ConstDateUtil.getLocalDateTimeByLongTime(timeMap.get(index).getTimestamps()); 164 LocalDateTime endTime = ConstDateUtil.getLocalDateTimeByLongTime(timeMap.get(index).getTimestamps());
165 long nowBetween = ChronoUnit.MINUTES.between(endTime, nowTime); 165 long nowBetween = ChronoUnit.MINUTES.between(endTime, nowTime);
166 // 如果当前有效范围内签到记录无效如酒精测试异常则重复当前操作 166 // 如果当前有效范围内签到记录无效如酒精测试异常则重复当前操作
167 - if ((Math.abs(nowBetween) <= 60) && timeMap.get(index).getExType().equals(SIGN_ALCOHOL_EX_NUM) && timeMap.get(index).getBcType().equals(BC_TYPE_OUT)) { 167 + if ((Math.abs(nowBetween) <= 60)) {
168 return timeMap.get(index); 168 return timeMap.get(index);
169 - } else { 169 + } else if (nowBetween > 60L){
170 index = index < timeMap.size() - 1 ? index + 1 : index; 170 index = index < timeMap.size() - 1 ? index + 1 : index;
171 } 171 }
172 } 172 }
@@ -358,6 +358,7 @@ public class DriverServiceImpl implements IDriverService { @@ -358,6 +358,7 @@ public class DriverServiceImpl implements IDriverService {
358 } else { 358 } else {
359 // 特定设备是无需酒精测试的 359 // 特定设备是无需酒精测试的
360 vo.setCheckAlcohol(needCheckAlcoholDevice); 360 vo.setCheckAlcohol(needCheckAlcoholDevice);
  361 + vo.setPlanAction("签到");
361 vos.add(vo); 362 vos.add(vo);
362 } 363 }
363 } 364 }
Bsth-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
@@ -517,52 +517,7 @@ public class SignInServiceImpl implements ISignInService { @@ -517,52 +517,7 @@ public class SignInServiceImpl implements ISignInService {
517 } 517 }
518 // 不在有效时间范围内,判断当前是否有签到记录 当前应签到还是签退 518 // 不在有效时间范围内,判断当前是否有签到记录 当前应签到还是签退
519 if (!(Math.abs(nowBetween) <= 60)) { 519 if (!(Math.abs(nowBetween) <= 60)) {
520 - // 签到一个逻辑 当前无记录  
521 - if (currentScheduling.getBcType().equals(BC_TYPE_OUT) && Objects.isNull(currentScheduling.getSignInId())) {  
522 - DriverSignInRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1);  
523 - // 给出签到范围  
524 - // 上一次无记|签到,type:签退 当前时间小于最近签到时间 -> 超时签退  
525 - if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_OUT) && lastClosestTimestamp.getBcType().equals(BC_TYPE_IN)) {  
526 - signIn.setRemark(SIGN_OUT_TIMEOUT + "请在" + ConstDateUtil.formatDate("HH:mm", new Date(lastClosestTimestamp.getTimestamps())) + "前后一小时内打卡。");  
527 - globalIndex.setIndex(lastClosestTimestamp.getIndex());  
528 - result = false;  
529 - }  
530 - // 上一次无记无|签到,type:签退 当前时间小于最近签到时间 -> 超时签退  
531 - else if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_OUT) && lastClosestTimestamp.getIndex().equals(currentScheduling.getIndex())) {  
532 - signIn.setRemark(SIGN_IN_TIMEOUT + "请在" + ConstDateUtil.formatDate("HH:mm", new Date(currentScheduling.getTimestamps())) + "前后一小时内打卡。");  
533 - globalIndex.setIndex(currentScheduling.getIndex());  
534 - result = false;  
535 - }  
536 - // 当前最近无记录|签到,type:签到|签退 -> 签到超时给上  
537 - else {  
538 - signIn.setRemark(SIGN_IN_TIMEOUT + "请在" + ConstDateUtil.formatDate("HH:mm", new Date(currentScheduling.getTimestamps())) + "前后一小时内打卡。");  
539 - globalIndex.setIndex(currentScheduling.getIndex());  
540 - result = false;  
541 - }  
542 - }  
543 - // 签退一个逻辑 当前无记录  
544 - if (currentScheduling.getBcType().equals(BC_TYPE_IN) && Objects.isNull(currentScheduling.getSignInId())) {  
545 - DriverSignInRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1);  
546 - // 上一次无记|签退,type:签到 当前时间小于最近签退时间 -> 签到异常  
547 - if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_IN)) {  
548 - signIn.setRemark(SIGN_IN_TIMEOUT + "请在" + ConstDateUtil.formatDate("HH:mm", new Date(lastClosestTimestamp.getTimestamps())) + "前后一小时内打卡。");  
549 - globalIndex.setIndex(lastClosestTimestamp.getIndex());  
550 - result = false;  
551 - }  
552 - // 当前无记|签退 , type:签退|签到 ——> 签退异常  
553 - else {  
554 - signIn.setRemark(SIGN_OUT_TIMEOUT + "请在" + ConstDateUtil.formatDate("HH:mm", new Date(currentScheduling.getTimestamps())) + "前后一小时内打卡。");  
555 - globalIndex.setIndex(currentScheduling.getIndex());  
556 - result = false;  
557 - }  
558 - }  
559 - // 签退|签到 当前有记录  
560 - if (!Objects.isNull(currentScheduling.getSignInId())) {  
561 - String prompt = "请在" + ConstDateUtil.formatDate("HH:mm", new Date(currentScheduling.getTimestamps())) + "前后一小时内打卡。";  
562 - signIn.setRemark((currentScheduling.getBcType().equals(BC_TYPE_IN) ? SIGN_OUT_TIMEOUT : SIGN_IN_TIMEOUT) + prompt);  
563 - globalIndex.setIndex(currentScheduling.getIndex());  
564 - result = false;  
565 - } 520 + result = handlerTimerOutSign(globalIndex, signIn, dto, now, result, currentScheduling, nowBetween);
566 } else { 521 } else {
567 globalIndex.setIndex(currentScheduling.getIndex()); 522 globalIndex.setIndex(currentScheduling.getIndex());
568 result = true; 523 result = true;
@@ -573,6 +528,56 @@ public class SignInServiceImpl implements ISignInService { @@ -573,6 +528,56 @@ public class SignInServiceImpl implements ISignInService {
573 } 528 }
574 } 529 }
575 530
  531 + private Boolean handlerTimerOutSign(GlobalIndex globalIndex, SignIn signIn, List<DriverScheduling> dto, long now, Boolean result, DriverSignInRecommendation currentScheduling, long nowBetween) {
  532 + // 签到一个逻辑 当前无记录
  533 + if (currentScheduling.getBcType().equals(BC_TYPE_OUT) && Objects.isNull(currentScheduling.getSignInId())) {
  534 + DriverSignInRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1);
  535 + // 给出签到范围
  536 + // 上一次无记|签到,type:签退 当前时间小于最近签到时间 -> 超时签退
  537 + if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_OUT) && lastClosestTimestamp.getBcType().equals(BC_TYPE_IN)) {
  538 + signIn.setRemark(SIGN_OUT_TIMEOUT + "请在" + ConstDateUtil.formatDate("HH:mm", new Date(lastClosestTimestamp.getTimestamps())) + "前后一小时内打卡。");
  539 + globalIndex.setIndex(lastClosestTimestamp.getIndex());
  540 + result = false;
  541 + }
  542 + // 上一次无记无|签到,type:签退 当前时间小于最近签到时间 -> 超时签退
  543 + else if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_OUT) && lastClosestTimestamp.getIndex().equals(currentScheduling.getIndex())) {
  544 + signIn.setRemark(SIGN_IN_TIMEOUT + "请在" + ConstDateUtil.formatDate("HH:mm", new Date(currentScheduling.getTimestamps())) + "前后一小时内打卡。");
  545 + globalIndex.setIndex(currentScheduling.getIndex());
  546 + result = false;
  547 + }
  548 + // 当前最近无记录|签到,type:签到|签退 -> 签到超时给上
  549 + else {
  550 + signIn.setRemark(SIGN_IN_TIMEOUT + "请在" + ConstDateUtil.formatDate("HH:mm", new Date(currentScheduling.getTimestamps())) + "前后一小时内打卡。");
  551 + globalIndex.setIndex(currentScheduling.getIndex());
  552 + result = false;
  553 + }
  554 + }
  555 + // 签退一个逻辑 当前无记录
  556 + if (currentScheduling.getBcType().equals(BC_TYPE_IN) && Objects.isNull(currentScheduling.getSignInId())) {
  557 + DriverSignInRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1);
  558 + // 上一次无记|签退,type:签到 当前时间小于最近签退时间 -> 签到异常
  559 + if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_IN)) {
  560 + signIn.setRemark(SIGN_IN_TIMEOUT + "请在" + ConstDateUtil.formatDate("HH:mm", new Date(lastClosestTimestamp.getTimestamps())) + "前后一小时内打卡。");
  561 + globalIndex.setIndex(lastClosestTimestamp.getIndex());
  562 + result = false;
  563 + }
  564 + // 当前无记|签退 , type:签退|签到 ——> 签退异常
  565 + else {
  566 + signIn.setRemark(SIGN_OUT_TIMEOUT + "请在" + ConstDateUtil.formatDate("HH:mm", new Date(currentScheduling.getTimestamps())) + "前后一小时内打卡。");
  567 + globalIndex.setIndex(currentScheduling.getIndex());
  568 + result = false;
  569 + }
  570 + }
  571 + // 签退|签到 当前有记录
  572 + if (!Objects.isNull(currentScheduling.getSignInId())) {
  573 + String prompt = "请在" + ConstDateUtil.formatDate("HH:mm", new Date(currentScheduling.getTimestamps())) + "前后一小时内打卡。";
  574 + signIn.setRemark((currentScheduling.getBcType().equals(BC_TYPE_IN) ? SIGN_OUT_TIMEOUT : SIGN_IN_TIMEOUT) + prompt);
  575 + globalIndex.setIndex(currentScheduling.getIndex());
  576 + result = false;
  577 + }
  578 + return result;
  579 + }
  580 +
576 private Boolean handlerExceptionRecord(List<DriverScheduling> dto, long now, GlobalIndex globalIndex, SignIn signIn) { 581 private Boolean handlerExceptionRecord(List<DriverScheduling> dto, long now, GlobalIndex globalIndex, SignIn signIn) {
577 DriverSignInRecommendation currentScheduling = schedulingService.computedTheCurrentClosestTimestamp(dto, now, 0); 582 DriverSignInRecommendation currentScheduling = schedulingService.computedTheCurrentClosestTimestamp(dto, now, 0);
578 LocalDateTime endTime = ConstDateUtil.getLocalDateTimeByLongTime(currentScheduling.getTimestamps()); 583 LocalDateTime endTime = ConstDateUtil.getLocalDateTimeByLongTime(currentScheduling.getTimestamps());
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
@@ -402,6 +402,8 @@ public class ThreadJobService { @@ -402,6 +402,8 @@ public class ThreadJobService {
402 402
403 // 处理非司售人员的排班明细 403 // 处理非司售人员的排班明细
404 bcList.addAll(handleOtherPostsScheduling()); 404 bcList.addAll(handleOtherPostsScheduling());
  405 + // 金高只需要签到
  406 + bcList = bcList.stream().filter(item->BC_TYPE_OUT.equals(item.getBcType())).collect(Collectors.toList());
405 // 插入排班 407 // 插入排班
406 schedulingMapper.insertRoster(bcList); 408 schedulingMapper.insertRoster(bcList);
407 // 异常数据过多,不通过自增获取id再次查询获取 409 // 异常数据过多,不通过自增获取id再次查询获取
@@ -414,9 +416,9 @@ public class ThreadJobService { @@ -414,9 +416,9 @@ public class ThreadJobService {
414 // 更新缓存 416 // 更新缓存
415 nowSchedulingCache.setCacheScheduling(date, resultMap); 417 nowSchedulingCache.setCacheScheduling(date, resultMap);
416 // 获取错误排班 418 // 获取错误排班
417 - List<ErrorJobcode> errorScheduling = getErrorScheduling(resultMap); 419 +// List<ErrorJobcode> errorScheduling = getErrorScheduling(resultMap);
418 // 插入错误排班 420 // 插入错误排班
419 - errorJobcodeService.insertBatchErrorJobcode(errorScheduling); 421 +// errorJobcodeService.insertBatchErrorJobcode(errorScheduling);
420 } 422 }
421 } 423 }
422 424
Bsth-admin/src/main/resources/application-druid-prd.yml
@@ -30,7 +30,7 @@ spring: @@ -30,7 +30,7 @@ spring:
30 # 测试地址 30 # 测试地址
31 url: jdbc:mysql://127.0.0.1:3306/all-in-one?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&useAffectedRows=true&allowMultiQueries=true 31 url: jdbc:mysql://127.0.0.1:3306/all-in-one?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&useAffectedRows=true&allowMultiQueries=true
32 username: root 32 username: root
33 - password: qinpugongjiao20230730 33 + password: jingaogongjiao20230730
34 # 从库数据源 34 # 从库数据源
35 slave: 35 slave:
36 # 从数据源开关/默认关闭 36 # 从数据源开关/默认关闭
@@ -70,7 +70,7 @@ spring: @@ -70,7 +70,7 @@ spring:
70 url-pattern: /druid/* 70 url-pattern: /druid/*
71 # 控制台管理用户名和密码 71 # 控制台管理用户名和密码
72 login-username: qpgj 72 login-username: qpgj
73 - login-password: 2023#manager@qpgjuse 73 + login-password: 2023#manager@jsgjuse
74 filter: 74 filter:
75 stat: 75 stat:
76 enabled: true 76 enabled: true