|
|
|
@ -15,6 +15,7 @@ import com.google.common.collect.Maps;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -198,8 +199,6 @@ public class UpdateAttendanceResultWrapper extends Service {
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<askForLeaveList.size();i++){
|
|
|
|
|
Map<String, Object> resultMap = Maps.newHashMap();
|
|
|
|
|
resultList.add(resultMap);
|
|
|
|
|
resultMap.put("item",askForLeaveList.get(i).get("jqlx"));
|
|
|
|
|
String kssj = askForLeaveList.get(i).get("ksrq") + " "+askForLeaveList.get(i).get("kssj");
|
|
|
|
|
String jssj = askForLeaveList.get(i).get("jsrq")+ " "+askForLeaveList.get(i).get("jssj");
|
|
|
|
|
//半天请假
|
|
|
|
@ -221,6 +220,11 @@ public class UpdateAttendanceResultWrapper extends Service {
|
|
|
|
|
//是否分组呈现
|
|
|
|
|
String sffzcx = Util.null2String(askForLeaveItem.get("sffzcx"));
|
|
|
|
|
|
|
|
|
|
if (!sffzcx.equals(CheckBoxEnum.CHECKED.getKey())){
|
|
|
|
|
resultMap.put("item",askForLeaveList.get(i).get("jqlx"));
|
|
|
|
|
resultList.add(resultMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String,Object> param = Maps.newHashMap();
|
|
|
|
|
param.put("abnormalClockInList",abnormalClockInList);
|
|
|
|
|
param.put("zysd",zysd);
|
|
|
|
@ -237,13 +241,57 @@ public class UpdateAttendanceResultWrapper extends Service {
|
|
|
|
|
//时长请假
|
|
|
|
|
itemduration = Utils.getItemduration(hsl,hsdw,Double.valueOf(Double.valueOf(qjsc)*60).intValue(),AccountingUnitEnum.MINUTES);
|
|
|
|
|
|
|
|
|
|
resultMap.put("itemduration",itemduration);
|
|
|
|
|
if (!sffzcx.equals(CheckBoxEnum.CHECKED.getKey())){
|
|
|
|
|
resultMap.put("itemduration",itemduration);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
param.put("qjsc",qjsc);
|
|
|
|
|
param.put("tybcndbjlhbjs",tybcndbjlhbjs);
|
|
|
|
|
if (abnormalClockInList.size()>0){
|
|
|
|
|
Map<String,Object> map1 = askForLeaveService.askForLeaveByDurationTime(param);
|
|
|
|
|
abnormalClockInList =(List<Map<String,Object>>)map1.get("abnormalClockInList");
|
|
|
|
|
offsetAskForLeaveAnomaly.addAll((List<Map<String,Object>>)map1.get("offsetAskForLeaveAnomaly"));
|
|
|
|
|
List<Map<String,Object>> offsetAskForLeaveAnomalyList = (List<Map<String,Object>>)map1.get("offsetAskForLeaveAnomaly");
|
|
|
|
|
offsetAskForLeaveAnomaly.addAll(offsetAskForLeaveAnomalyList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//按时长请假,将标记请假作用的时段上的异常 按标准逻辑进行冲销,如果冲销后还有多余时长,如请假时长为1.5小时,但员工当天有两个时段上各有不到30分钟的异常,此时每个时段0.5小时需要冲销,多出来的0.5小时放哪里,放到异常多的那个时段上
|
|
|
|
|
//有几个抵消异常计入几个请假考勤项目
|
|
|
|
|
if (sffzcx.equals(CheckBoxEnum.CHECKED.getKey())){
|
|
|
|
|
int total = offsetAskForLeaveAnomalyList.stream().mapToInt(e->Integer.valueOf(e.get("betweenMinutes").toString())).sum();
|
|
|
|
|
int more = 0;
|
|
|
|
|
if (total < Integer.valueOf(qjsc)*60){
|
|
|
|
|
more = Integer.valueOf(qjsc)*60-total;
|
|
|
|
|
}
|
|
|
|
|
List<Map<String,Object>> sortOffsetAskForLeaveAnomalyList = offsetAskForLeaveAnomalyList.stream().sorted(Comparator.comparing(e->Integer.valueOf(e.get("betweenMinutes").toString()))).collect(Collectors.toList());
|
|
|
|
|
for (int j=0;j<sortOffsetAskForLeaveAnomalyList.size();j++){
|
|
|
|
|
//异常班段类型
|
|
|
|
|
String bdlx = sortOffsetAskForLeaveAnomalyList.get(i).get("bdlx").toString();
|
|
|
|
|
//异常时间
|
|
|
|
|
int time = Integer.valueOf(abnormalClockInList.get(i).get("betweenMinutes").toString());
|
|
|
|
|
if (j == 0){
|
|
|
|
|
time = time+more;
|
|
|
|
|
}
|
|
|
|
|
Map<String,Object> item = CommonUtil.assembleAskForOrEvectionItem(askForLeaveItem,bdlx);
|
|
|
|
|
if (item != null){
|
|
|
|
|
itemduration = Utils.getItemduration(Double.valueOf(Util.null2String(item.get("hsl"))),Util.null2String(item.get("hsdw")),time,AccountingUnitEnum.MINUTES);
|
|
|
|
|
Map<String, Object> itemMap = Maps.newHashMap();
|
|
|
|
|
itemMap.put("itemduration",itemduration);
|
|
|
|
|
itemMap.put("item",itemMap.get("keyid"));
|
|
|
|
|
resultList.add(itemMap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
if (sffzcx.equals(CheckBoxEnum.CHECKED.getKey())){
|
|
|
|
|
Map<String,Object> item = CommonUtil.assembleAskForOrEvectionItem(askForLeaveItem,ClassSegmentTypeEnum.WORK_TIME.getKey());
|
|
|
|
|
if (item != null){
|
|
|
|
|
Map<String, Object> itemMap = Maps.newHashMap();
|
|
|
|
|
itemduration = Utils.getItemduration(Double.valueOf(Util.null2String(item.get("hsl"))),Util.null2String(item.get("hsdw")),Double.valueOf(Double.valueOf(qjsc)*60).intValue(),AccountingUnitEnum.MINUTES);
|
|
|
|
|
itemMap.put("itemduration",itemduration);
|
|
|
|
|
itemMap.put("item",itemMap.get("keyid"));
|
|
|
|
|
resultList.add(itemMap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
@ -252,9 +300,11 @@ public class UpdateAttendanceResultWrapper extends Service {
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(zdycbcndfgzsd)){
|
|
|
|
|
timeMinutes = Utils.removeRestTime(kssj,jssj,scheduleResult,analysisDate);
|
|
|
|
|
}
|
|
|
|
|
if (timeMinutes > Integer.valueOf(qjsc)*60){
|
|
|
|
|
timeMinutes = Integer.valueOf(qjsc)*60;
|
|
|
|
|
}
|
|
|
|
|
log.debug("recordAskForLeave timeMinutes :[{}] ,hsl:{},hsdw",timeMinutes,hsl,hsdw);
|
|
|
|
|
itemduration = Utils.getItemduration(hsl,hsdw,timeMinutes,AccountingUnitEnum.MINUTES);
|
|
|
|
|
resultMap.put("itemduration",itemduration);
|
|
|
|
|
param.put("kssj",kssj);
|
|
|
|
|
param.put("jssj",jssj);
|
|
|
|
|
if (abnormalClockInList.size()>0){
|
|
|
|
@ -262,6 +312,23 @@ public class UpdateAttendanceResultWrapper extends Service {
|
|
|
|
|
abnormalClockInList = (List<Map<String,Object>>)map1.get("abnormalClockInList");
|
|
|
|
|
offsetAskForLeaveAnomaly.addAll((List<Map<String,Object>>)map1.get("offsetAskForLeaveAnomaly"));
|
|
|
|
|
}
|
|
|
|
|
if (sffzcx.equals(CheckBoxEnum.CHECKED.getKey())){
|
|
|
|
|
//按时间区间请假时 将连接的同一类型时段设置一种假别 计算出分钟时长后按核算量算出核算时长及单位即可
|
|
|
|
|
Map<String,Object> proportionMap = Utils.getAskLeaveAndEvctionProportion(kssj,jssj,scheduleResult,analysisDate);
|
|
|
|
|
for (Map.Entry<String,Object> entry: proportionMap.entrySet()){
|
|
|
|
|
String bdlx = entry.getKey();
|
|
|
|
|
int betweenTimes = Integer.valueOf(entry.getValue().toString());
|
|
|
|
|
Map<String,Object> item = CommonUtil.assembleAskForOrEvectionItem(askForLeaveItem,bdlx);
|
|
|
|
|
if (item != null){
|
|
|
|
|
Map<String, Object> itemMap = Maps.newHashMap();
|
|
|
|
|
itemMap.put("itemduration",Utils.getItemduration(Double.valueOf(Util.null2String(item.get("hsl"))),Util.null2String(item.get("hsdw")),betweenTimes,AccountingUnitEnum.MINUTES));
|
|
|
|
|
itemMap.put("item",itemMap.get("keyid"));
|
|
|
|
|
resultList.add(itemMap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
resultMap.put("itemduration",itemduration);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
map.put("resultList",resultList);
|
|
|
|
@ -524,4 +591,5 @@ public class UpdateAttendanceResultWrapper extends Service {
|
|
|
|
|
utilService.recordItem(recordParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|