完成根据企业日历初始化日历的功能

main
seaon 3 months ago
parent 4320d173e5
commit f931a4c2ce

@ -86,12 +86,15 @@ public class VocationCmd extends AbstractCommonCommand<Map<String,Object>> {
vocation.put("qsrqValue",qsrqValue); vocation.put("qsrqValue",qsrqValue);
vocation.put("yjzdValue",yjzdValue); vocation.put("yjzdValue",yjzdValue);
vocation.put("ljcrglyfslwzValue",ljcrglyfslwzValue); vocation.put("ljcrglyfslwzValue",ljcrglyfslwzValue);
if (!"".equals(lsgldw) && !"".equals(ljcrglyfslwzValue) && "0".equals(lsgldw) && !"0".equals(jgsc)){ //lsgldw:累时工龄单位01
//当累计单位为年时 //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)); vocation.put("ljcrglyfslwzValue",Math.round(Double.valueOf(ljcrglyfslwzValue)*12));
} }
if ("0".equals(jgsc)){ if ("0".equals(jgsc)){
//起算日期与当前日期间隔不取 //起算日期与当前日期间隔不取 直取间隔时长
vocation.put("ljcrglyfslwzValue","0"); vocation.put("ljcrglyfslwzValue","0");
} }

@ -10,6 +10,8 @@ import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import weaver.general.Util; import weaver.general.Util;
import javax.swing.text.DateFormatter;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
@ -68,6 +70,8 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
String schdedkzsxrq = Util.null2String(vocationList.get(0).get("schdedkzsxrq")); String schdedkzsxrq = Util.null2String(vocationList.get(0).get("schdedkzsxrq"));
//间隔时长算法 //间隔时长算法
String jgscsf = Util.null2String(vocationList.get(0).get("jgsc")); String jgscsf = Util.null2String(vocationList.get(0).get("jgsc"));
//累计时长单位01
String ljgldw = Util.null2String(vocationList.get(0).get("lsgldw"));
if ("".equals(qsrq)){ if ("".equals(qsrq)){
return Maps.newHashMap(); return Maps.newHashMap();
@ -247,12 +251,31 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
String wscl = Util.null2String(vocationList.get(0).get("wscl")); String wscl = Util.null2String(vocationList.get(0).get("wscl"));
//间隔时长算法 //间隔时长算法
String jgscsf = Util.null2String(vocationList.get(0).get("jgsc")); String jgscsf = Util.null2String(vocationList.get(0).get("jgsc"));
//累计工龄数或者直取工龄数
int seniority = "".equals(ljcrglyfslwz)?0:Double.valueOf(ljcrglyfslwz).intValue(); int seniority = 0;
//累计时长单位01
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; double restTime=0.0;
//折算 //折算
if (changeMethodEnum == QuotaChangeMethodEnum.CONVERT){ if (changeMethodEnum == QuotaChangeMethodEnum.CONVERT){
int beginYear = 0;
int endYear = 0;
String divideTime = "";
if("2".equals(jgscsf)) {
//直接取工龄字段
beginYear = Double.valueOf(ljcrglyfslwz).intValue();
endYear = beginYear+1;
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); int beginYearMonth = DateUtil.getBetWeenMonths(qsrq, sxrq);
if (beginYearMonth < 0) { if (beginYearMonth < 0) {
beginYearMonth = 0; beginYearMonth = 0;
@ -260,29 +283,12 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
beginYearMonth = beginYearMonth + seniority; beginYearMonth = beginYearMonth + seniority;
int endYearMonth = DateUtil.getBetWeenMonths(qsrq, nextSxrq); int endYearMonth = DateUtil.getBetWeenMonths(qsrq, nextSxrq);
endYearMonth = endYearMonth + seniority; endYearMonth = endYearMonth + seniority;
int beginYear = beginYearMonth/12; beginYear = beginYearMonth / 12;
int endYear = endYearMonth/12; endYear = endYearMonth / 12;
//残年分割日期 //残年分割日期
String divideTime = DateUtil.beforeMonth(qsrq,seniority); divideTime = DateUtil.beforeMonth(qsrq,seniority);
divideTime = sxrq.split("-")[0]+"-"+divideTime.split("-")[1]+"-"+divideTime.split("-")[2]; divideTime = sxrq.split("-")[0]+"-"+divideTime.split("-")[1]+"-"+divideTime.split("-")[2];
if (jgscsf.equals("2")){
//直接取工龄字段
beginYear = seniority/12;
endYear = beginYear+1;
//分割日期
int month = DateUtil.getBetWeenMonths(qsrq,sxrq);
if (month < 0){
month = 0;
} }
int historySeniority = seniority-month<0?0:seniority-month;
divideTime = DateUtil.beforeMonth(qsrq,historySeniority);
divideTime = sxrq.split("-")[0]+"-"+divideTime.split("-")[1]+"-"+divideTime.split("-")[2];
}
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd,userId); Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd,userId);
Map<String,Object> endYearmap = VocationCommonUtil.getVocationMap(vocationList, endYear, yjzd,userId); Map<String,Object> endYearmap = VocationCommonUtil.getVocationMap(vocationList, endYear, yjzd,userId);
double beginEdktsc = Double.valueOf(beginYearmap.get("edktsc") == null? "0" :Util.null2String(beginYearmap.get("edktsc"))); 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); restTime = VocationCommonUtil.handleRestDays(beforeRestTime+afterRestTime,wscl);
} }
} }
}else { }else {
//不折算 //不折算
int beginYear = 0; int beginYear = 0;
if (jgscsf.equals("2")){ if (jgscsf.equals("2")){
//直接取工龄字段 //直接取工龄字段
beginYear = seniority/12; beginYear = Double.valueOf(ljcrglyfslwz).intValue();
}else { }else {
//起算日期与当前日期间隔+工龄字段 //起算日期与当前日期间隔+工龄字段
int beginYearMonth = DateUtil.getBetWeenMonths(qsrq,sxrq); int beginYearMonth = DateUtil.getBetWeenMonths(qsrq,sxrq);

Loading…
Cancel
Save