From f931a4c2ce29a8b12a08e23d152286d467c1890c Mon Sep 17 00:00:00 2001 From: seaon Date: Sun, 19 Jan 2025 22:59:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=A0=B9=E6=8D=AE=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E6=97=A5=E5=8E=86=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendance/vacation/cmd/VocationCmd.java | 9 ++- .../tactics/SinglePaymentInFullWay.java | 65 ++++++++++--------- 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/src/com/engine/jucailinkq/attendance/vacation/cmd/VocationCmd.java b/src/com/engine/jucailinkq/attendance/vacation/cmd/VocationCmd.java index 7b4e758..93b65aa 100644 --- a/src/com/engine/jucailinkq/attendance/vacation/cmd/VocationCmd.java +++ b/src/com/engine/jucailinkq/attendance/vacation/cmd/VocationCmd.java @@ -86,12 +86,15 @@ public class VocationCmd extends AbstractCommonCommand> { vocation.put("qsrqValue",qsrqValue); vocation.put("yjzdValue",yjzdValue); vocation.put("ljcrglyfslwzValue",ljcrglyfslwzValue); - if (!"".equals(lsgldw) && !"".equals(ljcrglyfslwzValue) && "0".equals(lsgldw) && !"0".equals(jgsc)){ - //当累计单位为年时 + //lsgldw:累时工龄单位:0:年;1:月 + //ljcrglyfslwzValue:累时工龄值:浮点数 + //jgsc:间隔时长算法:0:起算日期于当前日期间隔;1:起算日期与当前日期间隔额外加上累时工龄值;2:直接取累时工龄浮点值 + if (!"".equals(lsgldw) && !"".equals(ljcrglyfslwzValue) && "0".equals(lsgldw) && "1".equals(jgsc)){ + //当累计单位为年时 累计工龄的处理 vocation.put("ljcrglyfslwzValue",Math.round(Double.valueOf(ljcrglyfslwzValue)*12)); } if ("0".equals(jgsc)){ - //起算日期与当前日期间隔不取 + //起算日期与当前日期间隔不取 直取间隔时长 vocation.put("ljcrglyfslwzValue","0"); } diff --git a/src/com/engine/jucailinkq/attendance/vacation/job/holidaygeneration/tactics/SinglePaymentInFullWay.java b/src/com/engine/jucailinkq/attendance/vacation/job/holidaygeneration/tactics/SinglePaymentInFullWay.java index c724645..6292975 100644 --- a/src/com/engine/jucailinkq/attendance/vacation/job/holidaygeneration/tactics/SinglePaymentInFullWay.java +++ b/src/com/engine/jucailinkq/attendance/vacation/job/holidaygeneration/tactics/SinglePaymentInFullWay.java @@ -10,6 +10,8 @@ import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; import weaver.general.Util; +import javax.swing.text.DateFormatter; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Calendar; import java.util.List; @@ -68,6 +70,8 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay { String schdedkzsxrq = Util.null2String(vocationList.get(0).get("schdedkzsxrq")); //间隔时长算法 String jgscsf = Util.null2String(vocationList.get(0).get("jgsc")); + //累计时长单位:0:年;1:月 + String ljgldw = Util.null2String(vocationList.get(0).get("lsgldw")); if ("".equals(qsrq)){ return Maps.newHashMap(); @@ -247,42 +251,44 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay { String wscl = Util.null2String(vocationList.get(0).get("wscl")); //间隔时长算法 String jgscsf = Util.null2String(vocationList.get(0).get("jgsc")); - - int seniority = "".equals(ljcrglyfslwz)?0:Double.valueOf(ljcrglyfslwz).intValue(); - + //累计工龄数或者直取工龄数 + int seniority = 0; + //累计时长单位:0:年;1:月 + String ljgldw = Util.null2String(vocationList.get(0).get("lsgldw")); + if(!"2".equals(jgscsf)) { + //间隔时长不为直取工龄时,进行取整处理 todo:实际上累计工龄为年时 基本上都是有小数的 ,都不应该取整 ,这里的逻辑有待优化 + seniority = "".equals(ljcrglyfslwz) ? 0 : Double.valueOf(ljcrglyfslwz).intValue(); + } double restTime=0.0; //折算 if (changeMethodEnum == QuotaChangeMethodEnum.CONVERT){ - int beginYearMonth = DateUtil.getBetWeenMonths(qsrq,sxrq); - if (beginYearMonth < 0){ - beginYearMonth = 0; - } - beginYearMonth = beginYearMonth+seniority; - int endYearMonth = DateUtil.getBetWeenMonths(qsrq,nextSxrq); - endYearMonth = endYearMonth+seniority; - int beginYear = beginYearMonth/12; - int endYear = endYearMonth/12; - - //残年分割日期 - String divideTime = DateUtil.beforeMonth(qsrq,seniority); - divideTime = sxrq.split("-")[0]+"-"+divideTime.split("-")[1]+"-"+divideTime.split("-")[2]; - if (jgscsf.equals("2")){ + int beginYear = 0; + int endYear = 0; + String divideTime = ""; + if("2".equals(jgscsf)) { //直接取工龄字段 - beginYear = seniority/12; + beginYear = Double.valueOf(ljcrglyfslwz).intValue(); endYear = beginYear+1; - - //分割日期 - int month = DateUtil.getBetWeenMonths(qsrq,sxrq); - if (month < 0){ - month = 0; + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + double divdemonths = Double.valueOf(ljcrglyfslwz) - Double.valueOf(ljcrglyfslwz).intValue(); + divideTime = DateUtil.nextMonth(sxrq,(int)Math.ceil(divdemonths*12),dateTimeFormatter); + //LocalDateTime localDateTime = DateUtil.getTime(sxrq); + //localDateTime = localDateTime.plusMonths((int)Math.ceil(divdemonths*12)); + //divideTime = localDateTime.format(dateTimeFormatter); + }else { + int beginYearMonth = DateUtil.getBetWeenMonths(qsrq, sxrq); + if (beginYearMonth < 0) { + beginYearMonth = 0; } - int historySeniority = seniority-month<0?0:seniority-month; - - divideTime = DateUtil.beforeMonth(qsrq,historySeniority); + beginYearMonth = beginYearMonth + seniority; + int endYearMonth = DateUtil.getBetWeenMonths(qsrq, nextSxrq); + endYearMonth = endYearMonth + seniority; + beginYear = beginYearMonth / 12; + endYear = endYearMonth / 12; + //残年分割日期 + divideTime = DateUtil.beforeMonth(qsrq,seniority); divideTime = sxrq.split("-")[0]+"-"+divideTime.split("-")[1]+"-"+divideTime.split("-")[2]; } - - Map beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd,userId); Map endYearmap = VocationCommonUtil.getVocationMap(vocationList, endYear, yjzd,userId); double beginEdktsc = Double.valueOf(beginYearmap.get("edktsc") == null? "0" :Util.null2String(beginYearmap.get("edktsc"))); @@ -322,13 +328,12 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay { restTime = VocationCommonUtil.handleRestDays(beforeRestTime+afterRestTime,wscl); } } - }else { //不折算 int beginYear = 0; if (jgscsf.equals("2")){ //直接取工龄字段 - beginYear = seniority/12; + beginYear = Double.valueOf(ljcrglyfslwz).intValue(); }else { //起算日期与当前日期间隔+工龄字段 int beginYearMonth = DateUtil.getBetWeenMonths(qsrq,sxrq);