From 90ee454b5ced103e46b511d918aceca2cd635f39 Mon Sep 17 00:00:00 2001 From: TS-QD1 Date: Fri, 20 Oct 2023 18:30:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=AF=B7=E5=81=87=E5=90=8E?= =?UTF-8?q?=E6=AF=8F=E6=97=A5=E7=9A=84=E5=BE=97=E5=88=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/kpi/impl/KpiServiceImpl.java | 24 ++++++++++++------- .../com/cm/bigdata/utils/KpiScoreUtil.java | 5 ++-- .../java/com/cm/bigdata/utils/KpiUtil.java | 4 ++-- src/main/resources/application.yml | 4 ++-- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java b/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java index 7dddbc4..ce0189b 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java +++ b/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java @@ -134,17 +134,21 @@ public class KpiServiceImpl implements IKpiService { } } 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; 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)) { leaveDayIndex = i; break; } } - if (leaveTimeLong - (leaveDayIndex + 1) < 1) { - leaveTimelongInDay = leaveTimeLong; + double dayLeaveTimeLong = leaveTimeLong - (leaveDayIndex + 1); + if (dayLeaveTimeLong == 0) { + isLeave = 0; + isLeaveSelf = 0; + } else if (dayLeaveTimeLong < 1) { + leaveTimelongInDay = dayLeaveTimeLong; } else { leaveTimelongInDay = 1; } @@ -246,17 +250,21 @@ public class KpiServiceImpl implements IKpiService { } } 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; 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)) { leaveDayIndex = i; break; } } - if (leaveTimeLong - (leaveDayIndex + 1) < 1) { - leaveTimelongInDay = leaveTimeLong; + double dayLeaveTimeLong = leaveTimeLong - (leaveDayIndex + 1); + if (dayLeaveTimeLong == 0) { + isLeave = 0; + isLeaveSelf = 0; + } else if (dayLeaveTimeLong < 1) { + leaveTimelongInDay = dayLeaveTimeLong; } else { leaveTimelongInDay = 1; } diff --git a/src/main/java/com/cm/bigdata/utils/KpiScoreUtil.java b/src/main/java/com/cm/bigdata/utils/KpiScoreUtil.java index 3dbbd32..8da2bd2 100644 --- a/src/main/java/com/cm/bigdata/utils/KpiScoreUtil.java +++ b/src/main/java/com/cm/bigdata/utils/KpiScoreUtil.java @@ -30,8 +30,9 @@ public class KpiScoreUtil { if (isLeave == 1) { if (isLeaveSelf == 0) { // 公假,不算矿工 - signinScore += isSigninLate == 1 ? WGY_SIGNIN_SCORE / 2 : WGY_SIGNIN_SCORE; - signoutScore += isSignoutEarly == 1 ? WGY_SIGNOUT_SCORE / 2 : WGY_SIGNOUT_SCORE; + signinScore += WGY_SIGNIN_SCORE; + signoutScore += WGY_SIGNOUT_SCORE; + distanceScore += WGY_DISTANCE_SCORE; } else { // 私假,并且未超过上限 if (isLeaveSelfOverLimitInQuarter == 0) { diff --git a/src/main/java/com/cm/bigdata/utils/KpiUtil.java b/src/main/java/com/cm/bigdata/utils/KpiUtil.java index e7db00d..0623cb1 100644 --- a/src/main/java/com/cm/bigdata/utils/KpiUtil.java +++ b/src/main/java/com/cm/bigdata/utils/KpiUtil.java @@ -113,7 +113,7 @@ public class KpiUtil { List leavePOS = leaveService.listPOByUserIdsAndDay(userIds, day); Map leavePOMap = new HashMap<>(); leavePOS.forEach(leavePO -> { - leavePOMap.put(leavePO.getGmtCreate(), leavePO); + leavePOMap.put(leavePO.getCreator(), leavePO); }); return leavePOMap; } @@ -122,7 +122,7 @@ public class KpiUtil { List leavePOS = leaveService.listPOByUserIdAndDay(userId, day); Map leavePOMap = new HashMap<>(); leavePOS.forEach(leavePO -> { - leavePOMap.put(leavePO.getGmtCreate(), leavePO); + leavePOMap.put(leavePO.getCreator(), leavePO); }); return leavePOMap; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 6b20cf3..4781f2c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -21,14 +21,14 @@ spring: datasource: druid: 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 driver-class-name: com.mysql.jdbc.Driver username: root password: root mapper-locations: classpath*:mybatis/mapper/**/*.xml 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 driver-class-name: com.mysql.jdbc.Driver username: root