You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.3 KiB
Java
60 lines
2.3 KiB
Java
10 months ago
|
package com.engine.jucailinkq.attendance.attendanceanalysis.cmd.item;
|
||
2 years ago
|
|
||
10 months ago
|
import com.engine.jucailinkq.attendance.enums.AttendanceItemTypeEnum;
|
||
|
import com.engine.jucailinkq.attendance.enums.WorkForTimeEnum;
|
||
2 years ago
|
import com.engine.common.biz.AbstractCommonCommand;
|
||
|
import com.engine.common.entity.BizLogContext;
|
||
|
import com.engine.core.interceptor.CommandContext;
|
||
1 year ago
|
import lombok.extern.slf4j.Slf4j;
|
||
2 years ago
|
import weaver.general.Util;
|
||
|
|
||
1 year ago
|
import java.util.HashMap;
|
||
2 years ago
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
import java.util.stream.Collectors;
|
||
|
|
||
|
/**
|
||
1 year ago
|
* 获取早退项目
|
||
2 years ago
|
*/
|
||
1 year ago
|
@Slf4j
|
||
1 year ago
|
public class LeaveEarlyItemCmd extends AbstractCommonCommand<Map<String,Object>> {
|
||
|
|
||
|
public LeaveEarlyItemCmd(Map<String,Object> params){
|
||
|
this.params=params;
|
||
|
}
|
||
2 years ago
|
@Override
|
||
|
public BizLogContext getLogContext() {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Map<String, Object> execute(CommandContext commandContext) {
|
||
|
//作用时段
|
||
|
String workfor = Util.null2String(params.get("workfor"));
|
||
1 year ago
|
//早退分钟数
|
||
1 year ago
|
int time = Util.null2String(params.get("time")).equals("")? 0:Util.getIntValue(Util.null2String(params.get("time")));
|
||
|
Map<String, Object> resultMap = new HashMap<>();
|
||
|
|
||
2 years ago
|
List<Map<String,Object>> attendanceItems = (List<Map<String,Object>>)params.get("attendanceItems");
|
||
1 year ago
|
attendanceItems = attendanceItems.stream().filter(e -> {
|
||
2 years ago
|
//项目类型
|
||
|
String xmlx = Util.null2String(e.get("xmlx"));
|
||
|
//作用时段
|
||
|
String zysd = Util.null2String(e.get("zysd"));
|
||
|
//最小核算分钟数(不包含)
|
||
1 year ago
|
int zxhsl = Util.null2String(e.get("zxhsl")).equals("")?0:Util.getIntValue(Util.null2String(e.get("zxhsl")));
|
||
2 years ago
|
//最大核算分钟数(包含)
|
||
1 year ago
|
int zdhsl = Util.null2String(e.get("zdhsl")).equals("")?0:Util.getIntValue(Util.null2String(e.get("zdhsl")));
|
||
2 years ago
|
|
||
1 year ago
|
if(AttendanceItemTypeEnum.LEAVE_EARLY.getKey().equals(xmlx) && (zysd.contains(workfor) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey())) && time > zxhsl && time<=zdhsl) {
|
||
1 year ago
|
return true;
|
||
1 year ago
|
}else {
|
||
|
return false;
|
||
2 years ago
|
}
|
||
|
}).collect(Collectors.toList());
|
||
1 year ago
|
resultMap.put("attendanceItems",attendanceItems);
|
||
2 years ago
|
|
||
1 year ago
|
return resultMap;
|
||
2 years ago
|
}
|
||
|
}
|