Merge remote-tracking branch 'origin/main'
commit
84c86763d9
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,68 @@
|
|||||||
|
package com.engine.attendance.workflow.action;
|
||||||
|
|
||||||
|
import com.engine.common.util.CommonUtil;
|
||||||
|
import com.engine.common.util.DateUtil;
|
||||||
|
import com.engine.common.util.Utils;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.interfaces.workflow.action.Action;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 补打卡数据入建模表action
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class MakeUpClockImportAction implements Action {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo requestInfo) {
|
||||||
|
log.info("**********MakeUpClockImportAction import data start**********");
|
||||||
|
// 流程表单主表数据
|
||||||
|
HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo);
|
||||||
|
// 流程表单明细表数据
|
||||||
|
List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo,0);
|
||||||
|
//补打卡人员
|
||||||
|
String userId = mainTableData.get("bdkry");
|
||||||
|
|
||||||
|
String modeId = Utils.getFormmodeIdMap().get("uf_jcl_kq_bdkjl");
|
||||||
|
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
|
||||||
|
String sql = "insert into uf_jcl_kq_bdkjl (bdkry,dkrq,dksj,dksm,bdklx,formmodeid,modeuuid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime) values (?,?,?,?,?,?,?,?,?,?,?)";
|
||||||
|
|
||||||
|
List<List> lists = Lists.newArrayList();
|
||||||
|
for (Map<String, String> detailTable:detailTableData){
|
||||||
|
List list = Lists.newArrayList();
|
||||||
|
list.add(userId);
|
||||||
|
list.add(detailTable.get("bdkrq"));
|
||||||
|
list.add(detailTable.get("bdksj"));
|
||||||
|
list.add(detailTable.get("bdksm"));
|
||||||
|
list.add(detailTable.get("bdklx"));
|
||||||
|
list.add(modeId);
|
||||||
|
list.add(UUID.randomUUID().toString());
|
||||||
|
list.add(1);
|
||||||
|
list.add(0);
|
||||||
|
list.add(DateUtil.getCurrentDate());
|
||||||
|
list.add(DateUtil.getCurrentTime().split(" ")[1]);
|
||||||
|
lists.add(list);
|
||||||
|
}
|
||||||
|
boolean result = rs.executeBatchSql(sql,lists);
|
||||||
|
if (!result){
|
||||||
|
log.error("MakeUpClockImportAction insert data:[{}]",lists);
|
||||||
|
log.error("添加失败");
|
||||||
|
requestInfo.getRequestManager().setMessageid("11111" + requestInfo.getRequestid() + "22222");
|
||||||
|
requestInfo.getRequestManager().setMessagecontent("添加失败!");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
log.info("**********MakeUpClockImportAction import data end**********");
|
||||||
|
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,170 @@
|
|||||||
|
package com.engine.attendance.workflow.action;
|
||||||
|
|
||||||
|
import com.engine.attendance.workflow.service.MakeUpClockInService;
|
||||||
|
import com.engine.attendance.workflow.service.impl.MakeUpClockInServiceImpl;
|
||||||
|
import com.engine.common.util.CommonUtil;
|
||||||
|
import com.engine.common.util.DateUtil;
|
||||||
|
import com.engine.common.util.DbTools;
|
||||||
|
import com.engine.common.util.ServiceUtil;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.interfaces.workflow.action.Action;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 补打卡提交校验action
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class MakeUpClockInAction implements Action {
|
||||||
|
|
||||||
|
private MakeUpClockInService makeUpClockInService = ServiceUtil.getService(MakeUpClockInServiceImpl.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo requestInfo) {
|
||||||
|
String requestid = requestInfo.getRequestid();
|
||||||
|
BaseBean bs = new BaseBean();
|
||||||
|
// 流程表单主表数据
|
||||||
|
HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo);
|
||||||
|
// 流程表单明细表数据
|
||||||
|
List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo,0);
|
||||||
|
//补打卡人员
|
||||||
|
String userId = mainTableData.get("bdkry");
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> params = Maps.newHashMap();
|
||||||
|
params.put("userId",userId);
|
||||||
|
params.put("submitDate",DateUtil.getCurrentDate());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 补打卡日期是否关账
|
||||||
|
*/
|
||||||
|
Map<String,Object> dataMap = makeUpClockInService.getKqCycleTimeIntervalCmd(params);
|
||||||
|
List<Map<String,Object>> dateList = (List<Map<String,Object>>)dataMap.get("data");
|
||||||
|
boolean status = (boolean)dataMap.get("status");
|
||||||
|
if (!status){
|
||||||
|
log.error("该人员没有考勤周期");
|
||||||
|
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
|
||||||
|
requestInfo.getRequestManager().setMessagecontent("该人员没有考勤周期!");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
if (dateList.size()==0){
|
||||||
|
log.error("申请人员当前时间没有考勤周期,请联系管理员!");
|
||||||
|
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
|
||||||
|
requestInfo.getRequestManager().setMessagecontent("申请人员当前时间没有考勤周期,请联系管理员!");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for (Map<String, String> detailTable:detailTableData){
|
||||||
|
String bdkrq = detailTable.get("bdkrq");
|
||||||
|
boolean mark = true;
|
||||||
|
for (Map<String,Object> date:dateList){
|
||||||
|
//存在考勤周期内
|
||||||
|
String startDate = Util.null2String(date.get("startDate"));
|
||||||
|
String endDate = Util.null2String(date.get("endDate"));
|
||||||
|
if (DateUtil.getTime(startDate).compareTo(DateUtil.getTime(bdkrq)) <=0 &&
|
||||||
|
DateUtil.getTime(endDate).compareTo(DateUtil.getTime(bdkrq)) >=0){
|
||||||
|
mark = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mark){
|
||||||
|
//已关账
|
||||||
|
log.error("补打卡日期:{},已关账无法补打卡",bdkrq);
|
||||||
|
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
|
||||||
|
requestInfo.getRequestManager().setMessagecontent("补打卡日期:"+bdkrq+"所在考勤周期已经关账无法再补打卡!");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String,List<Map<String, String>>> dataGroupByBdlxs = Maps.newHashMap();
|
||||||
|
|
||||||
|
//按照考勤周期对补打卡数据进行分类
|
||||||
|
for (int i=0;i<dateList.size();i++){
|
||||||
|
String startDate = Util.null2String(dateList.get(i).get("startDate"));
|
||||||
|
String endDate = Util.null2String(dateList.get(i).get("endDate"));
|
||||||
|
List<Map<String, String>> datas = Lists.newArrayList();
|
||||||
|
for (Map<String, String> detailTable:detailTableData){
|
||||||
|
String bdkrq = detailTable.get("bdkrq");
|
||||||
|
if (DateUtil.getTime(startDate).compareTo(DateUtil.getTime(bdkrq)) <=0 &&
|
||||||
|
DateUtil.getTime(endDate).compareTo(DateUtil.getTime(bdkrq)) >=0){
|
||||||
|
datas.add(detailTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (datas.size() > 0){
|
||||||
|
dataGroupByBdlxs.put(startDate+","+endDate,datas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("dataGroupByBdlxs : [{}]",dataGroupByBdlxs);
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
for (Map.Entry<String,List<Map<String, String>>> detailentry :dataGroupByBdlxs.entrySet()){
|
||||||
|
List<Map<String, String>> details = detailentry.getValue();
|
||||||
|
String startDate = detailentry.getKey().split(",")[0];
|
||||||
|
String endDate = detailentry.getKey().split(",")[1];
|
||||||
|
|
||||||
|
Map<String,List<Map<String, String>>> dataGroupByBdlx = details.stream().collect(Collectors.groupingBy(e->e.get("bdklx")));
|
||||||
|
|
||||||
|
String bdklxs="";
|
||||||
|
for (Map.Entry<String,List<Map<String, String>>> entry :dataGroupByBdlx.entrySet()){
|
||||||
|
String bdklx = entry.getKey();
|
||||||
|
bdklxs = bdklxs + bdklx +",";
|
||||||
|
}
|
||||||
|
bdklxs = bdklxs.substring(0,bdklxs.length()-1);
|
||||||
|
String sql = "select id,kqzqnxzsycs,ygbcycb,xzsydcs,hbjrdkqxm from uf_jcl_kq_kqxm where id in ("+bdklxs+")";
|
||||||
|
List<Map<String,Object>> items = DbTools.getSqlToList(sql);
|
||||||
|
|
||||||
|
Map<String,List<Map<String, Object>>> itemsGroupById = items.stream().collect(Collectors.groupingBy(e->Util.null2String(e.get("id"))));
|
||||||
|
|
||||||
|
|
||||||
|
for (Map.Entry<String,List<Map<String, String>>> entry :dataGroupByBdlx.entrySet()){
|
||||||
|
String bdklx = entry.getKey();
|
||||||
|
//明细数据
|
||||||
|
List<Map<String, String>> detailDatas = entry.getValue();
|
||||||
|
//考勤项目
|
||||||
|
List<Map<String, Object>> item = itemsGroupById.get(bdklx);
|
||||||
|
int maxclockTimes = Integer.valueOf(item.get(0).get("xzsydcs").toString());
|
||||||
|
int clockTimes = detailDatas.size();
|
||||||
|
|
||||||
|
//计入限制次数的其他项目
|
||||||
|
String hbjrdkqxm = Util.null2String(item.get(0).get("hbjrdkqxm"));
|
||||||
|
//计入限制次数的其他项目的明细数据
|
||||||
|
List<Map<String, String>> list = dataGroupByBdlx.get(hbjrdkqxm);
|
||||||
|
if (list != null && list.size() > 0){
|
||||||
|
clockTimes += list.size();
|
||||||
|
}
|
||||||
|
sql = "select bdkry,dkrq from uf_jcl_kq_bdkjl where bdkry=? and bdklx=?";
|
||||||
|
List<Map<String,Object>> existsList = DbTools.getSqlToList(sql,userId,bdklx);
|
||||||
|
log.info("existsList : [{}]",existsList);
|
||||||
|
existsList = existsList.stream().filter(e->DateUtil.getTime(startDate).compareTo(DateUtil.getTime(e.get("dkrq").toString())) <=0 &&
|
||||||
|
DateUtil.getTime(endDate).compareTo(DateUtil.getTime(e.get("dkrq").toString())) >=0).collect(Collectors.toList());
|
||||||
|
clockTimes +=existsList.size();
|
||||||
|
log.info("clockTimes : [{}],maxclockTimes : [{}]",clockTimes,maxclockTimes);
|
||||||
|
if (clockTimes > maxclockTimes){
|
||||||
|
//已达到请假上限
|
||||||
|
log.error("考勤项目已达到补打卡上限");
|
||||||
|
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
|
||||||
|
requestInfo.getRequestManager().setMessagecontent("考勤项目已达到补打卡上限!");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("exception : [{}]",e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
package com.engine.attendance.workflow.cmd;
|
||||||
|
|
||||||
|
import com.engine.common.biz.AbstractCommonCommand;
|
||||||
|
import com.engine.common.entity.BizLogContext;
|
||||||
|
import com.engine.common.util.CommonUtil;
|
||||||
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.hrm.company.DepartmentComInfo;
|
||||||
|
import weaver.hrm.company.SubCompanyComInfo;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class GetKqCycleTimeIntervalCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||||
|
|
||||||
|
public GetKqCycleTimeIntervalCmd(Map<String, Object> params){
|
||||||
|
this.params = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BizLogContext getLogContext() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> execute(CommandContext commandContext) {
|
||||||
|
String userId = Util.null2String(params.get("userId"));
|
||||||
|
String submitDates = Util.null2String(params.get("submitDate"));
|
||||||
|
log.info("GetKqCycleTimeIntervalCmd userId:[{}],submitDates:[{}]",userId,submitDates);
|
||||||
|
String modeId = Utils.getFormmodeIdMap().get("uf_jcl_kq_kqzqmc");
|
||||||
|
|
||||||
|
Set<String> attendanceSetIdsSets = CommonUtil.getDataIds(userId,modeId,null,null);
|
||||||
|
log.info("attendanceSetIdsSets : {}",attendanceSetIdsSets);
|
||||||
|
|
||||||
|
|
||||||
|
String sql = "select id,departmentid,subcompanyid1 from hrmresource where id =?";
|
||||||
|
Map<String,Object> departMentMap = DbTools.getSqlToMap(sql,userId);
|
||||||
|
String deptid = Util.null2String(departMentMap.get("departmentid"));
|
||||||
|
String pdeptids = "";
|
||||||
|
List<Map<String,Object>> dateList = Lists.newArrayList();
|
||||||
|
Map<String,Object> resultMap = Maps.newHashMap();
|
||||||
|
resultMap.put("status",true);
|
||||||
|
resultMap.put("data",dateList);
|
||||||
|
try {
|
||||||
|
pdeptids = new DepartmentComInfo().getAllParentDepartId(Util.null2String(departMentMap.get("departmentid")), pdeptids);
|
||||||
|
pdeptids = deptid + pdeptids;
|
||||||
|
log.info("pdeptids : [{}]",pdeptids);
|
||||||
|
LocalDateTime nowLocalDateTime = DateUtil.getTime(submitDates);
|
||||||
|
int nowyear = nowLocalDateTime.getYear();
|
||||||
|
int nowMonth = nowLocalDateTime.getMonth().getValue();
|
||||||
|
|
||||||
|
LocalDateTime beforeLocalDateTime = DateUtil.getTime(submitDates).minusMonths(1);
|
||||||
|
int beforeYear = beforeLocalDateTime.getYear();
|
||||||
|
int beforeMonth = beforeLocalDateTime.getMonth().getValue();
|
||||||
|
|
||||||
|
sql = "select a.zt,a.ksrq,a.jsrq,a.gzrq,a.gzsj,b.zt dtzt,b.tsbm,b.gzrq dtgzrq,b.gzsj dtgzsj from uf_jcl_kq_kqzq a left join uf_jcl_kq_kqzq_dt1 b on a.id=b.mainid where a.mc=? and (a.nd=? and a.yf=? or a.nd=? and a.yf=?)";
|
||||||
|
if (attendanceSetIdsSets.toArray().length == 0){
|
||||||
|
resultMap.put("status",false);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
List<Map<String,Object>> list = DbTools.getSqlToList(sql,attendanceSetIdsSets.toArray()[0],nowyear,nowMonth,beforeYear,beforeMonth);
|
||||||
|
|
||||||
|
log.info("GetKqCycleTimeIntervalCmd list : [{}]",list);
|
||||||
|
for (Map<String,Object> dataMap : list){
|
||||||
|
String tsbm = Util.null2String(dataMap.get("tsbm"));
|
||||||
|
if (!"".equals(tsbm) && CommonUtil.ifContainStr(pdeptids,tsbm,",")){
|
||||||
|
//人员在特殊部门里
|
||||||
|
String gzrq = Util.null2String(dataMap.get("dtgzrq")) +" "+Util.null2String(dataMap.get("dtgzsj")) +":00";
|
||||||
|
if (DateUtil.getTime(submitDates).compareTo(DateUtil.getTime(gzrq))<=0){
|
||||||
|
Map<String,Object> date = Maps.newHashMap();
|
||||||
|
date.put("startDate",dataMap.get("ksrq"));
|
||||||
|
date.put("endDate",dataMap.get("jsrq"));
|
||||||
|
dateList.add(date);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map<String,Object> dataMap : list){
|
||||||
|
String gzrq = Util.null2String(dataMap.get("gzrq")) +" "+Util.null2String(dataMap.get("gzsj")) +":00";
|
||||||
|
if (DateUtil.getTime(submitDates).compareTo(DateUtil.getTime(gzrq))<=0){
|
||||||
|
Map<String,Object> date = Maps.newHashMap();
|
||||||
|
List<Map<String,Object>> filterDate = dateList.stream().filter(e->e.get("startDate").equals(dataMap.get("ksrq"))).collect(Collectors.toList());
|
||||||
|
if (filterDate.size() == 0){
|
||||||
|
date.put("startDate",dataMap.get("ksrq"));
|
||||||
|
date.put("endDate",dataMap.get("jsrq"));
|
||||||
|
dateList.add(date);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("catch error :{}",e);
|
||||||
|
}
|
||||||
|
log.info("GetKqCycleTimeIntervalCmd dateList : [{}]",dateList);
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
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.
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.
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.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue