处理请假后每日的得分问题

This commit is contained in:
TS-QD1 2023-10-20 18:30:53 +08:00
parent fb1a3d7613
commit 90ee454b5c
4 changed files with 23 additions and 14 deletions

View File

@ -134,17 +134,21 @@ public class KpiServiceImpl implements IKpiService {
} }
} else { } else {
// 开始时间不是当天 // 开始时间不是当天
DateTime leaveTimeDateTime = DateTime.parse(leaveTime, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD)); DateTime leaveTimeDateTime = DateTime.parse(leaveTime, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
int leaveDayIndex = 0; int leaveDayIndex = 0;
for (int i = 0; i < leaveTimeLong; i++) { for (int i = 0; i < leaveTimeLong; i++) {
String newDateTime = leaveTimeDateTime.plusDays(i + 1).toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD)); String newDateTime = leaveTimeDateTime.plusDays(i + 1).toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
if (StringUtils.contains(newDateTime, date)) { if (StringUtils.contains(newDateTime, date)) {
leaveDayIndex = i; leaveDayIndex = i;
break; break;
} }
} }
if (leaveTimeLong - (leaveDayIndex + 1) < 1) { double dayLeaveTimeLong = leaveTimeLong - (leaveDayIndex + 1);
leaveTimelongInDay = leaveTimeLong; if (dayLeaveTimeLong == 0) {
isLeave = 0;
isLeaveSelf = 0;
} else if (dayLeaveTimeLong < 1) {
leaveTimelongInDay = dayLeaveTimeLong;
} else { } else {
leaveTimelongInDay = 1; leaveTimelongInDay = 1;
} }
@ -246,17 +250,21 @@ public class KpiServiceImpl implements IKpiService {
} }
} else { } else {
// 开始时间不是当天 // 开始时间不是当天
DateTime leaveTimeDateTime = DateTime.parse(leaveTime, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD)); DateTime leaveTimeDateTime = DateTime.parse(leaveTime, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
int leaveDayIndex = 0; int leaveDayIndex = 0;
for (int i = 0; i < leaveTimeLong; i++) { for (int i = 0; i < leaveTimeLong; i++) {
String newDateTime = leaveTimeDateTime.plusDays(i + 1).toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD)); String newDateTime = leaveTimeDateTime.plusDays(i + 1).toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
if (StringUtils.contains(newDateTime, date)) { if (StringUtils.contains(newDateTime, date)) {
leaveDayIndex = i; leaveDayIndex = i;
break; break;
} }
} }
if (leaveTimeLong - (leaveDayIndex + 1) < 1) { double dayLeaveTimeLong = leaveTimeLong - (leaveDayIndex + 1);
leaveTimelongInDay = leaveTimeLong; if (dayLeaveTimeLong == 0) {
isLeave = 0;
isLeaveSelf = 0;
} else if (dayLeaveTimeLong < 1) {
leaveTimelongInDay = dayLeaveTimeLong;
} else { } else {
leaveTimelongInDay = 1; leaveTimelongInDay = 1;
} }

View File

@ -30,8 +30,9 @@ public class KpiScoreUtil {
if (isLeave == 1) { if (isLeave == 1) {
if (isLeaveSelf == 0) { if (isLeaveSelf == 0) {
// 公假不算矿工 // 公假不算矿工
signinScore += isSigninLate == 1 ? WGY_SIGNIN_SCORE / 2 : WGY_SIGNIN_SCORE; signinScore += WGY_SIGNIN_SCORE;
signoutScore += isSignoutEarly == 1 ? WGY_SIGNOUT_SCORE / 2 : WGY_SIGNOUT_SCORE; signoutScore += WGY_SIGNOUT_SCORE;
distanceScore += WGY_DISTANCE_SCORE;
} else { } else {
// 私假并且未超过上限 // 私假并且未超过上限
if (isLeaveSelfOverLimitInQuarter == 0) { if (isLeaveSelfOverLimitInQuarter == 0) {

View File

@ -113,7 +113,7 @@ public class KpiUtil {
List<LeavePO> leavePOS = leaveService.listPOByUserIdsAndDay(userIds, day); List<LeavePO> leavePOS = leaveService.listPOByUserIdsAndDay(userIds, day);
Map<String, LeavePO> leavePOMap = new HashMap<>(); Map<String, LeavePO> leavePOMap = new HashMap<>();
leavePOS.forEach(leavePO -> { leavePOS.forEach(leavePO -> {
leavePOMap.put(leavePO.getGmtCreate(), leavePO); leavePOMap.put(leavePO.getCreator(), leavePO);
}); });
return leavePOMap; return leavePOMap;
} }
@ -122,7 +122,7 @@ public class KpiUtil {
List<LeavePO> leavePOS = leaveService.listPOByUserIdAndDay(userId, day); List<LeavePO> leavePOS = leaveService.listPOByUserIdAndDay(userId, day);
Map<String, LeavePO> leavePOMap = new HashMap<>(); Map<String, LeavePO> leavePOMap = new HashMap<>();
leavePOS.forEach(leavePO -> { leavePOS.forEach(leavePO -> {
leavePOMap.put(leavePO.getGmtCreate(), leavePO); leavePOMap.put(leavePO.getCreator(), leavePO);
}); });
return leavePOMap; return leavePOMap;
} }

View File

@ -21,14 +21,14 @@ spring:
datasource: datasource:
druid: druid:
db1: db1:
url: jdbc:mysql://192.168.0.151:3306/db_btgxq_bigdata?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false url: jdbc:mysql://127.0.0.1:3306/db_btgxq_bigdata?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false
db-type: mysql db-type: mysql
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: root password: root
mapper-locations: classpath*:mybatis/mapper/**/*.xml mapper-locations: classpath*:mybatis/mapper/**/*.xml
db2: db2:
url: jdbc:mysql://192.168.0.151:3306/db_btgxq_city?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false url: jdbc:mysql://127.0.0.1:3306/db_btgxq_city?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false
db-type: mysql db-type: mysql
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root username: root