修改旷工bug,修改加班时长扣除请假、休息、出差时段bug,优化取打卡数据功能,加班流程action

main
liuliang 4 months ago
parent d9f00d3776
commit 75583ce2d0

@ -14,10 +14,8 @@ import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import weaver.general.Util; import weaver.general.Util;
import java.util.HashMap; import java.time.ZoneOffset;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -51,7 +49,9 @@ public class GetAskForLeaveCmd extends AbstractCommonCommand<Map<String,Object>>
String firstKssj = Utils.getkssjTime(scheduleResult.get(0),analysisDate); String firstKssj = Utils.getkssjTime(scheduleResult.get(0),analysisDate);
String lastjssj = Utils.getjssjTime(scheduleResult.get(scheduleResult.size()-1),analysisDate); List<Map<String,Object>> jssjscheduling = scheduleResult.stream().sorted(Comparator.comparing(e -> DateUtil.getTime(Utils.getjssjTime(e, analysisDate)).toInstant(ZoneOffset.of("+8")).toEpochMilli())).collect(Collectors.toList());
String lastjssj = Utils.getjssjTime(jssjscheduling.get(jssjscheduling.size()-1),analysisDate);
Set<String> jplxSet = Sets.newHashSet(); Set<String> jplxSet = Sets.newHashSet();
List<Map<String,Object>> haveAskForLeaveList = askForLeaveList.stream().filter(e->{ List<Map<String,Object>> haveAskForLeaveList = askForLeaveList.stream().filter(e->{

@ -13,6 +13,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 java.time.ZoneOffset;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -42,6 +44,8 @@ public class GetClockInTimeListCmd extends AbstractCommonCommand<Map<String,Obje
Map<String,Map<String,Object>> clockInTimeMap = (Map<String,Map<String,Object>>)params.get("clockInTimeMap"); Map<String,Map<String,Object>> clockInTimeMap = (Map<String,Map<String,Object>>)params.get("clockInTimeMap");
//当天班次 //当天班次
List<Map<String,Object>> needGetDateScheduling = schedulingResultCollect.get(needGetDate); List<Map<String,Object>> needGetDateScheduling = schedulingResultCollect.get(needGetDate);
needGetDateScheduling = needGetDateScheduling.stream().sorted(Comparator.comparing(e -> DateUtil.getTime(Utils.getkssjTime(e, needGetDate)).toInstant(ZoneOffset.of("+8")).toEpochMilli())).collect(Collectors.toList());
// //
Map<String, List<Map<String,Object>>> collect = (Map<String, List<Map<String,Object>>>)params.get("clockInTimeCollect"); Map<String, List<Map<String,Object>>> collect = (Map<String, List<Map<String,Object>>>)params.get("clockInTimeCollect");
//分析人员 //分析人员
@ -114,7 +118,9 @@ public class GetClockInTimeListCmd extends AbstractCommonCommand<Map<String,Obje
if (lastKsdkSchedule != null){ if (lastKsdkSchedule != null){
lastestTime = Utils.getjssjLastestTime(lastKsdkSchedule,needGetDate); lastestTime = Utils.getjssjLastestTime(lastKsdkSchedule,needGetDate);
} }
String lastTime = Utils.getjssjLastestTime(needGetDateScheduling.get(needGetDateScheduling.size()-1),needGetDate); List<Map<String,Object>> jssjscheduling = needGetDateScheduling.stream().sorted(Comparator.comparing(e -> DateUtil.getTime(Utils.getjssjTime(e, needGetDate)).toInstant(ZoneOffset.of("+8")).toEpochMilli())).collect(Collectors.toList());
String lastTime = Utils.getjssjLastestTime(jssjscheduling.get(jssjscheduling.size()-1),needGetDate);
if (lastestTime == "" || DateUtil.getTime(lastestTime).compareTo(DateUtil.getTime(lastTime)) < 0){ if (lastestTime == "" || DateUtil.getTime(lastestTime).compareTo(DateUtil.getTime(lastTime)) < 0){
lastestTime = lastTime; lastestTime = lastTime;
} }

@ -14,10 +14,8 @@ import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import weaver.general.Util; import weaver.general.Util;
import java.util.HashMap; import java.time.ZoneOffset;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -53,7 +51,9 @@ public class GetEvectionCmd extends AbstractCommonCommand<Map<String,Object>> {
String firstKssj = Utils.getkssjTime(scheduleResult.get(0),analysisDate); String firstKssj = Utils.getkssjTime(scheduleResult.get(0),analysisDate);
String lastjssj = Utils.getjssjTime(scheduleResult.get(scheduleResult.size()-1),analysisDate); List<Map<String,Object>> jssjscheduling = scheduleResult.stream().sorted(Comparator.comparing(e -> DateUtil.getTime(Utils.getjssjTime(e, analysisDate)).toInstant(ZoneOffset.of("+8")).toEpochMilli())).collect(Collectors.toList());
String lastjssj = Utils.getjssjTime(jssjscheduling.get(jssjscheduling.size()-1),analysisDate);
Set<String> cclxSet = Sets.newHashSet(); Set<String> cclxSet = Sets.newHashSet();
List<Map<String,Object>> haveEvectionList = evectionList.stream().filter(e->{ List<Map<String,Object>> haveEvectionList = evectionList.stream().filter(e->{

@ -34,7 +34,7 @@ public class AbsenteeismItemCmd extends AbstractCommonCommand<Map<String,Object>
//旷工分钟数 //旷工分钟数
int time = Util.null2String(params.get("time")).equals("")? 0:Util.getIntValue(Util.null2String(params.get("time"))); int time = Util.null2String(params.get("time")).equals("")? 0:Util.getIntValue(Util.null2String(params.get("time")));
//漏打卡转旷工标识 //漏打卡转旷工标识
String forgetConvertAbsenteeism = Util.null2String(params.get("workfor")); String forgetConvertAbsenteeism = Util.null2String(params.get("forgetConvertAbsenteeism"));
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String,Object>> attendanceItems = (List<Map<String,Object>>)params.get("attendanceItems"); List<Map<String,Object>> attendanceItems = (List<Map<String,Object>>)params.get("attendanceItems");

@ -262,13 +262,32 @@ public class GetOvertimeDurationCmd extends AbstractCommonCommand<Map<String, Ob
/** /**
* *
*/ */
int askForLeaveTime = removeAskForLeave(scheduleMap,realityStartTime, realityEndime String forComputeStartTime = realityStartTime;
if (DateUtil.getTime(forComputeStartTime).compareTo(DateUtil.getTime(kssj)) <0){
if (CheckBoxEnum.CHECKED.getKey().equals(tqdkjrjb) && CheckBoxEnum.CHECKED.getKey().equals(ksjbbxydk)) {
//提前打卡记入分钟数
forComputeStartTime = realityStartTime;
}else {
forComputeStartTime = kssj;
}
}
String forComputeEndTime = realityEndime;
if (DateUtil.getTime(forComputeEndTime).compareTo(DateUtil.getTime(jssj)) >0){
if (CheckBoxEnum.CHECKED.getKey().equals(thdkjrjb) && CheckBoxEnum.CHECKED.getKey().equals(jsjbbxydk)) {
//推后打卡计入分钟数
forComputeEndTime = realityEndime;
}else {
forComputeEndTime = jssj;
}
}
int askForLeaveTime = removeAskForLeave(scheduleMap,forComputeStartTime, forComputeEndTime
, bdlx, askForLeaveList, askForLeaveItems, askForLeaveToOffsetAbnomaly); , bdlx, askForLeaveList, askForLeaveItems, askForLeaveToOffsetAbnomaly);
/** /**
* *
*/ */
int evectionTime = removeEvection(scheduleMap,realityStartTime, realityEndime int evectionTime = removeEvection(scheduleMap,forComputeStartTime, forComputeEndTime
, bdlx, evectionList, evectionItems, evectionToOffsetAbnomaly); , bdlx, evectionList, evectionItems, evectionToOffsetAbnomaly);
/** /**
@ -282,16 +301,16 @@ public class GetOvertimeDurationCmd extends AbstractCommonCommand<Map<String, Ob
if (CheckBoxEnum.CHECKED.getKey().equals(zdkcjcxxsc)){ if (CheckBoxEnum.CHECKED.getKey().equals(zdkcjcxxsc)){
//扣除就餐段时长 //扣除就餐段时长
List<Map<String, Object>> dinnerSchedule = scheduleResult.stream().filter(e ->e.get("bdlx").toString().equals(ClassSegmentTypeEnum.DINING_PERIOD.getKey())).collect(Collectors.toList()); List<Map<String, Object>> dinnerSchedule = scheduleResult.stream().filter(e ->e.get("bdlx").toString().equals(ClassSegmentTypeEnum.DINING_PERIOD.getKey())).collect(Collectors.toList());
dinnerTime = Utils.removeTime(kssj,jssj,dinnerSchedule,analysisDate); dinnerTime = Utils.removeTime(forComputeStartTime,forComputeEndTime,dinnerSchedule,analysisDate);
} }
if (CheckBoxEnum.CHECKED.getKey().equals(sfkcxxdsc)){ if (CheckBoxEnum.CHECKED.getKey().equals(sfkcxxdsc)){
//扣除休息段时长 //扣除休息段时长
List<Map<String, Object>> restSchedule = scheduleResult.stream().filter(e ->e.get("bdlx").toString().equals(ClassSegmentTypeEnum.REST_PERIOD.getKey())).collect(Collectors.toList()); List<Map<String, Object>> restSchedule = scheduleResult.stream().filter(e ->e.get("bdlx").toString().equals(ClassSegmentTypeEnum.REST_PERIOD.getKey())).collect(Collectors.toList());
dinnerTime += Utils.removeTime(kssj,jssj,restSchedule,analysisDate); dinnerTime += Utils.removeTime(forComputeStartTime,forComputeEndTime,restSchedule,analysisDate);
} }
if (CheckBoxEnum.CHECKED.getKey().equals(zdkcjcxxsc) && CheckBoxEnum.CHECKED.getKey().equals(sfkcxxdsc)){ if (CheckBoxEnum.CHECKED.getKey().equals(zdkcjcxxsc) && CheckBoxEnum.CHECKED.getKey().equals(sfkcxxdsc)){
dinnerTime = Utils.dinnerTime(realityStartTime, realityEndime, scheduleResult, analysisDate); dinnerTime = Utils.dinnerTime(forComputeStartTime, forComputeEndTime, scheduleResult, analysisDate);
} }
} }

@ -49,8 +49,8 @@ public class AttendanceanalysisAction {
log.info("********AttendanceanalysisAction start********"); log.info("********AttendanceanalysisAction start********");
Map<String,Object> paramMap = ParamUtil.request2Map(request); Map<String,Object> paramMap = ParamUtil.request2Map(request);
// Map<String,Object> paramMap = Maps.newHashMap(); // Map<String,Object> paramMap = Maps.newHashMap();
// paramMap.put("startDate","2024-12-05"); // paramMap.put("startDate","2024-12-08");
// paramMap.put("endDate","2024-12-05"); // paramMap.put("endDate","2024-12-08");
// paramMap.put("userIds","25"); // paramMap.put("userIds","25");
String startDate = Util.null2String(paramMap.get("startDate")); String startDate = Util.null2String(paramMap.get("startDate"));
@ -91,7 +91,7 @@ public class AttendanceanalysisAction {
CommonUtil.checkHavePermission(); CommonUtil.checkHavePermission();
if ("".equals(userIds)){ if ("".equals(userIds)){
log.info("********AttendanceanalysisAction prepare start******"); log.info("********AttendanceanalysisAction prepare start******");
String queryDepartEmployeeSql = "select resourceid ,changedate,type_n from HRMSTATUSHISTORY where (type_n = 5 or type_n = 7) and changedate <> '' and changedate is not null"; String queryDepartEmployeeSql = "select resourceid ,changedate,type_n from HRMSTATUSHISTORY where (type_n = 5 or type_n = 7) and changedate is not null";
//获取离职日期 //获取离职日期
List<Map<String,Object>> departEmployeeList = DbTools.getSqlToList(queryDepartEmployeeSql); List<Map<String,Object>> departEmployeeList = DbTools.getSqlToList(queryDepartEmployeeSql);
Map<String,Object> departEmployeeMap = CommonUtil.getDepartEmployeeMap(departEmployeeList); Map<String,Object> departEmployeeMap = CommonUtil.getDepartEmployeeMap(departEmployeeList);
@ -204,7 +204,7 @@ public class AttendanceanalysisAction {
} }
}else { }else {
log.info("********AttendanceanalysisAction prepare start******"); log.info("********AttendanceanalysisAction prepare start******");
String queryDepartEmployeeSql = "select resourceid ,changedate,type_n from HRMSTATUSHISTORY where (type_n = 5 or type_n = 7) and changedate <> '' and changedate is not null and resourceid in ("+userIds+")"; String queryDepartEmployeeSql = "select resourceid ,changedate,type_n from HRMSTATUSHISTORY where (type_n = 5 or type_n = 7) and changedate is not null and resourceid in ("+userIds+")";
//获取离职日期 //获取离职日期
List<Map<String,Object>> departEmployeeList = DbTools.getSqlToList(queryDepartEmployeeSql); List<Map<String,Object>> departEmployeeList = DbTools.getSqlToList(queryDepartEmployeeSql);
Map<String,Object> departEmployeeMap = CommonUtil.getDepartEmployeeMap(departEmployeeList); Map<String,Object> departEmployeeMap = CommonUtil.getDepartEmployeeMap(departEmployeeList);

@ -496,6 +496,16 @@ public class WorkRulesServiceImpl extends Service implements WorkRulesService {
if (userIds.size() > 0){ if (userIds.size() > 0){
throw new AttendanceRunTimeException("部分人员更新失败,请检查修改班次人员是否有对应的企业日历"); throw new AttendanceRunTimeException("部分人员更新失败,请检查修改班次人员是否有对应的企业日历");
} }
/**
*
*/
List<String> newDateList = Lists.newArrayList();
for (String date : dateList){
newDateList.add("'"+date+"'");
}
String updateSql = "update uf_jcl_kq_cqjg set sjzt=0 where ygid in ("+resourceIds+") and rq in ("+String.join(",",newDateList)+")";
log.info("updateSql : [{}]",updateSql);
DbTools.update(updateSql);
return resultMap; return resultMap;
} }

@ -34,9 +34,9 @@ public class VocationServiceImpl extends Service implements VocationService {
param.put("modeId",modeId); param.put("modeId",modeId);
Map<String,Object> result = commandExecutor.execute(new GetPersonVocationBySuitOrganzation(param)); Map<String,Object> result = commandExecutor.execute(new GetPersonVocationBySuitOrganzation(param));
String sql = "select a.id userid,a.*,b.* from hrmresource a left join cus_fielddata b on a.id=b.id where a.id in ("; String sql = "select a.id userid,a.*,b.* from hrmresource a left join cus_fielddata b on a.id=b.id where a.status <> '5' and a.status <> '4' and a.status <> '7' and a.id in (";
String queryDepartEmployeeSql = "select resourceid ,changedate,type_n from HRMSTATUSHISTORY where type_n = 5 or type_n = 7 and changedate <> '' and changedate is not null"; String queryDepartEmployeeSql = "select resourceid ,changedate,type_n from HRMSTATUSHISTORY where (type_n = 5 or type_n = 7) and changedate is not null";
//获取离职日期 //获取离职日期
List<Map<String,Object>> departEmployeeList = DbTools.getSqlToList(queryDepartEmployeeSql); List<Map<String,Object>> departEmployeeList = DbTools.getSqlToList(queryDepartEmployeeSql);
Map<String,Object> departEmployeeMap = CommonUtil.getDepartEmployeeMap(departEmployeeList); Map<String,Object> departEmployeeMap = CommonUtil.getDepartEmployeeMap(departEmployeeList);
@ -75,7 +75,7 @@ public class VocationServiceImpl extends Service implements VocationService {
} }
log.debug("VocationServiceImpl userId:{}, userList:{}",userId,userIdMap.get(userId)); log.debug("VocationServiceImpl userId:{}, userList:{}",userId,userIdMap.get(userId));
for (Map.Entry<String, Object> e:needGenerateVocationMap.entrySet()){ for (Map.Entry<String, Object> e:needGenerateVocationMap.entrySet()){
if (e.getValue() != null && ((List<Map<String,Object>>)e.getValue()).size() > 0){ if (e.getValue() != null && ((List<Map<String,Object>>)e.getValue()).size() > 0 && userIdMap.get(userId) !=null){
Map<String,Object> vocationParam = Maps.newHashMap(); Map<String,Object> vocationParam = Maps.newHashMap();
vocationParam.put("userId",userId); vocationParam.put("userId",userId);
vocationParam.put("vocationList",e.getValue()); vocationParam.put("vocationList",e.getValue());

@ -3,6 +3,7 @@ package com.engine.jucailinkq.attendance.workflow.action;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.jucailinkq.attendance.component.AttendanceCycle.service.AttendanceCycleService; import com.engine.jucailinkq.attendance.component.AttendanceCycle.service.AttendanceCycleService;
import com.engine.jucailinkq.attendance.component.AttendanceCycle.service.impl.AttendanceCycleServiceImpl; import com.engine.jucailinkq.attendance.component.AttendanceCycle.service.impl.AttendanceCycleServiceImpl;
import com.engine.jucailinkq.attendance.workflow.enums.WorkFlowTypeEnum;
import com.engine.jucailinkq.attendance.workflow.service.MakeUpClockInService; import com.engine.jucailinkq.attendance.workflow.service.MakeUpClockInService;
import com.engine.jucailinkq.attendance.workflow.service.impl.MakeUpClockInServiceImpl; import com.engine.jucailinkq.attendance.workflow.service.impl.MakeUpClockInServiceImpl;
import com.engine.jucailinkq.common.util.CommonUtil; import com.engine.jucailinkq.common.util.CommonUtil;
@ -32,7 +33,7 @@ public class OvertimePlanApproveAction implements Action {
// 流程表单主表数据 // 流程表单主表数据
HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo); HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo);
// 流程表单明细表数据 // 流程表单明细表数据
List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo,0); List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo,0, WorkFlowTypeEnum.OVERTIME_PLAN);
//加班人员 //加班人员
String jbry = mainTableData.get("jbry"); String jbry = mainTableData.get("jbry");
try { try {

@ -1,6 +1,7 @@
package com.engine.jucailinkq.attendance.workflow.action; package com.engine.jucailinkq.attendance.workflow.action;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.jucailinkq.attendance.workflow.enums.WorkFlowTypeEnum;
import com.engine.jucailinkq.attendance.workflow.service.MakeUpClockInService; import com.engine.jucailinkq.attendance.workflow.service.MakeUpClockInService;
import com.engine.jucailinkq.attendance.workflow.service.impl.MakeUpClockInServiceImpl; import com.engine.jucailinkq.attendance.workflow.service.impl.MakeUpClockInServiceImpl;
import com.engine.jucailinkq.common.util.CommonUtil; import com.engine.jucailinkq.common.util.CommonUtil;
@ -30,7 +31,7 @@ public class OvertimePlanArchivingAction implements Action {
// 流程表单主表数据 // 流程表单主表数据
HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo); HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo);
// 流程表单明细表数据 // 流程表单明细表数据
List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo,0); List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo,0, WorkFlowTypeEnum.OVERTIME_PLAN);
//加班人员 //加班人员
String jbry = mainTableData.get("jbry"); String jbry = mainTableData.get("jbry");
try { try {

@ -4,6 +4,7 @@ import com.engine.jucailinkq.attendance.attendanceanalysis.service.UtilService;
import com.engine.jucailinkq.attendance.attendanceanalysis.service.impl.UtilServiceImpl; import com.engine.jucailinkq.attendance.attendanceanalysis.service.impl.UtilServiceImpl;
import com.engine.jucailinkq.attendance.component.persongroup.commonutil.PersongroupCommonUtil; import com.engine.jucailinkq.attendance.component.persongroup.commonutil.PersongroupCommonUtil;
import com.engine.jucailinkq.attendance.enums.*; import com.engine.jucailinkq.attendance.enums.*;
import com.engine.jucailinkq.attendance.workflow.enums.WorkFlowTypeEnum;
import com.engine.jucailinkq.attendance.workflow.service.MakeUpClockInService; import com.engine.jucailinkq.attendance.workflow.service.MakeUpClockInService;
import com.engine.jucailinkq.attendance.workflow.service.impl.MakeUpClockInServiceImpl; import com.engine.jucailinkq.attendance.workflow.service.impl.MakeUpClockInServiceImpl;
import com.engine.jucailinkq.common.util.*; import com.engine.jucailinkq.common.util.*;
@ -34,7 +35,7 @@ public class OvertimePlanCheckAction implements Action {
// 流程表单主表数据 // 流程表单主表数据
HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo); HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo);
// 流程表单明细表数据 // 流程表单明细表数据
List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo,0); List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo,0, WorkFlowTypeEnum.OVERTIME_PLAN);
log.info("OvertimePlanCheckAction_start, detailTableData_size : {}",detailTableData.size()); log.info("OvertimePlanCheckAction_start, detailTableData_size : {}",detailTableData.size());
log.info("detailTableData : [{}]", detailTableData); log.info("detailTableData : [{}]", detailTableData);
//加班人员 //加班人员

@ -1303,6 +1303,7 @@ public class CommonUtil {
* @return * @return
*/ */
public static Map<String,Object> getDepartEmployeeMap(List<Map<String,Object>> departEmployeeList){ public static Map<String,Object> getDepartEmployeeMap(List<Map<String,Object>> departEmployeeList){
departEmployeeList = departEmployeeList.stream().filter(e->!Util.null2String(e.get("changedate")).equals("")).collect(Collectors.toList());
Map<String,List<Map<String,Object>>> group = departEmployeeList.stream().collect(Collectors.groupingBy(e -> Util.null2String(e.get("resourceid")))); Map<String,List<Map<String,Object>>> group = departEmployeeList.stream().collect(Collectors.groupingBy(e -> Util.null2String(e.get("resourceid"))));
Map<String,Object> resultMap = Maps.newHashMap(); Map<String,Object> resultMap = Maps.newHashMap();
for (Map.Entry<String,List<Map<String,Object>>> entry: group.entrySet()){ for (Map.Entry<String,List<Map<String,Object>>> entry: group.entrySet()){

Loading…
Cancel
Save