liuliang
parent
fbcdecdf52
commit
c52d25d110
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1,118 @@
|
||||
package com.engine.attendance.attendanceanalysis.cmd;
|
||||
|
||||
import com.engine.attendance.enums.CheckBoxEnum;
|
||||
import com.engine.attendance.enums.ClassBelongToEnum;
|
||||
import com.engine.attendance.enums.ClassSegmentTypeEnum;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.common.util.DateUtil;
|
||||
import com.engine.common.util.DbTools;
|
||||
import com.engine.common.util.Utils;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class GetAskForLeaveCmd extends AbstractCommonCommand<Map<String,Object>> {
|
||||
|
||||
public GetAskForLeaveCmd(Map<String,Object> params){
|
||||
this.params=params;
|
||||
}
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String,Object> resultMap = Maps.newHashMap();
|
||||
String userId = Util.null2String(params.get("userId"));
|
||||
String analysisDate = Util.null2String(params.get("analysisDate"));
|
||||
List<Map<String, Object>> scheduleResult = (List<Map<String, Object>>)params.get("scheduleResult");
|
||||
String sql = "select a.qjry,a.jqlx,a.cxjqj,b.ksrq,b.kssj,b.jsrq,b.jssj,b.qjsc,b.qtj,b.btj from uf_jcl_kq_qjjl a left join uf_jcl_kq_qjjl_dt1 b on a.id = b.mainid where a.qjry=? and b.ksrq=>? and b.ksrq<=? and (b.cxqj=0 or b.cxqj is null)";
|
||||
List<Map<String,Object>> askForLeaveList = DbTools.getSqlToList(sql,userId, DateUtil.beforeDay(analysisDate,1),DateUtil.AfterDay(analysisDate,1));
|
||||
Map<String,Map<String,Object>> askForLeaveItems = Maps.newHashMap();
|
||||
|
||||
|
||||
String firstKssj = Utils.getkssjTime(scheduleResult.get(0),analysisDate);
|
||||
|
||||
String lastjssj = Utils.getjssjTime(scheduleResult.get(scheduleResult.size()-1),analysisDate);
|
||||
|
||||
Set<String> jplxSet = Sets.newHashSet();
|
||||
List<Map<String,Object>> haveAskForLeaveList = askForLeaveList.stream().filter(e->{
|
||||
String kssj = e.get("ksrq")+" "+e.get("kssj");
|
||||
String jssj = e.get("jsrq")+" "+e.get("jssj");
|
||||
if (e.get("ksrq").equals(analysisDate) && !"1".equals(e.get("cxjqj"))){
|
||||
jplxSet.add(e.get("jqlx").toString());
|
||||
return true;
|
||||
}else if (DateUtil.getTime(kssj).compareTo(DateUtil.getTime(lastjssj)) <0 && DateUtil.getTime(jssj).compareTo(DateUtil.getTime(firstKssj)) >0 && "1".equals(e.get("cxjqj"))){
|
||||
jplxSet.add(e.get("jqlx").toString());
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
log.info("haveAskForLeaveList : [{}]",haveAskForLeaveList);
|
||||
sql = "select id,hsl,hsdw,lgsbxydk,tqlghlfzs,fgsbxydk,thfghlfzs,tybcndbjlhbjs,zdycbcndfgzsd,zdycrqqjndxxb,zysd from uf_jcl_kq_kqxm where id in ("+String.join(",",jplxSet)+")";
|
||||
Map<String,List<Map<String,Object>>> collect = DbTools.getSqlToList(sql).stream().collect(Collectors.groupingBy(e->e.get("id").toString()));
|
||||
|
||||
|
||||
List<Map<String,Object>> resultList = Lists.newArrayList();
|
||||
List<Map<String,Object>> askForLeaveSchedule = Lists.newArrayList();
|
||||
for (Map<String,Object> askForLeaveData : haveAskForLeaveList){
|
||||
Map<String,Object> askForLeaveItem = collect.get(askForLeaveData.get("jqlx")).get(0);
|
||||
//全天请假
|
||||
if (CheckBoxEnum.CHECKED.getKey().equals(askForLeaveData.get("qtj"))){
|
||||
Map<String,Object> map = Maps.newHashMap();
|
||||
map.put("item",askForLeaveData.get("jqlx"));
|
||||
map.put("itemduration",scheduleResult.get(0).get("edsc"));
|
||||
resultList.add(map);
|
||||
resultMap.put("alldayVaction",resultList);
|
||||
}
|
||||
|
||||
|
||||
askForLeaveItems.put(askForLeaveData.get("jqlx").toString(),askForLeaveItem);
|
||||
|
||||
if (!"".equals(Util.null2String(askForLeaveData.get("kssj"))) && !"".equals(Util.null2String(askForLeaveData.get("jssj")))){
|
||||
Map<String,Object> askForLeaveMap = new HashMap(){{
|
||||
put("bcxx", scheduleResult.get(0).get("bcxx"));
|
||||
put("bcsdxx", scheduleResult.get(0).get("bcsdxx"));
|
||||
put("edsc", scheduleResult.get(0).get("edsc"));
|
||||
put("bdlx", ClassSegmentTypeEnum.ASK_FOR_LEAVE.getKey());
|
||||
put("dtkssj",askForLeaveData.get("kssj"));
|
||||
put("dtjssj",askForLeaveData.get("jssj"));
|
||||
put("ksdk",askForLeaveItem.get("fgsbxydk"));
|
||||
put("jsdk",askForLeaveItem.get("lgsbxydk"));
|
||||
put("tqdkfzs","60");
|
||||
put("thdkfzs","60");
|
||||
put("tqlghlfzs",askForLeaveItem.get("tqlghlfzs"));
|
||||
put("thfghlfzs",askForLeaveItem.get("thfghlfzs"));
|
||||
}};
|
||||
String ksrq = Util.null2String(askForLeaveData.get("ksrq"));
|
||||
if (DateUtil.getTime(ksrq).compareTo(DateUtil.getTime(analysisDate)) == 0){
|
||||
askForLeaveMap.put("gsrq",ClassBelongToEnum.NOWDAY.getKey());
|
||||
}else if (DateUtil.getTime(ksrq).compareTo(DateUtil.getTime(analysisDate)) < 0){
|
||||
askForLeaveMap.put("gsrq",ClassBelongToEnum.YESTERDAY.getKey());
|
||||
}else if (DateUtil.getTime(ksrq).compareTo(DateUtil.getTime(analysisDate)) > 0){
|
||||
askForLeaveMap.put("gsrq",ClassBelongToEnum.NEXTDAY.getKey());
|
||||
}
|
||||
askForLeaveSchedule.add(askForLeaveMap);
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("askForLeaveList",haveAskForLeaveList);
|
||||
resultMap.put("askForLeaveItems",askForLeaveItems);
|
||||
resultMap.put("askForLeaveSchedule",askForLeaveSchedule);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package com.engine.attendance.attendanceanalysis.cmd;
|
||||
|
||||
import com.engine.attendance.enums.CheckBoxEnum;
|
||||
import com.engine.attendance.enums.ClassSegmentTypeEnum;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.common.util.DateUtil;
|
||||
import com.engine.common.util.DbTools;
|
||||
import com.engine.common.util.Utils;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
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 GetClockInTimeListCmd extends AbstractCommonCommand<Map<String,Object>> {
|
||||
public GetClockInTimeListCmd(Map<String, Object> params){
|
||||
this.params=params;
|
||||
}
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
//打卡日期
|
||||
String needGetDate = Util.null2String(params.get("date"));
|
||||
//打卡数据
|
||||
List<Map<String,Object>> clockInTimeList = (List<Map<String,Object>>)params.get("clockInTimeList");
|
||||
//班次数据
|
||||
Map<String, List<Map<String,Object>>> schedulingResultCollect = (Map<String, List<Map<String,Object>>>)params.get("schedulingResultCollect");
|
||||
//出勤结果日期对应的进出数据
|
||||
Map<String,Map<String,Object>> clockInTimeMap = (Map<String,Map<String,Object>>)params.get("clockInTimeMap");
|
||||
//当天班次
|
||||
List<Map<String,Object>> needGetDateScheduling = schedulingResultCollect.get(needGetDate);
|
||||
//分析人员
|
||||
String userId = Util.null2String(params.get("userId"));
|
||||
|
||||
List<Map<String, Object>> scheduleList = needGetDateScheduling.stream().filter(e -> {
|
||||
if (!ClassSegmentTypeEnum.REST_AND_DINE.getKey().equals(e.get("bdlx")) && !ClassSegmentTypeEnum.REST_PERIOD.getKey().equals(e.get("bdlx")) &&
|
||||
!ClassSegmentTypeEnum.DINING_PERIOD.getKey().equals(e.get("bdlx")) && (CheckBoxEnum.CHECKED.getKey().equals(e.get("ksdk")) || CheckBoxEnum.CHECKED.getKey().equals(e.get("jsdk")))){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
Map<String, Object> firstKsdkSchedule = null;
|
||||
Map<String, Object> lastKsdkSchedule = null;
|
||||
for (int i=0;i<scheduleList.size();i++){
|
||||
if (CheckBoxEnum.CHECKED.getKey().equals(scheduleList.get(i).get("ksdk"))){
|
||||
firstKsdkSchedule = scheduleList.get(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int j=scheduleList.size()-1;j>0;j--){
|
||||
if (CheckBoxEnum.CHECKED.getKey().equals(scheduleList.get(j).get("jsdk"))){
|
||||
lastKsdkSchedule = scheduleList.get(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//当天班次最早会打卡的时间点
|
||||
String earliestTime = Utils.getkssjEarliestTime(firstKsdkSchedule,needGetDate);
|
||||
//当天班次最晚会打卡的时间点
|
||||
String lastestTime = Utils.getjssjLastestTime(lastKsdkSchedule,needGetDate);
|
||||
|
||||
if (DateUtil.getTime(earliestTime).compareTo(DateUtil.getTime(needGetDate+" 00:00:00")) < 0){
|
||||
//当最早打卡时间点在前一天时,获取前一天的出勤结果打卡数据
|
||||
String earliestDate = earliestTime.split(" ")[0];
|
||||
Map<String,Object> clockIntime = clockInTimeMap.get(earliestDate);
|
||||
if (clockIntime == null){
|
||||
String sql = "select rq,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>=? and rq<=?";
|
||||
List<Map<String,Object>> attendanceResult = DbTools.getSqlToList(sql,userId,DateUtil.beforeDay(earliestDate,1),earliestDate);
|
||||
Map<String, List<Map<String,Object>>> attendanceCollect = attendanceResult.stream().collect(Collectors.groupingBy(e->e.get("rq").toString()));
|
||||
clockIntime = attendanceCollect.get(earliestDate) == null?null:attendanceCollect.get(earliestDate).get(0);
|
||||
if (clockIntime == null){
|
||||
//取不到当天的就再往前取一天
|
||||
clockIntime = attendanceCollect.get(DateUtil.beforeDay(earliestDate,1)) == null?null:attendanceCollect.get(DateUtil.beforeDay(earliestDate,1)).get(0);
|
||||
}
|
||||
}
|
||||
if (clockIntime !=null){
|
||||
for (int i=8;i>0;i--){
|
||||
String in = Util.null2String(clockIntime.get("j"+i));
|
||||
String out = Util.null2String(clockIntime.get("c"+i));
|
||||
if (!"".equals(out)){
|
||||
if (DateUtil.getTime(out).compareTo(DateUtil.getTime(earliestTime)) > 0){
|
||||
earliestTime = out;
|
||||
}
|
||||
break;
|
||||
}else if (!"".equals(in)){
|
||||
if (DateUtil.getTime(in).compareTo(DateUtil.getTime(earliestTime)) > 0){
|
||||
earliestTime = in;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("earliestTime :[{}],lastestTime: [{}]",earliestTime,lastestTime);
|
||||
String finalEarliestTime = earliestTime;
|
||||
List<Map<String,Object>> effectiveclockInTimeList = clockInTimeList.stream().filter(e->{
|
||||
String signDate = e.get("signdate")+" "+e.get("signtime");
|
||||
if (DateUtil.getTime(signDate).compareTo(DateUtil.getTime(finalEarliestTime)) >0 && DateUtil.getTime(signDate).compareTo(DateUtil.getTime(lastestTime)) <=0){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
Map<String,Object> resultMap = Maps.newHashMap();
|
||||
resultMap.put("resultList",effectiveclockInTimeList);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package com.engine.attendance.attendanceanalysis.cmd;
|
||||
|
||||
import com.engine.attendance.enums.CheckBoxEnum;
|
||||
import com.engine.attendance.enums.ClassBelongToEnum;
|
||||
import com.engine.attendance.enums.ClassSegmentTypeEnum;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.common.util.DateUtil;
|
||||
import com.engine.common.util.DbTools;
|
||||
import com.engine.common.util.Utils;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class GetEvectionCmd extends AbstractCommonCommand<Map<String,Object>> {
|
||||
|
||||
public GetEvectionCmd(Map<String,Object> params){
|
||||
this.params=params;
|
||||
}
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String,Object> resultMap = Maps.newHashMap();
|
||||
String userId = Util.null2String(params.get("userId"));
|
||||
String analysisDate = Util.null2String(params.get("analysisDate"));
|
||||
List<Map<String, Object>> scheduleResult = (List<Map<String, Object>>)params.get("scheduleResult");
|
||||
String sql = "select b.ccr,a.cclx,a.ccsd,b.ksrq,b.jsrq,b.kssj,b.jssj,b.ccsc,b.qtcc,b.btcc,b.cxcc from uf_jcl_kq_ccjl a left join uf_jcl_kq_ccjl_dt1 b on a.id = b.mainid where b.ccr=? and b.ksrq>=? and b.ksrq<=? and (b.cxcc=0 or b.cxcc is null)";
|
||||
List<Map<String,Object>> evectionList = DbTools.getSqlToList(sql,userId, DateUtil.beforeDay(analysisDate,1),DateUtil.AfterDay(analysisDate,1));
|
||||
Map<String,Map<String,Object>> evectionItems = Maps.newHashMap();
|
||||
|
||||
|
||||
String firstKssj = Utils.getkssjTime(scheduleResult.get(0),analysisDate);
|
||||
|
||||
String lastjssj = Utils.getjssjTime(scheduleResult.get(scheduleResult.size()-1),analysisDate);
|
||||
|
||||
Set<String> cclxSet = Sets.newHashSet();
|
||||
List<Map<String,Object>> haveEvectionList = evectionList.stream().filter(e->{
|
||||
String kssj = e.get("ksrq")+" "+e.get("kssj");
|
||||
String jssj = e.get("jsrq")+" "+e.get("jssj");
|
||||
if (e.get("ksrq").equals(analysisDate) && !"1".equals(e.get("ccsd"))){
|
||||
cclxSet.add(e.get("cclx").toString());
|
||||
return true;
|
||||
}else if (DateUtil.getTime(kssj).compareTo(DateUtil.getTime(lastjssj)) <0 && DateUtil.getTime(jssj).compareTo(DateUtil.getTime(firstKssj)) >0 && "1".equals(e.get("ccsd"))){
|
||||
cclxSet.add(e.get("cclx").toString());
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
log.info("haveEvectionList : [{}]",haveEvectionList);
|
||||
sql = "select id,hsl,hsdw,lgsbxydk,tqlghlfzs,fgsbxydk,thfghlfzs,tybcndbjlhbjs,zdycbcndfgzsd,zdycrqqjndxxb,zysd from uf_jcl_kq_kqxm where id in ("+String.join(",",cclxSet)+")";
|
||||
Map<String,List<Map<String,Object>>> collect = DbTools.getSqlToList(sql).stream().collect(Collectors.groupingBy(e->e.get("id").toString()));
|
||||
|
||||
|
||||
List<Map<String,Object>> resultList = Lists.newArrayList();
|
||||
List<Map<String,Object>> evectionSchedule = Lists.newArrayList();
|
||||
for (Map<String,Object> evectionData : haveEvectionList){
|
||||
Map<String,Object> evectionItem = collect.get(evectionData.get("cclx")).get(0);
|
||||
//全天出差
|
||||
if (CheckBoxEnum.CHECKED.getKey().equals(evectionData.get("qtcc"))){
|
||||
Map<String,Object> map = Maps.newHashMap();
|
||||
map.put("item",evectionData.get("cclx"));
|
||||
map.put("itemduration",scheduleResult.get(0).get("edsc"));
|
||||
resultList.add(map);
|
||||
resultMap.put("alldayEvection",resultList);
|
||||
}
|
||||
|
||||
|
||||
evectionItems.put(evectionData.get("jqlx").toString(),evectionItem);
|
||||
|
||||
if (!"".equals(Util.null2String(evectionData.get("kssj"))) && !"".equals(Util.null2String(evectionData.get("jssj")))){
|
||||
Map<String,Object> evectioneMap = new HashMap(){{
|
||||
put("bcxx", scheduleResult.get(0).get("bcxx"));
|
||||
put("bcsdxx", scheduleResult.get(0).get("bcsdxx"));
|
||||
put("edsc", scheduleResult.get(0).get("edsc"));
|
||||
put("bdlx", ClassSegmentTypeEnum.ASK_FOR_LEAVE.getKey());
|
||||
put("dtkssj",evectionData.get("kssj"));
|
||||
put("dtjssj",evectionData.get("jssj"));
|
||||
put("ksdk",evectionItem.get("fgsbxydk"));
|
||||
put("jsdk",evectionItem.get("lgsbxydk"));
|
||||
put("tqdkfzs","60");
|
||||
put("thdkfzs","60");
|
||||
put("tqlghlfzs",evectionItem.get("tqlghlfzs"));
|
||||
put("thfghlfzs",evectionItem.get("thfghlfzs"));
|
||||
}};
|
||||
String ksrq = Util.null2String(evectionData.get("ksrq"));
|
||||
if (DateUtil.getTime(ksrq).compareTo(DateUtil.getTime(analysisDate)) == 0){
|
||||
evectioneMap.put("gsrq",ClassBelongToEnum.NOWDAY.getKey());
|
||||
}else if (DateUtil.getTime(ksrq).compareTo(DateUtil.getTime(analysisDate)) < 0){
|
||||
evectioneMap.put("gsrq",ClassBelongToEnum.YESTERDAY.getKey());
|
||||
}else if (DateUtil.getTime(ksrq).compareTo(DateUtil.getTime(analysisDate)) > 0){
|
||||
evectioneMap.put("gsrq",ClassBelongToEnum.NEXTDAY.getKey());
|
||||
}
|
||||
evectionSchedule.add(evectionData);
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("evectionList",haveEvectionList);
|
||||
resultMap.put("evectionItems",evectionItems);
|
||||
resultMap.put("evectionSchedule",evectionSchedule);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.engine.attendance.enums;
|
||||
|
||||
import com.finance.toolkit.BaseEnum;
|
||||
|
||||
/**
|
||||
* 班次归属日期
|
||||
*/
|
||||
public enum ClassBelongToEnum implements BaseEnum {
|
||||
NOWDAY("1","当日"),
|
||||
YESTERDAY("0","昨日"),
|
||||
NEXTDAY("2","次日");
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
|
||||
ClassBelongToEnum(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.
Loading…
Reference in New Issue