Compare commits

...

2 Commits

Author SHA1 Message Date
liuliang ce3d3321e3 出差支持上午下午 1 month ago
liuliang 573d28693d 更新 1 month ago

@ -0,0 +1,17 @@
package com.api.jucailinkq.attendance.workflow;
import com.engine.jucailinkq.attendance.workflow.web.MakeUpClockInAction;
import com.engine.jucailinkq.attendance.workflow.web.OvertimePlanApi;
import lombok.extern.slf4j.Slf4j;
import javax.ws.rs.Path;
/**
* @Author: liuliang
* @Description:
* @Date: 2025/03/05
**/
@Path("/attendance/makeupclock")
@Slf4j
public class MakeUpClockActionApi extends MakeUpClockInAction {
}

@ -5,6 +5,7 @@ import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command; import com.engine.core.interceptor.Command;
import com.engine.jucailinkq.attendance.workflow.proxy.tactics.WorkFlowHandleTacis; import com.engine.jucailinkq.attendance.workflow.proxy.tactics.WorkFlowHandleTacis;
import com.engine.jucailinkq.common.util.DbTools; import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils; import com.engine.jucailinkq.common.util.Utils;
import com.engine.workflow.cmd.monitor.DoDeleteCmd; import com.engine.workflow.cmd.monitor.DoDeleteCmd;
import com.engine.workflow.cmd.monitor.DoRepossessedCmd; import com.engine.workflow.cmd.monitor.DoRepossessedCmd;
@ -68,6 +69,7 @@ public class KQDoDeleteProxyCmd extends AbstractCommandProxy<Map<String,Object>>
} }
} }
} }
ExtensionClassHolder.remove();
bb.writeLog("KQDoDeleteProxyCmd requestMap"+resultMap.toString()); bb.writeLog("KQDoDeleteProxyCmd requestMap"+resultMap.toString());
return resultMap; return resultMap;
} }

@ -5,6 +5,7 @@ import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command; import com.engine.core.interceptor.Command;
import com.engine.jucailinkq.attendance.workflow.proxy.tactics.WorkFlowHandleTacis; import com.engine.jucailinkq.attendance.workflow.proxy.tactics.WorkFlowHandleTacis;
import com.engine.jucailinkq.common.util.DbTools; import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils; import com.engine.jucailinkq.common.util.Utils;
import com.engine.workflow.cmd.monitor.DoRepossessedCmd; import com.engine.workflow.cmd.monitor.DoRepossessedCmd;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -66,6 +67,7 @@ public class KQDoRepossessedProxyCmd extends AbstractCommandProxy<Map<String,Obj
} }
} }
}); });
ExtensionClassHolder.remove();
return resultMap; return resultMap;
} }

@ -8,6 +8,7 @@ import com.engine.jucailinkq.attendance.enums.ClockPointEnum;
import com.engine.common.biz.AbstractCommonCommand; import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext; import com.engine.common.entity.BizLogContext;
import com.engine.jucailinkq.common.util.DateUtil; import com.engine.jucailinkq.common.util.DateUtil;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils; import com.engine.jucailinkq.common.util.Utils;
import com.engine.core.interceptor.CommandContext; import com.engine.core.interceptor.CommandContext;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -356,6 +357,9 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
String middileTime = DateUtil.AfterMinutes(beforeTime, betWeenMinutes / 2); String middileTime = DateUtil.AfterMinutes(beforeTime, betWeenMinutes / 2);
Map<String,Object> gobalSet = ExtensionClassHolder.getGlobalSetMap();
String clockInPointSet = Util.null2String(gobalSet.get("clockInPointSet"));
String signdateTime = beforeClcokInTimeMap.get("signdate") + " " + beforeClcokInTimeMap.get("signtime"); String signdateTime = beforeClcokInTimeMap.get("signdate") + " " + beforeClcokInTimeMap.get("signtime");
ClockPointDTO resetClcokDTO =null; ClockPointDTO resetClcokDTO =null;
@ -366,6 +370,12 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
//该打卡归属后一个打卡点,前一个打卡点需要重新设置 //该打卡归属后一个打卡点,前一个打卡点需要重新设置
resetClcokDTO=beforeClcokDTO; resetClcokDTO=beforeClcokDTO;
} }
//0:归属前一天1过半原则2归属后一天
if ("0".equals(clockInPointSet)){
resetClcokDTO=afterClcokInDTO;
}else if ("2".equals(clockInPointSet)){
resetClcokDTO=beforeClcokDTO;
}
//需要重新赋值的打卡时间 //需要重新赋值的打卡时间
String restTime = resetClcokDTO.getClassTime(); String restTime = resetClcokDTO.getClassTime();

@ -309,13 +309,13 @@ public class GetOvertimeDurationCmd extends AbstractCommonCommand<Map<String, Ob
forComputeEndTime = jssj; forComputeEndTime = jssj;
} }
} }
int askForLeaveTime = removeAskForLeave(scheduleMap,forComputeStartTime, forComputeEndTime int askForLeaveTime = removeAskForLeave(scheduleMap,realityStartTime, realityEndime
, bdlx, askForLeaveList, askForLeaveItems, askForLeaveToOffsetAbnomaly); , bdlx, askForLeaveList, askForLeaveItems, askForLeaveToOffsetAbnomaly);
/** /**
* *
*/ */
int evectionTime = removeEvection(scheduleMap,forComputeStartTime, forComputeEndTime int evectionTime = removeEvection(scheduleMap,realityStartTime, realityEndime
, bdlx, evectionList, evectionItems, evectionToOffsetAbnomaly); , bdlx, evectionList, evectionItems, evectionToOffsetAbnomaly);
/** /**

@ -172,9 +172,9 @@ public class SaveWorkOverTimeCmd extends AbstractCommonCommand<Map<String,Object
Map<String,Object> insertParam = Maps.newHashMap(); Map<String,Object> insertParam = Maps.newHashMap();
insertParam.put("jbry",userId); insertParam.put("jbry",userId);
insertParam.put("sjksrq",realityStartTime.split(" ")[0]); insertParam.put("sjksrq",realityStartTime.split(" ")[0]);
insertParam.put("sjkssj",realityStartTime.split(" ")[1]); insertParam.put("sjkssj",DateUtil.converHourAndMinute(realityStartTime));
insertParam.put("sjjsrq",realityEndime.split(" ")[0]); insertParam.put("sjjsrq",realityEndime.split(" ")[0]);
insertParam.put("sjjssj",realityEndime.split(" ")[1]); insertParam.put("sjjssj",DateUtil.converHourAndMinute(realityEndime));
if (scheduleMap.get("overtimePlanId") != null){ if (scheduleMap.get("overtimePlanId") != null){
insertParam.put("jbjhid",scheduleMap.get("overtimePlanId")); insertParam.put("jbjhid",scheduleMap.get("overtimePlanId"));
} }

@ -56,7 +56,7 @@ public class AttendanceAnalysisJob extends BaseCronJob {
//查询所有在职人员 //查询所有在职人员
String queryUserSql = "select id,departmentid,subcompanyid1,companystartdate,seclevel from hrmresource where status <> '5' and status <> '4' and status <> '7' and (belongto is null or belongto='-1')"; String queryUserSql = "select id,departmentid,subcompanyid1,companystartdate,seclevel from hrmresource where status <> '5' and status <> '4' and status <> '7' and (belongto is null or belongto='-1' or belongto='0')";
List<Map<String,Object>> userList = DbTools.getSqlToList(queryUserSql); List<Map<String,Object>> userList = DbTools.getSqlToList(queryUserSql);
@ -66,7 +66,7 @@ public class AttendanceAnalysisJob extends BaseCronJob {
List<List<String>> departEmployeePartition = Lists.partition(departEmployeeList,200); List<List<String>> departEmployeePartition = Lists.partition(departEmployeeList,200);
for (List<String> userIdPartition :departEmployeePartition){ for (List<String> userIdPartition :departEmployeePartition){
String sql = "select id,departmentid,subcompanyid1,companystartdate from hrmresource where id in ("+String.join(",",userIdPartition)+") and (belongto is null or belongto='-1')"; String sql = "select id,departmentid,subcompanyid1,companystartdate from hrmresource where id in ("+String.join(",",userIdPartition)+") and (belongto is null or belongto='-1' or belongto='0')";
userList.addAll(DbTools.getSqlToList(sql)); userList.addAll(DbTools.getSqlToList(sql));
} }
} }
@ -269,7 +269,7 @@ public class AttendanceAnalysisJob extends BaseCronJob {
needCleanParam.put("startDate",startDate); needCleanParam.put("startDate",startDate);
needCleanParam.put("endDate",endDate); needCleanParam.put("endDate",endDate);
commonService.CleanHaveLeaveUserDataCmd(needCleanParam); commonService.CleanHaveLeaveUserDataCmd(needCleanParam);
ExtensionClassHolder.remove();
log.info("********AttendanceAnalysisJob end********"); log.info("********AttendanceAnalysisJob end********");
} }

@ -92,6 +92,20 @@ public class ForgetClockInServiceImpl extends Service implements ForgetClockInSe
lateParam.put("workfor",Utils.getWorkFor(bdlx)); lateParam.put("workfor",Utils.getWorkFor(bdlx));
List<Map<String,Object>> items = (List<Map<String,Object>>)commandExecutor.execute(new AbsenteeismItemCmd(lateParam)).get("attendanceItems"); List<Map<String,Object>> items = (List<Map<String,Object>>)commandExecutor.execute(new AbsenteeismItemCmd(lateParam)).get("attendanceItems");
if (items.size() > 0){ if (items.size() > 0){
String zkgtj = Util.null2String(items.get(0).get("zkgtj"));
List<Map<String,Object>> startmissCardlist = missCardlist.stream().filter(e->DateUtil.getTime(dtkssj).compareTo(DateUtil.getTime(e.get("pointTime").toString()))==0).collect(Collectors.toList());
List<Map<String,Object>> endmissCardlist = missCardlist.stream().filter(e->DateUtil.getTime(dtjssj).compareTo(DateUtil.getTime(e.get("pointTime").toString()))==0).collect(Collectors.toList());
if ("2".equals(zkgtj) && missCardlist.size()<2){
//开始结束均没有打卡才进行转旷工
continue;
}else if ("0".equals(zkgtj) && startmissCardlist.size()==0){
//开始时间点没有打卡
continue;
}else if ("1".equals(zkgtj) && endmissCardlist.size() == 0){
//结束时间点没有打卡
continue;
}
//去除异常 //去除异常
abnormalList = abnormalList.stream().filter(e->{ abnormalList = abnormalList.stream().filter(e->{
for (Map<String,Object> map:abnormal){ for (Map<String,Object> map:abnormal){

@ -21,6 +21,8 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import weaver.common.DateUtil; import weaver.common.DateUtil;
@ -75,6 +77,7 @@ public class AttendanceJucailinButtonAction {
retmap.put("status", "-1"); retmap.put("status", "-1");
return ApiReturnTools.error("500",SystemEnv.getHtmlLabelName(382661, user.getLanguage())); return ApiReturnTools.error("500",SystemEnv.getHtmlLabelName(382661, user.getLanguage()));
} }
ExtensionClassHolder.remove();
return JSONObject.toJSONString(retmap); return JSONObject.toJSONString(retmap);
} }
@ -122,6 +125,7 @@ public class AttendanceJucailinButtonAction {
retmap.put("status", "-1"); retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage())); retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
} }
ExtensionClassHolder.remove();
return JSONObject.toJSONString(retmap); return JSONObject.toJSONString(retmap);
} }

@ -6,6 +6,7 @@ import com.engine.jucailinkq.attendance.attendanceanalysis.service.AttendanceSum
import com.engine.jucailinkq.attendance.attendanceanalysis.service.impl.AttendanceSummaryServiceImpl; import com.engine.jucailinkq.attendance.attendanceanalysis.service.impl.AttendanceSummaryServiceImpl;
import com.engine.common.util.ParamUtil; import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import weaver.general.BaseBean; import weaver.general.BaseBean;
import weaver.hrm.HrmUserVarify; import weaver.hrm.HrmUserVarify;
import weaver.hrm.User; import weaver.hrm.User;
@ -42,6 +43,7 @@ public class AttendanceSummaryApi {
Map<String, Object> apidatas = new HashMap<String, Object>(); Map<String, Object> apidatas = new HashMap<String, Object>();
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
apidatas = getAttendanceSummaryService(user).getCqSummarySearchCondition(ParamUtil.request2Map(request)); apidatas = getAttendanceSummaryService(user).getCqSummarySearchCondition(ParamUtil.request2Map(request));
ExtensionClassHolder.remove();
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect); return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
} }
@ -58,6 +60,7 @@ public class AttendanceSummaryApi {
Map<String, Object> apidatas = new HashMap<String, Object>(); Map<String, Object> apidatas = new HashMap<String, Object>();
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
apidatas = getAttendanceSummaryService(user).getCqSummaryReport(ParamUtil.request2Map(request)); apidatas = getAttendanceSummaryService(user).getCqSummaryReport(ParamUtil.request2Map(request));
ExtensionClassHolder.remove();
return JSONObject.toJSONString(apidatas); return JSONObject.toJSONString(apidatas);
} }
@ -74,6 +77,7 @@ public class AttendanceSummaryApi {
Map<String, Object> apidatas = new HashMap<String, Object>(); Map<String, Object> apidatas = new HashMap<String, Object>();
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
apidatas = getAttendanceSummaryService(user).addAttendanceSummary(ParamUtil.request2Map(request)); apidatas = getAttendanceSummaryService(user).addAttendanceSummary(ParamUtil.request2Map(request));
ExtensionClassHolder.remove();
return JSONObject.toJSONString(apidatas); return JSONObject.toJSONString(apidatas);
} }
@ -95,6 +99,7 @@ public class AttendanceSummaryApi {
apidatas.put("status", "-1"); apidatas.put("status", "-1");
bs.writeLog(e); bs.writeLog(e);
} }
ExtensionClassHolder.remove();
return JSONObject.toJSONString(apidatas); return JSONObject.toJSONString(apidatas);
} }
@ -105,6 +110,7 @@ public class AttendanceSummaryApi {
Map<String, Object> apidatas = new HashMap<String, Object>(); Map<String, Object> apidatas = new HashMap<String, Object>();
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
apidatas = getAttendanceSummaryService(user).refreshViewAttendanceDaily(); apidatas = getAttendanceSummaryService(user).refreshViewAttendanceDaily();
ExtensionClassHolder.remove();
return JSONObject.toJSONString(apidatas); return JSONObject.toJSONString(apidatas);
} }
} }

@ -101,7 +101,7 @@ public class AttendaceActionWrapper extends Service {
List<Map<String,Object>> hxbzList = DbTools.getSqlToList(queryHxbz); List<Map<String,Object>> hxbzList = DbTools.getSqlToList(queryHxbz);
String queryUserSql = "select id,companystartdate,seclevel,departmentid,subcompanyid1 from hrmresource where status <> '5' and status <> '4' and status <> '7' and (belongto is null or belongto='-1')"; String queryUserSql = "select id,companystartdate,seclevel,departmentid,subcompanyid1 from hrmresource where status <> '5' and status <> '4' and status <> '7' and (belongto is null or belongto='-1' or belongto='0')";
List<Map<String,Object>> userList = DbTools.getSqlToList(queryUserSql); List<Map<String,Object>> userList = DbTools.getSqlToList(queryUserSql);
String sql = "select id,userid,signdate,signtime from hrmschedulesign where isincom=1 and signdate >= ? and signdate <= ? order by signdate,signtime"; String sql = "select id,userid,signdate,signtime from hrmschedulesign where isincom=1 and signdate >= ? and signdate <= ? order by signdate,signtime";
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,startBeforeDate,endAfterDate); List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,startBeforeDate,endAfterDate);
@ -221,7 +221,7 @@ public class AttendaceActionWrapper extends Service {
String sql = "select id,userid,signdate,signtime from hrmschedulesign where isincom=1 and userid in ("+userIds+") and signdate >= ? and signdate <= ? order by signdate,signtime"; String sql = "select id,userid,signdate,signtime from hrmschedulesign where isincom=1 and userid in ("+userIds+") and signdate >= ? and signdate <= ? order by signdate,signtime";
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,startBeforeDate,endAfterDate); List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,startBeforeDate,endAfterDate);
String queryUserSql = "select id,companystartdate,seclevel,departmentid,subcompanyid1 from hrmresource where id in ("+userIds+") and (belongto is null or belongto='-1')"; String queryUserSql = "select id,companystartdate,seclevel,departmentid,subcompanyid1 from hrmresource where id in ("+userIds+") and (belongto is null or belongto='-1' or belongto='0')";
List<Map<String,Object>> userList = DbTools.getSqlToList(queryUserSql); List<Map<String,Object>> userList = DbTools.getSqlToList(queryUserSql);
Map<String,List<Map<String,Object>>> userGroupMap = userList.stream().collect(Collectors.groupingBy(e->e.get("id").toString())); Map<String,List<Map<String,Object>>> userGroupMap = userList.stream().collect(Collectors.groupingBy(e->e.get("id").toString()));
@ -325,6 +325,7 @@ public class AttendaceActionWrapper extends Service {
resultMap.put("code","500"); resultMap.put("code","500");
resultMap.put("message",e.getCause().getMessage()); resultMap.put("message",e.getCause().getMessage());
} }
ExtensionClassHolder.remove();
return resultMap; return resultMap;

@ -1,6 +1,7 @@
package com.engine.jucailinkq.attendance.component.AttendanceCycle.job; package com.engine.jucailinkq.attendance.component.AttendanceCycle.job;
import com.engine.jucailinkq.common.util.DbTools; import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.time.util.DateUtil; import com.time.util.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import weaver.general.Util; import weaver.general.Util;
@ -69,7 +70,7 @@ public class AttendanceCycleCloseJob extends BaseCronJob {
boolean updateSign = DbTools.update(sql); boolean updateSign = DbTools.update(sql);
log.info("AttendanceCycleCloseJob-考勤周期明细表更新状态结果:" + updateSign); log.info("AttendanceCycleCloseJob-考勤周期明细表更新状态结果:" + updateSign);
} }
ExtensionClassHolder.remove();
log.info("********AttendanceCycleCloseJob end********"); log.info("********AttendanceCycleCloseJob end********");
} }
} }

@ -4,6 +4,7 @@ import com.engine.jucailinkq.attendance.component.ImportAndExport.service.ExcelE
import com.engine.jucailinkq.attendance.component.ImportAndExport.service.impl.ExcelExportImportServiceImpl; import com.engine.jucailinkq.attendance.component.ImportAndExport.service.impl.ExcelExportImportServiceImpl;
import com.engine.jucailinkq.attendance.component.ImportAndExport.service.param.ImportParam; import com.engine.jucailinkq.attendance.component.ImportAndExport.service.param.ImportParam;
import com.engine.common.util.ParamUtil; import com.engine.common.util.ParamUtil;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.ResponseResult; import com.engine.jucailinkq.common.util.ResponseResult;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.parameters.RequestBody;
@ -56,6 +57,7 @@ public class ExcelController {
outputStream.flush(); outputStream.flush();
}; };
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
ExtensionClassHolder.remove();
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build(); return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
} }

@ -226,6 +226,7 @@ public class WorkRulesServiceImpl extends Service implements WorkRulesService {
sqltj = Utils.converSQL(sqltj); sqltj = Utils.converSQL(sqltj);
log.info("getDepartSchedule sqltj : [{}]",sqltj); log.info("getDepartSchedule sqltj : [{}]",sqltj);
List<Map<String,Object>> dataList = DbTools.getSqlToList(sqltj); List<Map<String,Object>> dataList = DbTools.getSqlToList(sqltj);
log.info("getDepartSchedule dataList : [{}]",dataList);
for (Map<String,Object> dataMap :dataList){ for (Map<String,Object> dataMap :dataList){
String hrmId = Util.null2String(dataMap.get("id")); String hrmId = Util.null2String(dataMap.get("id"));
userIdMap.put(hrmId,date); userIdMap.put(hrmId,date);
@ -241,6 +242,8 @@ public class WorkRulesServiceImpl extends Service implements WorkRulesService {
userIdMap.put(map.get("id").toString(),startTime+","+endTime); userIdMap.put(map.get("id").toString(),startTime+","+endTime);
} }
} }
log.info("getDepartSchedule dataTable:[{}]",dataTable);
log.info("getDepartSchedule userIdMap:[{}]",userIdMap);
for (int i=0;i<dataTable.size();i++){ for (int i=0;i<dataTable.size();i++){
Map<String,Object> map = dataTable.get(i); Map<String,Object> map = dataTable.get(i);
String id = Util.null2String(map.get("id")); String id = Util.null2String(map.get("id"));

@ -3,6 +3,7 @@ package com.engine.jucailinkq.attendance.component.persongroup.job.scheduling;
import com.engine.jucailinkq.attendance.component.persongroup.job.scheduling.tactics.RegularScheduling; import com.engine.jucailinkq.attendance.component.persongroup.job.scheduling.tactics.RegularScheduling;
import com.engine.jucailinkq.common.util.DateUtil; import com.engine.jucailinkq.common.util.DateUtil;
import com.engine.jucailinkq.common.util.DbTools; import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils; import com.engine.jucailinkq.common.util.Utils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -51,5 +52,6 @@ public class SchedulingJob extends BaseCronJob {
}catch (Exception e){ }catch (Exception e){
log.error("catch error: [{}]",e); log.error("catch error: [{}]",e);
} }
ExtensionClassHolder.remove();
} }
} }

@ -4,6 +4,7 @@ import com.engine.jucailinkq.attendance.vacation.service.VocationService;
import com.engine.jucailinkq.attendance.vacation.service.impl.VocationServiceImpl; import com.engine.jucailinkq.attendance.vacation.service.impl.VocationServiceImpl;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.jucailinkq.common.util.CommonUtil; import com.engine.jucailinkq.common.util.CommonUtil;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils; import com.engine.jucailinkq.common.util.Utils;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -45,6 +46,7 @@ public class HolidayGenerationJob extends BaseCronJob {
basicsetService.generateVocation(params); basicsetService.generateVocation(params);
basicsetService.handleOverdueVocation(params); basicsetService.handleOverdueVocation(params);
ExtensionClassHolder.remove();
log.info("**********HolidayGenerationJob end ************"); log.info("**********HolidayGenerationJob end ************");
} }
} }

@ -295,7 +295,7 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
} }
VocationCommonUtil.computeRestTimeByjzrqzd(insertHoliDayParam,jzrqzd,companystartdate,wscl); VocationCommonUtil.computeRestTimeByjzrqzd(insertHoliDayParam,jzrqzd,companystartdate,wscl);
VocationCommonUtil.updateHolidayBalance("uf_jcl_kq_jqye", insertHoliDayParam,dataList,edyxq); VocationCommonUtil.updateHolidayBalance("uf_jcl_kq_jqye", insertHoliDayParam,dataList,Integer.valueOf(vocationList.get(0).get("sxsxrqtqts").toString()));
return insertHoliDayParam; return insertHoliDayParam;
} }

@ -221,7 +221,7 @@ public class BySchedulePaymentWay implements HolidayGenerationWay{
} }
VocationCommonUtil.computeRestTimeByjzrqzd(insertHoliDayParam,jzrqzd,companystartdate,wscl); VocationCommonUtil.computeRestTimeByjzrqzd(insertHoliDayParam,jzrqzd,companystartdate,wscl);
VocationCommonUtil.updateHolidayBalance("uf_jcl_kq_jqye",insertHoliDayParam,dataList,edyxq); VocationCommonUtil.updateHolidayBalance("uf_jcl_kq_jqye",insertHoliDayParam,dataList,Integer.valueOf(vocationList.get(0).get("sxsxrqtqts").toString()));
return insertHoliDayParam; return insertHoliDayParam;
} }

@ -40,7 +40,7 @@ public class OneTimePayMentWay implements HolidayGenerationWay{
String fgrq= Util.null2String(vocationList.get(0).get("fgrq")); String fgrq= Util.null2String(vocationList.get(0).get("fgrq"));
//额度依据 //额度依据
String edyj= Util.null2String(vocationList.get(0).get("edyj")); String edyj= Util.null2String(vocationList.get(0).get("edyj"));
// data.put("isOneTime","1"); data.put("isOneTime","1");
if ("".equals(qsrq)){ if ("".equals(qsrq)){
return Maps.newHashMap(); return Maps.newHashMap();

@ -7,13 +7,10 @@ import com.engine.jucailinkq.attendance.enums.StartingUnitEnum;
import com.engine.jucailinkq.attendance.vacation.util.VocationCommonUtil; import com.engine.jucailinkq.attendance.vacation.util.VocationCommonUtil;
import com.engine.jucailinkq.common.exception.AttendanceRunTimeException; import com.engine.jucailinkq.common.exception.AttendanceRunTimeException;
import com.engine.jucailinkq.common.util.DateUtil; import com.engine.jucailinkq.common.util.DateUtil;
import com.engine.jucailinkq.common.util.DbTools;
import com.google.common.collect.Maps; 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 javax.swing.text.DateFormatter;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
@ -80,20 +77,17 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
if ("".equals(qsrq)){ if ("".equals(qsrq)){
return Maps.newHashMap(); return Maps.newHashMap();
} }
if (!"1".equals(isOneTime)){ // if (!"1".equals(isOneTime)){
qsrq = VocationCommonUtil.getAfterAdjustTime(qsrq, dzqsrq, fgrq); qsrq = VocationCommonUtil.getAfterAdjustTime(qsrq, dzqsrq, fgrq);
for (Map<String, Object> vocationMap : vocationList) { for (Map<String, Object> vocationMap : vocationList) {
vocationMap.put("qsrqValue", qsrq); vocationMap.put("qsrqValue", qsrq);
} }
} // }
if (DateUtil.getTime(releaseDate).compareTo(DateUtil.getTime(qsrq)) < 0){ if (DateUtil.getTime(releaseDate).compareTo(DateUtil.getTime(qsrq)) < 0){
//releaseDate=qsrq; //releaseDate=qsrq;
return Maps.newHashMap(); return Maps.newHashMap();
} }
Map<String, Object> insertHoliDayParam = VocationCommonUtil.getInsertHoliDayParam(vocationList.get(0), userId, qsrq, releaseDate);
//相差天数 //相差天数
int betweenDays = DateUtil.getBetWeenDays(qsrq, releaseDate.split(" ")[0]); int betweenDays = DateUtil.getBetWeenDays(qsrq, releaseDate.split(" ")[0]);
//相差月份 //相差月份
@ -102,14 +96,16 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
int allWorkDays = Double.valueOf(ljcrglyfslwz).intValue() * 30 + betweenDays; int allWorkDays = Double.valueOf(ljcrglyfslwz).intValue() * 30 + betweenDays;
//总月数 //总月数
int allMonths = betweenMonth + Double.valueOf(ljcrglyfslwz).intValue(); int allMonths = betweenMonth + Double.valueOf(ljcrglyfslwz).intValue();
//如果工龄直接取工龄字段值
if ("2".equals(jgscsf)){
allMonths = (int)(Double.valueOf(ljcrglyfslwz)*12); Map<String, Object> insertHoliDayParam = VocationCommonUtil.getInsertHoliDayParam(vocationList.get(0), userId, qsrq, releaseDate);
if (allMonths == 0){ List<Map<String,Object>> dataList = null;
//return insertHoliDayParam; if ("1".equals(isOneTime)){
} dataList = VocationCommonUtil.ifisOneTimeexist("uf_jcl_kq_jqye", insertHoliDayParam);
}else {
dataList = VocationCommonUtil.ifexist("uf_jcl_kq_jqye", insertHoliDayParam);
} }
List<Map<String,Object>> dataList = VocationCommonUtil.ifexist("uf_jcl_kq_jqye", insertHoliDayParam);
// List<Map<String,Object>> dataList = new ArrayList<>(); // List<Map<String,Object>> dataList = new ArrayList<>();
//已存在数据且不覆盖 //已存在数据且不覆盖
@ -229,23 +225,9 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays, yjzd,userId); Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays, yjzd,userId);
restTime = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0; restTime = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
} }
restTime = VocationCommonUtil.handleRestDays(restTime,wscl);
if("102".equals(pjjb)){
String sql = "UPDATE UF_JCL_KQ_JQYE SET KTSC = 120 - " + restTime + " WHERE JQID = 101 AND KTSC + " + restTime + " > 120 AND YGID = " + userId + " AND sxrq = '" + sxrq + "'";
DbTools.update(sql);
}
if("101".equals(pjjb)){
String sql = "SELECT KTSC FROM UF_JCL_KQ_JQYE ujkj WHERE JQID = 102 AND ygid = " + userId + " AND sxrq = '" + sxrq + "'";
Map<String,Object> tmpres = DbTools.getSqlToMap(sql);
if (tmpres.size()>0) {
double restTime0 = Double.valueOf(tmpres.get("ktsc").toString());
if (restTime0 + restTime > 120)
restTime = 120 - restTime0;
}
}
insertHoliDayParam.put("ktsc", restTime); insertHoliDayParam.put("ktsc", restTime);
if (!"1".equals(isOneTime)){ // if (!"1".equals(isOneTime)){
//离职日期 //离职日期
//入职日期 //入职日期
List<Map<String,Object>> userList = (List<Map<String,Object>>)data.get("userList"); List<Map<String,Object>> userList = (List<Map<String,Object>>)data.get("userList");
@ -257,8 +239,9 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
} }
VocationCommonUtil.computeRestTimeByjzrqzd(insertHoliDayParam,jzrqzd,companystartdate,wscl); VocationCommonUtil.computeRestTimeByjzrqzd(insertHoliDayParam,jzrqzd,companystartdate,wscl);
VocationCommonUtil.updateHolidayBalance("uf_jcl_kq_jqye", insertHoliDayParam,dataList,edyxq);
} VocationCommonUtil.updateHolidayBalance("uf_jcl_kq_jqye", insertHoliDayParam,dataList,Util.null2String(vocationList.get(0).get("sxsxrqtqts")).equals("")?0:Integer.valueOf(vocationList.get(0).get("sxsxrqtqts").toString()));
// }
return insertHoliDayParam; return insertHoliDayParam;
} }
@ -275,44 +258,43 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
String wscl = Util.null2String(vocationList.get(0).get("wscl")); String wscl = Util.null2String(vocationList.get(0).get("wscl"));
//间隔时长算法 //间隔时长算法
String jgscsf = Util.null2String(vocationList.get(0).get("jgsc")); String jgscsf = Util.null2String(vocationList.get(0).get("jgsc"));
//累计工龄数或者直取工龄数
int seniority = 0; int seniority = "".equals(ljcrglyfslwz)?0:Double.valueOf(ljcrglyfslwz).intValue();
//累计时长单位01
String ljgldw = Util.null2String(vocationList.get(0).get("lsgldw"));
if(!"2".equals(jgscsf)) {
//间隔时长不为直取工龄时,进行取整处理 todo:实际上累计工龄为年时 基本上都是有小数的 ,都不应该取整 ,这里的逻辑有待优化
seniority = "".equals(ljcrglyfslwz) ? 0 : Double.valueOf(ljcrglyfslwz).intValue();
}
double restTime=0.0; double restTime=0.0;
//折算 //折算
if (changeMethodEnum == QuotaChangeMethodEnum.CONVERT){ if (changeMethodEnum == QuotaChangeMethodEnum.CONVERT){
int beginYear = 0; int beginYearMonth = DateUtil.getBetWeenMonths(qsrq,sxrq);
int endYear = 0; if (beginYearMonth < 0){
String divideTime = "";
if("2".equals(jgscsf)) {
//直接取工龄字段
beginYear = Double.valueOf(ljcrglyfslwz).intValue();
endYear = beginYear+1;
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
double divdemonths = Double.valueOf(ljcrglyfslwz) - Double.valueOf(ljcrglyfslwz).intValue();
divideTime = DateUtil.nextMonth(sxrq,12-(int)Math.ceil(divdemonths*12),dateTimeFormatter);
//LocalDateTime localDateTime = DateUtil.getTime(sxrq);
//localDateTime = localDateTime.plusMonths((int)Math.ceil(divdemonths*12));
//divideTime = localDateTime.format(dateTimeFormatter);
}else {
int beginYearMonth = DateUtil.getBetWeenMonths(qsrq, sxrq);
if (beginYearMonth < 0) {
beginYearMonth = 0; beginYearMonth = 0;
} }
beginYearMonth = beginYearMonth + seniority; beginYearMonth = beginYearMonth+seniority;
int endYearMonth = DateUtil.getBetWeenMonths(qsrq, nextSxrq); int endYearMonth = DateUtil.getBetWeenMonths(qsrq,nextSxrq);
endYearMonth = endYearMonth + seniority; endYearMonth = endYearMonth+seniority;
beginYear = beginYearMonth / 12; int beginYear = beginYearMonth/12;
endYear = endYearMonth / 12; int endYear = endYearMonth/12;
//残年分割日期 //残年分割日期
divideTime = DateUtil.beforeMonth(qsrq,seniority); String divideTime = DateUtil.beforeMonth(qsrq,seniority);
//divideTime = sxrq.split("-")[0]+"-"+divideTime.split("-")[1]+"-"+divideTime.split("-")[2];
divideTime = DateUtil.nextYear(divideTime,endYear,DateUtil.yyyyMMdd);
if (jgscsf.equals("2")){
//直接取工龄字段
beginYear = seniority/12;
endYear = beginYear+1;
//分割日期
int month = DateUtil.getBetWeenMonths(qsrq,sxrq);
if (month < 0){
month = 0;
}
int historySeniority = seniority-month<0?0:seniority-month;
divideTime = DateUtil.beforeMonth(qsrq,historySeniority);
divideTime = sxrq.split("-")[0]+"-"+divideTime.split("-")[1]+"-"+divideTime.split("-")[2]; divideTime = sxrq.split("-")[0]+"-"+divideTime.split("-")[1]+"-"+divideTime.split("-")[2];
} }
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd,userId); Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd,userId);
Map<String,Object> endYearmap = VocationCommonUtil.getVocationMap(vocationList, endYear, yjzd,userId); Map<String,Object> endYearmap = VocationCommonUtil.getVocationMap(vocationList, endYear, yjzd,userId);
double beginEdktsc = Double.valueOf(beginYearmap.get("edktsc") == null? "0" :Util.null2String(beginYearmap.get("edktsc"))); double beginEdktsc = Double.valueOf(beginYearmap.get("edktsc") == null? "0" :Util.null2String(beginYearmap.get("edktsc")));
@ -352,12 +334,13 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
restTime = VocationCommonUtil.handleRestDays(beforeRestTime+afterRestTime,wscl); restTime = VocationCommonUtil.handleRestDays(beforeRestTime+afterRestTime,wscl);
} }
} }
}else { }else {
//不折算 //不折算
int beginYear = 0; int beginYear = 0;
if (jgscsf.equals("2")){ if (jgscsf.equals("2")){
//直接取工龄字段 //直接取工龄字段
beginYear = Double.valueOf(ljcrglyfslwz).intValue(); beginYear = seniority/12;
}else { }else {
//起算日期与当前日期间隔+工龄字段 //起算日期与当前日期间隔+工龄字段
int beginYearMonth = DateUtil.getBetWeenMonths(qsrq,sxrq); int beginYearMonth = DateUtil.getBetWeenMonths(qsrq,sxrq);

@ -318,6 +318,7 @@ public class VocationCommonUtil {
//执行发放的时间点 //执行发放的时间点
String ffdtffsj = Util.null2String(vocationMap.get("ffdtffsj")); String ffdtffsj = Util.null2String(vocationMap.get("ffdtffsj"));
param.put("lyid",vocationMap.get("dataid")); param.put("lyid",vocationMap.get("dataid"));
param.put("jqid",vocationMap.get("jb")); param.put("jqid",vocationMap.get("jb"));
param.put("ygid",userId); param.put("ygid",userId);
@ -446,7 +447,7 @@ public class VocationCommonUtil {
}else if (edyxq.equals(StartingUnitEnum.NATURAL_DAY.getKey())){ }else if (edyxq.equals(StartingUnitEnum.NATURAL_DAY.getKey())){
String sxrq = DateUtil.AfterDay(ffsj.split(" ")[0],0); String sxrq = DateUtil.AfterDay(ffsj.split(" ")[0],0);
param.put("sxrq",sxrq); param.put("sxrq",sxrq);
param.put("jzrq",sxrq); param.put("jzrq",DateUtil.AfterDay(sxrq,edyxqsz-1));
} }
if (BalanceHandleEnum.DELAY.getKey().equals(jywxcl)){ if (BalanceHandleEnum.DELAY.getKey().equals(jywxcl)){
@ -475,10 +476,11 @@ public class VocationCommonUtil {
* @param tableName * @param tableName
* @param dataMap * @param dataMap
*/ */
public static void updateHolidayBalance(String tableName,Map<String,Object> dataMap,List<Map<String,Object>> dataList,String edyxq){ public static void updateHolidayBalance(String tableName,Map<String,Object> dataMap,List<Map<String,Object>> dataList,int sxsxrqtqts){
log.debug("updateHolidayBalance dataMap:[{}]",dataMap); log.debug("updateHolidayBalance dataMap:[{}]",dataMap);
try { try {
String lyid = Util.null2String(dataMap.get("lyid")); String lyid = Util.null2String(dataMap.get("lyid"));
String ygid = Util.null2String(dataMap.get("ygid")); String ygid = Util.null2String(dataMap.get("ygid"));
String jqid = Util.null2String(dataMap.get("jqid")); String jqid = Util.null2String(dataMap.get("jqid"));
@ -492,23 +494,25 @@ public class VocationCommonUtil {
dataMap.put("yqsc",0); dataMap.put("yqsc",0);
dataMap.put("yqyxsc",0); dataMap.put("yqyxsc",0);
dataMap.put("zfsc",0); dataMap.put("zfsc",0);
dataMap.put("sxrq",DateUtil.beforeDay(sxrq,sxsxrqtqts));
dataMap.put("jzrq",DateUtil.beforeDay(jzrq,sxsxrqtqts));
//查询上一笔假期余额是否有透支情况 //查询上一笔假期余额是否有透支情况
String queryBeforeHolidaySql = "select id,yxsc,wxsc,ktsc,ztsc,zfsc,modedatacreatedate,modedatacreatetime from uf_jcl_kq_jqye where ygid=? and jqid=? order by modedatacreatedate desc ,modedatacreatetime desc"; String queryBeforeHolidaySql = "select id,yxsc,wxsc,ktsc,ztsc,zfsc,modedatacreatedate,modedatacreatetime from uf_jcl_kq_jqye where ygid=? and jqid=? order by modedatacreatedate desc ,modedatacreatetime desc";
String beforeSxrq = ""; // String beforeSxrq = "";
String beforeJzrq = ""; // String beforeJzrq = "";
if (edyxq.equals(StartingUnitEnum.NATURAL_YEAR.getKey()) || edyxq.equals(StartingUnitEnum.STARTING_YEAR.getKey())){ // if (edyxq.equals(StartingUnitEnum.NATURAL_YEAR.getKey()) || edyxq.equals(StartingUnitEnum.STARTING_YEAR.getKey())){
beforeSxrq = DateUtil.beforeYear(sxrq,1,DateUtil.yyyyMMdd); // beforeSxrq = DateUtil.beforeYear(sxrq,1,DateUtil.yyyyMMdd);
beforeJzrq = DateUtil.beforeYear(jzrq,1,DateUtil.yyyyMMdd); // beforeJzrq = DateUtil.beforeYear(jzrq,1,DateUtil.yyyyMMdd);
}else if (edyxq.equals(StartingUnitEnum.NATURAL_MONTH.getKey()) || edyxq.equals(StartingUnitEnum.STARTING_MONTH.getKey())){ // }else if (edyxq.equals(StartingUnitEnum.NATURAL_MONTH.getKey()) || edyxq.equals(StartingUnitEnum.STARTING_MONTH.getKey())){
beforeSxrq = DateUtil.beforeMonth(sxrq,1); // beforeSxrq = DateUtil.beforeMonth(sxrq,1);
beforeJzrq = DateUtil.beforeMonth(jzrq,1); // beforeJzrq = DateUtil.beforeMonth(jzrq,1);
}else if (edyxq.equals(StartingUnitEnum.NATURAL_WEEK.getKey()) || edyxq.equals(StartingUnitEnum.STARTING_WEEK.getKey())){ // }else if (edyxq.equals(StartingUnitEnum.NATURAL_WEEK.getKey()) || edyxq.equals(StartingUnitEnum.STARTING_WEEK.getKey())){
beforeSxrq = DateUtil.beforeDay(sxrq,7); // beforeSxrq = DateUtil.beforeDay(sxrq,7);
beforeJzrq = DateUtil.beforeDay(jzrq,7); // beforeJzrq = DateUtil.beforeDay(jzrq,7);
}else if (edyxq.equals(StartingUnitEnum.NATURAL_DAY.getKey())){ // }else if (edyxq.equals(StartingUnitEnum.NATURAL_DAY.getKey())){
beforeSxrq = DateUtil.beforeDay(sxrq,1); // beforeSxrq = DateUtil.beforeDay(sxrq,1);
beforeJzrq = DateUtil.beforeDay(jzrq,1); // beforeJzrq = DateUtil.beforeDay(jzrq,1);
} // }
List<Map<String,Object>> beforeHolidayBalanceList = DbTools.getSqlToList(queryBeforeHolidaySql,ygid,jqid); List<Map<String,Object>> beforeHolidayBalanceList = DbTools.getSqlToList(queryBeforeHolidaySql,ygid,jqid);
double beforewxsc = 0; double beforewxsc = 0;
@ -582,6 +586,32 @@ public class VocationCommonUtil {
} }
return dataList;
}
/**
*
* @param tableName
* @param dataMap
* @return
*/
public static List<Map<String,Object>> ifisOneTimeexist(String tableName,Map<String,Object> dataMap){
log.debug("ifexist dataMap:[{}]",dataMap);
String lyid = Util.null2String(dataMap.get("lyid"));
String ygid = Util.null2String(dataMap.get("ygid"));
String jqid = Util.null2String(dataMap.get("jqid"));
String sxrq = Util.null2String(dataMap.get("sxrq"));
String jzrq = Util.null2String(dataMap.get("jzrq"));
String vacationRepeat = Util.null2String(ExtensionClassHolder.getGlobalSetMap().get("vacationRepeat"));
String sql = "select id,ffsj,ktsc,yxsc,wxsc,ztsc,zfsc,yqsc,yqyxsc,yqsxrq from "+tableName +" where lyid=? and ygid=? and jqid=? and sxrq=? ";
List<Map<String,Object>> dataList = null;
if (vacationRepeat.equals("1")){
sql = "select id,ffsj,ktsc,yxsc,wxsc,ztsc,zfsc,yqsc,yqyxsc,yqsxrq from "+tableName +" where ygid=? and jqid=? and sxrq=? ";
dataList = DbTools.getSqlToList(sql,ygid,jqid,sxrq);
}else {
dataList = DbTools.getSqlToList(sql,lyid,ygid,jqid,sxrq);
}
return dataList; return dataList;
} }

@ -314,6 +314,10 @@ public class OvertimePlanCheckAction implements Action {
} }
//修改加班时长
double totaljbsc = detailTableData.stream().mapToDouble(e->Double.valueOf(e.get("jbsc"))).sum();
sql = "update "+ requestInfo.getRequestManager().getBillTableName()+" set jbsc=? where requestid=?";
DbTools.update(sql,totaljbsc,requestid);
}catch (Exception e){ }catch (Exception e){
log.error("OvertimePlanCheckAction error : [{}]",e); log.error("OvertimePlanCheckAction error : [{}]",e);
return Action.FAILURE_AND_CONTINUE; return Action.FAILURE_AND_CONTINUE;

@ -0,0 +1,88 @@
package com.engine.jucailinkq.attendance.workflow.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.common.util.ServiceUtil;
import com.engine.core.interceptor.CommandContext;
import com.engine.jucailinkq.attendance.attendanceanalysis.service.UtilService;
import com.engine.jucailinkq.attendance.attendanceanalysis.service.impl.UtilServiceImpl;
import com.engine.jucailinkq.attendance.enums.CheckBoxEnum;
import com.engine.jucailinkq.common.util.DateUtil;
import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.Utils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import weaver.general.Util;
import weaver.hrm.User;
import java.time.ZoneOffset;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class GenerateMakeUpClockCmd extends AbstractCommonCommand<Map<String, Object>> {
private UtilService utilService = ServiceUtil.getService(UtilServiceImpl.class);
public GenerateMakeUpClockCmd(Map<String, Object> params) {
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
String bdkxm = Util.null2String(params.get("bdkxm"));
String ksrq = Util.null2String(params.get("ksrq"));
String jsrq = Util.null2String(params.get("jsrq"));
String bdkry = Util.null2String(params.get("bdkry"));
List<String> empidList = Lists.newArrayList();
String querClasssql = "select a.xxbdkzdjb,a.sfxx,a.id bcxx,a.edsc,a.zgzsc,a.bcsdxx,a.sfdx,a.sfkt,b.bdlx,a.btgz,a.fgsjd,a.zddxfz,a.dxhs,b.kssj dtkssj,b.jssj dtjssj,b.ksdk,b.jsdk,b.tqdkfzs,b.thdkfzs,b.edxss,b.edfzs,b.edts,b.sfdx dtsfdx,b.zddxfz dtzddxfz,b.dxhs dtdxhs,b.gsrq from uf_jcl_kq_bcxx a left join uf_jcl_kq_bcxx_dt1 b on a.id=b.mainid";
List<Map<String,Object>> allClassInfoList = DbTools.getSqlToList(querClasssql);
empidList.add(bdkry);
Map<String, List<Map<String, Object>>> data = utilService.getScheduleInfoWithEmpId(empidList,ksrq,jsrq);
List<Map<String, Object>> scheduleList = data.get(bdkry);
List<Map<String, Object>> resultList = Lists.newArrayList();
for (Map<String,Object> scheduleMap:scheduleList){
String bcxx = Util.null2String(scheduleMap.get("bcxx"));
String bcrq = Util.null2String(scheduleMap.get("bcrq"));
if (!"".equals(bcxx)){
List<Map<String,Object>> classList = allClassInfoList.stream().filter(e->e.get("bcxx").equals(bcxx)).collect(Collectors.toList());
for (Map<String,Object> classMap:classList){
if (CheckBoxEnum.CHECKED.getKey().equals(classMap.get("sfxx"))){
continue;
}
if (CheckBoxEnum.CHECKED.getKey().equals(classMap.get("ksdk"))){
String kssj = Utils.getkssjTime(classMap,bcrq);
Map<String, Object> dataMap = Maps.newHashMap();
dataMap.put("bdkry",bdkry);
dataMap.put("bdxx",classMap.get("bcsdxx"));
dataMap.put("bdklx",bdkxm);
dataMap.put("bdkrq",kssj.split(" ")[0]);
dataMap.put("bdksj",kssj.split(" ")[1]);
resultList.add(dataMap);
}
if (CheckBoxEnum.CHECKED.getKey().equals(classMap.get("jsdk"))){
String jssj = Utils.getjssjTime(classMap,bcrq);
Map<String, Object> dataMap = Maps.newHashMap();
dataMap.put("bdkry",bdkry);
dataMap.put("bdxx",classMap.get("bcsdxx"));
dataMap.put("bdklx",bdkxm);
dataMap.put("bdkrq",jssj.split(" ")[0]);
dataMap.put("bdksj",jssj.split(" ")[1]);
resultList.add(dataMap);
}
}
}
}
resultList = resultList.stream().sorted(Comparator.comparing(e -> DateUtil.getTime(e.get("bdkrq").toString()).toInstant(ZoneOffset.of("+8")).toEpochMilli())).collect(Collectors.toList());
Map<String,Object> resultMap = Maps.newHashMap();
resultMap.put("data",resultList);
return resultMap;
}
}

@ -6,4 +6,6 @@ public interface MakeUpClockInService {
Map<String,Object> processSubmitCheck(Map<String,Object> params); Map<String,Object> processSubmitCheck(Map<String,Object> params);
Map<String,Object> getKqCycleTimeIntervalCmd(Map<String,Object> params); Map<String,Object> getKqCycleTimeIntervalCmd(Map<String,Object> params);
Map<String,Object> generateMakeUpClock(Map<String,Object> params);
} }

@ -502,10 +502,15 @@ public class AskForLeaveServiceImpl extends Service implements AskForLeaveServic
//获取前一天班次id //获取前一天班次id
String yesterday = DateUtil.beforeDay(leaveDate,1); String yesterday = DateUtil.beforeDay(leaveDate,1);
String yesterdayBcId = restDateList.contains(yesterday) ? "" : Util.null2String(dateToBcxxMap.get(yesterday)).split("-")[0]; String yesterdayBcId = restDateList.contains(yesterday) ? "" : Util.null2String(dateToBcxxMap.get(yesterday)).split("-")[0];
if ("".equals(yesterdayBcId) && !"".equals(bcxx)){
yesterdayBcId = bcxx;
}
//获取次日班次id //获取次日班次id
String nextDay = DateUtil.AfterDay(leaveDate,1); String nextDay = DateUtil.AfterDay(leaveDate,1);
String nextDayBcId = restDateList.contains(nextDay) ? "" : Util.null2String(dateToBcxxMap.get(nextDay)).split("-")[0]; String nextDayBcId = restDateList.contains(nextDay) ? "" : Util.null2String(dateToBcxxMap.get(nextDay)).split("-")[0];
if ("".equals(nextDayBcId) && !"".equals(bcxx)){
nextDayBcId = bcxx;
}
if (halfDayRangeSelect.equals(CheckBoxEnum.CHECKED.getKey())) { if (halfDayRangeSelect.equals(CheckBoxEnum.CHECKED.getKey())) {
//根据“上下午选择”字段来重新获取开始和结束时间点 //根据“上下午选择”字段来重新获取开始和结束时间点
//获取开始日期班次id //获取开始日期班次id

@ -143,10 +143,10 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr
//生成出差明细数据 //生成出差明细数据
List<Map<String, String>> simpleDetailList; List<Map<String, String>> simpleDetailList;
if (ccMode.equals(AskAndEvctionWayEnum.TIME_INTERVAL.getKey()) && !"1".equals(dailyRepeat)) { if (ccMode.equals(AskAndEvctionWayEnum.TIME_INTERVAL.getKey()) && !"1".equals(dailyRepeat)) {
simpleDetailList = createDetailListWithNoDaily(ccEmpIdList, ccDateList, removeNonWorkDayRange, scheduleInfoMap, simpleDetailList = createDetailListWithNoDaily(mainTableData,ccEmpIdList, ccDateList, removeNonWorkDayRange, scheduleInfoMap,
restDayInfo, startDate, endDate, startTime, endTime, countBdlxList, hsdw, hsl, ccType, empIdToName, checkItemName, shiftInfoMap, empIdToDateRatedHours); restDayInfo, startDate, endDate, startTime, endTime, countBdlxList, hsdw, hsl, ccType, empIdToName, checkItemName, shiftInfoMap, empIdToDateRatedHours);
} else { } else {
simpleDetailList = createDetailList(ccEmpIdList, ccDateList, removeNonWorkDayRange, scheduleInfoMap, simpleDetailList = createDetailList(mainTableData,ccEmpIdList, ccDateList, removeNonWorkDayRange, scheduleInfoMap,
restDayInfo, ccMode, startTime, endTime, ccDuration, countBdlxList, hsdw, hsl, ccType, empIdToName, checkItemName, shiftInfoMap, empIdToDateRatedHours, cclxIdToHsdw); restDayInfo, ccMode, startTime, endTime, ccDuration, countBdlxList, hsdw, hsl, ccType, empIdToName, checkItemName, shiftInfoMap, empIdToDateRatedHours, cclxIdToHsdw);
} }
@ -614,11 +614,14 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr
* @param countBdlxList * @param countBdlxList
* @return * @return
*/ */
private List<Map<String, String>> createDetailList(List<String> empIdList, List<String> dateList, boolean removeNonWorkDayRange, Map<String, List<Map<String, Object>>> scheduleInfoMap, private List<Map<String, String>> createDetailList(Map<String, String> mainTableData,List<String> empIdList, List<String> dateList, boolean removeNonWorkDayRange, Map<String, List<Map<String, Object>>> scheduleInfoMap,
Map<String, List<String>> restDayInfo, String mode, String startTime, String endTime, String ccDuration, List<String> countBdlxList, Map<String, List<String>> restDayInfo, String mode, String startTime, String endTime, String ccDuration, List<String> countBdlxList,
String hsdw, double hsl, String ccType, Map<String, String> empIdToName, String checkItemName, Map<String, Map<String, Object>> shiftInfoMap, String hsdw, double hsl, String ccType, Map<String, String> empIdToName, String checkItemName, Map<String, Map<String, Object>> shiftInfoMap,
Map<String, Map<String, Double>> empIdToDateRatedHours, Map<String, String> cclxIdToHsdw) { Map<String, Map<String, Double>> empIdToDateRatedHours, Map<String, String> cclxIdToHsdw) {
List<Map<String, String>> simpleDetailList = new ArrayList<>(); List<Map<String, String>> simpleDetailList = new ArrayList<>();
String halfDayRangeSelect = Util.null2String((String)mainTableData.get("sxwxz"));
String startRange = Util.null2String((String)mainTableData.get("kssd"));
String endRange = Util.null2String((String)mainTableData.get("jssd"));
Map<String, String> simpleDetailItem; Map<String, String> simpleDetailItem;
Map<String, Double> dateToRatedHours; Map<String, Double> dateToRatedHours;
String ccScHours = ""; String ccScHours = "";
@ -656,6 +659,14 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr
if (mode.equals(AskAndEvctionWayEnum.TIME_INTERVAL.getKey())) { if (mode.equals(AskAndEvctionWayEnum.TIME_INTERVAL.getKey())) {
simpleDetailItem = new HashMap<>(); simpleDetailItem = new HashMap<>();
//组装初步的明细数据 //组装初步的明细数据
if (CheckBoxEnum.CHECKED.getKey().equals(halfDayRangeSelect)){
String startFromBc = this.getTimePointFromBc(ccDate, (Map)shiftInfoMap.get(currentDayBcId), "start", startRange);
String endFromBc = this.getTimePointFromBc(ccDate, (Map)shiftInfoMap.get(currentDayBcId), "end", endRange);
if (!"".equals(startFromBc) && !"".equals(endFromBc)) {
startTime = startFromBc.split(" ")[1];
endTime = endFromBc.split(" ")[1];
}
}
simpleDetailItem.put("ccr", ccEmpId); simpleDetailItem.put("ccr", ccEmpId);
simpleDetailItem.put("cclx", ccType); simpleDetailItem.put("cclx", ccType);
simpleDetailItem.put("ccrName", ccEmpName); simpleDetailItem.put("ccrName", ccEmpName);
@ -793,7 +804,7 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr
* @param countBdlxList * @param countBdlxList
* @return * @return
*/ */
private List<Map<String, String>> createDetailListWithNoDaily(List<String> empIdList, List<String> dateList, boolean removeNonWorkDayRange, Map<String, List<Map<String, Object>>> scheduleInfoMap, private List<Map<String, String>> createDetailListWithNoDaily(Map<String, String> mainTableData,List<String> empIdList, List<String> dateList, boolean removeNonWorkDayRange, Map<String, List<Map<String, Object>>> scheduleInfoMap,
Map<String, List<String>> restDayInfo, String startDate, String endDate, String startTime, String endTime, List<String> countBdlxList, Map<String, List<String>> restDayInfo, String startDate, String endDate, String startTime, String endTime, List<String> countBdlxList,
String hsdw, double hsl, String ccType, Map<String, String> empIdToName, String checkItemName, Map<String, Map<String, Object>> shiftInfoMap, String hsdw, double hsl, String ccType, Map<String, String> empIdToName, String checkItemName, Map<String, Map<String, Object>> shiftInfoMap,
Map<String, Map<String, Double>> empIdToDateRatedHours) { Map<String, Map<String, Double>> empIdToDateRatedHours) {
@ -804,6 +815,9 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr
String targetDateBcId = ""; String targetDateBcId = "";
dateList.add(0, DateUtil.beforeDay(startDate,1)); dateList.add(0, DateUtil.beforeDay(startDate,1));
dateList.add(DateUtil.AfterDay(endDate,1)); dateList.add(DateUtil.AfterDay(endDate,1));
String halfDayRangeSelect = Util.null2String((String)mainTableData.get("sxwxz"));
String startRange = Util.null2String((String)mainTableData.get("kssd"));
String endRange = Util.null2String((String)mainTableData.get("jssd"));
Map<String, Double> dateToRatedHours; Map<String, Double> dateToRatedHours;
for (String ccEmpId : empIdList) { for (String ccEmpId : empIdList) {
dateToRatedHours = new HashMap<>(); dateToRatedHours = new HashMap<>();
@ -829,6 +843,16 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr
restDateList.addAll(restDateListFromSchedule); restDateList.addAll(restDateListFromSchedule);
} }
String ccEmpName = empIdToName.get(ccEmpId); String ccEmpName = empIdToName.get(ccEmpId);
if (CheckBoxEnum.CHECKED.getKey().equals(halfDayRangeSelect)){
String startDayBcId = ((List)restDateList).contains(startDate) ? "" : Util.null2String((String)dateToBcxxMap.get(startDate)).split("-")[0];
String date = ((List)restDateList).contains(endDate) ? "" : Util.null2String((String)dateToBcxxMap.get(endDate)).split("-")[0];
String startFromBc = getTimePointFromBc(startDate, shiftInfoMap.get(startDayBcId), "start", startRange);
String endFromBc = getTimePointFromBc(endDate, (Map)shiftInfoMap.get(date), "end", endRange); if ("".equals(startFromBc) || "".equals(endFromBc)) {
continue;
}
startTime = startFromBc.split(" ")[1];
endTime = endFromBc.split(" ")[1];
}
simpleDetailItem = new HashMap<>(); simpleDetailItem = new HashMap<>();
//组装初步的出差明细数据 //组装初步的出差明细数据
simpleDetailItem.put("ccr", ccEmpId); simpleDetailItem.put("ccr", ccEmpId);
@ -871,4 +895,128 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr
} }
return simpleDetailList; return simpleDetailList;
} }
private String getTimePointFromBc(String leaveDate, Map<String, Object> shiftInfo, String pointType, String timeRange) {
String sql = "select id, bdlx, gsrq, kssj as dtkssj, jssj as dtjssj, edts, edxss from uf_jcl_kq_bcxx_dt1 where mainid = " + shiftInfo.get("id") + " and (bdlx=0 or bdlx=3) order by gsrq, kssj";
List<Map<String, Object>> bdData = DbTools.getSqlToList(sql);
if (bdData.size() == 0) {
return "";
}
//根据半天规则,处理班段的上下半天数据
String halfDayRuleValue = shiftInfo.get("btgz").toString();
double ratedSc = Double.parseDouble(shiftInfo.get("edsc").toString());
double totalSc = Double.parseDouble(shiftInfo.get("zgzsc").toString());
String wholeBdStartTime = Utils.getkssjTime(bdData.get(0), leaveDate);
String wholeBdEndTime = Utils.getjssjTime(bdData.get(bdData.size() - 1), leaveDate);
String firstHalfEndTime = "";
String secondHalfStartTime = "";
//按班次设置 取固定时间 取总时长一半 取额定时长一半
if (HalfDayRuleREnum.BY_CLASS_SET.getKey().equals(halfDayRuleValue)) {
//按班次设置根据班段明细中的额定天数来推断半天时间段累计额定天数达到0.5天的时间点为上午结束的时间点,之后开始的工作时段的时间点为下午开始的时间点
double countDays = 0;
for (Map<String, Object> bdItem : bdData) {
if (countDays == 0.50) {
secondHalfStartTime = Utils.getkssjTime(bdItem, leaveDate);
break;
}
double itemEdts = Double.parseDouble(bdItem.get("edts").toString());
if (countDays + itemEdts > 0.50) {
double multiple = (0.50 - countDays) / itemEdts;
String itemStartTime = Utils.getkssjTime(bdItem, leaveDate);
String itemEndTime = Utils.getjssjTime(bdItem, leaveDate);
int minutes = (int) (DateUtil.getBetWeenMinutes(itemStartTime, itemEndTime) * multiple);
firstHalfEndTime = DateUtil.AfterMinutes(itemStartTime, minutes);
secondHalfStartTime = firstHalfEndTime;
break;
} else if (countDays + itemEdts == 0.50) {
firstHalfEndTime = Utils.getjssjTime(bdItem, leaveDate);
}
countDays = countDays + itemEdts;
}
} else if (HalfDayRuleREnum.FIXED_DURATION.getKey().equals(halfDayRuleValue)) {
//取固定时间根据“分隔时间点”字段fgsjd来指定上午和下午分割的时间点
String segmentTime = shiftInfo.get("fgsjd").toString();
segmentTime = getSegmentTime(segmentTime, wholeBdStartTime, wholeBdEndTime);
if (segmentTime.equals("")) {
return "";
}
firstHalfEndTime = segmentTime;
secondHalfStartTime = segmentTime;
} else if (HalfDayRuleREnum.HALF_TOTAL_DURATION.getKey().equals(halfDayRuleValue)) {
//取总时长一半,根据工作总时长的一半小时数,来确定半天小时数,累加班段明细的额定时长达到半天小时数的时间点为上午结束时间点
double countHours = 0;
for (Map<String, Object> bdItem : bdData) {
if (countHours == totalSc / 2) {
secondHalfStartTime = Utils.getkssjTime(bdItem, leaveDate);
break;
}
double itemEdxss = Double.parseDouble(bdItem.get("edxss").toString());
if (countHours + itemEdxss > totalSc / 2) {
String itemStartTime = Utils.getkssjTime(bdItem, leaveDate);
int diffMinutes = (int) ((totalSc / 2 - countHours) * 60);
firstHalfEndTime = DateUtil.AfterMinutes(itemStartTime, diffMinutes);
secondHalfStartTime = firstHalfEndTime;
break;
} else if (countHours + itemEdxss == totalSc / 2) {
firstHalfEndTime = Utils.getjssjTime(bdItem, leaveDate);
}
countHours = countHours + itemEdxss;
}
} else if (HalfDayRuleREnum.HALF_RATED_DURATION.getKey().equals(halfDayRuleValue)) {
//取额定时长一半,根据主表额定时长的一半小时数,来确定半天小时数,累加班段明细的额定时长达到半天小时数的时间点为上午结束时间点
double countHours = 0;
for (Map<String, Object> bdItem : bdData) {
if (countHours == ratedSc / 2) {
secondHalfStartTime = Utils.getkssjTime(bdItem, leaveDate);
break;
}
double itemEdxss = Double.parseDouble(bdItem.get("edxss").toString());
if (countHours + itemEdxss > ratedSc / 2) {
String itemStartTime = Utils.getkssjTime(bdItem, leaveDate);
int diffMinutes = (int) ((ratedSc / 2 - countHours) * 60);
firstHalfEndTime = DateUtil.AfterMinutes(itemStartTime, diffMinutes);
secondHalfStartTime = firstHalfEndTime;
break;
} else if (countHours + itemEdxss == ratedSc / 2) {
firstHalfEndTime = Utils.getjssjTime(bdItem, leaveDate);
}
countHours = countHours + itemEdxss;
}
}
if ("0".equals(timeRange)) {
return "start".equals(pointType) ? wholeBdStartTime : firstHalfEndTime;
} else if ("1".equals(timeRange)) {
return "start".equals(pointType) ? secondHalfStartTime : wholeBdEndTime;
} else {
return "";
}
}
private String getSegmentTime(String segmentTime, String wholeBdStartTime, String wholeBdEndTime) {
String startDate = wholeBdStartTime.split(" ")[0];
String endDate = wholeBdEndTime.split(" ")[0];
String startPoint = wholeBdStartTime.split(" ")[1];
String endPoint = wholeBdEndTime.split(" ")[1];
if (startDate.equals(endDate)) {
if (segmentTime.compareTo(startPoint) > 0 && segmentTime.compareTo(endPoint) < 0) {
segmentTime = startDate + " " + segmentTime;
return segmentTime;
} else {
return "";
}
}
String waitJudgeSegTime = "";
int waitCompareMinutes = 9999;
for (int i = 0; i < 3; i++) {
String matchSegTime = DateUtil.AfterDay(startDate,i) + " " + segmentTime;
if (matchSegTime.compareTo(wholeBdStartTime) > 0 && matchSegTime.compareTo(wholeBdEndTime) < 0) {
int diffMinutes = Math.abs(DateUtil.getBetWeenMinutes(wholeBdStartTime, matchSegTime) - DateUtil.getBetWeenMinutes(matchSegTime, wholeBdEndTime));
waitCompareMinutes = Math.min(waitCompareMinutes, diffMinutes);
waitJudgeSegTime = waitCompareMinutes == diffMinutes ? matchSegTime : waitJudgeSegTime;
}
}
return waitJudgeSegTime;
}
} }

@ -1,5 +1,6 @@
package com.engine.jucailinkq.attendance.workflow.service.impl; package com.engine.jucailinkq.attendance.workflow.service.impl;
import com.engine.jucailinkq.attendance.workflow.cmd.GenerateMakeUpClockCmd;
import com.engine.jucailinkq.attendance.workflow.cmd.GetKqCycleTimeIntervalCmd; import com.engine.jucailinkq.attendance.workflow.cmd.GetKqCycleTimeIntervalCmd;
import com.engine.jucailinkq.attendance.workflow.service.MakeUpClockInService; import com.engine.jucailinkq.attendance.workflow.service.MakeUpClockInService;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
@ -19,4 +20,10 @@ public class MakeUpClockInServiceImpl extends Service implements MakeUpClockInSe
return commandExecutor.execute(new GetKqCycleTimeIntervalCmd(params)); return commandExecutor.execute(new GetKqCycleTimeIntervalCmd(params));
} }
@Override
public Map<String, Object> generateMakeUpClock(Map<String, Object> params) {
return commandExecutor.execute(new GenerateMakeUpClockCmd(params));
}
} }

@ -6,6 +6,7 @@ import com.engine.jucailinkq.attendance.workflow.service.impl.AllowanceServiceIm
import com.engine.common.util.ParamUtil; import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.jucailinkq.common.util.ApiReturnTools; import com.engine.jucailinkq.common.util.ApiReturnTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.ResponseResult; import com.engine.jucailinkq.common.util.ResponseResult;
import com.google.gson.Gson; import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -50,6 +51,7 @@ public class AllowanceApi {
Map<String, Object> apidatas = new HashMap<String, Object>(); Map<String, Object> apidatas = new HashMap<String, Object>();
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
apidatas = getAllowanceService(user).addAllowanceRecords(ParamUtil.request2Map(request)); apidatas = getAllowanceService(user).addAllowanceRecords(ParamUtil.request2Map(request));
ExtensionClassHolder.remove();
return JSONObject.toJSONString(apidatas); return JSONObject.toJSONString(apidatas);
} }

@ -40,4 +40,22 @@ public class MakeUpClockInAction {
return ApiReturnTools.error("500","processSubmitCheck error"); return ApiReturnTools.error("500","processSubmitCheck error");
} }
} }
/**
*
* @return
*/
@POST
@Path("/generateMakeUpClock")
@Produces({"text/plain"})
public String generateMakeUpClock(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
Map<String,Object> paramMap = ParamUtil.request2Map(request);
Map<String,Object> dataMap = makeUpClockInService.generateMakeUpClock(paramMap);
return ApiReturnTools.success(dataMap);
}catch (Exception e){
log.error("execute fail,catch error: [{}]",e);
return ApiReturnTools.error("500","processSubmitCheck error");
}
}
} }

@ -59,6 +59,8 @@ public class CleanHaveLeaveUserDataCmd extends AbstractCommonCommand<Map<String,
DbTools.update(updateSql, user, startDate, beforeCompanystartdateDay); DbTools.update(updateSql, user, startDate, beforeCompanystartdateDay);
} }
} }
}else if (!"".equals(companystartdate) && DateUtil.getTime(companystartdate).compareTo(DateUtil.getTime(endDate))>0){
DbTools.update(updateSql,user,startDate,endDate);
} }
if (!"".equals(terminationDate) && DateUtil.getTime(terminationDate).compareTo(DateUtil.getTime(endDate)) <= 0 && if (!"".equals(terminationDate) && DateUtil.getTime(terminationDate).compareTo(DateUtil.getTime(endDate)) <= 0 &&
DateUtil.getTime(terminationDate).compareTo(DateUtil.getTime(startDate)) >= 0) { DateUtil.getTime(terminationDate).compareTo(DateUtil.getTime(startDate)) >= 0) {
@ -70,6 +72,8 @@ public class CleanHaveLeaveUserDataCmd extends AbstractCommonCommand<Map<String,
DbTools.update(updateSql, user, AfterDay, endDate); DbTools.update(updateSql, user, AfterDay, endDate);
} }
} }
}else if (!"".equals(terminationDate) && DateUtil.getTime(terminationDate).compareTo(DateUtil.getTime(startDate))<0 ){
DbTools.update(updateSql,user,startDate,endDate);
} }
} }

@ -33,12 +33,10 @@ public class GetPersonVocationBySuitOrganzation extends AbstractCommonCommand<Ma
@Override @Override
public Map<String, Object> execute(CommandContext commandContext) { public Map<String, Object> execute(CommandContext commandContext) {
String modeId = Util.null2String(params.get("modeId")); String modeId = Util.null2String(params.get("modeId"));
//查询所有假期额度的作用范围对象
String sql = "select dxlx,aqjb,dataid,dx from uf_jcl_syzz where modeid=?"; String sql = "select dxlx,aqjb,dataid,dx from uf_jcl_syzz where modeid=?";
//假期额度适用组织所有值集合 //假期额度适用组织所有值集合
List<Map<String,Object>> organzationList = DbTools.getSqlToList(sql,modeId); List<Map<String,Object>> organzationList = DbTools.getSqlToList(sql,modeId);
//查询所有假期额度规则及明细信息 sql = "select a.id dataid,b.id detailid,a.*,b.* from uf_jcl_kq_jqed a left join uf_jcl_kq_jqed_dt1 b on a.id=b.mainid where (gzzt is null or gzzt <> '1')";
sql = "select a.id dataid,b.id detailid,a.*,b.* from uf_jcl_kq_jqed a left join uf_jcl_kq_jqed_dt1 b on a.id=b.mainid where (gzzt is null or gzzt <> '1') ORDER BY a.JB DESC ,b.ID";
//所有假期额度生成规则值 //所有假期额度生成规则值
List<Map<String,Object>> vacationList = DbTools.getSqlToList(sql); List<Map<String,Object>> vacationList = DbTools.getSqlToList(sql);
//人力资源id假别规则id //人力资源id假别规则id
@ -53,26 +51,17 @@ public class GetPersonVocationBySuitOrganzation extends AbstractCommonCommand<Ma
//以假期额度生成规则id分割的假期额度生成规则值集合 //以假期额度生成规则id分割的假期额度生成规则值集合
Map<String,String> vacationMap = Maps.newHashMap(); Map<String,String> vacationMap = Maps.newHashMap();
String empid = ""; for (Map<String,Object> vocation:vacationList){
if (params.containsKey("empid")){ vacationMap.put(vocation.get("dataid").toString(),vocation.get("jb").toString());
empid = Util.null2String(params.get("empid")); vocation.put("zyzValue",getUserIds(vocation));
for (Map<String, Object> vocation : vacationList) {
vacationMap.put(vocation.get("dataid").toString(), vocation.get("jb").toString());
vocation.put("zyzValue", getUserIds(vocation,empid));
}
}else {
for (Map<String, Object> vocation : vacationList) {
vacationMap.put(vocation.get("dataid").toString(), vocation.get("jb").toString());
vocation.put("zyzValue", getUserIds(vocation));
}
} }
Map<String,List<Map<String,Object>>> vacationGroupByDataIdMap = vacationList.stream().collect(Collectors.groupingBy(e->e.get("dataid").toString())); Map<String,List<Map<String,Object>>> vacationGroupByDataIdMap = vacationList.stream().collect(Collectors.groupingBy(e->e.get("dataid").toString()));
Set<String> personOrganzationIds = Sets.newHashSet(); Set<String> personOrganzationIds = Sets.newHashSet();
Set<String> departMentIds = Sets.newHashSet(); Set<String> departMentIds = Sets.newHashSet();
Set<String> subCompanyIds = Sets.newHashSet(); Set<String> subCompanyIds = Sets.newHashSet();
//遍历所有适用范围信息
for (Map<String,Object> organzation:organzationList){ for (Map<String,Object> organzation:organzationList){
String dx = Util.null2String(organzation.get("dx")).split("-")[0]; String dx = Util.null2String(organzation.get("dx")).split("-")[0];
String dataid = Util.null2String(organzation.get("dataid")); String dataid = Util.null2String(organzation.get("dataid"));
@ -117,16 +106,13 @@ public class GetPersonVocationBySuitOrganzation extends AbstractCommonCommand<Ma
if (departMentIds.size() > 0){ if (departMentIds.size() > 0){
sql = sql+ " and departmentid in ("+String.join(",",departMentIds)+")"; sql = sql+ " and departmentid in ("+String.join(",",departMentIds)+")";
} }
if (subCompanyIds.size() >0 && departMentIds.size() > 0){ if (subCompanyIds .size() >0 && departMentIds.size() > 0){
sql = "select id,departmentid,subcompanyid1,seclevel from hrmresource where status <> '5' and status <> '4' and status <> '7' "; sql = "select id,departmentid,subcompanyid1,seclevel from hrmresource where status <> '5' and status <> '4' and status <> '7' ";
sql = sql+ " and (departmentid in ("+String.join(",",departMentIds)+")"+ " or subcompanyid1 in ("+String.join(",",subCompanyIds)+"))"; sql = sql+ " and (departmentid in ("+String.join(",",departMentIds)+")"+ " or subcompanyid1 in ("+String.join(",",subCompanyIds)+"))";
}else if (subCompanyIds .size() >0 && departMentIds.size() == 0){ }else if (subCompanyIds .size() >0 && departMentIds.size() == 0){
sql = sql+ " and subcompanyid1 in ("+String.join(",",subCompanyIds)+")"; sql = sql+ " and subcompanyid1 in ("+String.join(",",subCompanyIds)+")";
} }
sql += " and (belongto is null or belongto='-1') "; sql += " and (belongto is null or belongto='-1' or belongto='0') ";
if (params.containsKey("empid")){
sql += " and id = " + empid;
}
List<Map<String,Object>> hrmListByDepartAndSubCompanyIds = DbTools.getSqlToList(sql); List<Map<String,Object>> hrmListByDepartAndSubCompanyIds = DbTools.getSqlToList(sql);
//部门id-人员id集合 //部门id-人员id集合
@ -138,12 +124,7 @@ public class GetPersonVocationBySuitOrganzation extends AbstractCommonCommand<Ma
//人员分组id-人员id集合 //人员分组id-人员id集合
if (personOrganzationIds.size() >0){ if (personOrganzationIds.size() >0){
//人员分组id-假别假期规则id //人员分组id-假别假期规则id
Map<String,Set<String>> personGroupUserIds = Maps.newHashMap(); Map<String,Set<String>> personGroupUserIds = getPersonGroupUserIds(personOrganzationIds);
if (!empid.equals("")) {
personGroupUserIds = getPersonGroupUserIds(personOrganzationIds,empid);
}else{
personGroupUserIds = getPersonGroupUserIds(personOrganzationIds);
}
log.info("personGroupUserIds : [{}]",personGroupUserIds); log.info("personGroupUserIds : [{}]",personGroupUserIds);
log.info("personOrganzationMap : [{}]",personOrganzationMap); log.info("personOrganzationMap : [{}]",personOrganzationMap);
for (Map.Entry<String,Object> entry : personOrganzationMap.entrySet()){ for (Map.Entry<String,Object> entry : personOrganzationMap.entrySet()){
@ -170,9 +151,7 @@ public class GetPersonVocationBySuitOrganzation extends AbstractCommonCommand<Ma
} }
} }
} }
if (!empid.equals("")){
sql = "select * from (" + sql + ") where id = " + empid;
}
log.debug("before personMap : [{}]",personMap); log.debug("before personMap : [{}]",personMap);
//部门id //部门id
log.debug("departMentMap : [{}]",departMentMap); log.debug("departMentMap : [{}]",departMentMap);
@ -244,67 +223,6 @@ public class GetPersonVocationBySuitOrganzation extends AbstractCommonCommand<Ma
return newpersonMap; return newpersonMap;
} }
/**
*
* @param personOrganzationIds
* @returnid-id
*/
public Map<String,Set<String>> getPersonGroupUserIds(Set<String> personOrganzationIds, String pEmpId){
String sql = "select b.mainid,b.empid,b.filters,b.sqltj,b.bdate,b.edate,a.list_type from uf_ryqz a left join uf_ryqz_dt1 b on a.id=b.mainid where mainid in ("+String.join(",",personOrganzationIds)+")";
List<Map<String,Object>> personGroupDataList = DbTools.getSqlToList(sql);
Map<String,Set<String>> personGroupUserIds = Maps.newHashMap();
for (Map<String,Object> personGroupData :personGroupDataList){
String id = Util.null2String(personGroupData.get("mainid"));
String empid = Util.null2String(personGroupData.get("empid"));
String filters = Util.null2String(personGroupData.get("filters"));
String list_type = Util.null2String(personGroupData.get("list_type"));
String sqltj = Util.null2String(personGroupData.get("sqltj"));
Set<String> userIds = personGroupUserIds.get(id);
if (userIds == null){
userIds = Sets.newHashSet();
personGroupUserIds.put(id,userIds);
}
if ("0".equals(list_type) && !"".equals(empid)){
//人员清单
if (empid.equals(pEmpId))
userIds.add(empid);
}else if ("1".equals(list_type) && !"".equals(filters)){
//条件清单
sql = "select id,seclevel from hrmresource where status <> '5' and status <> '4' and status <> '7' ";
filters = filters.replace("","and");
filters = filters.replace("","or");
if (filters.contains("field")){
sql = "select a.id,a.seclevel from hrmresource a left join cus_fielddata b on a.id=b.id where scope='HrmCustomFieldByInfoType' and a.status <> '5' and a.status <> '4' and a.status <> '7' and "+filters;
}else {
sql = sql+ " and "+filters;
}
sql = "select * from (" + sql + ") where id = " + pEmpId;
log.info("getPersonnelGroupingByPerson filter sql : {}",sql);
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql);
for (Map<String,Object> dataMap :dataList){
String hrmId = Util.null2String(dataMap.get("id"));
String seclevel = Util.null2String(dataMap.get("seclevel"));
userIds.add(hrmId);
}
}else if ("2".equals(list_type) && !"".equals(sqltj)){
sqltj = Utils.converSQL(sqltj);
sqltj = "select * from (" + sqltj + ") where id = " + pEmpId;
log.debug("getPersonnelGroupingByPerson sqltj : [{}]",sqltj);
List<Map<String,Object>> dataList = DbTools.getSqlToList(sqltj);
for (Map<String,Object> dataMap :dataList){
String hrmId = Util.null2String(dataMap.get("id"));
userIds.add(hrmId);
}
}
}
return personGroupUserIds;
}
/** /**
* *
* @param personOrganzationIds * @param personOrganzationIds
@ -335,11 +253,11 @@ public class GetPersonVocationBySuitOrganzation extends AbstractCommonCommand<Ma
}else if ("1".equals(list_type) && !"".equals(filters)){ }else if ("1".equals(list_type) && !"".equals(filters)){
//条件清单 //条件清单
sql = "select id,seclevel from hrmresource where status <> '5' and status <> '4' and status <> '7' and (belongto is null or belongto='-1') "; sql = "select id,seclevel from hrmresource where status <> '5' and status <> '4' and status <> '7' and (belongto is null or belongto='-1' or belongto='0') ";
filters = filters.replace("","and"); filters = filters.replace("","and");
filters = filters.replace("","or"); filters = filters.replace("","or");
if (filters.contains("field")){ if (filters.contains("field")){
sql = "select a.id,a.seclevel from hrmresource a left join cus_fielddata b on a.id=b.id where scope='HrmCustomFieldByInfoType' and a.status <> '5' and a.status <> '4' and a.status <> '7' and (a.belongto is null or a.belongto='-1') and "+filters; sql = "select a.id,a.seclevel from hrmresource a left join cus_fielddata b on a.id=b.id where scope='HrmCustomFieldByInfoType' and a.status <> '5' and a.status <> '4' and a.status <> '7' and (a.belongto is null or a.belongto='-1' or a.belongto='0') and "+filters;
}else { }else {
sql = sql+ " and "+filters; sql = sql+ " and "+filters;
} }
@ -354,7 +272,7 @@ public class GetPersonVocationBySuitOrganzation extends AbstractCommonCommand<Ma
sqltj = Utils.converSQL(sqltj); sqltj = Utils.converSQL(sqltj);
log.debug("getPersonnelGroupingByPerson sqltj : [{}]",sqltj); log.debug("getPersonnelGroupingByPerson sqltj : [{}]",sqltj);
List<Map<String,Object>> dataList = DbTools.getSqlToList(sqltj); List<Map<String,Object>> dataList = DbTools.getSqlToList(sqltj);
sql = "select id from hrmresource where belongto is null or belongto='-1'"; sql = "select id from hrmresource where belongto is null or belongto='-1' or belongto='0'";
List<Map<String,Object>> hrmListMap = DbTools.getSqlToList(sql); List<Map<String,Object>> hrmListMap = DbTools.getSqlToList(sql);
List<String> hrmList = hrmListMap.stream().map(e->e.get("id").toString()).collect(Collectors.toList()); List<String> hrmList = hrmListMap.stream().map(e->e.get("id").toString()).collect(Collectors.toList());
for (Map<String,Object> dataMap :dataList){ for (Map<String,Object> dataMap :dataList){
@ -380,22 +298,4 @@ public class GetPersonVocationBySuitOrganzation extends AbstractCommonCommand<Ma
} }
return userIds; return userIds;
} }
/**
*
* @param vocation
* @param pEmpId
* @return
*/
public List<String> getUserIds(Map<String,Object> vocation, String pEmpId){
List<String> userIds = Lists.newArrayList();
String edyj = Util.null2String(vocation.get("edyj"));
if (edyj.equals("3") || edyj.equals("4")){
String zyz = "select ID from ("+Util.null2String(vocation.get("zyz"))+") where id = " + pEmpId;
zyz = Utils.converSQL(zyz);
List<Map<String,Object>> dataList = DbTools.getSqlToList(zyz);
userIds = dataList.stream().map(e->Util.null2String(e.get("id"))).collect(Collectors.toList());
}
return userIds;
}
} }

@ -14,6 +14,7 @@ public class ApiReturnTools {
Map<String,String> returnMap = new HashMap<>(); Map<String,String> returnMap = new HashMap<>();
returnMap.put("code",errorCode); returnMap.put("code",errorCode);
returnMap.put("message",errorMessage); returnMap.put("message",errorMessage);
ExtensionClassHolder.remove();
return gson.toJson(returnMap); return gson.toJson(returnMap);
} }
@ -21,23 +22,26 @@ public class ApiReturnTools {
Map<String,Object> returnMap = new HashMap<>(); Map<String,Object> returnMap = new HashMap<>();
returnMap.put("code","200"); returnMap.put("code","200");
returnMap.put("data",dataMap); returnMap.put("data",dataMap);
ExtensionClassHolder.remove();
return gson.toJson(returnMap); return gson.toJson(returnMap);
} }
public static String success(List<Map<String,Object>> dataMap){ public static String success(List<Map<String,Object>> dataMap){
Map<String,Object> returnMap = new HashMap<>(); Map<String,Object> returnMap = new HashMap<>();
returnMap.put("code","200"); returnMap.put("code","200");
returnMap.put("data",dataMap); returnMap.put("data",dataMap);
ExtensionClassHolder.remove();
return gson.toJson(returnMap); return gson.toJson(returnMap);
} }
public static String errorjson(String errorCode,String errorMessage){ public static String errorjson(String errorCode,String errorMessage){
Map<String,String> returnMap = new HashMap<>(); Map<String,String> returnMap = new HashMap<>();
returnMap.put("code",errorCode); returnMap.put("code",errorCode);
returnMap.put("message",errorMessage); returnMap.put("message",errorMessage);
ExtensionClassHolder.remove();
return JSON.toJSONString(returnMap); return JSON.toJSONString(returnMap);
} }
public static String DirectReturn(Map<String,Object> dataMap){ public static String DirectReturn(Map<String,Object> dataMap){
ExtensionClassHolder.remove();
return gson.toJson(dataMap); return gson.toJson(dataMap);
} }
} }

@ -473,4 +473,10 @@ public class DateUtil {
calendar.setFirstDayOfWeek(Calendar.MONDAY);//设置星期一为一周开始的第一天 calendar.setFirstDayOfWeek(Calendar.MONDAY);//设置星期一为一周开始的第一天
return calendar.get(Calendar.WEEK_OF_YEAR); return calendar.get(Calendar.WEEK_OF_YEAR);
} }
public static String converHourAndMinute(String date) {
String time = date.split(" ")[1];
String str = time.split(":")[0]+":"+time.split(":")[1];
return str;
}
} }

@ -77,4 +77,14 @@ public class ExtensionClassHolder {
public static void setPetDepartMentThreadLocal(Map<String, String> petDepartMent) { public static void setPetDepartMentThreadLocal(Map<String, String> petDepartMent) {
ExtensionClassHolder.petDepartThreadLocal.set(petDepartMent); ExtensionClassHolder.petDepartThreadLocal.set(petDepartMent);
} }
public static void remove(){
adjustClockPointActionThreadLocal.remove();
globalSetMapThreadLocal.remove();
personBelongGroupThreadLocal.remove();
personInformationThreadLocal.remove();
petDepartThreadLocal.remove();
DbTools.thread.remove();
DbTools.threadRecordSetTrans.remove();
}
} }

@ -52,7 +52,9 @@ public class ResponseResult<T, R> {
* *
*/ */
public String run(Function<T, R> f, T t) { public String run(Function<T, R> f, T t) {
try { try {
ExtensionClassHolder.remove();
if (isLog) { if (isLog) {
log.debug("run attendance api , param {}", t); log.debug("run attendance api , param {}", t);
} }
@ -83,6 +85,7 @@ public class ResponseResult<T, R> {
*/ */
public String run(Consumer<T> f, T t) { public String run(Consumer<T> f, T t) {
try { try {
ExtensionClassHolder.remove();
if (isLog) { if (isLog) {
log.debug("run attendance api , param {}", t); log.debug("run attendance api , param {}", t);
} }
@ -106,6 +109,7 @@ public class ResponseResult<T, R> {
*/ */
public String run(Supplier<R> f) { public String run(Supplier<R> f) {
try { try {
ExtensionClassHolder.remove();
if (isLog) { if (isLog) {
log.debug("run attendance api"); log.debug("run attendance api");
} }

@ -0,0 +1,95 @@
package weaver.formmode.customjavacode.customsearch.jucailinkq;
import java.util.*;
import java.util.stream.Collectors;
import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils;
import lombok.extern.slf4j.Slf4j;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
/**
*
*
*
* class
* class
* java
* @author Administrator
*
*/
@Slf4j
public class AskforCustomSearchTemplate extends AbstractCustomSqlConditionJavaCode {
/**
* SQL
* @param param
* param()
* user
*
* @return
* : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
public String generateSqlCondition(Map<String, Object> param) throws Exception {
log.info("generateSqlCondition : [{}]",param);
User user = (User)param.get("user");
int userId = user.getUID();
String sql = "select b.*,a.list_type from uf_ryqz a left join uf_ryqz_dt1 b on a.id=b.mainid where a.userfor=5 and a.fzgly=?";
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,userId);
String sqlCondition = "";
if (dataList.size() > 0){
String listType = Util.null2String(dataList.get(0).get("list_type"));
if (listType.equals("0")){
//人员清单
List<String> userList = dataList.stream().map(e->Util.null2String(e.get("empid"))).collect(Collectors.toList());
sqlCondition = "d1.qjry in ("+String.join(",",userList)+")";
}else if (listType.equals("1")){
//条件清单
sql = "select id from hrmresource where (";
for (int i=0;i<dataList.size();i++){
Map<String,Object> map = dataList.get(i);
String filters = Util.null2String(map.get("filters"));
filters = Utils.converSQL(filters);
if (i == dataList.size()-1){
sql = sql+filters+")";
}else {
sql = sql+filters+" or ";
}
}
sqlCondition = "d1.qjry in ("+sql+") ";
}else if (listType.equals("2")){
//sql条件
String sqltj = "";
for (int i=0;i<dataList.size();i++){
if (i == dataList.size()-1){
sqltj = sqltj+Util.null2String(Util.null2String(dataList.get(i).get("sqltj")));
}else {
sqltj = sqltj + Util.null2String(Util.null2String(dataList.get(i).get("sqltj"))) +" union ";
}
}
sqlCondition = "d1.qjry in ( select a.id from ("+sqltj+") a)";
}
}else {
if (userId !=1){
sqlCondition = "d1.qjry="+userId;
}
}
log.info("sqlCondition : [{}]",sqlCondition);
ExtensionClassHolder.remove();
return sqlCondition;
}
}

@ -0,0 +1,94 @@
package weaver.formmode.customjavacode.customsearch.jucailinkq;
import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils;
import lombok.extern.slf4j.Slf4j;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*
*
* class
* class
* java
* @author Administrator
*
*/
@Slf4j
public class AttendanceResultCustomSearchTemplate extends AbstractCustomSqlConditionJavaCode {
/**
* SQL
* @param param
* param()
* user
*
* @return
* : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
public String generateSqlCondition(Map<String, Object> param) throws Exception {
log.info("generateSqlCondition : [{}]",param);
User user = (User)param.get("user");
int userId = user.getUID();
String sql = "select b.*,a.list_type from uf_ryqz a left join uf_ryqz_dt1 b on a.id=b.mainid where a.userfor=5 and a.fzgly=?";
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,userId);
String sqlCondition = "";
if (dataList.size() > 0){
String listType = Util.null2String(dataList.get(0).get("list_type"));
if (listType.equals("0")){
//人员清单
List<String> userList = dataList.stream().map(e->Util.null2String(e.get("empid"))).collect(Collectors.toList());
sqlCondition = "t1.ygid in ("+String.join(",",userList)+")";
}else if (listType.equals("1")){
//条件清单
sql = "select id from hrmresource where (";
for (int i=0;i<dataList.size();i++){
Map<String,Object> map = dataList.get(i);
String filters = Util.null2String(map.get("filters"));
filters = Utils.converSQL(filters);
if (i == dataList.size()-1){
sql = sql+filters+")";
}else {
sql = sql+filters+" or ";
}
}
sqlCondition = "t1.ygid in ("+sql+") ";
}else if (listType.equals("2")){
//sql条件
String sqltj = "";
for (int i=0;i<dataList.size();i++){
if (i == dataList.size()-1){
sqltj = sqltj+Util.null2String(Util.null2String(dataList.get(i).get("sqltj")));
}else {
sqltj = sqltj + Util.null2String(Util.null2String(dataList.get(i).get("sqltj"))) +" union ";
}
}
sqlCondition = "t1.ygid in ( select a.id from ("+sqltj+") a)";
}
}else {
if (userId !=1){
sqlCondition = "t1.ygid="+userId;
}
}
log.info("sqlCondition : [{}]",sqlCondition);
ExtensionClassHolder.remove();
return sqlCondition;
}
}

@ -0,0 +1,94 @@
package weaver.formmode.customjavacode.customsearch.jucailinkq;
import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils;
import lombok.extern.slf4j.Slf4j;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*
*
* class
* class
* java
* @author Administrator
*
*/
@Slf4j
public class ClockAgainCustomSearchTemplate extends AbstractCustomSqlConditionJavaCode {
/**
* SQL
* @param param
* param()
* user
*
* @return
* : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
public String generateSqlCondition(Map<String, Object> param) throws Exception {
log.info("generateSqlCondition : [{}]",param);
User user = (User)param.get("user");
int userId = user.getUID();
String sql = "select b.*,a.list_type from uf_ryqz a left join uf_ryqz_dt1 b on a.id=b.mainid where a.userfor=5 and a.fzgly=?";
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,userId);
String sqlCondition = "";
if (dataList.size() > 0){
String listType = Util.null2String(dataList.get(0).get("list_type"));
if (listType.equals("0")){
//人员清单
List<String> userList = dataList.stream().map(e->Util.null2String(e.get("empid"))).collect(Collectors.toList());
sqlCondition = "t1.bdkry in ("+String.join(",",userList)+")";
}else if (listType.equals("1")){
//条件清单
sql = "select id from hrmresource where (";
for (int i=0;i<dataList.size();i++){
Map<String,Object> map = dataList.get(i);
String filters = Util.null2String(map.get("filters"));
filters = Utils.converSQL(filters);
if (i == dataList.size()-1){
sql = sql+filters+")";
}else {
sql = sql+filters+" or ";
}
}
sqlCondition = "t1.bdkry in ("+sql+") ";
}else if (listType.equals("2")){
//sql条件
String sqltj = "";
for (int i=0;i<dataList.size();i++){
if (i == dataList.size()-1){
sqltj = sqltj+Util.null2String(Util.null2String(dataList.get(i).get("sqltj")));
}else {
sqltj = sqltj + Util.null2String(Util.null2String(dataList.get(i).get("sqltj"))) +" union ";
}
}
sqlCondition = "t1.bdkry in ( select a.id from ("+sqltj+") a)";
}
}else {
if (userId !=1){
sqlCondition = "t1.bdkry="+userId;
}
}
log.info("sqlCondition : [{}]",sqlCondition);
ExtensionClassHolder.remove();
return sqlCondition;
}
}

@ -0,0 +1,95 @@
package weaver.formmode.customjavacode.customsearch.jucailinkq;
import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils;
import lombok.extern.slf4j.Slf4j;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*
*
* class
* class
* java
* @author Administrator
*
*/
@Slf4j
public class EvectionCustomSearchTemplate extends AbstractCustomSqlConditionJavaCode {
/**
* SQL
* @param param
* param()
* user
*
* @return
* : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
public String generateSqlCondition(Map<String, Object> param) throws Exception {
log.info("generateSqlCondition : [{}]",param);
User user = (User)param.get("user");
int userId = user.getUID();
String sql = "select b.*,a.list_type from uf_ryqz a left join uf_ryqz_dt1 b on a.id=b.mainid where a.userfor=5 and a.fzgly=?";
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,userId);
String sqlCondition = "";
if (dataList.size() > 0){
String listType = Util.null2String(dataList.get(0).get("list_type"));
if (listType.equals("0")){
//人员清单
List<String> userList = dataList.stream().map(e->Util.null2String(e.get("empid"))).collect(Collectors.toList());
sqlCondition = "d1.ccr in ("+String.join(",",userList)+")";
}else if (listType.equals("1")){
//条件清单
sql = "select id from hrmresource where (";
for (int i=0;i<dataList.size();i++){
Map<String,Object> map = dataList.get(i);
String filters = Util.null2String(map.get("filters"));
filters = Utils.converSQL(filters);
if (i == dataList.size()-1){
sql = sql+filters+")";
}else {
sql = sql+filters+" or ";
}
}
sqlCondition = "d1.ccr in ("+sql+") ";
}else if (listType.equals("2")){
//sql条件
String sqltj = "";
for (int i=0;i<dataList.size();i++){
if (i == dataList.size()-1){
sqltj = sqltj+Util.null2String(Util.null2String(dataList.get(i).get("sqltj")));
}else {
sqltj = sqltj + Util.null2String(Util.null2String(dataList.get(i).get("sqltj"))) +" union ";
}
}
sqlCondition = "d1.ccr in ( select a.id from ("+sqltj+") a)";
}
}else {
if (userId !=1){
sqlCondition = "d1.ccr="+userId;
}
}
log.info("sqlCondition : [{}]",sqlCondition);
ExtensionClassHolder.remove();
return sqlCondition;
}
}

@ -0,0 +1,94 @@
package weaver.formmode.customjavacode.customsearch.jucailinkq;
import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils;
import lombok.extern.slf4j.Slf4j;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*
*
* class
* class
* java
* @author Administrator
*
*/
@Slf4j
public class HolidayCustomSearchTemplate extends AbstractCustomSqlConditionJavaCode {
/**
* SQL
* @param param
* param()
* user
*
* @return
* : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
public String generateSqlCondition(Map<String, Object> param) throws Exception {
log.info("generateSqlCondition : [{}]",param);
User user = (User)param.get("user");
int userId = user.getUID();
String sql = "select b.*,a.list_type from uf_ryqz a left join uf_ryqz_dt1 b on a.id=b.mainid where a.userfor=5 and a.fzgly=?";
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,userId);
String sqlCondition = "";
if (dataList.size() > 0){
String listType = Util.null2String(dataList.get(0).get("list_type"));
if (listType.equals("0")){
//人员清单
List<String> userList = dataList.stream().map(e->Util.null2String(e.get("empid"))).collect(Collectors.toList());
sqlCondition = "t1.ygid in ("+String.join(",",userList)+")";
}else if (listType.equals("1")){
//条件清单
sql = "select id from hrmresource where (";
for (int i=0;i<dataList.size();i++){
Map<String,Object> map = dataList.get(i);
String filters = Util.null2String(map.get("filters"));
filters = Utils.converSQL(filters);
if (i == dataList.size()-1){
sql = sql+filters+")";
}else {
sql = sql+filters+" or ";
}
}
sqlCondition = "t1.ygid in ("+sql+") ";
}else if (listType.equals("2")){
//sql条件
String sqltj = "";
for (int i=0;i<dataList.size();i++){
if (i == dataList.size()-1){
sqltj = sqltj+Util.null2String(Util.null2String(dataList.get(i).get("sqltj")));
}else {
sqltj = sqltj + Util.null2String(Util.null2String(dataList.get(i).get("sqltj"))) +" union ";
}
}
sqlCondition = "t1.ygid in ( select a.id from ("+sqltj+") a)";
}
}else {
if (userId !=1){
sqlCondition = "t1.ygid="+userId;
}
}
log.info("sqlCondition : [{}]",sqlCondition);
ExtensionClassHolder.remove();
return sqlCondition;
}
}

@ -0,0 +1,94 @@
package weaver.formmode.customjavacode.customsearch.jucailinkq;
import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils;
import lombok.extern.slf4j.Slf4j;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*
*
* class
* class
* java
* @author Administrator
*
*/
@Slf4j
public class OverTimePlanCustomSearchTemplate extends AbstractCustomSqlConditionJavaCode {
/**
* SQL
* @param param
* param()
* user
*
* @return
* : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
public String generateSqlCondition(Map<String, Object> param) throws Exception {
log.info("generateSqlCondition : [{}]",param);
User user = (User)param.get("user");
int userId = user.getUID();
String sql = "select b.*,a.list_type from uf_ryqz a left join uf_ryqz_dt1 b on a.id=b.mainid where a.userfor=5 and a.fzgly=?";
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,userId);
String sqlCondition = "";
if (dataList.size() > 0){
String listType = Util.null2String(dataList.get(0).get("list_type"));
if (listType.equals("0")){
//人员清单
List<String> userList = dataList.stream().map(e->Util.null2String(e.get("empid"))).collect(Collectors.toList());
sqlCondition = "d1.jbry in ("+String.join(",",userList)+")";
}else if (listType.equals("1")){
//条件清单
sql = "select id from hrmresource where (";
for (int i=0;i<dataList.size();i++){
Map<String,Object> map = dataList.get(i);
String filters = Util.null2String(map.get("filters"));
filters = Utils.converSQL(filters);
if (i == dataList.size()-1){
sql = sql+filters+")";
}else {
sql = sql+filters+" or ";
}
}
sqlCondition = "d1.jbry in ("+sql+") ";
}else if (listType.equals("2")){
//sql条件
String sqltj = "";
for (int i=0;i<dataList.size();i++){
if (i == dataList.size()-1){
sqltj = sqltj+Util.null2String(Util.null2String(dataList.get(i).get("sqltj")));
}else {
sqltj = sqltj + Util.null2String(Util.null2String(dataList.get(i).get("sqltj"))) +" union ";
}
}
sqlCondition = "d1.jbry in ( select a.id from ("+sqltj+") a)";
}
}else {
if (userId !=1){
sqlCondition = "d1.jbry="+userId;
}
}
log.info("sqlCondition : [{}]",sqlCondition);
ExtensionClassHolder.remove();
return sqlCondition;
}
}

@ -0,0 +1,94 @@
package weaver.formmode.customjavacode.customsearch.jucailinkq;
import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import com.engine.jucailinkq.common.util.Utils;
import lombok.extern.slf4j.Slf4j;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*
*
* class
* class
* java
* @author Administrator
*
*/
@Slf4j
public class OverTimeResultCustomSearchTemplate extends AbstractCustomSqlConditionJavaCode {
/**
* SQL
* @param param
* param()
* user
*
* @return
* : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
public String generateSqlCondition(Map<String, Object> param) throws Exception {
log.info("generateSqlCondition : [{}]",param);
User user = (User)param.get("user");
int userId = user.getUID();
String sql = "select b.*,a.list_type from uf_ryqz a left join uf_ryqz_dt1 b on a.id=b.mainid where a.userfor=5 and a.fzgly=?";
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,userId);
String sqlCondition = "";
if (dataList.size() > 0){
String listType = Util.null2String(dataList.get(0).get("list_type"));
if (listType.equals("0")){
//人员清单
List<String> userList = dataList.stream().map(e->Util.null2String(e.get("empid"))).collect(Collectors.toList());
sqlCondition = "t1.jbry in ("+String.join(",",userList)+")";
}else if (listType.equals("1")){
//条件清单
sql = "select id from hrmresource where (";
for (int i=0;i<dataList.size();i++){
Map<String,Object> map = dataList.get(i);
String filters = Util.null2String(map.get("filters"));
filters = Utils.converSQL(filters);
if (i == dataList.size()-1){
sql = sql+filters+")";
}else {
sql = sql+filters+" or ";
}
}
sqlCondition = "t1.jbry in ("+sql+") ";
}else if (listType.equals("2")){
//sql条件
String sqltj = "";
for (int i=0;i<dataList.size();i++){
if (i == dataList.size()-1){
sqltj = sqltj+Util.null2String(Util.null2String(dataList.get(i).get("sqltj")));
}else {
sqltj = sqltj + Util.null2String(Util.null2String(dataList.get(i).get("sqltj"))) +" union ";
}
}
sqlCondition = "t1.jbry in ( select a.id from ("+sqltj+") a)";
}
}else {
if (userId !=1){
sqlCondition = "t1.jbry="+userId;
}
}
log.info("sqlCondition : [{}]",sqlCondition);
ExtensionClassHolder.remove();
return sqlCondition;
}
}

@ -1,6 +1,7 @@
package weaver.formmode.customjavacode.modeexpand; package weaver.formmode.customjavacode.modeexpand;
import com.engine.jucailinkq.common.util.DbTools; import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew; import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.Util; import weaver.general.Util;
@ -62,6 +63,7 @@ public class DeleteApplicableOrg extends AbstractModeExpandJavaCodeNew {
result.put("errmsg","适用范围数据删除失败!"); result.put("errmsg","适用范围数据删除失败!");
result.put("flag", "false"); result.put("flag", "false");
} }
ExtensionClassHolder.remove();
return result; return result;
} }
} }

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.engine.jucailinkq.common.util.DbTools; import com.engine.jucailinkq.common.util.DbTools;
import com.engine.jucailinkq.common.util.ExtensionClassHolder;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew; import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.Util; import weaver.general.Util;
@ -61,6 +62,7 @@ public class DeleteCheckCalendar extends AbstractModeExpandJavaCodeNew {
result.put("errmsg","删除逻辑校验失败"); result.put("errmsg","删除逻辑校验失败");
result.put("flag", "false"); result.put("flag", "false");
} }
ExtensionClassHolder.remove();
return result; return result;
} }
} }

@ -0,0 +1,584 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script>
$('.generateLeaveInfoList').css("background-color","#2db7f5")
$('.generateLeaveInfoList').css("height","35px")
$('.generateLeaveInfoList span').css("line-height","35px")
$('.generateLeaveInfoList').css("border-radius","3px")
$('.generateLeaveInfoList').click(function(){
//允许继续添加行调用callback不调用代表阻断添加
let mainTableData = {
szjg: WfForm.getFieldValue(WfForm.convertFieldNameToId("szjg")),
qjr: WfForm.getFieldValue(WfForm.convertFieldNameToId("qjry")),
jqlx: WfForm.getFieldValue(WfForm.convertFieldNameToId("jqlx")),
jqlx_vals: mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("jqlx")).specialobj),
mtcfsdjq: WfForm.getFieldValue(WfForm.convertFieldNameToId("mtcfsdjq")),
ksrq: WfForm.getFieldValue(WfForm.convertFieldNameToId("ksrq")),
jsrq: WfForm.getFieldValue(WfForm.convertFieldNameToId("jsrq")),
kssj: WfForm.getFieldValue(WfForm.convertFieldNameToId("kssj")),
jssj: WfForm.getFieldValue(WfForm.convertFieldNameToId("jssj")),
cxjqj: WfForm.getFieldValue(WfForm.convertFieldNameToId("cxjqj")),
yesygz: WfForm.getFieldValue(WfForm.convertFieldNameToId("yesygz")),
sxwxz: WfForm.getFieldValue(WfForm.convertFieldNameToId("sxwxz")),
kssd: WfForm.getFieldValue(WfForm.convertFieldNameToId("kssd")),
jssd: WfForm.getFieldValue(WfForm.convertFieldNameToId("jssd")),
qjsc: WfForm.getFieldValue(WfForm.convertFieldNameToId("qjsc")),
bcxx:WfForm.getFieldValue(WfForm.convertFieldNameToId("bcxx"))
}
generateHoliday(mainTableData);
})
function generateHoliday(mainTableData){
let detailTableData=[];
let param = {
mainTableData:JSON.stringify(mainTableData),
detailTableData:JSON.stringify(detailTableData),
}
console.log(param);
WfForm.delDetailRow("detail_3", "all");
$.ajax({
url:'/api/attendance/askforleave/generateLeaveInfoList',
data:param,
type:'GET',
dataType:'json',
async:false,
success:function(res){
debugger;
if(res.api_status){
if(res.data.status){
WfForm.delDetailRow("detail_1", "all");
let resultData = res.data.data;
resultData.filter(item => {
let qjsc = Number(item.qjsc);
if (qjsc%2>0){
qjsc = qjsc-(qjsc%2)+2;
item.qjsc = qjsc
}
let addObj = {}
addObj[WfForm.convertFieldNameToId("qjr", "detail_1")] = {value:item.qjr,specialobj:[{id:item.qjr,name:item.qjrName}]};
addObj[WfForm.convertFieldNameToId("qjlx", "detail_1")] = {value:item.qjlx,specialobj:[{id:item.qjlx,name:item.qjlxName}]};
addObj[WfForm.convertFieldNameToId("ksrq", "detail_1")]={value:item.ksrq}
addObj[WfForm.convertFieldNameToId("kssj", "detail_1")]={value:item.kssj}
addObj[WfForm.convertFieldNameToId("jsrq", "detail_1")]={value:item.jsrq}
addObj[WfForm.convertFieldNameToId("jssj", "detail_1")]={value:item.jssj}
addObj[WfForm.convertFieldNameToId("qjsc", "detail_1")]={value:item.qjsc}
addObj[WfForm.convertFieldNameToId("qtj", "detail_1")]={value:item.qtj}
addObj[WfForm.convertFieldNameToId("btj", "detail_1")]={value:item.btj}
addObj[WfForm.convertFieldNameToId("jqye", "detail_1")]={value:item.jqye==undefined?'':item.jqye}
WfForm.addDetailRow("detail_1", addObj);
if (mainTableData.mtcfsdjq == "0"){
addObj = {};
addObj[WfForm.convertFieldNameToId("yesygz", "detail_3")]={value:mainTableData.yesygz};
addObj[WfForm.convertFieldNameToId("sxwxz", "detail_3")]={value:mainTableData.sxwxz};
addObj[WfForm.convertFieldNameToId("qjfs", "detail_3")]={value:mainTableData.cxjqj};
addObj[WfForm.convertFieldNameToId("qjr", "detail_3")]={value:mainTableData.qjr};
addObj[WfForm.convertFieldNameToId("qjlx", "detail_3")]={value:mainTableData.jqlx,specialobj:mainTableData.jqlx_vals};
addObj[WfForm.convertFieldNameToId("ksrq", "detail_3")]={value:mainTableData.ksrq};
addObj[WfForm.convertFieldNameToId("jsrq", "detail_3")]={value:mainTableData.jsrq}
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")]={value:""};
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")]={value:''};//设置全天假为不勾选
addObj[WfForm.convertFieldNameToId("btj", "detail_3")]={value:''};//设置半天假为不勾选
switch(mainTableData.cxjqj) {
case '0'://全天请假
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")] = {value: '1'};//设置全天假为勾选
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")]={value:""};
addObj[WfForm.convertFieldNameToId("btj", "detail_3")]={value:''};//设置半天假为不勾选
break;
case '1'://按时间区间请假,需要单独设置开始结束时间或者开始结束时段
//按时间区间请假,需要单独设置开始结束时间或者开始结束时段
if (mainTableData.sxwxz == '0') {
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")] = {value: mainTableData.kssj};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")] = {value: mainTableData.jssj};
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")]={value:""};
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")]={value:''};//设置全天假为不勾选
addObj[WfForm.convertFieldNameToId("btj", "detail_3")]={value:''};//设置半天假为不勾选
} else {
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")] = {value: mainTableData.kssd};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")] = {value: mainTableData.jssd};
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")]={value:""};
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")]={value:''};//设置全天假为不勾选
addObj[WfForm.convertFieldNameToId("btj", "detail_3")]={value:''};//设置半天假为不勾选
}
break;
case '2'://半天请假
addObj[WfForm.convertFieldNameToId("btj", "detail_3")] = {value: '1'};//设置半天假为勾选
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")]={value:''};//设置全天假为不勾选
break;
case '3'://按时间长度请假
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")] = {value: mainTableData.qjsc};
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")]={value:''};//设置全天假为不勾选
addObj[WfForm.convertFieldNameToId("btj", "detail_3")]={value:''};//设置半天假为不勾选
break;
default://其他全天或者半天出差
break;
}
WfForm.addDetailRow("detail_3", addObj);
}else{
var v_tmpbdate = new Date(item.ksrq);
var v_tmpedate = new Date(v_tmpbdate);
if (!DateCheck(item.ksrq,item.kssj,item.jsrq,item.jssj)) {
v_tmpedate = v_tmpedate.setDate(v_tmpedate.getDate() + 1);
v_tmpedate = new Date(v_tmpedate);
}
while (v_tmpbdate<=new Date(item.jsrq)){
addObj = {};
addObj[WfForm.convertFieldNameToId("yesygz", "detail_3")]={value:mainTableData.yesygz};
addObj[WfForm.convertFieldNameToId("sxwxz", "detail_3")]={value:mainTableData.sxwxz};
addObj[WfForm.convertFieldNameToId("qjfs", "detail_3")]={value:mainTableData.cxjqj};
addObj[WfForm.convertFieldNameToId("qjr", "detail_3")]={value:mainTableData.qjr};
addObj[WfForm.convertFieldNameToId("qjlx", "detail_3")]={value:mainTableData.jqlx,specialobj:mainTableData.jqlx_vals};
addObj[WfForm.convertFieldNameToId("ksrq", "detail_3")]={value:v_tmpbdate};
addObj[WfForm.convertFieldNameToId("jsrq", "detail_3")]={value:v_tmpedate};
switch(mainTableData.cxjqj) {
case '0'://全天请假
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")] = {value: '1'};//设置全天假为勾选
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")]={value:""};
addObj[WfForm.convertFieldNameToId("btj", "detail_3")]={value:''};//设置半天假为不勾选
break;
case '1'://按时间区间请假,需要单独设置开始结束时间或者开始结束时段
//按时间区间请假,需要单独设置开始结束时间或者开始结束时段
if (mainTableData.sxwxz == '0') {
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")] = {value: mainTableData.kssj};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")] = {value: mainTableData.jssj};
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")]={value:""};
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")]={value:''};//设置全天假为不勾选
addObj[WfForm.convertFieldNameToId("btj", "detail_3")]={value:''};//设置半天假为不勾选
} else {
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")] = {value: mainTableData.kssd};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")] = {value: mainTableData.jssd};
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")]={value:""};
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")]={value:''};//设置全天假为不勾选
addObj[WfForm.convertFieldNameToId("btj", "detail_3")]={value:''};//设置半天假为不勾选
}
break;
case '2'://半天请假
addObj[WfForm.convertFieldNameToId("btj", "detail_3")] = {value: '1'};//设置半天假为勾选
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")]={value:""};
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")]={value:''};//设置全天假为不勾选
break;
case '3'://按时间长度请假
addObj[WfForm.convertFieldNameToId("qjsc", "detail_3")] = {value: mainTableData.qjsc};
addObj[WfForm.convertFieldNameToId("kssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("kssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("jssd", "detail_3")]={value:''};
addObj[WfForm.convertFieldNameToId("qtj", "detail_3")]={value:''};//设置全天假为不勾选
addObj[WfForm.convertFieldNameToId("btj", "detail_3")]={value:''};//设置半天假为不勾选
break;
default://其他全天或者半天出差
break;
}
WfForm.addDetailRow("detail_3", addObj);
v_tmpbdate = v_tmpbdate.setDate(v_tmpbdate.getDate() + 1);
v_tmpbdate = new Date(v_tmpbdate);
//明细结束日期加一天
v_tmpedate = v_tmpedate.setDate(v_tmpedate.getDate() + 1);
v_tmpedate = new Date(v_tmpedate);
}
}
});
}else{
WfForm.showMessage(res.data.errorInfo, 2, 5);
}
}
resetqjfs();
}
})
}
function generateHolidayNoDetail(mainTableData){
let detailTableData=[];
let param = {
mainTableData:JSON.stringify(mainTableData),
detailTableData:JSON.stringify(detailTableData),
}
console.log(param);
$.ajax({
url:'/api/attendance/askforleave/generateLeaveInfoList',
data:param,
type:'GET',
dataType:'json',
async:false,
success:function(res){
debugger;
if(res.api_status){
if(res.data.status){
let resultData = res.data.data;
resultData.filter(item => {
let qjsc = Number(item.qjsc);
if (qjsc%2>0){
qjsc = qjsc-(qjsc%2)+2;
item.qjsc = qjsc
}
let addObj = {}
addObj[WfForm.convertFieldNameToId("qjr", "detail_1")] = {value:item.qjr,specialobj:[{id:item.qjr,name:item.qjrName}]};
addObj[WfForm.convertFieldNameToId("qjlx", "detail_1")] = {value:item.qjlx,specialobj:[{id:item.qjlx,name:item.qjlxName}]};
addObj[WfForm.convertFieldNameToId("ksrq", "detail_1")]={value:item.ksrq}
addObj[WfForm.convertFieldNameToId("kssj", "detail_1")]={value:item.kssj}
addObj[WfForm.convertFieldNameToId("jsrq", "detail_1")]={value:item.jsrq}
addObj[WfForm.convertFieldNameToId("jssj", "detail_1")]={value:item.jssj}
addObj[WfForm.convertFieldNameToId("qjsc", "detail_1")]={value:item.qjsc}
addObj[WfForm.convertFieldNameToId("qtj", "detail_1")]={value:item.qtj}
addObj[WfForm.convertFieldNameToId("btj", "detail_1")]={value:item.btj}
addObj[WfForm.convertFieldNameToId("jqye", "detail_1")]={value:item.jqye==undefined?'':item.jqye}
WfForm.addDetailRow("detail_1", addObj);
});
}else{
WfForm.showMessage(res.data.errorInfo, 2, 5);
}
}
resetqjfs();
}
})
}
//绑定全天假栏位值变更事件
jQuery(document).ready(function(){
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("ksrq", "detail_3"),function(id,rowIndex,value){
generateDetail1()
});
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("jsrq", "detail_3"),function(id,rowIndex,value){
generateDetail1()
});
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("kssj", "detail_3"),function(id,rowIndex,value){
generateDetail1()
});
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("jssj", "detail_3"),function(id,rowIndex,value){
generateDetail1()
});
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("kssd", "detail_3"),function(id,rowIndex,value){
generateDetail1()
});
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("jssd", "detail_3"),function(id,rowIndex,value){
generateDetail1()
});
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("qjsc", "detail_3"),function(id,rowIndex,value){
generateDetail1()
});
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("qtj", "detail_3"),function(id,rowIndex,value){
if (null2String(WfForm.getFieldValue(WfForm.convertFieldNameToId("btj", "detail_3")+"_"+rowIndex))=="1" && null2String(value) == "1") {
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj","detail_3")+"_"+rowIndex,{ value: '0' });//重置开始时间
}
});
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("btj", "detail_3"),function(id,rowIndex,value){
if (null2String(WfForm.getFieldValue(WfForm.convertFieldNameToId("qtj", "detail_3")+"_"+rowIndex))=="1" && null2String(value) == "1") {
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj","detail_3")+"_"+rowIndex,{ value: '0' });//重置开始时间
generateDetail1();
}
});
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("sxwxz", "detail_3"),function(id,rowIndex,value){
if (null2String(value)=="1"){
//按上下午进行请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj","detail_3")+"_"+rowIndex, 1);//结束时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj","detail_3")+"_"+rowIndex, 1);//开始时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssd","detail_3")+"_"+rowIndex, 3);//开始时段
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssd","detail_3")+"_"+rowIndex, 3);//结束时段
}else{
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj","detail_3")+"_"+rowIndex, 3);//结束时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj","detail_3")+"_"+rowIndex, 3);//开始时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssd","detail_3")+"_"+rowIndex, 1);//开始时段
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssd","detail_3")+"_"+rowIndex, 1);//结束时段
}
generateDetail1();
});
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("qjfs", "detail_3"),function(id,rowIndex,value){
if(rowIndex !== ""){
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("sxwxz","detail_3")+"_"+rowIndex, 1);//按上下午请假功能不开放
WfForm.changeFieldValue(WfForm.convertFieldNameToId("kssj","detail_3")+"_"+rowIndex,{ value: '' });//重置开始时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj","detail_3")+"_"+rowIndex, 1);//开始时间
WfForm.changeFieldValue(WfForm.convertFieldNameToId("jssj","detail_3")+"_"+rowIndex,{ value: '' });//重置结束时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj","detail_3")+"_"+rowIndex, 1);//结束时间
WfForm.changeFieldValue(WfForm.convertFieldNameToId("kssd","detail_3")+"_"+rowIndex,{ value: '' });//清空开始时段内容
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssd","detail_3")+"_"+rowIndex, 1);//开始时段
WfForm.changeFieldValue(WfForm.convertFieldNameToId("jssd","detail_3")+"_"+rowIndex,{ value: '' });//清空结束时段内容
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssd","detail_3")+"_"+rowIndex, 1);//结束时段
switch(value){
case '0'://全天请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_3")+"_"+rowIndex, 1);//请假时长
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj","detail_3")+"_"+rowIndex, {value:"1"});//全天假勾选
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj","detail_3")+"_"+rowIndex, {value:"0"});//半天假取消勾选
break;
case '1'://指定时间区间请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_3")+"_"+rowIndex, 1);//请假时长
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("sxwxz","detail_3")+"_"+rowIndex, 2);//按上下午请假功能开放
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj","detail_3")+"_"+rowIndex, {value:"0"});//全天假取消勾选
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj","detail_3")+"_"+rowIndex, {value:"0"});//半天假取消勾选
if (null2String(WfForm.getFieldValue(WfForm.convertFieldNameToId("sxwxz", "detail_3")+"_"+rowIndex))=="1"){
//按上下午进行请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj","detail_3")+"_"+rowIndex, 1);//结束时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj","detail_3")+"_"+rowIndex, 1);//开始时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssd","detail_3")+"_"+rowIndex, 3);//开始时段
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssd","detail_3")+"_"+rowIndex, 3);//结束时段
}else{
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj","detail_3")+"_"+rowIndex, 3);//结束时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj","detail_3")+"_"+rowIndex, 3);//开始时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssd","detail_3")+"_"+rowIndex, 1);//开始时段
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssd","detail_3")+"_"+rowIndex, 1);//结束时段
}
break;
case '2'://半天请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_3")+"_"+rowIndex, 1);//请假时长
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj","detail_3")+"_"+rowIndex, {value:"0"});//全天假勾选
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj","detail_3")+"_"+rowIndex, {value:"1"});//半天假取消勾选
break;
case '3'://按时间长度请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_3")+"_"+rowIndex, 3);//请假时长
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj","detail_3")+"_"+rowIndex, {value:"0"});//全天假取消勾选
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj","detail_3")+"_"+rowIndex, {value:"0"});//半天假取消勾选
break;
}
}
generateDetail1();
});
resetqjfs();
});
//请假方式变更时,同样进行页面显示属性的调整
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("cxjqj"),function(obj,id,value){
resetAttr(value);
});
WfForm.registerCheckEvent(WfForm.OPER_SAVE+","+WfForm.OPER_SUBMIT,function(callback){
//清空明细1重新根据明细3生成明细1及明细2
callback();
// let detailNum = WfForm.getDetailRowCount("detail_1")
// if(detailNum > 0){
// callback();
// }else{
// WfForm.showMessage("明细表1没有数据请点击生成请假按钮", 2, 10);
// }
});
WfForm.registerCheckEvent(WfForm.OPER_ADDROW+"3", function(callback){
// WfForm.delDetailRow("detail_1", "all");
callback(); //允许继续添加行调用callback不调用代表阻断添加
});
resetAttr(WfForm.getFieldValue(WfForm.convertFieldNameToId("cxjqj")))
function generateDetail1(){
WfForm.delDetailRow("detail_1", "all");
let detail3Index = WfForm.getDetailAllRowIndexStr("detail_3").split(",");
for(var i=0; i<detail3Index.length; i++){
var rowIndex = detail3Index[i];
if(rowIndex !== ""){
let mainTableData = {
szjg: WfForm.getFieldValue(WfForm.convertFieldNameToId("szjg")),
qjr: WfForm.getFieldValue(WfForm.convertFieldNameToId("qjry")),
jqlx: WfForm.getFieldValue(WfForm.convertFieldNameToId("jqlx")),
jqlx_vals: mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("jqlx")).specialobj),
mtcfsdjq: WfForm.getFieldValue(WfForm.convertFieldNameToId("mtcfsdjq")),
ksrq: WfForm.getFieldValue(WfForm.convertFieldNameToId("ksrq", "detail_3")+"_"+rowIndex),
jsrq: WfForm.getFieldValue(WfForm.convertFieldNameToId("jsrq", "detail_3")+"_"+rowIndex),
kssj: WfForm.getFieldValue(WfForm.convertFieldNameToId("kssj", "detail_3")+"_"+rowIndex),
jssj: WfForm.getFieldValue(WfForm.convertFieldNameToId("jssj", "detail_3")+"_"+rowIndex),
cxjqj: WfForm.getFieldValue(WfForm.convertFieldNameToId("qjfs", "detail_3")+"_"+rowIndex),
yesygz: WfForm.getFieldValue(WfForm.convertFieldNameToId("yesygz", "detail_3")+"_"+rowIndex),
sxwxz: WfForm.getFieldValue(WfForm.convertFieldNameToId("sxwxz", "detail_3")+"_"+rowIndex),
kssd: WfForm.getFieldValue(WfForm.convertFieldNameToId("kssd", "detail_3")+"_"+rowIndex),
jssd: WfForm.getFieldValue(WfForm.convertFieldNameToId("jssd", "detail_3")+"_"+rowIndex),
qjsc: WfForm.getFieldValue(WfForm.convertFieldNameToId("qjsc", "detail_3")+"_"+rowIndex),
}
generateHolidayNoDetail(mainTableData);
}
}
}
function resetqjfs(){
let detail3Index = WfForm.getDetailAllRowIndexStr("detail_3").split(",");
for(var i=0; i<detail3Index.length; i++){
var rowIndex = detail3Index[i];
if(rowIndex !== ""){
let qjfs = WfForm.getFieldValue(WfForm.convertFieldNameToId("qjfs", "detail_3")+"_"+rowIndex);
switch(qjfs){
case '0'://全天请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_3")+"_"+rowIndex, 1);//请假时长
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj","detail_3")+"_"+rowIndex, {value:"1"});//全天假勾选
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj","detail_3")+"_"+rowIndex, {value:"0"});//半天假取消勾选
break;
case '1'://指定时间区间请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_3")+"_"+rowIndex, 1);//请假时长
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("sxwxz","detail_3")+"_"+rowIndex, 2);//按上下午请假功能开放
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj","detail_3")+"_"+rowIndex, {value:"0"});//全天假取消勾选
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj","detail_3")+"_"+rowIndex, {value:"0"});//半天假取消勾选
if (null2String(WfForm.getFieldValue(WfForm.convertFieldNameToId("sxwxz", "detail_3")+"_"+rowIndex))=="1"){
//按上下午进行请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj","detail_3")+"_"+rowIndex, 1);//结束时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj","detail_3")+"_"+rowIndex, 1);//开始时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssd","detail_3")+"_"+rowIndex, 3);//开始时段
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssd","detail_3")+"_"+rowIndex, 3);//结束时段
}else{
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj","detail_3")+"_"+rowIndex, 3);//结束时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj","detail_3")+"_"+rowIndex, 3);//开始时间
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssd","detail_3")+"_"+rowIndex, 1);//开始时段
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssd","detail_3")+"_"+rowIndex, 1);//结束时段
}
break;
case '2'://半天请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_3")+"_"+rowIndex, 1);//请假时长
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj","detail_3")+"_"+rowIndex, {value:"0"});//全天假勾选
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj","detail_3")+"_"+rowIndex, {value:"1"});//半天假取消勾选
break;
case '3'://按时间长度请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_3")+"_"+rowIndex, 3);//请假时长
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj","detail_3")+"_"+rowIndex, {value:"0"});//全天假取消勾选
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj","detail_3")+"_"+rowIndex, {value:"0"});//半天假取消勾选
break;
}
}
}
}
/**
*
* @param pleavetype 请假方式0全天请假1按时间区间请假2半天3按时间长度请假
*/
function resetAttr(pleavetype) {
//alert('resetAttr');
switch (pleavetype){
case '1'://按时间区间请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc"), 4);
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("scdw"), 4);
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj"), 3);
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj"), 3);
break;
case '3'://按时间区间请假
WfForm.changeFieldValue(WfForm.convertFieldNameToId("scdw"),{ value: '1' });//请假时长单位为小时
//请假时间长度可编辑
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc"), 3);
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("scdw"), 1);
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj"), 5);
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj"), 5);
//每天请假时长默认为1小时
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qjsc"),{ value: '1' });
break;
default:
//请假时间长度不可编辑
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc"), 4);
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("scdw"), 4);
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj"), 5);
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj"), 5);
break;
}
}
function null2String(s){
if(!s){
return "";
}
return s;
}
function DateCheck(fromDate,fromTime,toDate,toTime,msg){
var begin = new Date(fromDate.replace(/\-/g, "\/"));
var end = new Date(toDate.replace(/\-/g, "\/"));
if(fromTime != "" && toTime != ""){
begin = new Date(fromDate.replace(/\-/g, "\/")+" "+fromTime+":00");
end = new Date(toDate.replace(/\-/g, "\/")+" "+toTime+":00");
if(fromDate!=""&&toDate!=""&&begin >end)
{
if(isMobile){
alert(msg);
}else{
WfForm.showMessage(msg);
}
return false;
}
}else{
if(fromDate!=""&&toDate!=""&&begin >end)
{
if(isMobile){
alert(msg);
}else{
WfForm.showMessage(msg);
}
return false;
}
}
return true;
}
</script>

@ -6,41 +6,102 @@
<script> <script>
//补打卡人变更 获取补打卡日期 //补打卡人变更 获取补打卡日期
jQuery(document).ready(function(){ // jQuery(document).ready(function(){
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("bdkr", "detail_1"),function(id,rowIndex,value){ // WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("bdkr", "detail_1"),function(id,rowIndex,value){
WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkrq", "detail_1")+"_"+rowIndex) // WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkrq", "detail_1")+"_"+rowIndex)
//alert(WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkrq", "detail_1")+"_"+rowIndex)); // //alert(WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkrq", "detail_1")+"_"+rowIndex));
}); // });
}); // });
//补打卡日期变更 获取补打卡人 // //补打卡日期变更 获取补打卡人
jQuery(document).ready(function(){ // jQuery(document).ready(function(){
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("bdkrq", "detail_1"),function(id,rowIndex,value){ // WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("bdkrq", "detail_1"),function(id,rowIndex,value){
WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkr", "detail_1")+"_"+rowIndex) // WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkr", "detail_1")+"_"+rowIndex)
//alert(WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkr", "detail_1")+"_"+rowIndex)); // //alert(WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkr", "detail_1")+"_"+rowIndex));
}); // });
}); // });
//添加行记录后 对部分栏位进行二次调整 //添加行记录后 对部分栏位进行二次调整
WfForm.registerAction(WfForm.ACTION_ADDROW+"1", function(index){ // WfForm.registerAction(WfForm.ACTION_ADDROW+"1", function(index){
//取主表的流程提交人为补打卡人 // //取主表的流程提交人为补打卡人
var bdkr= mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("bdkry")).specialobj); // var bdkr= mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("bdkry")).specialobj);
var bdklx;//补打卡类型 // var bdklx;//补打卡类型
var bdkrq;//补打卡日期 // var bdkrq;//补打卡日期
if (WfForm.getDetailRowCount("detail_1") > 1){ // if (WfForm.getDetailRowCount("detail_1") > 1){
//明细超过一行,添加第二行时,取第一行对应的补打卡人 // //明细超过一行,添加第二行时,取第一行对应的补打卡人
bdkr = mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("bdkr","detail_1")+"_"+(index-1)).specialobj); // bdkr = mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("bdkr","detail_1")+"_"+(index-1)).specialobj);
//取上一行的补打卡日期 // //取上一行的补打卡日期
bdkrq = wfform.getFieldValue(WfForm.convertFieldNameToId("bdkrq","detail_1")+"_"+(index-1)); // bdkrq = wfform.getFieldValue(WfForm.convertFieldNameToId("bdkrq","detail_1")+"_"+(index-1));
//新行默认上一行补打卡日期 // //新行默认上一行补打卡日期
WfForm.changeSingleField(WfForm.convertFieldNameToId("bdkrq","detail_1")+"_"+index, {value: bdkrq}); // WfForm.changeSingleField(WfForm.convertFieldNameToId("bdkrq","detail_1")+"_"+index, {value: bdkrq});
//取第一行对应的补打卡类型 // //取第一行对应的补打卡类型
// bdklx = mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("bdklx","detail_1")+"_"+(index-1)).specialobj); // // bdklx = mobx.toJS(wfform.getFieldValueObj(WfForm.convertFieldNameToId("bdklx","detail_1")+"_"+(index-1)).specialobj);
// if (bdklx !== null){ // // if (bdklx !== null){
// //新行默认上一行的补打卡类型 // // //新行默认上一行的补打卡类型
// WfForm.changeSingleField(WfForm.convertFieldNameToId("bdklx","detail_1")+"_"+index, {value:bdklx[0].id,specialobj:[{id:bdklx[0].id,name:bdklx[0].mc}]}); // // WfForm.changeSingleField(WfForm.convertFieldNameToId("bdklx","detail_1")+"_"+index, {value:bdklx[0].id,specialobj:[{id:bdklx[0].id,name:bdklx[0].mc}]});
// // }
// } // }
// WfForm.changeSingleField(WfForm.convertFieldNameToId("bdkr","detail_1")+"_"+index, {value:bdkr[0].id,specialobj:[{id:bdkr[0].id,name:bdkr[0].name}]});
// });
/**
* 自动添加补打卡明细
*/
function adddetail() {
//首先进行必填校验,不通过直接退出
//if(!WfForm.verifyFormRequired(false, true)){ return; }
let mainTableData = {
bdkxm: WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkxm")),
ksrq: WfForm.getFieldValue(WfForm.convertFieldNameToId("ksrq")),
jsrq: WfForm.getFieldValue(WfForm.convertFieldNameToId("jsrq")),
bdkry: WfForm.getFieldValue(WfForm.convertFieldNameToId("bdkry"))
}
let param = {
mainTableData:JSON.stringify(mainTableData),
} }
WfForm.changeSingleField(WfForm.convertFieldNameToId("bdkr","detail_1")+"_"+index, {value:bdkr[0].id,specialobj:[{id:bdkr[0].id,name:bdkr[0].name}]}); console.log(param);
$.ajax({
url:'/api/attendance/makeupclock/generateMakeUpClock',
data:mainTableData,
type:'POST',
dataType:'json',
async:false,
success:function(res){
if(res.code=='200'){
WfForm.delDetailRow("detail_1", "all");
let resultData = res.data.data;
resultData.filter(item => {
let addObj = {};
addObj[WfForm.convertFieldNameToId("bdkr", "detail_1")] = {value:item.bdkry,specialobj:[{id:item.bdkry,name:WfForm.getBrowserShowName(WfForm.convertFieldNameToId('bdkry'))}]};
addObj[WfForm.convertFieldNameToId("bdklx", "detail_1")] = {value:item.bdklx,specialobj:[{id:item.bdklx,name:WfForm.getBrowserShowName(WfForm.convertFieldNameToId('bdkxm'))}]};
addObj[WfForm.convertFieldNameToId("bdksj", "detail_1")]={value:item.bdksj};
addObj[WfForm.convertFieldNameToId("bcbdxx", "detail_1")]={value:item.bdxx};
addObj[WfForm.convertFieldNameToId("bdkrq", "detail_1")]={value:item.bdkrq};
WfForm.addDetailRow("detail_1", addObj);
})
}
}
})
}
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("bdkxm"),function(obj,id,value){
adddetail();
});
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("ksrq"),function(obj,id,value){
adddetail();
});
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("jsrq"),function(obj,id,value){
adddetail();
}); });
</script> </script>

@ -122,6 +122,12 @@
} }
}else { }else {
let errorData = res.data.errorInfo; let errorData = res.data.errorInfo;
WfForm.changeFieldValue(WfForm.convertFieldNameToId("jbsc", "detail_1")+"_"+rowindex, {
value: ''
});
WfForm.changeFieldValue(WfForm.convertFieldNameToId("gsrq", "detail_1")+"_"+rowindex, {
value: WfForm.getFieldValue(WfForm.convertFieldNameToId("ksrq","detail_1")+"_"+rowindex)
});
if (errorData.length >0){ if (errorData.length >0){
WfForm.showMessage(errorData[0], 2, 10); WfForm.showMessage(errorData[0], 2, 10);

Loading…
Cancel
Save