Merge remote-tracking branch 'origin/main'

# Conflicts:
#	src/com/engine/common/util/CommonUtil.java
zm_dev
sy 1 year ago
commit 5b933ca3bf

@ -1 +1 @@
<EFBFBD><EFBFBD><EFBFBD>}<EFBFBD><EFBFBD><EFBFBD>p<EFBFBD>Z譿<EFBFBD>y<EFBFBD>Q<EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>}<EFBFBD><EFBFBD><EFBFBD>p<EFBFBD>Z譿<EFBFBD>y<EFBFBD>Q<EFBFBD><EFBFBD>

@ -10,20 +10,17 @@
</component>
<component name="ChangeListManager">
<list default="true" id="baeb3dfb-5097-46c5-933e-6d1dab18b815" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/src/com/engine/attendance/workflow/cmd/GetEliminationsEvctionListCmd.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/dataSources/ade958e9-d72b-48ba-8be1-0441de7da9a5/entities/entities.dat" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/ade958e9-d72b-48ba-8be1-0441de7da9a5/entities/entities.dat" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/dataSources/ade958e9-d72b-48ba-8be1-0441de7da9a5/entities/entities.dat.values" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/ade958e9-d72b-48ba-8be1-0441de7da9a5/entities/entities.dat.values" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/dataSources/ade958e9-d72b-48ba-8be1-0441de7da9a5/entities/entities.dat.values.at" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/ade958e9-d72b-48ba-8be1-0441de7da9a5/entities/entities.dat.values.at" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/dataSources/ade958e9-d72b-48ba-8be1-0441de7da9a5/entities/entities.dat.values.s" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/ade958e9-d72b-48ba-8be1-0441de7da9a5/entities/entities.dat.values.s" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/dataSources/ade958e9-d72b-48ba-8be1-0441de7da9a5/entities/entities.dat_i" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/ade958e9-d72b-48ba-8be1-0441de7da9a5/entities/entities.dat_i" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/artifacts/hrm_attendance/hrm-attendance.jar" beforeDir="false" afterPath="$PROJECT_DIR$/out/artifacts/hrm_attendance/hrm-attendance.jar" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/engine/attendance/workflow/service/ProcessSubmitCheckService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/engine/attendance/workflow/service/ProcessSubmitCheckService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/engine/attendance/workflow/service/impl/ProcessSubmitCheckServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/engine/attendance/workflow/service/impl/ProcessSubmitCheckServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/engine/attendance/workflow/web/BusinessTripsApplyApi.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/engine/attendance/workflow/web/BusinessTripsApplyApi.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/engine/attendance/workflow/web/ProcessSubmitCheckApi.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/engine/attendance/workflow/web/ProcessSubmitCheckApi.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/engine/attendance/workflow/action/RevokeLeaveAction.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/engine/attendance/workflow/action/RevokeLeaveAction.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/engine/attendance/workflow/cmd/GetKqCycleTimeIntervalCmd.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/engine/attendance/workflow/cmd/GetKqCycleTimeIntervalCmd.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/engine/attendance/vacation/cmd/VocationCmd.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/engine/attendance/vacation/cmd/VocationCmd.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/engine/attendance/vacation/job/holidaygeneration/tactics/ByIntervalPayMentWay.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/engine/attendance/vacation/job/holidaygeneration/tactics/ByIntervalPayMentWay.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/engine/attendance/vacation/job/holidaygeneration/tactics/BySchedulePaymentWay.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/engine/attendance/vacation/job/holidaygeneration/tactics/BySchedulePaymentWay.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/engine/attendance/vacation/job/holidaygeneration/tactics/SinglePaymentInFullWay.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/engine/attendance/vacation/job/holidaygeneration/tactics/SinglePaymentInFullWay.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/engine/attendance/vacation/util/VocationCommonUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/engine/attendance/vacation/util/VocationCommonUtil.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -35,8 +32,8 @@
<list>
<option value="FxmlFile" />
<option value="Kotlin Class" />
<option value="Interface" />
<option value="Enum" />
<option value="Interface" />
<option value="Class" />
</list>
</option>
@ -66,9 +63,9 @@
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File" value="PLAIN_TEXT" />
<property name="last_directory_selection" value="$PROJECT_DIR$/src/com/engine/kq" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../../easyentry" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.last.edited" value="Artifacts" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.14124292" />
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
@ -86,13 +83,18 @@
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="com.engine.attendance.workflow.action" />
<recent name="com.api.attendance.workflow" />
<recent name="com.engine.attendance.workflow.enums" />
<recent name="com.engine.common.util" />
<recent name="com.engine.kq.biz" />
<recent name="com.api.kq.browser.service.impl.jucailin" />
<recent name="com.engine.jucailin.cmd.cycle" />
</key>
</component>
<component name="RunManager" selected="Application.TestObj">
<component name="RunAnythingCache">
<option name="myCommands">
<command value="organzationList" />
</option>
</component>
<component name="RunManager" selected="Application.TestMain">
<configuration name="Test" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Test" />
<module name="hrm-attendance" />
@ -115,6 +117,14 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TestMethod" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="TestMethod" />
<module name="hrm-attendance" />
<shortenClasspath name="MANIFEST" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TestObj" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="TestObj" />
<module name="hrm-attendance" />
@ -137,16 +147,13 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="generated-requests#1" type="HttpClient.HttpRequestRunConfigurationType" factoryName="HTTP Request" temporary="true" path="$APPLICATION_CONFIG_DIR$/scratches/generated-requests.http" runType="Run single request">
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.TestMain" />
<item itemvalue="Application.TestMethod" />
<item itemvalue="Application.TestObj" />
<item itemvalue="Application.TestOneTimePayMentWay" />
<item itemvalue="Application.Test" />
<item itemvalue="Application.TestMain" />
<item itemvalue="HTTP Request.generated-requests#1" />
</list>
</recent_temporary>
</component>
@ -486,7 +493,19 @@
<workItem from="1710984188934" duration="25917000" />
<workItem from="1711070917436" duration="19301000" />
<workItem from="1711344507598" duration="4516000" />
<workItem from="1711419500615" duration="617000" />
<workItem from="1711419500615" duration="9736000" />
<workItem from="1711503987509" duration="18566000" />
<workItem from="1711537146832" duration="4748000" />
<workItem from="1711589154079" duration="31495000" />
<workItem from="1711675265773" duration="6499000" />
<workItem from="1711690112141" duration="1413000" />
<workItem from="1711693040160" duration="12896000" />
<workItem from="1711952005002" duration="9518000" />
<workItem from="1712020250580" duration="29664000" />
<workItem from="1712065821130" duration="2114000" />
<workItem from="1712107764009" duration="8487000" />
<workItem from="1712122093628" duration="7701000" />
<workItem from="1712137663376" duration="1779000" />
</task>
<servers />
</component>
@ -529,14 +548,6 @@
<line>301</line>
<option name="timeStamp" value="28" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-method">
<url>file://$PROJECT_DIR$/src/com/engine/attendance/workflow/service/BusinessTripsApplyService.java</url>
<line>5</line>
<properties class="com.engine.attendance.workflow.service.BusinessTripsApplyService" method="getBusinessTripsApplyList">
<option name="EMULATED" value="true" />
</properties>
<option name="timeStamp" value="76" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
<watches-manager>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,15 @@
package com.api.attendance.workflow;
import com.engine.attendance.workflow.web.AskForLeaveAction;
import lombok.extern.slf4j.Slf4j;
import javax.ws.rs.Path;
/**
*
*/
@Path("/attendance/askforleave")
@Slf4j
public class AskForLeaveActionApi extends AskForLeaveAction {
}

@ -267,7 +267,8 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
if (Util.null2String(needClockIn.get("tqdkfzs")).equals("") && !"".equals(getBeforeClockTime(needClockDateList,dtkssj))){
tqdkfzs = DateUtil.getBetWeenMinutes(getBeforeClockTime(needClockDateList,dtkssj),dtkssj);
}else {
tqdkfzs = Integer.valueOf(Util.null2String(needClockIn.get("tqdkfzs")));
tqdkfzs = Integer.valueOf(needClockIn.get("tqdkfzs") == null?"0":needClockIn.get("tqdkfzs").toString());
}
Map<String, Map<String, Object>> ksdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(dtkssj, clockInTimeList);
@ -304,7 +305,7 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
if (Util.null2String(needClockIn.get("thdkfzs")).equals("") && !"".equals(getNextClockTime(needClockDateList,dtjssj))){
thdkfzs = DateUtil.getBetWeenMinutes(dtjssj,getNextClockTime(needClockDateList,dtjssj));
}else {
thdkfzs = Integer.valueOf(Util.null2String(needClockIn.get("thdkfzs")));
thdkfzs = Integer.valueOf(needClockIn.get("thdkfzs") == null?"0":needClockIn.get("thdkfzs").toString());
}
if (DateUtil.getTime(dtkssj).compareTo(DateUtil.getTime(dtjssj)) > 0) {

@ -85,12 +85,12 @@ public class PersonGroupServiceImpl extends Service implements PersonGroupServic
List<Map<String,String>> dataList = Utils.resolveList_Map(data);
//清空原有数据
String sql = "delete from kq_groupmember where modeid=? and dataid =?";
String sql = "delete from uf_jcl_syzz where modeid=? and dataid =?";
RecordSet rs = new RecordSet();
boolean updateResult = DbTools.update(rs,sql,modeId,billId);
List<List> addLists = new ArrayList<>();
log.info("updateResult : {}",updateResult);
String insertSql = "insert into kq_groupmember (dxlx,dx,aqjb,modeid,dataid) values (?,?,?,?,?)";
String insertSql = "insert into uf_jcl_syzz (dxlx,dx,aqjb,modeid,dataid) values (?,?,?,?,?)";
if (updateResult){
dataList.forEach(e->{
ArrayList<Object> list = new ArrayList<>();

@ -4,13 +4,16 @@ import com.engine.attendance.component.persongroup.job.scheduling.tactics.Regula
import com.engine.attendance.vacation.job.holidaygeneration.tactics.HolidayGenerationWay;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.common.util.DbTools;
import com.engine.common.util.Utils;
import com.engine.core.interceptor.CommandContext;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import weaver.general.Util;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
public class VocationCmd extends AbstractCommonCommand<Map<String,Object>> {
@ -40,6 +43,7 @@ public class VocationCmd extends AbstractCommonCommand<Map<String,Object>> {
vocation.put("qsrqValue",qsrq);
vocation.put("yjzdValue",yjzd);
vocation.put("ljcrglyfslwzValue",ljcrglyfslwz);
vocation.put("zyzValue",getUserIds(vocation));
}
log.info("VocationCmd params: [{}]",params);
String edfffs = Util.null2String(vocationList.get(0).get("edfffs"));
@ -51,4 +55,17 @@ public class VocationCmd extends AbstractCommonCommand<Map<String,Object>> {
return null;
}
public List<String> getUserIds(Map<String,Object> vocation){
List<String> userIds = Lists.newArrayList();
String edyj = Util.null2String(vocation.get("edyj"));
if (edyj.equals("3") || edyj.equals("4")){
String zyz = Util.null2String(vocation.get("zyz"));
zyz = zyz.replace("","and");
zyz = zyz.replace("","or");
List<Map<String,Object>> dataList = DbTools.getSqlToList(zyz);
userIds = dataList.stream().map(e->Util.null2String(e.get("id"))).collect(Collectors.toList());
}
return userIds;
}
}

@ -100,9 +100,9 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
//工龄小于1年的新员工,且额度有效期单位为自然年
if (allMonths < 12 && edyxq.equals(StartingUnitEnum.NATURAL_YEAR.getKey())) {
if (QuotaChangeMethodEnum.CONVERT.getKey().equals(edbgsedclfs) || CheckBoxEnum.CHECKED.getKey().equals(schdedablzs)) {
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate,userId);
}else {
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT,releaseDate);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT,releaseDate,userId);
}
if (CheckBoxEnum.CHECKED.getKey().equals(schdedkzsxrq)) {
int seniority = "".equals(ljcrglyfslwz)?0:Double.valueOf(ljcrglyfslwz).intValue();
@ -120,12 +120,12 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
if (CheckBoxEnum.CHECKED.getKey().equals(rzdqedablzs) && betweenMonth < 12
&& sxrq.split("-")[0].equals(releaseDate.split("-")[0]) && releaseDate.split("-")[0].equals(qsrq.split("-")[0])) {
//入职不满一年,且入职当期额度按比例折算
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate,userId);
}else {
if (QuotaChangeMethodEnum.CONVERT.getKey().equals(edbgsedclfs)) {
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate,userId);
} else if (QuotaChangeMethodEnum.NO_CONVERT.getKey().equals(edbgsedclfs)) {
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT,releaseDate);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT,releaseDate,userId);
}
}
@ -140,7 +140,7 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
int betweenYear = DateUtil.getBetWeenYears(qsrq,releaseDate.split(" ")[0]);
allMonths = Double.valueOf(ljcrglyfslwz).intValue();
int intervalYear = allMonths / 12+betweenYear;
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, intervalYear, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, intervalYear, yjzd,userId);
double edktsc = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
int days = 0;
if (DateUtil.getTime(qsrq).compareTo(DateUtil.getTime(sxrq)) >=0){
@ -165,7 +165,7 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
betweenMonth = DateUtil.getBetWeenMonths(qsrq,sxrq);
allMonths = betweenMonth+Double.valueOf(ljcrglyfslwz).intValue();
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allMonths, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allMonths, yjzd,userId);
int days = DateUtil.getBetWeenDays(sxrq,releaseDate.split(" ")[0])+1;
if (days <0){
days=0;
@ -186,7 +186,7 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
betweenMonth = DateUtil.getBetWeenMonths(qsrq,sxrq);
allMonths = betweenMonth+Double.valueOf(ljcrglyfslwz).intValue();
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allMonths, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allMonths, yjzd,userId);
double edktsc = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
int days = DateUtil.getBetWeenDays(sxrq,releaseDate.split(" ")[0])+1;
if (days <0){
@ -213,7 +213,7 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
betweenDays = 0;
}
allWorkDays = Double.valueOf(ljcrglyfslwz).intValue()*30+betweenDays;
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays/7, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays/7, yjzd,userId);
double edktsc = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
int days = DateUtil.getBetWeenDays(sxrq,releaseDate.split(" ")[0])+1;
@ -240,7 +240,7 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
betweenDays=0;
}
allWorkDays = Double.valueOf(ljcrglyfslwz).intValue()*30+betweenDays;
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays/7, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays/7, yjzd,userId);
int days = DateUtil.getBetWeenDays(sxrq,releaseDate.split(" ")[0])+1;
if (days <0){
days=0;
@ -253,7 +253,7 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
//自然天
betweenDays = DateUtil.getBetWeenDays(qsrq,sxrq)+1;
allWorkDays = Double.valueOf(ljcrglyfslwz).intValue()*30+betweenDays;
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays, yjzd,userId);
restTime = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
}
insertHoliDayParam.put("ktsc", restTime);
@ -263,7 +263,7 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
return insertHoliDayParam;
}
public double getRestTime(Map<String, Object> insertHoliDayParam,List<Map<String, Object>> vocationList,QuotaChangeMethodEnum changeMethodEnum,String releaseDate){
public double getRestTime(Map<String, Object> insertHoliDayParam,List<Map<String, Object>> vocationList,QuotaChangeMethodEnum changeMethodEnum,String releaseDate,String userId){
String sxrq = insertHoliDayParam.get("sxrq").toString();
String qsrq = Util.null2String(vocationList.get(0).get("qsrqValue"));
String nextSxrq = DateUtil.nextYear(sxrq,1,DateUtil.yyyyMMdd);
@ -304,8 +304,8 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
endYearMonth = endYearMonth+seniority;
int beginYear = beginYearMonth/12;
int endYear = endYearMonth/12;
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd);
Map<String,Object> endYearmap = VocationCommonUtil.getVocationMap(vocationList, endYear, yjzd);
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, 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 endEdktsc = Double.valueOf(endYearmap.get("edktsc") == null? "0" :Util.null2String(endYearmap.get("edktsc")));
@ -366,7 +366,7 @@ public class ByIntervalPayMentWay implements HolidayGenerationWay{
}
beginYearMonth = beginYearMonth+seniority;
int beginYear = beginYearMonth/12;
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd);
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd,userId);
double beginEdktsc = Double.valueOf(beginYearmap.get("edktsc") == null? "0" :Util.null2String(beginYearmap.get("edktsc")));
int days = 0;
if (DateUtil.getTime(qsrq).compareTo(DateUtil.getTime(sxrq)) >=0){

@ -126,9 +126,9 @@ public class BySchedulePaymentWay implements HolidayGenerationWay{
if (QuotaChangeMethodEnum.CONVERT.getKey().equals(edbgsedclfs) || CheckBoxEnum.CHECKED.getKey().equals(schdedablzs)) {
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate,userId);
} else {
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT,releaseDate);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT,releaseDate,userId);
}
if (CheckBoxEnum.CHECKED.getKey().equals(schdedkzsxrq)) {
int seniority = "".equals(ljcrglyfslwz)?0:Double.valueOf(ljcrglyfslwz).intValue();
@ -147,17 +147,17 @@ public class BySchedulePaymentWay implements HolidayGenerationWay{
if (CheckBoxEnum.CHECKED.getKey().equals(rzdqedablzs) && betweenMonth < 12
&& sxrq.split("-")[0].equals(releaseDate.split("-")[0]) && releaseDate.split("-")[0].equals(qsrq.split("-")[0])) {
//起算年和发生日期在同一年,生成假期为起算年的当年
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate,userId);
} else {
if (QuotaChangeMethodEnum.CONVERT.getKey().equals(edbgsedclfs)) {
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,releaseDate,userId);
} else if (QuotaChangeMethodEnum.NO_CONVERT.getKey().equals(edbgsedclfs)) {
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT,releaseDate);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT,releaseDate,userId);
}
}
}else if (edyxq.equals(StartingUnitEnum.STARTING_YEAR.getKey())){
int betweenYear = DateUtil.getBetWeenYears(qsrq,releaseDate.split(" ")[0]);
Map<String,Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList,betweenYear,yjzd);
Map<String,Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList,betweenYear,yjzd,userId);
int occurMonths = DateUtil.getTime(releaseDate).getMonthValue();
int StartMonths = DateUtil.getTime(qsrq).getMonthValue();
@ -182,7 +182,7 @@ public class BySchedulePaymentWay implements HolidayGenerationWay{
return insertHoliDayParam;
}
public double getRestTime(Map<String, Object> insertHoliDayParam,List<Map<String, Object>> vocationList,QuotaChangeMethodEnum changeMethodEnum,String releaseDate){
public double getRestTime(Map<String, Object> insertHoliDayParam,List<Map<String, Object>> vocationList,QuotaChangeMethodEnum changeMethodEnum,String releaseDate,String userId){
String sxrq = insertHoliDayParam.get("sxrq").toString();
String qsrq = Util.null2String(vocationList.get(0).get("qsrqValue"));
String nextSxrq = DateUtil.nextYear(sxrq,1,DateUtil.yyyyMMdd);
@ -221,8 +221,8 @@ public class BySchedulePaymentWay implements HolidayGenerationWay{
int beginYear = beginYearMonth/12;
int endYear = endYearMonth/12;
int endYearRemainder = endYearMonth%12;
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd);
Map<String,Object> endYearmap = VocationCommonUtil.getVocationMap(vocationList, endYear, yjzd);
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, 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 endEdktsc = Double.valueOf(endYearmap.get("edktsc") == null? "0" :Util.null2String(endYearmap.get("edktsc")));
@ -278,7 +278,7 @@ public class BySchedulePaymentWay implements HolidayGenerationWay{
}
beginYearMonth = beginYearMonth+seniority;
int beginYear = beginYearMonth/12;
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd);
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd,userId);
restTime = getRestTime(releaseDateMonths,beginYearmap);
}
return restTime;

@ -134,11 +134,11 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
// //起算年在发生日期的上一年,生成假期为起算年的后第二年
// restTime = edktsc;
// }
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,userId);
} else {
// restTime = edktsc;
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT,userId);
}
@ -165,7 +165,7 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
// int days = DateUtil.getBetWeenDays(qsrq, releaseDate.split(" ")[0]) + 1;
// int yearDays = DateUtil.getDays(qsrq, Calendar.DAY_OF_YEAR);
// restTime = VocationCommonUtil.computeRestDays(days, yearDays, edktsc, wscl);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,userId);
} else {
//
// if (!sxrq.split("-")[0].equals(releaseDate.split("-")[0]) && releaseDate.split("-")[0].equals(qsrq.split("-")[0])) {
@ -209,10 +209,10 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
// } else {
// restTime = edktsc;
// }
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.CONVERT,userId);
} else if (QuotaChangeMethodEnum.NO_CONVERT.getKey().equals(edbgsedclfs)) {
// restTime = edktsc;
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT);
restTime = getRestTime(insertHoliDayParam,vocationList,QuotaChangeMethodEnum.NO_CONVERT,userId);
}
}
} else if (edyxq.equals(StartingUnitEnum.STARTING_YEAR.getKey())) {
@ -220,7 +220,7 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
//起算年
allMonths = Double.valueOf(ljcrglyfslwz).intValue();
int intervalYear = allMonths / 12+betweenYear;
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, intervalYear, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, intervalYear, yjzd,userId);
restTime = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
} else if (edyxq.equals(StartingUnitEnum.NATURAL_MONTH.getKey())){
//自然月
@ -230,7 +230,7 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
}
allMonths = betweenMonth+Double.valueOf(ljcrglyfslwz).intValue();
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allMonths, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allMonths, yjzd,userId);
restTime = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
} else if (edyxq.equals(StartingUnitEnum.STARTING_MONTH.getKey())){
@ -238,7 +238,7 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
betweenMonth = DateUtil.getBetWeenMonths(qsrq,sxrq);
allMonths = betweenMonth+Double.valueOf(ljcrglyfslwz).intValue();
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allMonths, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allMonths, yjzd,userId);
restTime = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
} else if (edyxq.equals(StartingUnitEnum.NATURAL_WEEK.getKey())){
//起自然周
@ -247,7 +247,7 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
betweenDays = 0;
}
allWorkDays = Double.valueOf(ljcrglyfslwz).intValue()*30+betweenDays;
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays/7, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays/7, yjzd,userId);
restTime = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
} else if (edyxq.equals(StartingUnitEnum.STARTING_WEEK.getKey())){
@ -257,14 +257,14 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
betweenDays=0;
}
allWorkDays = Double.valueOf(ljcrglyfslwz).intValue()*30+betweenDays;
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays/7, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays/7, yjzd,userId);
restTime = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
} else if (edyxq.equals(StartingUnitEnum.NATURAL_DAY.getKey())){
//自然天
betweenDays = DateUtil.getBetWeenDays(qsrq,sxrq)+1;
allWorkDays = Double.valueOf(ljcrglyfslwz).intValue()*30+betweenDays;
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays, yjzd);
Map<String, Object> vocationMap = VocationCommonUtil.getVocationMap(vocationList, allWorkDays, yjzd,userId);
restTime = vocationMap.size()>0?Double.valueOf(vocationMap.get("edktsc").toString()):0;
}
insertHoliDayParam.put("ktsc", restTime);
@ -277,7 +277,7 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
}
public double getRestTime(Map<String, Object> insertHoliDayParam,List<Map<String, Object>> vocationList,QuotaChangeMethodEnum changeMethodEnum){
public double getRestTime(Map<String, Object> insertHoliDayParam,List<Map<String, Object>> vocationList,QuotaChangeMethodEnum changeMethodEnum,String userId){
String sxrq = insertHoliDayParam.get("sxrq").toString();
String qsrq = Util.null2String(vocationList.get(0).get("qsrqValue"));
String nextSxrq = DateUtil.nextYear(sxrq,1,DateUtil.yyyyMMdd);
@ -303,8 +303,8 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
int beginYear = beginYearMonth/12;
int endYear = endYearMonth/12;
int endYearRemainder = endYearMonth%12;
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd);
Map<String,Object> endYearmap = VocationCommonUtil.getVocationMap(vocationList, endYear, yjzd);
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, 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 endEdktsc = Double.valueOf(endYearmap.get("edktsc") == null? "0" :Util.null2String(endYearmap.get("edktsc")));
@ -354,7 +354,7 @@ public class SinglePaymentInFullWay implements HolidayGenerationWay {
}
beginYearMonth = beginYearMonth+seniority;
int beginYear = beginYearMonth/12;
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd);
Map<String,Object> beginYearmap = VocationCommonUtil.getVocationMap(vocationList, beginYear, yjzd,userId);
double beginEdktsc = Double.valueOf(beginYearmap.get("edktsc") == null? "0" :Util.null2String(beginYearmap.get("edktsc")));
restTime=beginEdktsc;
}

@ -155,7 +155,7 @@ public class VocationCommonUtil {
* @param yjzd
* @return
*/
public static Map<String,Object> getVocationMap(List<Map<String,Object>> vocationList,int intervalDuration,String yjzd){
public static Map<String,Object> getVocationMap(List<Map<String,Object>> vocationList,int intervalDuration,String yjzd,String userId){
String edyj = Util.null2String(vocationList.get(0).get("edyj"));
List<Map<String,Object>> resultList = Lists.newArrayList();
@ -201,10 +201,26 @@ public class VocationCommonUtil {
}).collect(Collectors.toList());
}else if (edyj.equals("3")){
//自由值
resultList = vocationList.stream().filter(e->{
List<String> zyzValue = (List<String>)e.get("zyzValue");
return zyzValue.contains(userId);
}).collect(Collectors.toList());
}else if (edyj.equals("4")){
//自由值+间隔时长
resultList = vocationList.stream().filter(e->{
List<String> zyzValue = (List<String>)e.get("zyzValue");
//间隔时长起
double jgsc0 = Double.valueOf(Util.null2String(e.get("jgsc0")));
//间隔时长止
double jgsc1 = Double.valueOf(Util.null2String(e.get("jgsc1")));
if (intervalDuration >=jgsc0 && intervalDuration<=jgsc1 && zyzValue.contains(userId)){
return true;
}else {
return false;
}
}).collect(Collectors.toList());
}
if (resultList.size() > 0){
return resultList.get(0);

@ -1,81 +0,0 @@
package com.engine.attendance.workflow.action;
import com.engine.attendance.workflow.service.MakeUpClockInService;
import com.engine.attendance.workflow.service.impl.MakeUpClockInServiceImpl;
import com.engine.common.util.CommonUtil;
import com.engine.common.util.DateUtil;
import com.engine.common.util.ServiceUtil;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*/
@Slf4j
public class AskForLeaveCheckAction implements Action {
private MakeUpClockInService makeUpClockInService = ServiceUtil.getService(MakeUpClockInServiceImpl.class);
@Override
public String execute(RequestInfo requestInfo) {
String requestid = requestInfo.getRequestid();
// 流程表单主表数据
HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo);
// 流程表单明细表数据
List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo,0);
//补打卡人员
String qjry = mainTableData.get("qjry");
Map<String, Object> params = Maps.newHashMap();
params.put("userId",qjry);
params.put("submitDate", DateUtil.getCurrentDate());
Map<String,Object> dataMap = makeUpClockInService.getKqCycleTimeIntervalCmd(params);
List<Map<String,Object>> dateList = (List<Map<String,Object>>)dataMap.get("data");
boolean status = (boolean)dataMap.get("status");
if (!status){
log.error("该人员没有考勤周期");
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("该人员没有考勤周期!");
return Action.FAILURE_AND_CONTINUE;
}
if (dateList.size()==0){
log.error("申请人员当前时间没有考勤周期,请联系管理员!");
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("申请人员当前时间没有考勤周期,请联系管理员!");
return Action.FAILURE_AND_CONTINUE;
}
for (Map<String, String> detailTable:detailTableData){
String bdkrq = detailTable.get("ksrq");
boolean mark = true;
for (Map<String,Object> date:dateList){
//存在考勤周期内
String startDate = Util.null2String(date.get("startDate"));
String endDate = Util.null2String(date.get("endDate"));
if (DateUtil.getTime(startDate).compareTo(DateUtil.getTime(bdkrq)) <=0 &&
DateUtil.getTime(endDate).compareTo(DateUtil.getTime(bdkrq)) >=0){
mark = false;
}
}
if (mark){
//已关账
log.error("补打卡日期:{},已关账无法补打卡",bdkrq);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("补打卡日期:"+bdkrq+"所在考勤周期已经关账无法再补打卡!");
return Action.FAILURE_AND_CONTINUE;
}
}
return Action.SUCCESS;
}
}

@ -75,9 +75,9 @@ public class EliminationsAskForLeaveAction implements Action {
}
if (mark){
//已关账
log.error("补打卡日期:{},已关账无法补打卡",bdkrq);
log.error("销假日期:{},已关账无法销假",bdkrq);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("补打卡日期:"+bdkrq+"所在考勤周期已经关账无法再补打卡");
requestInfo.getRequestManager().setMessagecontent("销假日期:"+bdkrq+"不在当前月份对应考勤周期内无法再销假");
return Action.FAILURE_AND_CONTINUE;
}
}

@ -8,6 +8,7 @@ import com.engine.common.util.DbTools;
import com.engine.common.util.ServiceUtil;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
@ -27,6 +28,7 @@ public class EliminationsEvctionCheckAction implements Action {
@Override
public String execute(RequestInfo requestInfo) {
String requestid = requestInfo.getRequestid();
// 流程表单主表数据
HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo);
@ -75,9 +77,9 @@ public class EliminationsEvctionCheckAction implements Action {
}
if (mark){
//已关账
log.error("补打卡日期:{},已关账无法补打卡",bdkrq);
log.error("销差日期:{},已关账无法销差",bdkrq);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("补打卡日期:"+bdkrq+"所在考勤周期已经关账无法再补打卡");
requestInfo.getRequestManager().setMessagecontent("销差日期:"+bdkrq+"不在当前月份对应考勤周期内无法再销差");
return Action.FAILURE_AND_CONTINUE;
}
}

@ -68,9 +68,9 @@ public class EvctionCheckAction implements Action {
}
if (mark){
//已关账
log.error("补打卡日期:{},已关账无法补打卡",bdkrq);
log.error("出差日期:{},已关账无法提交出差",bdkrq);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("补打卡日期:"+bdkrq+"所在考勤周期已经关账无法再补打卡");
requestInfo.getRequestManager().setMessagecontent("出差日期:"+bdkrq+"不在当前月份对应考勤周期内无法再提交出差");
return Action.FAILURE_AND_CONTINUE;
}
}

@ -78,7 +78,7 @@ public class MakeUpClockInAction implements Action {
//已关账
log.error("补打卡日期:{},已关账无法补打卡",bdkrq);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("补打卡日期:"+bdkrq+"所在考勤周期已经关账无法再补打卡!");
requestInfo.getRequestManager().setMessagecontent("补打卡日期:"+bdkrq+"不在当前月份对应考勤周期内无法再补打卡!");
return Action.FAILURE_AND_CONTINUE;
}
}

@ -69,9 +69,9 @@ public class OvertimePlanCheckAction implements Action {
}
if (mark){
//已关账
log.error("补打卡日期:{},已关账无法补打卡",bdkrq);
log.error("加班计划日期:{},已关账无法提交",bdkrq);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("补打卡日期:"+bdkrq+"所在考勤周期已经关账无法再补打卡");
requestInfo.getRequestManager().setMessagecontent("加班计划日期:"+bdkrq+"不在当前月份对应考勤周期内无法再提交");
return Action.FAILURE_AND_CONTINUE;
}
}

@ -66,9 +66,9 @@ public class OvertimeResultCheckAction implements Action {
}
if (mark){
//已关账
log.error("补打卡日期:{},已关账无法补打卡",bdkrq);
log.error("加班结果日期:{},已关账无法补打卡",bdkrq);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("补打卡日期:"+bdkrq+"所在考勤周期已经关账无法再补打卡");
requestInfo.getRequestManager().setMessagecontent("加班结果日期:"+bdkrq+"不在当前月份对应考勤周期内无法再提交");
return Action.FAILURE_AND_CONTINUE;
}

@ -0,0 +1,135 @@
package com.engine.attendance.workflow.action;
import com.engine.attendance.enums.AccountingUnitEnum;
import com.engine.attendance.workflow.service.MakeUpClockInService;
import com.engine.attendance.workflow.service.impl.MakeUpClockInServiceImpl;
import com.engine.common.util.CommonUtil;
import com.engine.common.util.DateUtil;
import com.engine.common.util.DbTools;
import com.engine.common.util.ServiceUtil;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Cell;
import weaver.soa.workflow.request.DetailTable;
import weaver.soa.workflow.request.RequestInfo;
import weaver.soa.workflow.request.Row;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
import java.util.stream.Collectors;
/**
*
*/
@Slf4j
public class RevokeEliminationsAskForLeaveAction implements Action {
private MakeUpClockInService makeUpClockInService = ServiceUtil.getService(MakeUpClockInServiceImpl.class);
@Override
public String execute(RequestInfo requestInfo) {
log.info("RevokeEliminationsAskForLeaveAction,do action on request:" + requestInfo.getRequestid());
String requestid = requestInfo.getRequestid();
try {
// 流程表单主表数据
HashMap<String, String> mainTableData = CommonUtil.getMainTableInfo(requestInfo);
String qjlx = mainTableData.get("qjlx");
String queryItemsql = "select hsdw,hsl from uf_jcl_kq_kqxm where id=?";
Map<String, Object> holidayItem = DbTools.getSqlToMap(queryItemsql, qjlx);
DetailTable[] detailTable = requestInfo.getDetailTableInfo().getDetailTable();
log.info("RevokeLeaveAction detailTable : [{}], length : {}", Arrays.toString(detailTable), detailTable.length);
List<Map<String, String>> updateList = new ArrayList<>();
if (detailTable.length > 0) {
for (DetailTable dt : detailTable) {
//明细表
Row[] s = dt.getRow();
for (Row r : s) {
//行
Cell[] h = r.getCell();
Map<String, String> itemMap = new HashMap<>();
for (Cell c : h) {
//列
String name = Util.null2String(c.getName());
log.info("RevokeLeaveAction key : {}, value : {}",c.getName(), c.getValue());
if ("cxsm".equals(name)) {
itemMap.put("cxsm", Util.null2String(c.getValue()));
}
if ("cxlyid".equals(name)) {
itemMap.put("cxlyid", Util.null2String(c.getValue()));
}
if ("cx".equals(name)) {
itemMap.put("cx", Util.null2String(c.getValue()));
}
}
log.info("RevokeEliminationsAskForLeaveAction itemMap : [{}]",itemMap);
if (Util.null2String(itemMap.get("cx")).equals("1")) {
updateList.add(itemMap);
}
}
}
}
log.info("RevokeLeaveAction updateList : [{}]",updateList);
if (updateList.size() > 0) {
updateList.forEach(f -> {
if (StringUtils.isNotBlank(f.get("cxlyid"))) {
String sql = "update uf_jcl_kq_qjjl_dt1" +" set "+"cxly=0,cxqj=1,cxsm=?,cxid=? where id = ?";
log.info("RevokeEliminationsAskForLeaveAction sql : [{}]",sql);
DbTools.update(sql, Util.null2String(f.get("cxsm")), requestid, f.get("cxlyid"));
log.info("RevokeEliminationsAskForLeaveAction cxsm : {}, requestid : {}, cxlyid : {}",Util.null2String(f.get("cxsm")), requestid, f.get("cxlyid"));
updateHoliday(f.get("cxlyid"),holidayItem.get("hsdw").toString());
}
});
}
} catch (Exception e) {
log.info("流程数据报错:RevokeLeaveAction:");
StringWriter errorsWriter = new StringWriter();
e.printStackTrace(new PrintWriter(errorsWriter));
log.info(errorsWriter.toString());
requestInfo.getRequestManager().setMessageid("11111" + requestInfo.getRequestid() + "22222");
requestInfo.getRequestManager().setMessagecontent("【更改请假撤销状态action】报错请联系管理员");
return Action.FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
/**
*
* @param dt1Id
* @param hsdw
*/
public void updateHoliday(String dt1Id,String hsdw){
String sql = "select a.glmxid,a.jqye,sysc,b.qjsc,b.qtj,b.btj from uf_jcl_kq_qjjl_dt2 a left join uf_jcl_kq_qjjl_dt1 b on a.mainid=b.mainid and a.glrq=b.ksrq where b.id=?";
List<Map<String,Object>> dataList = DbTools.getSqlToList(sql,dt1Id);
log.info("updateHoliday dataList :[{}]",dataList);
Map<String,List<Map<String,Object>>> datagroupbyId = dataList.stream().collect(Collectors.groupingBy(e->e.get("jqye").toString()));
for(Map.Entry<String,List<Map<String,Object>>> entry: datagroupbyId.entrySet()){
String jqyeId = entry.getKey();
List<Map<String,Object>> list = entry.getValue();
double qjscTotal = list.stream().mapToDouble(e->Double.valueOf(e.get("qjsc").toString())).sum();
double qtjTotal = list.stream().mapToDouble(e->Double.valueOf(e.get("qtj").toString())).sum();
double btjTotal = list.stream().mapToDouble(e->Double.valueOf(e.get("qtj").toString())).sum();
double qjsc = 0;
if (AccountingUnitEnum.DAY.getKey().equals(hsdw)){
qjsc = qtjTotal+btjTotal;
}else if (AccountingUnitEnum.HOUR.getKey().equals(hsdw)){
qjsc = qjscTotal + (qtjTotal+btjTotal)*8;
}
sql = "update uf_jcl_kq_jqye set yxsc=yxsc-"+qjsc+",wxsc=wxsc+"+qjsc+" where id=?";
log.info("updateHoliday sql : [{}]",sql);
DbTools.update(sql,jqyeId);
}
}
}

@ -0,0 +1,87 @@
package com.engine.attendance.workflow.action.askforleave;
import com.engine.common.util.CommonUtil;
import com.engine.common.util.DbTools;
import com.engine.common.util.Utils;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
public class AskForLeaveWorkFlowArchivingAction implements Action {
@Override
public String execute(RequestInfo requestInfo) {
// 流程表单主表数据
HashMap<String,String> mainTableData = CommonUtil.getMainTableInfo(requestInfo);
log.info("mainTableData : [{}]",mainTableData);
// 流程表单明细表1数据
List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo,0);
log.info("detailTableData : [{}]",detailTableData);
//流程表单明细表2数据
List<Map<String, String>> detailTable2 = CommonUtil.getDetailTableInfo(requestInfo,1);
log.info("detailTableData : [{}]",detailTable2);
//请假人员
String qjry = mainTableData.get("qjry");
//实际假期类型
String jqlx = mainTableData.get("sjqjlx");
//第一笔开始时间
String firstStartDate = detailTableData.get(0).get("ksrq");
String sql = "select id,jqid,sxrq,ktsc,yxsc,wxsc,yqsxrq,ztsc from uf_jcl_kq_jqye where ygid=? and jqid=? and sxrq<=? and yqsxrq>=? order by sxrq";
List<Map<String,Object>> holidayBalanceList = DbTools.getSqlToList(sql,qjry,jqlx,firstStartDate,firstStartDate);
Map<String,Object> holidayBalanceMap = holidayBalanceList.stream().collect(Collectors.toMap(e->e.get("id").toString(), e->e));
try {
Map<String,Object> balanceMap = Maps.newHashMap();
for (Map<String, String> data : detailTable2){
String jqye = Util.null2String(data.get("jqye"));
double sysc = Double.valueOf(data.get("sysc").toString());
double havedSysc= balanceMap.get(jqye) ==null?0:Double.valueOf(balanceMap.get(jqye).toString());
sysc = Utils.add(sysc,havedSysc);
balanceMap.put(jqye,sysc);
}
for (Map.Entry<String,Object> entry:balanceMap.entrySet()){
String id = entry.getKey();
double ztsc = Double.valueOf(entry.getValue().toString());
Map<String,Object> map = (Map<String,Object>)holidayBalanceMap.get(id);
double havedztsc = Util.null2String(map.get("ztsc")).equals("") ? 0 : Double.valueOf(map.get("ztsc").toString());
double havedyxsc = Util.null2String(map.get("yxsc")).equals("") ? 0 : Double.valueOf(map.get("yxsc").toString());
double updatedztsc = Utils.subtract(havedztsc,ztsc);
double updatedwxsc = Utils.add(havedyxsc,ztsc);
String updateSql = "update uf_jcl_kq_jqye set yxsc=?,ztsc=? where id=?";
if (!DbTools.update(updateSql,updatedwxsc,updatedztsc,id)){
//更新假期余额失败
String message = "更新假期余额失败";
log.error(message);
requestInfo.getRequestManager().setMessageid("11111" + requestInfo.getRequestid() + "22222");
requestInfo.getRequestManager().setMessagecontent(message);
return Action.FAILURE_AND_CONTINUE;
}
}
}catch (Exception e){
log.error("AskForLeaveWorkFlowSubmitAction error : [{}]",e);
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
}

@ -0,0 +1,213 @@
package com.engine.attendance.workflow.action.askforleave;
import com.engine.attendance.enums.AccountingUnitEnum;
import com.engine.attendance.enums.CheckBoxEnum;
import com.engine.attendance.workflow.enums.AskAndEvctionWayEnum;
import com.engine.attendance.workflow.service.MakeUpClockInService;
import com.engine.attendance.workflow.service.impl.MakeUpClockInServiceImpl;
import com.engine.common.util.*;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
public class AskForLeaveWorkFlowSubmitAction implements Action {
private MakeUpClockInService makeUpClockInService = ServiceUtil.getService(MakeUpClockInServiceImpl.class);
@Override
public String execute(RequestInfo requestInfo) {
String requestid = requestInfo.getRequestid();
try {
// 流程表单主表数据
HashMap<String, String> mainTableData = CommonUtil.getMainTableInfo(requestInfo);
log.info("mainTableData : [{}]", mainTableData);
// 流程表单明细表1数据
List<Map<String, String>> detailTableData = CommonUtil.getDetailTableInfo(requestInfo, 0);
log.info("detailTableData : [{}]", detailTableData);
String detail2TableName = requestInfo.getDetailTableInfo().getDetailTable()[1].getTableDBName();
log.info("detail2TableName : [{}]", detail2TableName);
//请假人员
String qjry = mainTableData.get("qjry");
//实际假期类型
String jqlx = mainTableData.get("sjqjlx");
//第一笔开始时间
String firstStartDate = detailTableData.get(0).get("ksrq");
List<Map<String, Object>> detailTable2 = Lists.newArrayList();
/**
*
*/
Map<String, Object> params = Maps.newHashMap();
params.put("userId", qjry);
params.put("submitDate", DateUtil.getCurrentDate());
Map<String, Object> dataMap = makeUpClockInService.getKqCycleTimeIntervalCmd(params);
List<Map<String, Object>> dateList = (List<Map<String, Object>>) dataMap.get("data");
boolean status = (boolean) dataMap.get("status");
if (!status) {
log.error("该人员没有考勤周期");
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("该人员没有考勤周期!");
return Action.FAILURE_AND_CONTINUE;
}
if (dateList.size() == 0) {
log.error("申请人员当前时间没有考勤周期,请联系管理员!");
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("申请人员当前时间没有考勤周期,请联系管理员!");
return Action.FAILURE_AND_CONTINUE;
}
for (Map<String, String> detailTable : detailTableData) {
String bdkrq = detailTable.get("ksrq");
boolean mark = true;
for (Map<String, Object> date : dateList) {
//存在考勤周期内
String startDate = Util.null2String(date.get("startDate"));
String endDate = Util.null2String(date.get("endDate"));
if (DateUtil.getTime(startDate).compareTo(DateUtil.getTime(bdkrq)) <= 0 &&
DateUtil.getTime(endDate).compareTo(DateUtil.getTime(bdkrq)) >= 0) {
mark = false;
}
}
if (mark) {
//已关账
log.error("请假日期:{},已关账无法提交", bdkrq);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent("请假日期:" + bdkrq + "不在当前月份对应考勤周期内无法再提交请假!");
return Action.FAILURE_AND_CONTINUE;
}
}
/**
*
*/
String sql = "select id,jqid,sxrq,ktsc,yxsc,wxsc,yqsxrq,ztsc from uf_jcl_kq_jqye where ygid=? and jqid=? and sxrq<=? and yqsxrq>=? order by sxrq";
List<Map<String, Object>> holidayBalanceList = DbTools.getSqlToList(sql, qjry, jqlx, firstStartDate, firstStartDate);
Map<String, Object> holidayBalanceMap = holidayBalanceList.stream().collect(Collectors.toMap(e -> e.get("id").toString(), e -> e));
sql = "select id,mc,hsdw,hsl,jcbyxsyqjb,yxsydjb,qzsyyxjb from uf_jcl_kq_kqxm where id=?";
Map<String, Object> holidayItem = DbTools.getSqlToMap(sql, jqlx);
//假期核算单位
String hsdw = Util.null2String(holidayItem.get("hsdw"));
//请假方式
String cxjqj = mainTableData.get("cxjqj");
for (Map<String, String> detailData : detailTableData) {
String ksrq = detailData.get("ksrq");
//请假时间
double leaveDuration = 0;
if (cxjqj.equals(AskAndEvctionWayEnum.ALLDAY.getKey())) {
leaveDuration = 1;
} else if (cxjqj.equals(AskAndEvctionWayEnum.HALFDAY.getKey())) {
leaveDuration = 0.5;
} else if (cxjqj.equals(AskAndEvctionWayEnum.TIME_INTERVAL.getKey()) || cxjqj.equals(AskAndEvctionWayEnum.HOUR.getKey())) {
leaveDuration = Double.valueOf(Util.null2String(detailData.get("qjsc")));
}
if (hsdw.equals(AccountingUnitEnum.HOUR.getKey()) && (cxjqj.equals(AskAndEvctionWayEnum.ALLDAY.getKey()) || cxjqj.equals(AskAndEvctionWayEnum.HALFDAY.getKey()))) {
leaveDuration = leaveDuration * 8;
}
log.info("leaveDuration : [{}]", leaveDuration);
List<Map<String, Object>> holidayBalancefilterList = holidayBalanceList.stream().filter(e -> DateUtil.getTime(e.get("yqsxrq").toString()).compareTo(DateUtil.getTime(ksrq)) >= 0).collect(Collectors.toList());
for (Map<String, Object> holidayBalance : holidayBalancefilterList) {
//额定未休时长
double wxsc = holidayBalance.get("wxsc") == null ? 0 : Double.valueOf(holidayBalance.get("wxsc").toString());
if (leaveDuration > 0) {
Map<String, Object> detail2Map = Maps.newHashMap();
detail2Map.put("glmxid", detailData.get("id"));
detail2Map.put("jqye", holidayBalance.get("id"));
detail2Map.put("mainid", mainTableData.get("id"));
detail2Map.put("glrq", detailData.get("ksrq"));
if (leaveDuration > wxsc) {
detail2Map.put("sysc", wxsc);
leaveDuration = Utils.subtract(leaveDuration, wxsc);
wxsc = 0;
} else {
detail2Map.put("sysc", leaveDuration);
leaveDuration = 0;
wxsc = Utils.subtract(wxsc, leaveDuration);
}
detailTable2.add(detail2Map);
holidayBalance.put("wxsc", wxsc);
}
}
if (leaveDuration > 0) {
//假期余额不足
String message = ksrq + "对应的" + holidayItem.get("mc") + "假期余额不足!";
log.error(message);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent(message);
return Action.FAILURE_AND_CONTINUE;
}
}
log.info("detailTable2 : [{}]", detailTable2);
//更新流程明细表2
String delteSql = "delete from " + detail2TableName + " where mainid=?";
DbTools.update(delteSql, requestid);
if (!CommonUtil.insertBatch(detailTable2, detail2TableName)) {
//更新流程明细表2失败
String message = "更新流程明细表2失败";
log.error(message);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent(message);
return Action.FAILURE_AND_CONTINUE;
}
//更新假期余额在途时长
Map<String, Object> balanceMap = Maps.newHashMap();
for (Map<String, Object> data : detailTable2) {
String jqye = Util.null2String(data.get("jqye"));
double sysc = Double.valueOf(data.get("sysc").toString());
double havedSysc = balanceMap.get(jqye) == null ? 0 : Double.valueOf(balanceMap.get(jqye).toString());
sysc = Utils.add(sysc, havedSysc);
balanceMap.put(jqye, sysc);
}
for (Map.Entry<String, Object> entry : balanceMap.entrySet()) {
String id = entry.getKey();
double ztsc = Double.valueOf(entry.getValue().toString());
Map<String, Object> map = (Map<String, Object>) holidayBalanceMap.get(id);
double havedztsc = Util.null2String(map.get("ztsc")).equals("") ? 0 : Double.valueOf(map.get("ztsc").toString());
double havedwxsc = Util.null2String(map.get("wxsc")).equals("") ? 0 : Double.valueOf(map.get("wxsc").toString());
double updatedztsc = Utils.add(havedztsc, ztsc);
double updatedwxsc = Utils.subtract(havedwxsc, ztsc);
String updateSql = "update uf_jcl_kq_jqye set wxsc=?,ztsc=? where id=?";
if (!DbTools.update(updateSql, updatedwxsc, updatedztsc, id)) {
//更新假期余额失败
String message = "更新假期余额失败";
log.error(message);
requestInfo.getRequestManager().setMessageid("11111" + requestid + "22222");
requestInfo.getRequestManager().setMessagecontent(message);
return Action.FAILURE_AND_CONTINUE;
}
}
}catch (Exception e){
log.error("AskForLeaveWorkFlowSubmitAction error : [{}]",e);
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
}

@ -0,0 +1,74 @@
package com.engine.attendance.workflow.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.common.util.DbTools;
import com.engine.core.interceptor.CommandContext;
import lombok.extern.slf4j.Slf4j;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
public class GetAskForLeaveRecordListCmd extends AbstractCommonCommand<Map<String, Object>> {
public GetAskForLeaveRecordListCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
//获取主表id列表
String targetUserId = Util.null2String(params.get("targetUserId"));
String businessTripsType = Util.null2String(params.get("businessTripsType"));
String startDate = Util.null2String(params.get("startDate"));
String endDate = Util.null2String(params.get("endDate"));
log.info("targetUserId : {}, businessTripsType : {}, startDate : {}, endDate : {}",targetUserId, businessTripsType, startDate, endDate);
String sql = "select * from uf_jcl_kq_qjjl where qjry="+targetUserId;
if (!businessTripsType.equals("")) {
sql += " and jqlx = " + businessTripsType;
}
if (!startDate.equals("")) {
sql += " and ksrq >= '" + startDate+"'";
}
if (!endDate.equals("")) {
sql += " and jsrq <= '" + endDate+"'";
}
log.info(sql);
List<String> maidList = new ArrayList<>();
if (!targetUserId.equals("")) {
List<Map<String,Object>> datas = DbTools.getSqlToList(sql);
if (datas.size() > 0) {
datas.forEach(f -> {
maidList.add(f.get("id").toString());
});
}
}
log.info("maidList : [{}]",maidList);
//查询子表数据
if (maidList.size() > 0) {
String detailSql = "select a.id,a.cxqj,a.ksrq,a.kssj,a.jsrq,a.jssj,a.qjsc,a.qtj,a.btj,a.cxsm from uf_jcl_kq_qjjl_dt1 a where (a.cxqj is null or a.cxqj<>1) mainid in ("+String.join(",",maidList)+")";
List<Map<String,Object>> detailList = DbTools.getSqlToList(detailSql);
if (detailList.size() > 0) {
retmap.put("result", detailList);
} else {
retmap.put("result", null);
}
log.info("detailList : [{}]",detailList);
} else {
retmap.put("result", null);
}
return retmap;
}
}

@ -0,0 +1,33 @@
package com.engine.attendance.workflow.enums;
import com.finance.toolkit.BaseEnum;
/**
*
*/
public enum AskAndEvctionWayEnum implements BaseEnum {
ALLDAY("0","全天"),
TIME_INTERVAL("1","指定时间区间"),
HALFDAY("2","半天"),
HOUR("3","指定时间长度");
private String key;
private String value;
AskAndEvctionWayEnum(String key, String value){
this.key=key;
this.value=value;
}
@Override
public String getKey() {
return this.key;
}
@Override
public String getValue() {
return this.value;
}
}

@ -0,0 +1,9 @@
package com.engine.attendance.workflow.service;
import java.util.Map;
public interface AskForLeaveService {
Map<String, Object> getUesdHolidayItem(Map<String, Object> params);
Map<String, Object> getAskForLeaveRecordList(Map<String, Object> params);
}

@ -0,0 +1,110 @@
package com.engine.attendance.workflow.service.impl;
import com.engine.attendance.enums.CheckBoxEnum;
import com.engine.attendance.workflow.cmd.GetAskForLeaveRecordListCmd;
import com.engine.attendance.workflow.cmd.GetKqCycleTimeIntervalCmd;
import com.engine.attendance.workflow.service.AskForLeaveService;
import com.engine.common.exception.AttendanceRunTimeException;
import com.engine.common.util.DateUtil;
import com.engine.common.util.DbTools;
import com.engine.core.impl.Service;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import java.time.ZoneOffset;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
public class AskForLeaveServiceImpl extends Service implements AskForLeaveService {
@Override
public Map<String, Object> getUesdHolidayItem(Map<String, Object> params) {
Map<String,Object> resultMap = Maps.newHashMap();
// 流程表单主表数据
Map<String,String> mainTableData = (Map<String,String>)params.get("mainTableData");
// 流程表单明细表1数据
List<Map<String, String>> detailTableData = (List<Map<String, String>>)params.get("detailTableData");
detailTableData = detailTableData.stream().sorted(Comparator.comparing(e->DateUtil.getTime(e.get("ksrq")).toInstant(ZoneOffset.of("+8")).toEpochMilli())).collect(Collectors.toList());
//第一笔开始时间
String firstStartDate = detailTableData.get(0).get("ksrq");
//请假人员
String qjry = mainTableData.get("qjry");
//假期类型
String jqlx = mainTableData.get("jqlx");
String sql = "select id,mc,hsdw,hsl,jcbyxsyqjb,yxsydjb,qzsyyxjb from uf_jcl_kq_kqxm where id=?";
Map<String,Object> holidayItem = DbTools.getSqlToMap(sql,jqlx);
if (CheckBoxEnum.CHECKED.getKey().equals(holidayItem.get("qzsyyxjb")) &&
CheckBoxEnum.CHECKED.getKey().equals(holidayItem.get("jcbyxsyqjb"))){
Map<String,Object> holidayPriorityItem = DbTools.getSqlToMap(sql,holidayItem.get("yxsydjb"));
sql = "select id,jqid,sxrq,ktsc,yxsc,wxsc,yqsxrq,ztsc from uf_jcl_kq_jqye where ygid=? and jqid=? and sxrq<=? and yqsxrq>=? order by sxrq";
List<Map<String,Object>> holidayBalanceList = DbTools.getSqlToList(sql,qjry,holidayPriorityItem.get("id"),firstStartDate,firstStartDate);
Map<String,Object> useItemMap = Maps.newHashMap();
for (Map<String, String> detail:detailTableData){
String ksrq = detail.get("ksrq");
List<Map<String,Object>> list = holidayBalanceList.stream().filter(e-> DateUtil.getTime(e.get("yqsxrq").toString()).compareTo(DateUtil.getTime(ksrq))>=0).collect(Collectors.toList());
log.info("ksrq : [{}], list : [{}]",ksrq,list);
double totalUnearnedLeave = list.stream().mapToDouble(e->Double.valueOf(e.get("wxsc").toString())).sum();
if (totalUnearnedLeave == 0){
List<Map<String,String>> details = (List<Map<String,String>>)useItemMap.get(holidayItem.get("id"));
if (details == null){
details = Lists.newArrayList();
}
details.add(detail);
useItemMap.put(holidayItem.get("id").toString(),details);
}else {
List<Map<String,String>> details = (List<Map<String,String>>)useItemMap.get(holidayPriorityItem.get("id"));
if (details == null){
details = Lists.newArrayList();
}
details.add(detail);
useItemMap.put(holidayPriorityItem.get("id").toString(),details);
}
}
//需要使用到2种以上假期
if (useItemMap.size() > 1){
throw new AttendanceRunTimeException("优先使用的"+holidayPriorityItem.get("mc")+"余额不足");
}else {
if (useItemMap.get(holidayPriorityItem.get("id")) != null){
resultMap.put("jqlx",holidayPriorityItem.get("id"));
resultMap.put("hsdw",holidayPriorityItem.get("hsdw"));
resultMap.put("hsl",holidayPriorityItem.get("hsl"));
resultMap.put("mc",holidayPriorityItem.get("mc"));
resultMap.put("jcbyxsyqjb",CheckBoxEnum.CHECKED.getKey());
}else if (useItemMap.get(holidayItem.get("id")) != null){
resultMap.put("jqlx",jqlx);
resultMap.put("hsdw",holidayItem.get("hsdw"));
resultMap.put("hsl",holidayItem.get("hsl"));
resultMap.put("mc",holidayItem.get("mc"));
resultMap.put("jcbyxsyqjb",CheckBoxEnum.UNCHECKED.getKey());
}
}
}else {
resultMap.put("jqlx",jqlx);
resultMap.put("hsdw",holidayItem.get("hsdw"));
resultMap.put("hsl",holidayItem.get("hsl"));
resultMap.put("mc",holidayItem.get("mc"));
resultMap.put("jcbyxsyqjb",CheckBoxEnum.UNCHECKED.getKey());
}
return resultMap;
}
@Override
public Map<String, Object> getAskForLeaveRecordList(Map<String, Object> params) {
return commandExecutor.execute(new GetAskForLeaveRecordListCmd(params,user));
}
}

@ -0,0 +1,79 @@
package com.engine.attendance.workflow.web;
import com.engine.attendance.workflow.service.AskForLeaveService;
import com.engine.attendance.workflow.service.impl.AskForLeaveServiceImpl;
import com.engine.common.util.*;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;
/**
*
*/
@Slf4j
public class AskForLeaveAction {
private AskForLeaveService getAskForLeaveService(User user) {
return ServiceUtil.getService(AskForLeaveServiceImpl.class,user);
}
/**
*
* @return
*/
@GET
@Path("/getUesdHolidayItem")
@Produces({"text/plain"})
public String generateVocation(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
Map<String,Object> param = ParamUtil.request2Map(request);
User user = HrmUserVarify.getUser(request, response);
String mainTableDataStr = Util.null2String(param.get("mainTableData"));
String detailTableDataStr = Util.null2String(param.get("detailTableData"));
Gson gson = new Gson();
Map<String,Object> mainTableData = gson.fromJson(mainTableDataStr, (Type) Map.class);
List<Map<String, String>> detailTableData = gson.fromJson(detailTableDataStr, (Type) List.class);
param.put("mainTableData",mainTableData);
param.put("detailTableData",detailTableData);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getAskForLeaveService(user) :: getUesdHolidayItem,param);
}catch (Exception e){
log.error("sync fund status fail,catch error: [{}]",e);
return ApiReturnTools.error("200","查询失败");
}
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getAskForLeaveRecordList")
@Produces(MediaType.APPLICATION_JSON)
public String getAskForLeaveRecordList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getAskForLeaveService(user) :: getAskForLeaveRecordList,param);
}catch (Exception e){
log.error("execute fail,catch error: [{}]",e);
return ApiReturnTools.error("500","getBusinessTripsApplyList error");
}
}
}

@ -3,6 +3,7 @@ package com.engine.common.util;
import com.engine.attendance.component.persongroup.commonutil.PersongroupCommonUtil;
import com.engine.attendance.enums.ApplicableOrganizationEnum;
import com.google.common.collect.Maps;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import weaver.general.Util;
@ -59,6 +60,36 @@ public class CommonUtil {
}
/**
*
* @param dataList
* @param tableName
* @return
*/
public static boolean insertBatch(List<Map<String,Object>> dataList, String tableName){
String sql = "insert into "+tableName;
String key = "(";
String value = "(";
for (Map.Entry<String,Object> data : dataList.get(0).entrySet()){
key = key + data.getKey() +",";
value = value + "?,";
}
key = key.substring(0,key.length()-1) + ")";
value = value.substring(0,value.length()-1)+")";
sql = sql + key +" values "+value;
log.info("insertBatch sql :"+sql);
List<List> insertDataList = Lists.newArrayList();
for (Map<String,Object> dataMap : dataList){
ArrayList<Object> list = new ArrayList<>();
for (Map.Entry<String,Object> entry : dataMap.entrySet()){
list.add(entry.getValue());
}
insertDataList.add(list);
}
log.info("insertBatch : [{}]",insertDataList);
return DbTools.updateBatch(sql,insertDataList);
}
public static Set<String> getDataIds(String resourceId,String modeId,String startDate,String endDate){
String sql = "select dxlx,dataid,dx from uf_jcl_syzz where modeid=?";
@ -151,11 +182,13 @@ public class CommonUtil {
public static HashMap<String,String> getMainTableInfo(RequestInfo requestInfo){
HashMap<String,String> mainMap = new HashMap<String,String>();
Property[] properties = requestInfo.getMainTableInfo().getProperty();// 获取表单主字段信息
for (int i = 0; i < properties.length; i++) {
String name = properties[i].getName();// 主字段名称
String value = Util.null2String(properties[i].getValue());// 主字段对应的值
mainMap.put(name, value);
}
mainMap.put("id",String.valueOf(requestInfo.getRequestManager().getBillid()));
return mainMap;
}
@ -171,6 +204,7 @@ public class CommonUtil {
DetailTable[] detailtables = request.getDetailTableInfo().getDetailTable();// 获取明细表数据
if (detailtables.length > index) {
DetailTable dt = detailtables[index];// 获取明细表 0代表明细表1
Row[] rows = dt.getRow();// 获取明细表中所有行的信息
for (int i = 0; i < rows.length; i++) {
Row row = rows[i];// 获取具体行信息
@ -182,6 +216,7 @@ public class CommonUtil {
String value = cell.getValue();// 获取具体的值
map.put(name, value);
}
map.put("id",row.getId());
list.add(map);
}
}

@ -142,5 +142,9 @@ public class DbTools {
}
return sentenceSql;
}
public static boolean updateBatch(String sql,List<List> dataList){
RecordSet rs = thread.get();
return rs.executeBatchSql(sql,dataList);
}
}

@ -561,4 +561,14 @@ public class Utils<T> {
}
return resultList;
}
public static double subtract(double value1,double value2){
return new BigDecimal(value1).subtract(new BigDecimal(value2),new MathContext(BigDecimal.ROUND_HALF_DOWN)).doubleValue();
}
public static double add(double value1,double value2){
return new BigDecimal(value1).add(new BigDecimal(value2),new MathContext(BigDecimal.ROUND_HALF_DOWN)).doubleValue();
}
}

@ -0,0 +1,33 @@
import com.engine.common.util.DateUtil;
import com.google.common.collect.Lists;
import java.time.ZoneOffset;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class TestMethod {
public static void main(String[] args) {
// List<Map<String,Object>> detailTableData = Lists.newArrayList();
// detailTableData.add(new HashMap(){{
// put("ksrq","2024-02-18");
// put("sysc","1");
// }});
// detailTableData.add(new HashMap(){{
// put("ksrq","2024-01-18");
// put("sysc","1");
// }});
//
// detailTableData = detailTableData.stream().sorted(Comparator.comparing(e-> DateUtil.getTime(e.get("ksrq").toString()).toInstant(ZoneOffset.of("+8")).toEpochMilli())).collect(Collectors.toList());
// System.out.println(detailTableData);
List<Map<String,Object>> list = Lists.newArrayList();
double totalUnearnedLeave = list.stream().mapToDouble(e->Double.valueOf(e.get("wxsc").toString())).sum();
System.out.println(totalUnearnedLeave);
}
}

@ -13,5 +13,13 @@ public class K3CloudApiClientSon extends K3CloudApiClient {
public String GetSysReportData(String formid, String data) throws Exception {
return (String)this.execute("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.GetSysReportData", new Object[]{formid, data}, String.class);
}
public String queryXSDDSLTJ() throws Exception {
return (String)this.execute("SS.Count.WebApiService.XSDDSLTJ.ExecuteService,SS.Count.WebApiService", new Object[]{""}, String.class);
}
public String queryCGDDSLTJ() throws Exception {
return (String)this.execute("SS.Count.WebApiService.CGDDSLTJ.ExecuteService,SS.Count.WebApiService", new Object[]{""}, String.class);
}
public String querySCDDTJSL() throws Exception {
return (String)this.execute("SS.Count.WebApiService.SCDDTJSL.ExecuteService,SS.Count.WebApiService", new Object[]{""}, String.class);
}
}

@ -13,18 +13,38 @@ public class TestMain {
boolean result = client.login("20210629185713582","kingdee","Kingdee_898",2052);
System.out.println(result);
String view = client.GetSysReportData("PRD_MOExecuteDetailRpt","{\n" +
" \"FieldKeys\": \"FWORKSHOPID,FMOBILLNO,FMOENTRYSEQ,FSALEORDERENTRYSEQ\",\n" +
" \"SchemeId\": \"\",\n" +
" \"StartRow\": 0,\n" +
" \"Limit\": 2000,\n" +
" \"IsVerifyBaseDataField\": \"true\",\n" +
" \"Model\": {\n" +
" }\n" +
"}" )
;
// String view = client.query("PRD_MOExecuteDetailRpt","{\n" +
// " \"FieldKeys\": \"FWORKSHOPID,FMOBILLNO,FMOENTRYSEQ,FSALEORDERENTRYSEQ\",\n" +
// " \"SchemeId\": \"\",\n" +
// " \"StartRow\": 0,\n" +
// " \"Limit\": 2000,\n" +
// " \"IsVerifyBaseDataField\": \"true\",\n" +
// " \"Model\": {\n" +
// " \"FPrdOrgId\": \"180235\",\n" +
// " \"FBeginConveyDate\": \"2024-02-01\",\n" +
// " \"FEndConveyDate\": \"2024-12-31\",\n" +
// " \"FBeginPlanStartDate\": \"2024-02-01\",\n" +
// " \"FEndPlanStartDate\": \"2024-12-31\",\n" +
// " \"FBeginPlanFinishDate\": \"2024-02-01\",\n" +
// " \"FEndPlanFinishDate\": \"2024-12-31\",\n" +
// " \"FCtrlItem\": \"1\",\n" +
// " \"FIsSuspend\": \"0,1\",\n" +
// " \"FStatus\": \"3,4,5,6\",\n" +
// " \"FMOBillType\": \"123f39178eb2424c8449f992e1fff1ee,0e74146732c24bec90178b6fe16a2d1c,b7dd912d4ef545578f0f5d1d08cb2602,00232405fc58a68311e33257e9e17076,00505694499eb16411e3cd16dc62e287,005056945fca85e511e42420f363da25,574e87276ff23a\",\n" +
// " \"FWorkshopId\": [\n" +
// " {\n" +
// " \"FNumber\": \"BM000034\"\n" +
// " }\n" +
// " ],\n" +
// " \"FConveyDateInvolve\": true,\n" +
// " \"FStartDateInvolve\": true,\n" +
// " \"FFinishDateInvolve\": true\n" +
// " }\n" +
// "}" )
// ;
String view = client.queryXSDDSLTJ();
System.out.println(view);
// String view = client.view("AP_AgingAnalysis","{\n" +
// " \"FormId\": \"AP_AgingAnalysis\",\n" +
// " \"FieldKeys\": \"FContactUnitNumber\",\n" +

@ -0,0 +1,540 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:useBean id="strUtil" class="weaver.common.StringUtil" scope="page" />
<jsp:useBean id="dateUtil" class="weaver.common.DateUtil" scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="attProcSetManager" class="com.engine.kq.wfset.attendance.manager.HrmAttProcSetManager" scope="page" />
<%
%>
<script >
jQuery(document).ready(function(){
try{
//依据当前请假方式,对页面上的控件显示属性进行调整
resetAttr(WfForm.getFieldValue(WfForm.convertFieldNameToId("cxjqj")));
//是否自动产生明细记录标记
//考虑到影响明细记录的栏位如开始结束日期时间等发生变更时,需要重新生成明细,而请假方式变更时又需要对相应栏位的值做修改,所以添加这个开关,防止重复生成明细记录
var autodetail = true;
//假期类别值变更时,自动生成明细
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("jqlx"),function(obj,id,value){
//alert("jqlx change");
//关掉自动生成明细记录功能
autodetail = false;
//自动添加请假明细数据
adddetail();
//打开自动生成明细记录功能
autodetail = true;
detailtTable();
});
//请假人员值变更时,自动生成明细
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("qjry"),function(obj,id,value){
//alert("qjry change");
//关掉自动生成明细记录功能
autodetail = false;
//自动添加请假明细数据
adddetail();
//打开自动生成明细记录功能
autodetail = true;
detailtTable();
});
//请假方式变更时,同样进行页面显示属性的调整
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("cxjqj"),function(obj,id,value){
//alert("cxjqj change");
//关掉自动生成明细记录功能
autodetail = false;
//请假方式变更后,修改页面上的控件显示属性
resetAttr(value);
//自动添加请假明细数据
adddetail();
//打开自动生成明细记录功能
autodetail = true;
});
//是否每日重复时间段值变更时,自动生成明细
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("mtcfsdjq"),function(obj,id,value){
//alert("mtcfsdjq change");
//关掉自动生成明细记录功能
autodetail = false;
//自动添加请假明细数据
adddetail();
//打开自动生成明细记录功能
autodetail = true;
});
//开始日期变更后,自动重新生成明细
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("ksrq"),function(obj,id,value){
//alert("ksrq change");
if (autodetail){
autodetail = false;
adddetail();
autodetail = true;
}
detailtTable();
});
//结束日期变更后,自动重新生成明细
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("jsrq"),function(obj,id,value){
//alert("jsrq change");
if (autodetail){
autodetail = false;
adddetail();
autodetail = true;
}
detailtTable();
});
//开始时间变更后,自动重新生成明细
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("kssj"),function(obj,id,value){
//alert("kssj change");
if (autodetail){
autodetail = false;
adddetail();
autodetail = true;
}
});
//结束时间变更后,自动重新生成明细
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("jssj"),function(obj,id,value){
//alert("jssj change");
if (autodetail){
autodetail = false;
adddetail();
autodetail = true;
}
});
//请假时长发生变更后,自动重新生成明细
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("qjsc"),function(obj,id,value){
//alert("qjsc change");
if (autodetail){
autodetail = false;
adddetail();
autodetail = true;
}
});
//绑定全天假栏位值变更事件
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("qtj", "detail_1"),function(id,rowIndex,value){
//alert('qtj change');
if (autodetail){
autodetail = false;
if (value === '0')
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj", "detail_1")+"_"+rowIndex, {value:"1"});
else
WfForm.changeFieldValue(WfForm.convertFieldNameToId("btj", "detail_1")+"_"+rowIndex, {value:"0"});
var totalsc = getTotalsc();
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qjsc"), {value:totalsc});
autodetail = true;
}
});
//绑定半天假值变更事件
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("btj", "detail_1"),function(id,rowIndex,value){
//alert('btj change');
if (autodetail){
autodetail = false;
if (value === '0')
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj", "detail_1")+"_"+rowIndex, {value:"1"});
else
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qtj", "detail_1")+"_"+rowIndex, {value:"0"});
var totalsc = getTotalsc();
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qjsc"), {value:totalsc});
autodetail = true;
}
});
//绑定请假时长栏位值变更事件
WfForm.bindDetailFieldChangeEvent(WfForm.convertFieldNameToId("qjsc", "detail_1"),function(id,rowIndex,value){
//alert('qjsc change');
if (autodetail){
autodetail = false;
var totalsc = getTotalsc();
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qjsc"), {value:totalsc});
autodetail = true;
}
});
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("ksrq"),function(obj,id,value){
console.log("WfForm.bindFieldChangeEvent--",obj,id,value);
detailtTable();
});
WfForm.registerCheckEvent(WfForm.OPER_SAVE+","+WfForm.OPER_SUBMIT,function(callback){
//alert('OPER_SUBMIT');
let qjry = WfForm.getFieldValue(WfForm.convertFieldNameToId('qjry'));
let jqlx = WfForm.getFieldValue(WfForm.convertFieldNameToId('jqlx'));
if (jqlx == '' || jqlx == null || jqlx == undefined){
return;
}
let mainTableData = {
qjry:qjry,
jqlx:jqlx
}
let detailTableData = [];
let detailksrqField = WfForm.convertFieldNameToId('ksrq','detail_1');
var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(",");
for(var i=0; i<rowArr.length; i++){
var rowIndex = rowArr[i];
if(rowIndex !== ""){
var fieldMark = detailksrqField+"_"+rowIndex; //遍历明细行字段
detailTableData.push({
ksrq:WfForm.getFieldValue(fieldMark)
})
}
}
let data = {
mainTableData:JSON.stringify(mainTableData),
detailTableData:JSON.stringify(detailTableData)
}
console.log(data);
$.ajax({
url:'/api/attendance/askforleave/getUesdHolidayItem',
data:data,
type:'GET',
dataType:'json',
success:function(res){
let mark1 = true;
console.log(res)
if (res.api_status){
let data = res.data
//实际标记项目
WfForm.changeFieldValue(WfForm.convertFieldNameToId("sjqjlx"), {
value: data.jqlx,
specialobj:[
{id:data.jqlx,name:data.mc},
]
});
let hsdw = data.hsdw;
if (hsdw == '0'){ //天
let cxjqj = WfForm.getFieldValue(WfForm.convertFieldNameToId("cxjqj"));
if (cxjqj == '1' || cxjqj == '3'){
WfForm.changeFieldValue(WfForm.convertFieldNameToId("cxjqj"), {value:""});
WfForm.showMessage("假期核算单位为天只能选择半天或全天", 2, 10);
mark1 = false;
}
}
if (data.jcbyxsyqjb == '1'){
WfForm.showConfirm("优先使用"+data.mc+"项目的假期余额", function(){
if (mark1){
callback();
}else {
WfForm.showMessage("假期核算单位为天只能选择半天或全天", 2, 10);
}
},function (){
if (mark1){
callback();
}else {
WfForm.showMessage("假期核算单位为天只能选择半天或全天", 2, 10);
}
});
}else {
if (mark1){
callback();
}else {
WfForm.showMessage("假期核算单位为天只能选择半天或全天", 2, 10);
}
}
}else {
WfForm.showMessage(res.errormsg, 2, 10);
}
}
})
});
}catch (e) {
}
});
/**
*
* @param pleavetype 请假方式0全天请假1按时间区间请假2半天3按时间长度请假
*/
function resetAttr(pleavetype) {
//alert('resetAttr');
switch (pleavetype){
case '1'://按时间区间请假
WfForm.changeFieldValue(WfForm.convertFieldNameToId("scdw"),{ value: '1' });//请假时长单位为小时
//请假开始时间可编辑
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj"), 3);
//请假结束时间可编辑
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("jssj"), 3);
//请假时间长度不可编辑
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc"), 1);
break;
case '3'://按时间区间请假
WfForm.changeFieldValue(WfForm.convertFieldNameToId("scdw"),{ value: '1' });//请假时长单位为小时
//隐藏请假开始时间所在行(结束时间在同一行,不需要额外设置)
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj"), 5);
//请假时间长度可编辑
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc"), 3);
//每天请假时长默认为1小时
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qjsc"),{ value: '1' });
break;
default:
WfForm.changeFieldValue(WfForm.convertFieldNameToId("scdw"),{ value: '0' });//请假时长单位为小时
//隐藏请假开始时间所在行(结束时间在同一行,不需要额外设置)
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("kssj"), 5);
//请假时间长度不可编辑
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc"), 1);
break;
}
}
/**
* 自动添加请假明细
*/
function adddetail() {
//alert('adddetail');
//首先进行必填校验,不通过直接退出
if(!WfForm.verifyFormRequired(false, true)){ return; }
//获取请假时段类型0全天1指定时间区间2半天3指定时长长度
let ccsd = WfForm.getFieldValue(WfForm.convertFieldNameToId("cxjqj"));
//每天同时段请假1:是0
let mttsdcc = WfForm.getFieldValue(WfForm.convertFieldNameToId("mtcfsdjq"));
//开始日期
var ksrq = new Date(WfForm.getFieldValue(WfForm.convertFieldNameToId("ksrq")));
//结束日期
var jsrq = new Date(WfForm.getFieldValue(WfForm.convertFieldNameToId("jsrq")));
//开始时间
var kssj = WfForm.getFieldValue(WfForm.convertFieldNameToId("kssj"));
//结束时间
let jssj = WfForm.getFieldValue(WfForm.convertFieldNameToId("jssj"));
//请假时长
var qjsc = WfForm.getFieldValue(WfForm.convertFieldNameToId("qjsc"));
//清空第一明细所有记录
WfForm.delDetailRow("detail_1", "all");
//判断请假是否跨天
let v_overzero = jssj < kssj ? true : false;
//预置明细记录开始日期
var v_tmpbdate = new Date(ksrq);
//预置明细记录结束日期
var v_tmpedate = new Date(v_tmpbdate);
if (mttsdcc == '1') {
//首次循环时,明细开始与结束日期均等于主表开始日期,而主表结束日期一定大于等于开始日期,所以至少添加一笔明细
//当请假为跨天假时,每笔明细的结束日期会加一天
while(v_tmpedate <= jsrq && v_tmpedate <= jsrq){
//初始化明细记录
var addObj = {};
//添加开始日期字段信息
addObj[WfForm.convertFieldNameToId("ksrq", "detail_1")] = {value:v_tmpbdate};
if (ccsd === '1'){
//按时间区间请假逻辑
if (v_overzero){
//跨天时,明细记录的结束日期等于开始日期加一天
v_tmpedate = v_tmpedate.setDate(v_tmpbdate.getDate() + 1);
v_tmpedate = new Date(v_tmpedate);
}
//添加结束日期字段信息
addObj[WfForm.convertFieldNameToId("jsrq", "detail_1")] = {value:v_tmpedate};
//添加开始时间字段信息
addObj[WfForm.convertFieldNameToId("kssj", "detail_1")] = {value:kssj};
//添加结束时间字段信息
addObj[WfForm.convertFieldNameToId("jssj", "detail_1")] = {value:jssj};
//todo 调用接口计算开始结束时间区间内的工作时长;
//暂时先不调用接口,直接使用开始结束时间区间间隔小时数
var v_hours = (new Date(v_tmpedate+" "+jssj).getTime() - new Date(v_tmpbdate+" "+kssj).getTime())/(1000 * 60 * 60);
//超过8小时以8小时计
v_hours = Number(v_hours) > 8 ? 8 : Number(v_hours)
addObj[WfForm.convertFieldNameToId("qjsc", "detail_1")] = {value:v_hours};
}else{
//按时间长度请假或者全天、半天请假逻辑,
//此三种情况系统只需要知道员工当天班次上是希望请假的小数数或者是全天还是半天请假即可,与结束日期,开始及结束时间没有关系,所以相应的值均设置为空
//添加结束日期字段信息
addObj[WfForm.convertFieldNameToId("jsrq", "detail_1")] = {value:''};
//添加开始时间字段信息
addObj[WfForm.convertFieldNameToId("kssj", "detail_1")] = {value:''};
//添加结束时间字段信息
addObj[WfForm.convertFieldNameToId("jssj", "detail_1")] = {value:''};
if (ccsd == '0'){
//全天请假时,全天的标记打开
addObj[WfForm.convertFieldNameToId("qtj", "detail_1")] = {value:'1'};
}else if (ccsd == '2') {
//半天请假时,半天的标记打开
addObj[WfForm.convertFieldNameToId("btj", "detail_1")] = {value:'1'};
}else if (ccsd == '3'){
//按小数数请假时,将主表上的总请假时长当成每天请假时长进行赋值
addObj[WfForm.convertFieldNameToId("qjsc", "detail_1")] = {value:qjsc};
}
}
//追加明细记录
WfForm.addDetailRow("detail_1", 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{
//非每天同时段请假方式请假
//设置第一笔明细结束日期为请假开始日期加一天
v_tmpedate = v_tmpedate.setDate(v_tmpedate.getDate() + 1);
v_tmpedate = new Date(v_tmpedate);
while (v_tmpedate <= jsrq) {
var addObj = {};
addObj[WfForm.convertFieldNameToId("ksrq", "detail_1")] = {value:v_tmpbdate};
if (ccsd === '1'){
addObj[WfForm.convertFieldNameToId("jsrq", "detail_1")] = {value:v_tmpedate};
addObj[WfForm.convertFieldNameToId("kssj", "detail_1")] = {value:kssj};
addObj[WfForm.convertFieldNameToId("jssj", "detail_1")] = {value:"00:00"};
}else{
addObj[WfForm.convertFieldNameToId("jsrq", "detail_1")] = {value:''};
addObj[WfForm.convertFieldNameToId("kssj", "detail_1")] = {value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_1")] = {value:''};
if (ccsd == '0'){
addObj[WfForm.convertFieldNameToId("qtj", "detail_1")] = {value:'1'};
addObj[WfForm.convertFieldNameToId("btj", "detail_1")] = {value:'0'};
}else{
addObj[WfForm.convertFieldNameToId("qtj", "detail_1")] = {value:'0'};
addObj[WfForm.convertFieldNameToId("btj", "detail_1")] = {value:'1'};
}
}
//追加明细记录
WfForm.addDetailRow("detail_1", addObj);
v_tmpbdate = new Date(v_tmpedate);
kssj = '00:00';
//明细结束日期加一天
v_tmpedate = v_tmpedate.setDate(v_tmpedate.getDate() + 1);
v_tmpedate = new Date(v_tmpedate);
}
var addObj = {};
addObj[WfForm.convertFieldNameToId("ksrq", "detail_1")] = {value:v_tmpbdate};
if (ccsd === '1'){
addObj[WfForm.convertFieldNameToId("jsrq", "detail_1")] = {value:jsrq};
addObj[WfForm.convertFieldNameToId("kssj", "detail_1")] = {value:kssj};
addObj[WfForm.convertFieldNameToId("jssj", "detail_1")] = {value:jssj};
}else{
addObj[WfForm.convertFieldNameToId("jsrq", "detail_1")] = {value:''};
addObj[WfForm.convertFieldNameToId("kssj", "detail_1")] = {value:''};
addObj[WfForm.convertFieldNameToId("jssj", "detail_1")] = {value:''};
if (ccsd == '0')
addObj[WfForm.convertFieldNameToId("qtj", "detail_1")] = {value:'1'};
else
addObj[WfForm.convertFieldNameToId("btj", "detail_1")] = {value:'1'};
}
//追加明细记录
WfForm.addDetailRow("detail_1", addObj);
}
//添加完明细后,更新主表的总请假时长栏位信息
var totalsc = getTotalsc();
WfForm.changeFieldValue(WfForm.convertFieldNameToId("qjsc"), {value:totalsc});
//控制明细显示属性
var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(",");
for(var i=0; i<rowArr.length; i++){
var rowIndex = rowArr[i];
if(rowIndex !== ""){
switch(ccsd){
case '1'://按时间区间请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_1")+"_"+rowIndex, 1);//请假时长栏位设置只读
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qtj","detail_1")+"_"+rowIndex, 1);//全天假栏位设置只读
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("btj","detail_1")+"_"+rowIndex, 1);//半天假栏位设置只读
break;
case '3'://按时间长度请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_1")+"_"+rowIndex, 3);//请假时长栏位设置必填
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qtj","detail_1")+"_"+rowIndex, 1);//全天假栏位设置只读
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("btj","detail_1")+"_"+rowIndex, 1);//半天假栏位设置只读
break;
default://其他全天或者半天请假
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qjsc","detail_1")+"_"+rowIndex, 1);//请假时长栏位设置只读
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("qtj","detail_1")+"_"+rowIndex, 2);//全天假栏位设置可编辑
WfForm.changeFieldAttr(WfForm.convertFieldNameToId("btj","detail_1")+"_"+rowIndex, 2);//半天假栏位设置可编辑
break;
}
}
}
}
/**
* 计算明细总请假长度
*/
function getTotalsc(){
//alert('getTotalsc');
var ccsd = WfForm.getFieldValue(WfForm.convertFieldNameToId("cxjqj"));
var totalsc = 0;
var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(",");
for(var i=0; i<rowArr.length; i++){
var rowIndex = rowArr[i];
if(rowIndex !== ""){
if (ccsd == '3' || ccsd == '1')//累计小时时长
totalsc = Number(totalsc) + Number(WfForm.getFieldValue(WfForm.convertFieldNameToId("qjsc", "detail_1")+"_"+rowIndex));
else{
//累计天数时长
totalsc = Number(totalsc) +
Number(WfForm.getFieldValue(WfForm.convertFieldNameToId("qtj", "detail_1")+"_"+rowIndex)) +
Number(WfForm.getFieldValue(WfForm.convertFieldNameToId("btj", "detail_1")+"_"+rowIndex)) * 0.5;
}
}
}
return totalsc;
}
function detailtTable(){
let qjry = WfForm.getFieldValue(WfForm.convertFieldNameToId('qjry'));
let jqlx = WfForm.getFieldValue(WfForm.convertFieldNameToId('jqlx'));
if (jqlx == '' || jqlx == null || jqlx == undefined){
return;
}
let mainTableData = {
qjry:qjry,
jqlx:jqlx
}
let detailTableData = [];
let detailksrqField = WfForm.convertFieldNameToId('ksrq','detail_1');
var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(",");
for(var i=0; i<rowArr.length; i++){
var rowIndex = rowArr[i];
if(rowIndex !== ""){
var fieldMark = detailksrqField+"_"+rowIndex; //遍历明细行字段
detailTableData.push({
ksrq:WfForm.getFieldValue(fieldMark)
})
}
}
let data = {
mainTableData:JSON.stringify(mainTableData),
detailTableData:JSON.stringify(detailTableData)
}
console.log(data);
$.ajax({
url:'/api/attendance/askforleave/getUesdHolidayItem',
data:data,
type:'GET',
dataType:'json',
success:function(res){
console.log(res)
if (res.api_status){
let data = res.data
//实际标记项目
WfForm.changeFieldValue(WfForm.convertFieldNameToId("sjqjlx"), {
value: data.jqlx,
specialobj:[
{id:data.jqlx,name:data.mc},
]
});
let hsdw = data.hsdw;
if (hsdw == '0'){ //天
let cxjqj = WfForm.getFieldValue(WfForm.convertFieldNameToId("cxjqj"));
if (cxjqj == '1' || cxjqj == '3'){
WfForm.changeFieldValue(WfForm.convertFieldNameToId("cxjqj"), {value:""});
WfForm.showMessage("假期核算单位为天只能选择半天或全天", 2, 10);
}
}
}else {
WfForm.showMessage(res.errormsg, 2, 10);
}
}
})
}
</script>

@ -0,0 +1,132 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:useBean id="strUtil" class="weaver.common.StringUtil" scope="page" />
<jsp:useBean id="dateUtil" class="weaver.common.DateUtil" scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="attProcSetManager" class="com.engine.kq.wfset.attendance.manager.HrmAttProcSetManager" scope="page" />
<%
%>
<script >
jQuery(document).ready(function(){
try{
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("xjr"),function(obj,id,value){
console.log("WfForm.bindFieldChangeEvent--",obj,id,value);
detailtTable();
});
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("qjlx"),function(obj,id,value){
console.log("WfForm.bindFieldChangeEvent--",obj,id,value);
detailtTable();
});
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId("cxqj"),function(obj,id,value){
console.log("WfForm.bindFieldChangeEvent--",obj,id,value);
detailtTable();
});
}catch (e) {
}
});
function detailtTable(){
let qjlx = WfForm.getFieldValue(WfForm.convertFieldNameToId('qjlx'));
let xcr = WfForm.getFieldValue(WfForm.convertFieldNameToId('xjr'));
let cxqj = WfForm.getFieldValue(WfForm.convertFieldNameToId('cxqj'));
let startDate="";
let endDate="";
let nowYear = new Date().getFullYear();
let nowMonth =new Date().getMonth()+1;
let month = 1;
let fullDay = 30;
if (cxqj == "0"){
//上月
month = nowMonth-1;
if (month == 0){
month =12;
}
fullDay = new Date(nowYear,month,0).getDate();
if (month < 10){
month = "0"+month;
}
}else if (cxqj == "1"){
//本月
month = nowMonth;
fullDay = new Date(nowYear,month,0).getDate();
if (month < 10){
month = "0"+month;
}
}else if (cxqj == "2"){
//下月
month = nowMonth+1;
if (month > 12){
month = month-12;
nowYear = nowYear+1;
}
fullDay = new Date(nowYear,month,0).getDate();
if (month < 10){
month = "0"+month;
}
}else if (cxqj == "3"){
//下下月
month = nowMonth+2;
if (month > 12){
month = month-12;
nowYear = nowYear+1;
}
fullDay = new Date(nowYear,month,0).getDate();
if (month < 10){
month = "0"+month;
}
}
startDate = nowYear+"-"+month+"-01";
endDate = nowYear+"-"+month+"-"+fullDay;
let data = {
targetUserId:xcr,
businessTripsType:qjlx,
startDate:startDate,
endDate:endDate
}
$.ajax({
url:'/api/attendance/askforleave/getAskForLeaveRecordList',
data:data,
type:'GET',
dataType:'json',
success:function(res){
console.log(res)
let data = res.data.result;
WfForm.delDetailRow("detail_1", "all");
if (data != undefined){
data.filter(item => {
var obj = {};
//撤销
obj[WfForm.convertFieldNameToId("cx", "detail_1")] = {value:item.cxqj};
//开始日期
obj[WfForm.convertFieldNameToId("ksrq", "detail_1")] = {value:item.ksrq};
//开始时间
obj[WfForm.convertFieldNameToId("kssj", "detail_1")] = {value:item.kssj};
//结束日期
obj[WfForm.convertFieldNameToId("jsrq", "detail_1")] = {value:item.jsrq};
//结束时间
obj[WfForm.convertFieldNameToId("jssj", "detail_1")] = {value:item.jssj};
//出差时长
obj[WfForm.convertFieldNameToId("qjsc", "detail_1")] = {value:item.qjsc};
//全天
obj[WfForm.convertFieldNameToId("qt", "detail_1")] = {value:item.qtj};
//半天
obj[WfForm.convertFieldNameToId("bt", "detail_1")] = {value:item.btj};
//撤销id
obj[WfForm.convertFieldNameToId("cxlyid", "detail_1")] = {value:item.id};
WfForm.addDetailRow("detail_1", obj);
})
}
}
})
}
</script>
Loading…
Cancel
Save