考勤分析
parent
0290e1f04f
commit
33341430f6
@ -0,0 +1,8 @@
|
|||||||
|
2023-10-24 00:28:21,221 [main] [com.engine.attendance.attendanceanalysis.cmd.AbsenteeismCmd] [INFO] - absenteeismCmd attendanceItems : [[{zdhsl=180, xmlx=2, zysd=1, zxhsl=60}, {zdhsl=180, xmlx=2, zysd=1, zxhsl=60}, {zdhsl=60, xmlx=1, zysd=1, zxhsl=0}]]
|
||||||
|
2023-10-24 00:29:46,847 [main] [com.engine.attendance.attendanceanalysis.cmd.AbsenteeismCmd] [INFO] - absenteeismCmd attendanceItems : [[{zdhsl=180, xmlx=1, zysd=1, zxhsl=60}, {zdhsl=180, xmlx=2, zysd=1, zxhsl=60}, {zdhsl=60, xmlx=2, zysd=1, zxhsl=0}]]
|
||||||
|
2023-10-24 00:33:14,365 [main] [com.engine.attendance.attendanceanalysis.cmd.AbsenteeismCmd] [INFO] - absenteeismCmd attendanceItems : [[{zdhsl=180, xmlx=2, zysd=1, zxhsl=60}]]
|
||||||
|
2023-10-24 00:33:33,275 [main] [com.engine.attendance.attendanceanalysis.cmd.AbsenteeismCmd] [INFO] - absenteeismCmd attendanceItems : [[{zdhsl=60, xmlx=2, zysd=1, zxhsl=0}]]
|
||||||
|
2023-10-26 17:08:22,114 [main] [com.engine.attendance.attendanceanalysis.cmd.AbsenteeismCmd] [INFO] - absenteeismCmd attendanceItems : [[{zdhsl=60, xmlx=2, zysd=1, zxhsl=0}]]
|
||||||
|
2023-10-26 17:09:45,677 [main] [com.engine.attendance.attendanceanalysis.cmd.AbsenteeismCmd] [INFO] - absenteeismCmd attendanceItems : [[{zdhsl=60, xmlx=2, zysd=1, zxhsl=0}]]
|
||||||
|
2023-10-26 17:10:16,663 [main] [com.engine.attendance.attendanceanalysis.cmd.AbsenteeismCmd] [INFO] - absenteeismCmd attendanceItems : [[{zdhsl=60, xmlx=2, zysd=1, zxhsl=0}]]
|
||||||
|
2023-10-27 16:45:00,661 [main] [com.engine.attendance.attendanceanalysis.cmd.AbsenteeismCmd] [INFO] - absenteeismCmd attendanceItems : [[{zdhsl=60, xmlx=2, zysd=1, zxhsl=0}]]
|
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
package com.api.attendance.attendancePlan.web;
|
package com.api.attendance.attendancePlan;
|
||||||
|
|
||||||
|
|
||||||
import com.engine.attendance.attendanceplan.web.AttendancePlanAction;
|
import com.engine.attendance.attendanceplan.web.AttendancePlanAction;
|
@ -1,4 +1,4 @@
|
|||||||
package com.api.attendance.persongroup.web;
|
package com.api.attendance.persongroup;
|
||||||
|
|
||||||
import com.engine.attendance.component.persongroup.web.PersonGroupAction;
|
import com.engine.attendance.component.persongroup.web.PersonGroupAction;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
@ -1,4 +1,4 @@
|
|||||||
package com.api.attendance.persongroup.web;
|
package com.api.attendance.persongroup;
|
||||||
|
|
||||||
import com.engine.attendance.component.persongroup.web.SchedulingResultsAction;
|
import com.engine.attendance.component.persongroup.web.SchedulingResultsAction;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.engine.attendance.attendanceanalysis.cmd;
|
||||||
|
|
||||||
|
import com.engine.attendance.enums.SystemItemEnum;
|
||||||
|
import com.engine.common.biz.AbstractCommonCommand;
|
||||||
|
import com.engine.common.entity.BizLogContext;
|
||||||
|
import com.engine.common.util.DbTools;
|
||||||
|
import com.engine.core.interceptor.CommandContext;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.Util;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人员当天出勤结果
|
||||||
|
*/
|
||||||
|
public class UpdateAttendanceResultsCmd extends AbstractCommonCommand<Map<String,Object>> {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BizLogContext getLogContext() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public UpdateAttendanceResultsCmd(Map<String,Object> params){
|
||||||
|
this.params=params;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> execute(CommandContext commandContext) {
|
||||||
|
String userId = Util.null2String(params.get("userId"));
|
||||||
|
String date = Util.null2String(params.get("date"));
|
||||||
|
//项目
|
||||||
|
String item = Util.null2String(params.get("item"));
|
||||||
|
//项目时长
|
||||||
|
String itemduration = Util.null2String(params.get("itemduration"));
|
||||||
|
Map<String,Object> resultMap = Maps.newHashMap();
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
//班次信息
|
||||||
|
if (params.get("classInfo") == null){
|
||||||
|
//当天没有排班,计入异常
|
||||||
|
noScheduling(params,rs);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
List<Map<String,Object>> classInfo = (List<Map<String,Object>>)params.get("classInfo");
|
||||||
|
|
||||||
|
String sql = "select ygid,rq,bc,xm1,xm2,xm3,xm4,xm5,xm6,xm7,xm8,j1,c1,j2,c2,j3,c3,j4,c4,j5,c5,j6,c6,j7,c7,j8,c8 from uf_jcl_kq_cqjg where ygid=? and rq=?";
|
||||||
|
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,userId,date);
|
||||||
|
if (dataList.size() >0){
|
||||||
|
//有出勤结果
|
||||||
|
int index = 0;
|
||||||
|
int i = 0;
|
||||||
|
while (index==0){
|
||||||
|
i++;
|
||||||
|
if (dataList.get(0).get("xm"+i) != null || !"".equals(dataList.get(0).get("xm"+i))){
|
||||||
|
index = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sql = "update uf_jcl_kq_cqjg set xm"+index+"=?,sc"+index+"=? where ygid=? and rq=?";
|
||||||
|
DbTools.update(rs,sql,item,itemduration,userId,date);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
//没有出勤结果
|
||||||
|
sql = "select subcompanyid1,departmentid,jobtitle from hrmresource where id=?";
|
||||||
|
List<Map<String,Object>> userList = DbTools.getSqlToList(sql,userId);
|
||||||
|
sql = "insert into uf_jcl_kq_cqjg (szjg,ygid,fbid,bm,zw,rq,bc,bcbdxx,cqzt,cqsc,xm1,sc1) values (?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||||
|
DbTools.update(rs,sql,userList.get(0).get("subcompanyid1"),userId,userList.get(0).get("subcompanyid1"),userList.get(0).get("departmentid"),
|
||||||
|
userList.get(0).get("jobtitle"),date,classInfo.get(0).get("bcxx"),classInfo.get(0).get("bcsdxx"),1,0,item,itemduration);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 没有排班处理
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
public void noScheduling(Map<String,Object> params, RecordSet rs){
|
||||||
|
String userId = Util.null2String(params.get("userId"));
|
||||||
|
String date = Util.null2String(params.get("date"));
|
||||||
|
String sql = "select subcompanyid1,departmentid,jobtitle from hrmresource where id=?";
|
||||||
|
List<Map<String,Object>> userList = DbTools.getSqlToList(sql,userId);
|
||||||
|
sql = "insert into uf_jcl_kq_cqjg (szjg,ygid,fbid,bm,zw,rq,xm1,cqzt) values (?,?,?,?,?,?,?,?)";
|
||||||
|
DbTools.update(rs,sql,userList.get(0).get("subcompanyid1"),userId,userList.get(0).get("subcompanyid1"),
|
||||||
|
userList.get(0).get("departmentid"),userList.get(0).get("jobtitle"),date, SystemItemEnum.NO_SCHEDULING.getKey(),1);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.engine.attendance.attendanceanalysis.service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 旷工service
|
||||||
|
*/
|
||||||
|
public interface BeLateService {
|
||||||
|
/**
|
||||||
|
* 全天旷工
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String,Object> fullDayAbsenteeism(Map<String,Object> params);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.engine.attendance.attendanceanalysis.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 漏打卡service
|
||||||
|
*/
|
||||||
|
public interface ForgetClockInService {
|
||||||
|
/**
|
||||||
|
* 全天未打卡
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Object> ForgetClockInAllDays(Map<String,Object> params);
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.engine.attendance.attendanceanalysis.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具service
|
||||||
|
*/
|
||||||
|
public interface UtilService {
|
||||||
|
/**
|
||||||
|
* 获得人员班次信息
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, List<Map<String,Object>>> getSchedulingInFormation(Map<String,Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得指定天数的打卡时间集合
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> getClockInTime(Map<String,Object> params);
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.engine.attendance.attendanceanalysis.service.impl;
|
||||||
|
|
||||||
|
import com.engine.attendance.attendanceanalysis.service.BeLateService;
|
||||||
|
import com.engine.core.impl.Service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class BeLateServiceImpl extends Service implements BeLateService {
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> fullDayAbsenteeism(Map<String, Object> params) {
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.engine.attendance.attendanceanalysis.service.impl;
|
||||||
|
|
||||||
|
import com.engine.attendance.attendanceanalysis.cmd.UpdateAttendanceResultsCmd;
|
||||||
|
import com.engine.attendance.attendanceanalysis.service.ForgetClockInService;
|
||||||
|
import com.engine.attendance.enums.SystemItemEnum;
|
||||||
|
import com.engine.core.impl.Service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ForgetClockInServiceImpl extends Service implements ForgetClockInService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> ForgetClockInAllDays(Map<String, Object> params) {
|
||||||
|
params.put("item", SystemItemEnum.MISSING_CLOCK_IN);
|
||||||
|
params.put("itemduration", 1);
|
||||||
|
Map<String,Object> result = commandExecutor.execute(new UpdateAttendanceResultsCmd(params));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.engine.attendance.attendanceanalysis.service.impl;
|
||||||
|
|
||||||
|
import com.engine.attendance.attendanceanalysis.cmd.GetClockInTimeCmd;
|
||||||
|
import com.engine.attendance.attendanceanalysis.cmd.UpdateAttendanceResultsCmd;
|
||||||
|
import com.engine.attendance.attendanceanalysis.service.UtilService;
|
||||||
|
import com.engine.attendance.component.persongroup.service.SchedulingResultsService;
|
||||||
|
import com.engine.attendance.component.persongroup.service.impl.SchedulingResultsServiceImpl;
|
||||||
|
import com.engine.common.util.DateUtil;
|
||||||
|
import com.engine.common.util.DbTools;
|
||||||
|
import com.engine.common.util.ServiceUtil;
|
||||||
|
import com.engine.core.impl.Service;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import weaver.general.Util;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class UtilServiceImpl extends Service implements UtilService {
|
||||||
|
private SchedulingResultsService schedulingResultsService = ServiceUtil.getService(SchedulingResultsServiceImpl.class);
|
||||||
|
@Override
|
||||||
|
public Map<String, List<Map<String,Object>>> getSchedulingInFormation(Map<String, Object> params) {
|
||||||
|
|
||||||
|
Map<String,Object> schedulingResultsMap = schedulingResultsService.queryDataTable(params);
|
||||||
|
List<Map<String,Object>> schedulingResultsList = (List<Map<String,Object>>)schedulingResultsMap.get("data");
|
||||||
|
Map<String,String> schedulingMap = schedulingResultsList.stream().collect(Collectors.toMap(e-> Util.null2String(e.get("bcxx")), e->Util.null2String(e.get("bcrq"))));
|
||||||
|
String sql = "select a.id bcxx,a.bcsdxx,a.sfkt,b.bdlx,b.kssj dtkssj,b.jssj dtjssj,b.ksdk,b.jsdk,b.tqdkfzs,b.thdkfzs from uf_jcl_kq_bcxx a left join uf_jcl_kq_bcxx_dt1 b on a.id=b.mainid where a.id in (";
|
||||||
|
String bcxxIds = "";
|
||||||
|
for (Map.Entry<String,String> entry :schedulingMap.entrySet()){
|
||||||
|
bcxxIds +=entry.getKey() +",";
|
||||||
|
}
|
||||||
|
bcxxIds = bcxxIds.substring(0,bcxxIds.length()-1);
|
||||||
|
sql = sql +bcxxIds+") order by b.kssj";
|
||||||
|
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql);
|
||||||
|
Map<String,List<Map<String,Object>>> dataMap = dataList.stream().collect(Collectors.groupingBy(e->Util.null2String(e.get("bcxx"))));
|
||||||
|
Map<String,List<Map<String,Object>>> resultMap = Maps.newHashMap();
|
||||||
|
dataMap.entrySet().forEach(e -> {
|
||||||
|
resultMap.put(schedulingMap.get(e.getKey()),e.getValue());
|
||||||
|
});
|
||||||
|
log.info("SchedulingResults : [{}]",resultMap);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getClockInTime(Map<String, Object> params) {
|
||||||
|
Map<String,Object> result = commandExecutor.execute(new GetClockInTimeCmd(params));
|
||||||
|
List<Map<String, Object>> resultList = (List<Map<String, Object>>)result.get("resultList");
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.engine.attendance.enums;
|
||||||
|
|
||||||
|
import com.finance.toolkit.BaseEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 班次班段类型
|
||||||
|
*/
|
||||||
|
public enum ClassSegmentTypeEnum implements BaseEnum {
|
||||||
|
WORK_TIME("0","工作时段"),
|
||||||
|
REST_AND_DINE("1","休息就餐"),
|
||||||
|
EXTENDED_OVERTIME("2","延长加班"),
|
||||||
|
EARLY_OVERTIME("3","早到加班"),
|
||||||
|
REST_PERIOD("4","休息时段"),
|
||||||
|
DINING_PERIOD("5","就餐时段");
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
ClassSegmentTypeEnum(String key, String value){
|
||||||
|
this.key=key;
|
||||||
|
this.value=value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.engine.attendance.enums;
|
||||||
|
|
||||||
|
import com.finance.toolkit.BaseEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统项目
|
||||||
|
*/
|
||||||
|
public enum SystemItemEnum implements BaseEnum {
|
||||||
|
NORMAL("1","正常"),
|
||||||
|
WORK_DAY("2","工作日"),
|
||||||
|
REST_DAY("3","假日"),
|
||||||
|
HOLIDAY("4","节日"),
|
||||||
|
ABNORMAL("5","异常"),
|
||||||
|
NO_SCHEDULING("6","没有排班"),
|
||||||
|
MISSING_CLOCK_IN("7","漏打卡"),
|
||||||
|
ALGORITHM_MISSING("100","算法缺失");
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
SystemItemEnum(String key, String value){
|
||||||
|
this.key=key;
|
||||||
|
this.value=value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.engine.attendance.enums;
|
||||||
|
|
||||||
|
import com.finance.toolkit.BaseEnum;
|
||||||
|
|
||||||
|
public enum WorkForTimeEnum implements BaseEnum {
|
||||||
|
ALL_TIME("0","所有时段"),
|
||||||
|
WORK_TIME("1","工作时段"),
|
||||||
|
DELAY_TO_WORK_OVERTIME("2","延长加班"),
|
||||||
|
EARLY_TO_WORK_OVERTIME("3","早到加班"),
|
||||||
|
PLAN_WORK_OVERTIME("4","计划加班"),
|
||||||
|
LEAVE_TIME("5","请假时段"),
|
||||||
|
EVECTION("6","外出出差");
|
||||||
|
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
WorkForTimeEnum(String key, String value){
|
||||||
|
this.key=key;
|
||||||
|
this.value=value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue