后续加班扣减转事假

dev-chenwnj
chenwei 1 year ago
parent 1faf03be7c
commit f52e8484df

@ -0,0 +1,56 @@
package com.customization.sskj;
import com.customization.sskj.util.JobGroupUtil;
import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import com.engine.hrm.cmd.jobset.AddJobGroupCmd;
import com.engine.kq.cmd.reportdetial.GetTabsCmd;
import org.apache.commons.lang.StringUtils;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* tab
*/
@CommandDynamicProxy(target = GetTabsCmd.class, desc = "GetTabsCmd")
public class GetTabsCmdInter extends AbstractCommandProxy<Map<String, Object>> {
BaseBean basebean = new BaseBean();
@Override
public Map<String, Object> execute(Command<Map<String, Object>> command) {
GetTabsCmd cmd = (GetTabsCmd) command;
User user = cmd.getUser();
Map<String, Object> params = cmd.getParams();
Map<String, Object> result = nextExecute(cmd);
try {
String calLeaveId = basebean.getPropValue("project_sskj", "calLeaveId");
String type = Util.null2String(params.get("type"));
if (("leaveType_"+calLeaveId).equals(type)) {
String status = Util.null2String(result.get("status"));
if ( status.equals("1")) {
Object tabsObj = result.get("tabs");
if (tabsObj !=null & tabsObj != "") {
List<Map<String, Object>> tabs = (List<Map<String, Object>>) tabsObj;
Map<String, Object> temp = new HashMap<>();
temp.put("key","3");
temp.put("title", SystemEnv.getHtmlLabelName(10000,user.getLanguage()));
tabs.add(temp);
}
}
}
}catch (Exception e) {
basebean.writeLog("GetTabsCmdInter Exception: " + e);
}
return result;
}
}

File diff suppressed because it is too large Load Diff

@ -392,6 +392,9 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
} else { } else {
flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0))); flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData, 0.0) - Util.getDoubleValue(leavebackData, 0.0)));
} }
/*考勤二开--转事假start*/
/*考勤二开--转事假end*/
data.put(flowType, flowLeaveData); data.put(flowType, flowLeaveData);
} }

@ -106,15 +106,58 @@ public class SskjUtil {
* @param duration * @param duration
*/ */
public boolean handleCasLeave(String resourceId, String kqDate, String requestid, double duration) { public boolean handleCasLeave(String resourceId, String kqDate, String requestid, double duration) {
basebean.writeLog("SskjUtil handleCasLeave start");
String tableName = getTableName(resourceId, kqDate); String tableName = getTableName(resourceId, kqDate);
basebean.writeLog("tableName: " + tableName);
String[] split = tableName.split("_dt"); String[] split = tableName.split("_dt");
String handleTabel = split[0] + "_dt6"; String handleTabel = split[0] + "_dt6";
String acqCasData = "select qjsc, qjbid from " + handleTabel + " where sfdk = ? "; basebean.writeLog("handleTabel: " + handleTabel);
String acqCasData = "select qjsc, qjbid from " + handleTabel + " where sfdk = ? and xm = ? and ny = ?";
basebean.writeLog("acqCasData: " + acqCasData);
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
//获取已抵扣转事假的时长
//加班类型:1-节假日、2-工作日、3-休息日、-1-数据异常,无效数据
int changeType = KQOvertimeRulesBiz.getChangeType(resourceId, kqDate);
basebean.writeLog("changeType: " + changeType);
double tempDecu = 0.00;
if (changeType == 1) {
String acqToCasSql = "select jrjbdkzsj from " + split[0] + " where xm = ? and ny = ?";
basebean.writeLog("acqToCasSql: " + acqToCasSql);
rs.executeQuery(acqToCasSql, resourceId, kqDate.substring(0,7));
while ( rs.next()) {
tempDecu = Util.getDoubleValue(Util.null2String(rs.getString("psjbdkzsj")));
}
basebean.writeLog("tempDecu: " + tempDecu);
} else if (changeType == 2) {
String acqToCasSql = "select psjbdkzsj from " + split[0] + " where xm = ? and ny = ?";
basebean.writeLog("acqToCasSql: " + acqToCasSql);
rs.executeQuery(acqToCasSql, resourceId, kqDate.substring(0,7));
while ( rs.next()) {
tempDecu = Util.getDoubleValue(Util.null2String(rs.getString("psjbdkzsj")));
}
basebean.writeLog("tempDecu: " + tempDecu);
} else if (changeType == 3) {
String acqToCasSql = "select zmjbdkzsj from " + split[0] + " where xm = ? and ny = ?";
basebean.writeLog("acqToCasSql: " + acqToCasSql);
rs.executeQuery(acqToCasSql, resourceId, kqDate.substring(0,7));
while ( rs.next()) {
tempDecu = Util.getDoubleValue(Util.null2String(rs.getString("psjbdkzsj")));
}
basebean.writeLog("tempDecu: " + tempDecu);
}
Map<String, Double> casMap = new HashMap<>(); Map<String, Double> casMap = new HashMap<>();
rs.executeQuery(acqCasData); rs.executeQuery(acqCasData, resourceId, kqDate.substring(0,7));
while ( rs.next()) { while ( rs.next()) {
double qjsc = Util.getDoubleValue(Util.null2String(rs.getString("qjsc"))); double qjsc = Util.getDoubleValue(Util.null2String(rs.getString("qjsc")));
String qjbid = Util.null2String(rs.getString("qjbid")); String qjbid = Util.null2String(rs.getString("qjbid"));
@ -124,7 +167,24 @@ public class SskjUtil {
} }
if (casMap != null && casMap.size() > 0) { if (casMap != null && casMap.size() > 0) {
String modCasSql = "update " + handleTabel + " set qjsc = ?, sfdk = ?, dklcid = ? where qjbid = ?"; String modCasSql = "update " + handleTabel + " set qjsc = ?, sfdk = ?, dklcid = ? where qjbid = ?";
basebean.writeLog("modCasSql: " + modCasSql);
String modLeaveSql = "update uf_casleave set duration = ?, isdecu = ?, decuflowid = ? where id = ?"; String modLeaveSql = "update uf_casleave set duration = ?, isdecu = ?, decuflowid = ? where id = ?";
basebean.writeLog("modLeaveSql: " + modLeaveSql);
String backField = "";
if (changeType == 1) {
backField = "jrjbdkzsj";
} else if (changeType == 2) {
backField = "psjbdkzsj";
} else if (changeType == 3) {
backField = "zmjbdkzsj";
}
basebean.writeLog("backField: " + backField);
String modDecuSql = "update "+ split[0] +" set " + backField + " = ? where xm = ? and ny = ?";
basebean.writeLog("modDecuSql: " + modDecuSql);
List<List> modCasList = new ArrayList<>(); List<List> modCasList = new ArrayList<>();
List tempList = new ArrayList(); List tempList = new ArrayList();
for (String key : casMap.keySet()) { for (String key : casMap.keySet()) {
@ -136,22 +196,31 @@ public class SskjUtil {
tempList.add(key); tempList.add(key);
tempList.add(requestid); tempList.add(requestid);
modCasList.add(tempList); modCasList.add(tempList);
tempDecu = tempDecu + qjsc;
} else { } else {
tempList.add(Math.abs(temp)); tempList.add(Math.abs(temp));
tempList.add(0); tempList.add(0);
tempList.add(key); tempList.add(key);
tempList.add(requestid); tempList.add(requestid);
modCasList.add(tempList); modCasList.add(tempList);
tempDecu = tempDecu + duration;
} }
} }
basebean.writeLog("modCasList: " + modCasList);
basebean.writeLog("tempDecu: " + tempDecu);
if (modCasList != null && modCasList.size() > 0) { if (modCasList != null && modCasList.size() > 0) {
//修改转事假建模台账 //修改转事假建模台账
rs.executeBatchSql(modLeaveSql, modCasList); boolean b = rs.executeBatchSql(modLeaveSql, modCasList);
basebean.writeLog("b: " + b);
//修改转事假建模台账 //修改转事假建模台账
rs.executeBatchSql(modCasSql, modCasList); boolean b1 = rs.executeBatchSql(modCasSql, modCasList);
basebean.writeLog("b1: " + b1);
//修改加班抵扣转事假
boolean b2 = rs.executeUpdate(modDecuSql, tempDecu, resourceId, kqDate.substring(0, 7));
basebean.writeLog("b2: " + b2);
} }
} }
return true; return true;

@ -116,7 +116,7 @@ public class DeductTrainTimesJob extends BaseCronJob {
SskjUtil sskjUtil = new SskjUtil(); SskjUtil sskjUtil = new SskjUtil();
String tableName = sskjUtil.getTableName(xm, pxsj); String tableName = sskjUtil.getTableName(xm, pxsj);
if (StringUtils.isNotBlank(tableName)) { if (StringUtils.isNotBlank(tableName)) {
String acqOverTimeSql = "select count(*) as number from " + tableName + " where jbry = ? and belongdate = ? and kssj <='" + kssj + "' " + String acqOverTimeSql = "select mainid from " + tableName + " where jbry = ? and lcgzrq = '"+pxsj+"' and kssj <='" + kssj + "' " +
" and jssj >='" + jssj + "' "; " and jssj >='" + jssj + "' ";
String[] split = tableName.split("_dt"); String[] split = tableName.split("_dt");
String addTraNa = ""; String addTraNa = "";
@ -127,23 +127,23 @@ public class DeductTrainTimesJob extends BaseCronJob {
addLeaNa = split[0] + "_dt6"; addLeaNa = split[0] + "_dt6";
addOverNa = split[0]; addOverNa = split[0];
} }
String addTrainSql = "insert into " + addTraNa + " (pxry, pxrq, kssj, jssj, pxsc) values (?,?,?,?,?)"; String addTrainSql = "insert into " + addTraNa + " (mainid, pxry, pxrq, kssj, jssj, pxsc) values (?,?,?,?,?,?)";
String addLeaSql = "insert into " + addLeaNa + " (qjry, qjlx, qjrq, kssj, jssj, sfdk, qjbid, qjsc) values (?,?,?,?,?,?,?,?)"; String addLeaSql = "insert into " + addLeaNa + " (mainid, qjry, qjlx, qjrq, kssj, jssj, sfdk, qjbid, qjsc) values (?,?,?,?,?,?,?,?,?)";
String acqOverSql = "select jbzsy from " + addOverNa + " where xm = ? and ny = ? "; String acqOverSql = "select id, jbzsy from " + addOverNa + " where xm = ? and ny = '" + pxsj.substring(0, 7) + "'";
String addCaslLeaSql = "insert into uf_casleave (resourceid, kqdate, starttime, endtime, duration, isdecu, formmodeid, modedatacreater, modedatacreatertype, " + String addCaslLeaSql = "insert into uf_casleave (resourceid, startdate, starttime, enddate, endtime, duration, isdecu, formmodeid, modedatacreater, modedatacreatertype, " +
" modedatacreatedate, modedatacreatetime, MODEUUID) values (?,?,?,?,?,?,?,?,?,?,?,?)"; " modedatacreatedate, modedatacreatetime, MODEUUID) values (?,?,?,?,?,?,?,?,?,?,?,?,?)";
String acqCasLeaveSql = "select id from kq_flow_split_leave where casleaveuuid = ?"; String acqCasLeaveSql = "select id from kq_flow_split_leave where casleaveuuid = ?";
String acqModeIdSql = "select id from uf_casleave where MODEUUID = ?"; String acqModeIdSql = "select id from uf_casleave where MODEUUID = ?";
String modTrainSql = "update " + addOverNa + " set pxzsc = (select sum(pxsc) from " + addTraNa + " as dt_table where " + String modTrainSql = "update " + addOverNa + " set pxzsc = (select sum(pxsc) from " + addTraNa + " as dt_table where " +
" dt_table.mainid = " + addOverNa + ".id ) where xm = ? and ny = ? "; " dt_table.mainid = " + addOverNa + ".id ) where xm = ? and ny = ? ";
String modOverSql = "update " + addOverNa + " set jbzsy = (psjbsy + zmjbsy + jrjbsy - pxzsc) where xm = ? and ny = ? "; String modOverSql = "update " + addOverNa + " set jbzsy = (psjbsy + zmjbsy + jrjbsy - pxzsc) where xm = ? and ny = ? ";
rs.executeQuery(acqOverTimeSql, xm, pxsj); rs.executeQuery(acqOverTimeSql, xm);
while (rs.next()) { while (rs.next()) {
int number = Util.getIntValue(Util.null2String(rs.getString("number"))); int billid = Util.getIntValue(Util.null2String(rs.getString("mainid")));
if (number > 0) { if (billid > 0) {
//插入一条培训记录 //插入一条培训记录
boolean b = rs2.executeUpdate(addTrainSql, xm, pxsj, kssj, jssj, ksh); boolean b = rs2.executeUpdate(addTrainSql, billid, xm, pxsj, kssj, jssj, ksh);
//重新计算主表培训总时长 //重新计算主表培训总时长
if (b) { if (b) {
boolean b1 = rs2.executeUpdate(modTrainSql, xm, pxsj.substring(0, 7)); boolean b1 = rs2.executeUpdate(modTrainSql, xm, pxsj.substring(0, 7));
@ -157,9 +157,14 @@ public class DeductTrainTimesJob extends BaseCronJob {
} }
} }
//根据目前加班剩余时长来判断是否需要插入一条事假的数据 //根据目前加班剩余时长来判断是否需要插入一条事假的数据
rs2.executeQuery(acqOverSql, xm, pxsj.substring(0, 7)); rs2.executeQuery(acqOverSql, xm);
while (rs2.next()) { while (rs2.next()) {
double jbzsy = Util.getDoubleValue(Util.null2String(rs.getString("jbzsy"))); int id = Util.getIntValue(Util.null2String(rs2.getString("id")));
double jbzsy = Util.getDoubleValue(Util.null2String(rs2.getString("jbzsy")));
if (jbzsy<0.00) {
jbzsy = 0.00;
}
double temp = ksh - jbzsy; double temp = ksh - jbzsy;
if (temp > 0 ) { if (temp > 0 ) {
Integer casleaveId = -1; Integer casleaveId = -1;
@ -167,8 +172,8 @@ public class DeductTrainTimesJob extends BaseCronJob {
String modedatacreatedate = DateUtil.format(new Date(), "yyyy-MM-dd"); String modedatacreatedate = DateUtil.format(new Date(), "yyyy-MM-dd");
String modedatacreatetime = DateUtil.format(new Date(), "HH:mm:ss"); String modedatacreatetime = DateUtil.format(new Date(), "HH:mm:ss");
String uuid = UUID.randomUUID().toString(); String uuid = UUID.randomUUID().toString();
boolean addFlag = rs.executeUpdate(addCaslLeaSql, xm, pxsj, kssj, jssj, ksh, 0, casLeaveModeId, 1, 0, modedatacreatedate, boolean addFlag = rs.executeUpdate(addCaslLeaSql, xm, pxsj, kssj, pxsj, jssj, ksh, 0, casLeaveModeId, 1, 0, modedatacreatedate, modedatacreatetime,
uuid, modedatacreatetime); uuid );
bb.writeLog("addFlag" + addFlag); bb.writeLog("addFlag" + addFlag);
if (addFlag) { if (addFlag) {
String billid = "-1"; String billid = "-1";
@ -179,12 +184,12 @@ public class DeductTrainTimesJob extends BaseCronJob {
bb.writeLog("billid" + billid); bb.writeLog("billid" + billid);
sskjUtil.modePerRecon(1, casLeaveModeId, billid); sskjUtil.modePerRecon(1, casLeaveModeId, billid);
//记录事假台账 //记录事假台账
rs.executeUpdate(addLeaSql, xm, calLeaveTypeId, pxsj, kssj, jssj, 0, casleaveId, temp); boolean b = rs.executeUpdate(addLeaSql, id, xm, calLeaveTypeId, pxsj, kssj, jssj, 0, casleaveId, temp);
}
} }
} }
} }
}
//回写培训台账修改状态 //回写培训台账修改状态
rs.executeUpdate(modTrainStatusSql, 1, detailId); rs.executeUpdate(modTrainStatusSql, 1, detailId);

Loading…
Cancel
Save