|
|
|
@ -520,7 +520,7 @@ public class AskForLeaveServiceImpl extends Service implements AskForLeaveServic
|
|
|
|
|
//优先使用的的请假项目是否已被编辑
|
|
|
|
|
double firstItemEditedDetailSc = editedLeaveInfo.get(empId + "_" + firstItemId + "_" + ksrq) == null ? 0 : Double.parseDouble(editedLeaveInfo.get(empId + "_" + firstItemId + "_" + ksrq));
|
|
|
|
|
boolean firstItemEditedDetail = editedLeaveInfo.get(empId + "_" + firstItemId + "_" + ksrq) != null;
|
|
|
|
|
//勾选的请假项目是否已被编辑
|
|
|
|
|
//勾选的请假项目是否已被编辑,此处判定包含了优先使用的请假项目编辑记录中的时长大于等于提交请假需求者的时长
|
|
|
|
|
double checkItemEditedDetailSc = editedLeaveInfo.get(empId + "_" + checkItemId + "_" + ksrq) == null ? 0 : Double.parseDouble(editedLeaveInfo.get(empId + "_" + checkItemId + "_" + ksrq));
|
|
|
|
|
boolean checkItemEditedDetail = editedLeaveInfo.get(empId + "_" + checkItemId + "_" + ksrq) != null || (firstItemEditedDetail && firstItemEditedDetailSc - leaveDuration >= 0);
|
|
|
|
|
|
|
|
|
@ -589,7 +589,9 @@ public class AskForLeaveServiceImpl extends Service implements AskForLeaveServic
|
|
|
|
|
String message = empName;
|
|
|
|
|
if (checkItemEditedDetail) {
|
|
|
|
|
//人员id+日期+假期类型三种条件约束唯一性
|
|
|
|
|
message = message + "_" + ksrq + "在明细表1中已存在一笔该请假类型的请假明细!";
|
|
|
|
|
message = message + "_" + ksrq + "已存在一笔该请假类型的请假明细!";
|
|
|
|
|
} else if(!checkItemNonCheck && canUseCheckJqyeInfo.size() == 0) {
|
|
|
|
|
message = message + "_" + ksrq + "不存在可使用的假期余额,请检查假期余额使用次数和最小使用时长设置!";
|
|
|
|
|
} else {
|
|
|
|
|
//假期余额不足
|
|
|
|
|
message = message + "_" + ksrq + "假期余额不足!";
|
|
|
|
@ -620,12 +622,12 @@ public class AskForLeaveServiceImpl extends Service implements AskForLeaveServic
|
|
|
|
|
String eddw = Util.null2String(holidayBalancefilterList.get(0).get("eddw"));
|
|
|
|
|
int multipleNum = eddw.equals(AccountingUnitEnum.DAY.getKey()) ? 8 : 1;
|
|
|
|
|
for (Map<String, Object> holidayBalance : holidayBalancefilterList) {
|
|
|
|
|
//1-如果已编辑的请假明细中已有该假期余额id的记录,则满足最小使用时长
|
|
|
|
|
boolean minLeaveDurationSign = editedUseJqed.get(holidayBalance.get("id").toString()) != null;
|
|
|
|
|
//1-如果已编辑的请假明细中已有该假期余额id的记录,则满足最小使用时长;如果result的请假明细中已有该假期余额id的记录,则满足最小使用时长
|
|
|
|
|
boolean minLeaveDurationSign = editedUseJqed.get(holidayBalance.get("id").toString()) != null || result.stream().anyMatch(map -> itemId.equals(map.get("qjlx")));
|
|
|
|
|
//2-如果编辑记录中不存在,则需要判断是否满足最小使用时长
|
|
|
|
|
if (!minLeaveDurationSign) {
|
|
|
|
|
String minLeaveDuration = Util.null2String(holidayBalance.get("minLeaveDuration"));
|
|
|
|
|
minLeaveDurationSign = "".equals(minLeaveDuration) || totalLeaveDuration > Double.parseDouble(minLeaveDuration);
|
|
|
|
|
minLeaveDurationSign = "".equals(minLeaveDuration) || totalLeaveDuration > Double.parseDouble(minLeaveDuration) * multipleNum;
|
|
|
|
|
}
|
|
|
|
|
//不满足最小使用时长,直接执行下一条
|
|
|
|
|
if (!minLeaveDurationSign) {
|
|
|
|
@ -689,14 +691,15 @@ public class AskForLeaveServiceImpl extends Service implements AskForLeaveServic
|
|
|
|
|
Map<String, Object> jqedInfo = DbTools.getSqlToMap(jqedSql, itemId);
|
|
|
|
|
//假期额度的额度单位,0-天、1-小时
|
|
|
|
|
String eddw = Util.null2String(jqedInfo.get("eddw"));
|
|
|
|
|
int multiple = 1;
|
|
|
|
|
if (eddw.equals(AccountingUnitEnum.DAY.getKey())) {
|
|
|
|
|
multiple = 8;
|
|
|
|
|
}
|
|
|
|
|
//单次最小休时长
|
|
|
|
|
String minDuration = Util.null2String(jqedInfo.get("dczskxsc"));
|
|
|
|
|
Double minLeaveDuration = null;
|
|
|
|
|
if (!"".equals(eddw) && !"".equals(minDuration)) {
|
|
|
|
|
minLeaveDuration = Double.parseDouble(minDuration);
|
|
|
|
|
if (eddw.equals(AccountingUnitEnum.DAY.getKey())) {
|
|
|
|
|
minLeaveDuration = minLeaveDuration * 8;
|
|
|
|
|
}
|
|
|
|
|
minLeaveDuration = Double.parseDouble(minDuration) * multiple;
|
|
|
|
|
}
|
|
|
|
|
//额度可修次数
|
|
|
|
|
String allowLeaveNumStr = Util.null2String(jqedInfo.get("edbxdcxw"));
|
|
|
|
@ -733,13 +736,12 @@ public class AskForLeaveServiceImpl extends Service implements AskForLeaveServic
|
|
|
|
|
for (Map<String, Object> holidayBalance : holidayBalanceList) {
|
|
|
|
|
String jqyeId = Util.null2String(holidayBalance.get("id"));
|
|
|
|
|
if (!unableUseJqyeIdList.contains(jqyeId)) {
|
|
|
|
|
double wxsc = Utils.convertDouble(holidayBalance.get("wxsc"));
|
|
|
|
|
double wxsc = Utils.convertDouble(holidayBalance.get("wxsc")) * multiple;
|
|
|
|
|
double editedUseSc = Utils.convertDouble(editedUseJqed.get(jqyeId));
|
|
|
|
|
double realWxsc = wxsc - editedUseSc;
|
|
|
|
|
if ((minLeaveDuration == null || wxsc >= minLeaveDuration) && realWxsc > 0) {
|
|
|
|
|
|
|
|
|
|
holidayBalance.put("wxsc", realWxsc);
|
|
|
|
|
holidayBalance.put("minLeaveDuration", minLeaveDuration);
|
|
|
|
|
holidayBalance.put("wxsc", Utils.divide(realWxsc, multiple));
|
|
|
|
|
holidayBalance.put("minLeaveDuration", minLeaveDuration == null ? null : Utils.divide(minLeaveDuration, multiple));
|
|
|
|
|
holidayBalance.put("eddw", eddw);
|
|
|
|
|
canUseHolidayBalanceList.add(holidayBalance);
|
|
|
|
|
}
|
|
|
|
|