考勤编译文件初始化

上海科蓝柏新材料科技有限公司
Chengliang 4 months ago
parent 46f1c9fde1
commit 92686da8dd

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,319 @@
package com.engine.kq.biz;
import com.engine.kq.wfset.util.KQAttFlowCheckUtil;
import weaver.cache.CacheBase;
import weaver.cache.CacheColumn;
import weaver.cache.CacheColumnType;
import weaver.cache.PKColumn;
import weaver.general.Util;
import weaver.systeminfo.SystemEnv;
/**
*
*/
public class KQLeaveRulesComInfo extends CacheBase {
/**
*
*/
protected static String TABLE_NAME = "kq_leaveRules";
/**
* sqlwherewhere
*/
protected static String TABLE_WHERE = " (isDelete is null or isDelete !=1) ";
/**
* sqlorder byorder by
*/
protected static String TABLE_ORDER = " showOrder,id ";
/**
*
*/
@PKColumn(type = CacheColumnType.NUMBER)
protected static String PK_NAME = "id";
/**
*
*/
@CacheColumn(name = "leaveName")
protected static int leaveName;
@CacheColumn(name = "SchevacationON")
protected static int SchevacationON;
@CacheColumn(name = "Schevacation")
protected static int Schevacation;
/**
* 0-1-
*/
@CacheColumn(name = "isEnable")
protected static int isEnable;
/**
* 0-1-
*/
@CacheColumn(name = "scopeType")
protected static int scopeType;
/**
* ID(ID)
*/
@CacheColumn(name = "scopeValue")
protected static int scopeValue;
/**
*
* 1-
* 2-
* 3-
* 4-
*
*/
@CacheColumn(name = "minimumUnit")
protected static int minimumUnit;
/**
*
* XX=1
*/
@CacheColumn(name = "proportion")
protected static int proportion;
/**
* 1=XX
*/
@CacheColumn(name = "hoursToDay")
protected static int hoursToDay;
/**
* 0-1-2-3-
*/
@CacheColumn(name = "filterHolidays")
protected static int filterHolidays;
/**
*
* 1-
* 2-
*/
@CacheColumn(name = "computingMode")
protected static int computingMode;
/**
*
* 0-
* 1-
*/
@CacheColumn(name = "balanceEnable")
protected static int balanceEnable;
/**
*
*/
@CacheColumn(name = "leaveCode")
protected static int leaveCode;
/**
* 1- 2-
*/
@CacheColumn(name = "timeselection")
protected static int timeselection;
/**
* 1 2 3
*/
@CacheColumn(name = "conversion")
protected static int conversion;
/**
* 1 0
*/
@CacheColumn(name = "repeat_time")
protected static int repeatTime;
public String getId(){
return (String)getRowValue(PK_INDEX);
}
public String getLeaveName() {
return (String)getRowValue(leaveName);
}
public String getLeaveName(String key){
return (String) getValue(leaveName,key);
}
public String getSchevacationON() {
return (String)getRowValue(SchevacationON);
}
public String getSchevacationON(String key){
return (String) getValue(SchevacationON,key);
}
public String getSchevacation() {
return (String)getRowValue(Schevacation);
}
public String getSchevacation(String key){
return (String) getValue(Schevacation,key);
}
public String getIsEnable() {
return (String)getRowValue(isEnable);
}
public String getIsEnable(String key){
return (String) getValue(isEnable,key);
}
public String getScopeType() {
return (String)getRowValue(scopeType);
}
public String getScopeType(String key){
return (String) getValue(scopeType,key);
}
public String getScopeValue() {
return (String)getRowValue(scopeValue);
}
public String getScopeValue(String key){
return (String) getValue(scopeValue,key);
}
public String getMinimumUnit() {
return (String)getRowValue(minimumUnit);
}
public String getMinimumUnit(String key){
return (String)getValue(minimumUnit,key);
}
public String getProportion() {
return (String)getRowValue(proportion);
}
public String getProportion(String key){
return (String)getValue(proportion,key);
}
public String getHoursToDay() {
return (String)getRowValue(hoursToDay);
}
public String getHoursToDay(String key){
return (String)getValue(hoursToDay,key);
}
public String getFilterHolidays() {
return (String)getRowValue(filterHolidays);
}
public String getFilterHolidays(String key){
return (String)getValue(filterHolidays,key);
}
public String getComputingMode() {
return (String)getRowValue(computingMode);
}
public String getComputingMode(String key){
return (String)getValue(computingMode,key);
}
public String getBalanceEnable() {
return (String)getRowValue(balanceEnable);
}
public String getBalanceEnable(String key){
return (String)getValue(balanceEnable,key);
}
public String getLeaveCode() {
return (String)getRowValue(leaveCode);
}
public String getLeaveCode(String key){
return (String)getValue(leaveCode,key);
}
public String getTimeSelection() {
String value = (String) getRowValue(timeselection);
if (value == null || value.equals("")) {
value = "1";
}
return value;
}
public String getTimeSelection(String key) {
String value = (String) getValue(timeselection, key);
if (value == null || value.equals("")) {
value = "1";
}
return value;
}
public String getConversion() {
return (String)getRowValue(conversion);
}
public String getConversion(String key){
return (String)getValue(conversion,key);
}
public String getRepeatTime() {
return (String)getRowValue(repeatTime);
}
public String getRepeatTime(String key){
return (String)getValue(repeatTime,key);
}
public String getUnitName(int language){
String unitName = "";//单位名称,天/小时
int minimumUnit = Util.getIntValue(getMinimumUnit(),1);
if (minimumUnit == 1 || minimumUnit == 2 || minimumUnit == 4) {
unitName = SystemEnv.getHtmlLabelName(389325, language);//(天)
} else {
unitName = SystemEnv.getHtmlLabelName(389326, language);//(小时)
}
return unitName;
}
public String getUnitName(String key,int language){
String unitName = "";//单位名称,天/小时
int minimumUnit = Util.getIntValue(getMinimumUnit(key),1);
if (minimumUnit == 1 || minimumUnit == 2 || minimumUnit == 4) {
unitName = SystemEnv.getHtmlLabelName(389325, language);//(天)
} else {
unitName = SystemEnv.getHtmlLabelName(389326, language);//(小时)
}
// KQTransMethod method = new KQTransMethod();
// unitName = "("+method.getMinimumUnitName4Browser(""+minimumUnit, ""+language)+")";
return unitName;
}
public String getUnitNameNew(String key,int language){
String unitName = "";//单位名称,天/小时
int minimumUnit = Util.getIntValue(getMinimumUnit(key),1);
if (minimumUnit == 1 || minimumUnit == 2 || minimumUnit == 4) {
unitName = SystemEnv.getHtmlLabelName(389325, language);//(天)
} else {
unitName = SystemEnv.getHtmlLabelName(389326, language);//(小时)
}
return unitName;
}
@Override
public void removeCache() {
super.removeCache();
KQAttFlowCheckUtil kqAttFlowCheckUtil = new KQAttFlowCheckUtil();
kqAttFlowCheckUtil.initLeaveUnit();
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,461 @@
package com.engine.kq.cmd.leaverules;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.biz.SimpleBizLogger;
import com.engine.common.constant.BizLogSmallType4Hrm;
import com.engine.common.constant.BizLogType;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQLeaveRulesBiz;
import com.engine.kq.biz.KQLeaveRulesDetailComInfo;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* --
*/
public class AddLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>> {
private SimpleBizLogger logger;
public AddLeaveRulesCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
this.logger = new SimpleBizLogger();
String ruleId = Util.null2String(params.get("typeId"));
String ruleName = Util.null2String(params.get("ruleName"));
BizLogContext bizLogContext = new BizLogContext();
bizLogContext.setLogType(BizLogType.HRM_ENGINE);//模块类型
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_ENGINE_KQ_LEAVERULES);//所属大类型
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_ENGINE_KQ_LEAVERULES);//当前小类型
bizLogContext.setParams(params);//当前request请求参数
logger.setUser(user);//当前操作人
String mainSql = "select * from kq_LeaveRulesDetail where ruleId=" + ruleId + " and ruleName like '%" + ruleName + "%'";
logger.setMainSql(mainSql, "id");//主表sql
logger.setMainPrimarykey("id");//主日志表唯一key
logger.setMainTargetNameColumn("rulename");
SimpleBizLogger.SubLogInfo subLogInfo1 = logger.getNewSubLogInfo();
String subSql1 = "select * from kq_EntryToLeave where leaveRulesId in (select id from kq_LeaveRulesDetail where ruleId=" + ruleId + " and ruleName like '%" + ruleName + "%')";
subLogInfo1.setSubSql(subSql1, "id");
logger.addSubLogInfo(subLogInfo1);
SimpleBizLogger.SubLogInfo subLogInfo2 = logger.getNewSubLogInfo();
String subSql2 = "select * from kq_WorkingAgeToLeave where leaveRulesId in (select id from kq_LeaveRulesDetail where ruleId=" + ruleId + " and ruleName like '%" + ruleName + "%')";
subLogInfo2.setSubSql(subSql2, "id");
logger.addSubLogInfo(subLogInfo2);
SimpleBizLogger.SubLogInfo subLogInfo3 = logger.getNewSubLogInfo();
String subSql3 = "select * from kq_MixModeToLegalLeave where leaveRulesId in (select id from kq_LeaveRulesDetail where ruleId=" + ruleId + " and ruleName like '%" + ruleName + "%')";
subLogInfo3.setSubSql(subSql3, "id");
logger.addSubLogInfo(subLogInfo3);
SimpleBizLogger.SubLogInfo subLogInfo4 = logger.getNewSubLogInfo();
String subSql4 = "select * from kq_MixModeToWelfareLeave where leaveRulesId in (select id from kq_LeaveRulesDetail where ruleId=" + ruleId + " and ruleName like '%" + ruleName + "%')";
subLogInfo4.setSubSql(subSql4, "id");
logger.addSubLogInfo(subLogInfo4);
logger.before(bizLogContext);
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public List<BizLogContext> getLogContexts() {
return logger.getBizLogContexts();
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
boolean canAdd = HrmUserVarify.checkUserRight("KQLeaveRulesAdd:Add", user);//是否具有新建权限
if (!canAdd) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));//没有权限
return resultMap;
}
/*假期规则对应的假期类型的ID*/
String ruleId = Util.null2String(params.get("typeId"));
/*假期规则名称*/
String ruleName = Util.null2String(params.get("ruleName"));
/*应用范围0-总部、1-分部*/
int scopeType = Util.getIntValue((String) params.get("scopeType"));
/*应用范围为分部时选择的分部ID*/
String scopeValue = Util.null2String(params.get("scopeValue"));
String deductorder = Util.null2String(params.get("deductorder"));
/*应用范围为部门时选择的部门ID*/
String scopeValueDepartment = Util.null2String(params.get("scopeValueDepartment"));
/*应用范围为人员时选择的人员ID*/
String scopeValueMember = Util.null2String(params.get("scopeValueMember"));
if(scopeType == 2) {
scopeValue = scopeValueDepartment;
} else if(scopeType == 3) {
scopeValue = scopeValueMember;
}
/*余额发放方式1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、5-加班时长自动计入余额、6-按司龄+工龄自动发放*/
int distributionMode = Util.getIntValue((String) params.get("distributionMode"), 1);
/*每人发放小时(天)数(当余额发放方式为每年自动发放固定天数时有效)*/
double annualAmount = Util.getDoubleValue((String) params.get("annualAmount"), 0);
//法定年假规则0-工龄、1-司龄、2-工龄+司龄 (当余额发放方式为按工龄+司龄自动发放时有效)
String legalKey = Util.null2s((String) params.get("legalKey"), "0");
//福利年假规则0-工龄、1-工龄、2-工龄+司龄 (当余额发放方式为按工龄+司龄自动发放时有效)
String welfareKey = Util.null2s((String) params.get("welfareKey"), "1");
/*扣减优先级1-法定年假、2-福利年假*/
int priority = Util.getIntValue((String) params.get("priority"), 1);
/*有效期规则0-不限制、1-按自然月(1月1日-12月31日)、2-按入职日期起12个月、3-自定义次年失效日期、4-自定义有效天数*/
int validityRule = Util.getIntValue((String) params.get("validityRule"), 1);
/*有效期天数:(当有效期天数选择按天数失效的时候有效)*/
int effectiveDays = Util.getIntValue((String) params.get("effectiveDays"), 30);
//有效月数(当有效期规则选择自定义有效月数时)
int effectiveMonths = Util.getIntValue((String) params.get("effectiveMonths"), 1);
/*失效日期--月当有效期规则选择3-自定义次年失效日期时有效)*/
String expirationMonth = Util.null2String(params.get("expirationMonth"));
/*失效日期--日当有效期规则选择3-自定义次年失效日期时有效)*/
String expirationDay = Util.null2String(params.get("expirationDay"));
/*允许延长有效期0-不允许、1-允许*/
int extensionEnable = Util.getIntValue((String) params.get("extensionEnable"), 0);
/*允许超过有效期天数*/
int extendedDays = Util.getIntValue((String) params.get("extendedDays"), 0);
/*释放规则0-不限制、1-按天释放、2-按月释放*/
int releaseRule = Util.getIntValue((String) params.get("releaseRule"), 0);
/*假期基数计算方式0-精确计算、1-按最少的假期余额计算、2-按最多的假期余额计算*/
int calcMethod = Util.getIntValue((String) params.get("calcMethod"), 0);
/*是否折算0-不折算、1-四舍五入、2-向上取整、3-向下取整、4-向上取0.5的倍数、5-向下取0.5的倍数*/
int convertMode = Util.getIntValue("" + params.get("convertMode"), 1);
/*次账号是否发放假期余额0-不发放、1-发放*/
int excludeSubAccount = Util.getIntValue("" + params.get("excludeSubAccount"), 1);
//多孩叠加开关。
int severalChildren = Util.getIntValue("" + params.get("severalChildren"), 0);
//孩子多少周岁前发放。
int yearsOld = Util.getIntValue("" + params.get("yearsOld"), 3);
//是否按照省份发放育儿假。
int isprovince = Util.getIntValue("" + params.get("isprovince"), 1);
// 2、在假期规则页面增加开关控制是否开启。carryOver
// 3、增加输入框控制结转天数。 carryOverDays
int carryOver = Util.getIntValue("" + params.get("carryOver"), 0);
double carryOverDays = Util.getDoubleValue((String) params.get("carryOverDays"), 0);
/*转正之前是否发放假期余额0-不发放、1-发放*/
int beforeFormal = Util.getIntValue("" + params.get("beforeFormal"), 1);
if (scopeType != 0 && scopeValue.equals("")) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(388858, user.getLanguage()));//参数有误
return resultMap;
}
/*两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式*/
if (distributionMode == 5) {
releaseRule = 0;
Map<String,String> data = KQLeaveRulesBiz.isRepeat(ruleId,scopeType,scopeValue,user,"");
if(null != data && "1".equals(data.get("flag"))){
resultMap.put("status", "-1");
resultMap.put("message", data.get("msg"));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
return resultMap;
}
// String sql = "select * from kq_LeaveRules where (isDelete is null or isDelete<>1) and id<>? and id in (select ruleId from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and distributionMode=5)";
// RecordSet recordSet = new RecordSet();
// recordSet.executeQuery(sql, ruleId);
// if (recordSet.next()) {
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(505664, user.getLanguage()));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
// return resultMap;
// }
if(null != deductorder && deductorder.length()>0){
String[] orders = deductorder.split(",");
if(null != orders && orders.length != 3){
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(547752, user.getLanguage()));
return resultMap;
}
}
} else if (distributionMode == 6) {
/*同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode<>6";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505665, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
} else if (distributionMode == 8) {
/*同一假期类型下 育儿假 不能与其他余额发放方式共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode<>8";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546858, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=8";
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
int severalChildrenValue = Util.getIntValue(Util.null2s(recordSet.getString("severalChildren"), "0"), 0);
if(severalChildrenValue!=severalChildren){
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546859, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
}
} else {
/*同一个假期类型下其他余额发放方式不能与 按司龄+工龄自动发放 共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=6";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505666, user.getLanguage()));//同一个假期类型下其他余额发放方式不能与 按司龄+工龄自动发放 共存
return resultMap;
}
//同一个假期类型下其他余额发放方式不能与 加班时长自动计入余额 共存
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=5";
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(510357, user.getLanguage()));//同一个假期类型下其他余额发放方式不能与 加班时长自动计入余额 共存
return resultMap;
}
//同一个假期类型下其他余额发放方式不能与 育儿假叠加 共存
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=8";
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546858, user.getLanguage()));
return resultMap;
}
}
String searchSql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=?";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(searchSql, ruleId);
while (recordSet.next()) {
int scopeTypeTemp = Util.getIntValue(recordSet.getString("scopeType"), 0);
String scopeValueTemp = recordSet.getString("scopeValue");
if (scopeType == 0 && scopeTypeTemp == 0) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505667, user.getLanguage()));//该假期类型下已经新建过总部的假期规则,请勿重复新建
return resultMap;
}
if (scopeType == 1 && scopeTypeTemp == 1) {
List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
for (String temp : scopeValueList)
if (scopeValueTempList.contains(temp)) {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
String subcomName = subCompanyComInfo.getSubCompanyname(temp);
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505668, user.getLanguage()).replace("$", subcomName));//该假期类型下已经新建过分部的假期规则,请勿重复新建
return resultMap;
}
}
if (scopeType == 2 && scopeTypeTemp == 2) {
List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
for (String temp : scopeValueList)
if (scopeValueTempList.contains(temp)) {
DepartmentComInfo comInfo = new DepartmentComInfo();
String name = comInfo.getDepartmentname(temp);
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(534890, user.getLanguage()).replace("$", name));//该假期类型下已经新建过部门的假期规则,请勿重复新建
return resultMap;
}
}
if (scopeType == 3 && scopeTypeTemp == 3) {
List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
for (String temp : scopeValueList)
if (scopeValueTempList.contains(temp)) {
ResourceComInfo comInfo = new ResourceComInfo();
String name = comInfo.getLastname(temp);
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(534891, user.getLanguage()).replace("$", name));//该假期类型下已经新建过人员的假期规则,请勿重复新建
return resultMap;
}
}
}
boolean flag = false;//数据是否插入成功
String sql = "insert into kq_LeaveRulesDetail(ruleId,ruleName,scopeType,scopeValue," +
"distributionMode,annualAmount,legalKey,welfareKey,priority,validityRule,effectiveDays,effectiveMonths,expirationMonth,expirationDay,extensionEnable,extendedDays,releaseRule,calcMethod,convertMode,excludeSubAccount,beforeFormal,severalChildren,yearsOld,isprovince,carryOver,carryOverDays,deductorder,isDelete) values(?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?, ?,?,?,?,?,?,?,0)";
flag = recordSet.executeUpdate(sql, ruleId, ruleName, scopeType, scopeValue,
distributionMode, annualAmount, legalKey, welfareKey, priority, validityRule, effectiveDays, effectiveMonths, expirationMonth, expirationDay, extensionEnable, extendedDays, releaseRule, calcMethod, convertMode, excludeSubAccount, beforeFormal,severalChildren,yearsOld,isprovince,carryOver,carryOverDays,deductorder);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
/*获取刚才插入的假期规则详情的ID*/
int ruleDetailId = 0;
sql = "select max(id) maxId from kq_LeaveRulesDetail";
recordSet.executeQuery(sql);
if (recordSet.next()) {
ruleDetailId = Util.getIntValue(recordSet.getString("maxId"), 0);
}
if ((distributionMode == 2 || distributionMode == 7) && ruleDetailId != 0) {
int lowerLimit = 0;//司龄下限
int upperLimit = 0;//司龄上限
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int timePoint = jsonObject.getIntValue("timePoint");
double amount = jsonObject.getDoubleValue("amount");
lowerLimit = i == 0 ? 0 : timePoint;
upperLimit = i == jsonArray.size() - 1 ? 9999 : jsonArray.getJSONObject(i + 1).getIntValue("timePoint");
sql = "insert into kq_EntryToLeave(leaveRulesId,lowerLimit,upperLimit,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, lowerLimit, upperLimit, amount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 3 && ruleDetailId != 0) {
int lowerLimit = 0;//工龄下限
int upperLimit = 0;//工龄上限
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int timePoint = jsonObject.getIntValue("timePoint");
double amount = jsonObject.getDoubleValue("amount");
lowerLimit = i == 0 ? 0 : timePoint;
upperLimit = i == jsonArray.size() - 1 ? 9999 : jsonArray.getJSONObject(i + 1).getIntValue("timePoint");
sql = "insert into kq_WorkingAgeToLeave(leaveRulesId,lowerLimit,upperLimit,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, lowerLimit, upperLimit, amount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 6 && ruleDetailId != 0) {
String mixModeData = Util.null2String(params.get("legalRule"));
JSONArray jsonArray = JSONArray.parseArray(mixModeData);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int workYear = jsonObject.getIntValue("workYear");
int entryTime = jsonObject.getIntValue("entryTime");
double legalAmount = jsonObject.getDoubleValue("legalAmount");
sql = "insert into kq_MixModeToLegalLeave(leaveRulesId,limit1,limit2,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, workYear, entryTime, legalAmount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
mixModeData = Util.null2String(params.get("welfareRule"));
jsonArray = JSONArray.parseArray(mixModeData);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int workYear = jsonObject.getIntValue("workYear");
int entryTime = jsonObject.getIntValue("entryTime");
double welfareAmount = jsonObject.getDoubleValue("welfareAmount");
sql = "insert into kq_MixModeToWelfareLeave(leaveRulesId,limit1,limit2,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, workYear, entryTime, welfareAmount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 8 && ruleDetailId != 0) {
int provinceidValue = 0;//省份id
int yearsOldValue = 0;//孩子周岁
double amountValue = 0;//假期天数
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
provinceidValue = jsonObject.getIntValue("provinceid");
yearsOldValue = jsonObject.getIntValue("yearsOld");
amountValue = jsonObject.getDoubleValue("amount");
sql = "insert into kq_provinceToLeave(leaveRulesId,provinceid,yearsOld,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, provinceidValue, yearsOldValue, amountValue);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (flag) {
resultMap.put("sign", "1");
resultMap.put("message", SystemEnv.getHtmlLabelName(83551, user.getLanguage()));//保存成功
}
} catch (Exception e) {
writeLog(e);
} finally {
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
detailComInfo.removeCache();
}
return resultMap;
}
}

@ -0,0 +1,489 @@
package com.engine.kq.cmd.leaverules;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.biz.SimpleBizLogger;
import com.engine.common.constant.BizLogSmallType4Hrm;
import com.engine.common.constant.BizLogType;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQLeaveRulesBiz;
import com.engine.kq.biz.KQLeaveRulesDetailComInfo;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* --
*/
public class EditLeaveRulesCmd extends AbstractCommonCommand<Map<String, Object>> {
private SimpleBizLogger logger;
public EditLeaveRulesCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
this.logger = new SimpleBizLogger();
int ruleDetailId = Util.getIntValue((String) params.get("ruleId"));
BizLogContext bizLogContext = new BizLogContext();
bizLogContext.setLogType(BizLogType.HRM_ENGINE);//模块类型
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_ENGINE_KQ_LEAVERULES);//所属大类型
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_ENGINE_KQ_LEAVERULES);//当前小类型
bizLogContext.setParams(params);//当前request请求参数
logger.setUser(user);//当前操作人
String mainSql = "select * from kq_LeaveRulesDetail where id=" + ruleDetailId;
logger.setMainSql(mainSql, "id");//主表sql
logger.setMainPrimarykey("id");//主日志表唯一key
logger.setMainTargetNameColumn("rulename");
SimpleBizLogger.SubLogInfo subLogInfo1 = logger.getNewSubLogInfo();
String subSql1 = "select * from kq_EntryToLeave where leaveRulesId=" + ruleDetailId;
subLogInfo1.setSubSql(subSql1, "id");
logger.addSubLogInfo(subLogInfo1);
SimpleBizLogger.SubLogInfo subLogInfo2 = logger.getNewSubLogInfo();
String subSql2 = "select * from kq_WorkingAgeToLeave where leaveRulesId=" + ruleDetailId;
subLogInfo2.setSubSql(subSql2, "id");
logger.addSubLogInfo(subLogInfo2);
SimpleBizLogger.SubLogInfo subLogInfo3 = logger.getNewSubLogInfo();
String subSql3 = "select * from kq_MixModeToLegalLeave where leaveRulesId=" + ruleDetailId;
subLogInfo3.setSubSql(subSql3, "id");
logger.addSubLogInfo(subLogInfo3);
SimpleBizLogger.SubLogInfo subLogInfo4 = logger.getNewSubLogInfo();
String subSql4 = "select * from kq_MixModeToLegalLeave where leaveRulesId=" + ruleDetailId;
subLogInfo4.setSubSql(subSql4, "id");
logger.addSubLogInfo(subLogInfo4);
logger.before(bizLogContext);
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public List<BizLogContext> getLogContexts() {
return logger.getBizLogContexts();
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
boolean canEdit = HrmUserVarify.checkUserRight("KQLeaveRulesEdit:Edit", user);//是否具有新建权限
if (!canEdit) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
return resultMap;
}
/*假期类型的ID*/
int ruleId = Util.getIntValue((String) params.get("typeId"));
/*假期规则详情的ID*/
int ruleDetailId = Util.getIntValue((String) params.get("ruleId"));
/*假期规则名称*/
String ruleName = Util.null2String(params.get("ruleName"));
/*应用范围0-总部、1-分部*/
int scopeType = Util.getIntValue((String) params.get("scopeType"));
/*应用范围为分部时选择的分部ID*/
String scopeValue = Util.null2String(params.get("scopeValue"));
String deductorder = Util.null2String(params.get("deductorder"));
/*应用范围为部门时选择的部门ID*/
String scopeValueDepartment = Util.null2String(params.get("scopeValueDepartment"));
/*应用范围为人员时选择的人员ID*/
String scopeValueMember = Util.null2String(params.get("scopeValueMember"));
if(scopeType == 2) {
scopeValue = scopeValueDepartment;
} else if(scopeType == 3) {
scopeValue = scopeValueMember;
}
/*余额发放方式1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、 5-加班时长自动计入余额*/
int distributionMode = Util.getIntValue((String) params.get("distributionMode"), 1);
/*每人发放小时(天)数(当余额发放方式为每年自动发放固定天数时有效)*/
double annualAmount = Util.getDoubleValue((String) params.get("annualAmount"), 0);
/*扣减优先级1-法定年假、2-福利年假*/
int priority = Util.getIntValue((String) params.get("priority"), 1);
//法定年假规则0-工龄、1-司龄、2-工龄+司龄 (当余额发放方式为按工龄+司龄自动发放时有效)
String legalKey = Util.null2s((String) params.get("legalKey"), "0");
//福利年假规则0-工龄、1-工龄、2-工龄+司龄 (当余额发放方式为按工龄+司龄自动发放时有效)
String welfareKey = Util.null2s((String) params.get("welfareKey"), "1");
/*有效期规则0-不限制、1-按自然月(1月1日-12月31日)、2-按入职日期起12个月、3-自定义次年失效日期、4-自定义有效天数*/
int validityRule = Util.getIntValue((String) params.get("validityRule"), 1);
/*有效期天数:(当有效期天数选择按天数失效的时候有效)*/
int effectiveDays = Util.getIntValue((String) params.get("effectiveDays"), 30);
//有效月数(当有效期规则选择自定义有效月数时)
int effectiveMonths = Util.getIntValue((String) params.get("effectiveMonths"), 1);
/*失效日期--月当有效期规则选择3-自定义次年失效日期时有效)*/
String expirationMonth = Util.null2String(params.get("expirationMonth"));
/*失效日期--日当有效期规则选择3-自定义次年失效日期时有效)*/
String expirationDay = Util.null2String(params.get("expirationDay"));
/*允许延长有效期0-不允许、1-允许*/
int extensionEnable = Util.getIntValue((String) params.get("extensionEnable"), 0);
/*允许超过有效期天数*/
int extendedDays = Util.getIntValue((String) params.get("extendedDays"), 0);
/*释放规则0-不限制、1-按天释放、2-按月释放*/
int releaseRule = Util.getIntValue((String) params.get("releaseRule"), 0);
/*假期基数计算方式0-精确计算、1-按最少的假期余额计算、2-按最多的假期余额计算*/
int calcMethod = Util.getIntValue((String) params.get("calcMethod"), 0);
/*是否折算0-不折算、1-四舍五入、2-向上取整、3-向下取整、4-向上取0.5的倍数、5-向下取0.5的倍数*/
int convertMode = Util.getIntValue("" + params.get("convertMode"), 1);
/*次账号是否发放假期余额0-不发放、1-发放*/
int excludeSubAccount = Util.getIntValue("" + params.get("excludeSubAccount"), 1);
/*转正之前是否发放假期余额0-不发放、1-发放*/
int beforeFormal = Util.getIntValue("" + params.get("beforeFormal"), 1);
//多孩叠加开关。
int severalChildren = Util.getIntValue("" + params.get("severalChildren"), 0);
//孩子多少周岁前发放。
int yearsOld = Util.getIntValue("" + params.get("yearsOld"), 3);
//是否按照省份发放育儿假。
int isprovince = Util.getIntValue("" + params.get("isprovince"), 1);
// 2、在假期规则页面增加开关控制是否开启。carryOver
// 3、增加输入框控制结转天数。 carryOverDays
int carryOver = Util.getIntValue("" + params.get("carryOver"), 0);
double carryOverDays = Util.getDoubleValue((String) params.get("carryOverDays"), 0);
if (scopeType == 1 && scopeValue.equals("")) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(388858, user.getLanguage()));//参数有误
return resultMap;
}
if (distributionMode == 5) {
releaseRule = 0;
Map<String,String> data = KQLeaveRulesBiz.isRepeat(Util.null2String(ruleId),scopeType,scopeValue,user,Util.null2String(ruleDetailId));
if(null != data && "1".equals(data.get("flag"))){
resultMap.put("status", "-1");
resultMap.put("message", data.get("msg"));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
return resultMap;
}
/*两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式*/
// String sql = "select * from kq_LeaveRules where (isDelete is null or isDelete<>1) and id<>? and id in (select ruleId from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and distributionMode=5)";
// RecordSet recordSet = new RecordSet();
// recordSet.executeQuery(sql, ruleId);
// if (recordSet.next()) {
// resultMap.put("status", "-1");
// resultMap.put("message", SystemEnv.getHtmlLabelName(505664, user.getLanguage()));//两个不同的假期类型下不能同时存在 加班时长自动计入余额 的余额发放方式
// return resultMap;
// }
if(null != deductorder && deductorder.length()>0){
String[] orders = deductorder.split(",");
if(null != orders && orders.length != 3){
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(547752, user.getLanguage()));
return resultMap;
}
}
} else if (distributionMode == 6) {
/*同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode<>6";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505665, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
}else if (distributionMode == 8) {
/*同一假期类型下 育儿假 不能与其他余额发放方式共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode<>8";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546858, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=8 and id<>?";
recordSet.executeQuery(sql, ruleId,ruleDetailId);
if (recordSet.next()) {
int severalChildrenValue = Util.getIntValue(Util.null2s(recordSet.getString("severalChildren"), "0"), 0);
if(severalChildrenValue!=severalChildren){
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546859, user.getLanguage()));//同一假期类型下 按司龄+工龄自动发放 不能与其他余额发放方式共存
return resultMap;
}
}
} else {
/*同一个假期类型下其他余额发放方式不能与 按司龄+工龄自动发放 共存*/
String sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=6";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505666, user.getLanguage()));//同一个假期类型下其他余额发放方式不能与 按司龄+工龄自动发放 共存
return resultMap;
}
//同一个假期类型下其他余额发放方式不能与 加班时长自动计入余额 共存
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=5";
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(510357, user.getLanguage()));//同一个假期类型下其他余额发放方式不能与 加班时长自动计入余额 共存
return resultMap;
}
//同一个假期类型下其他余额发放方式不能与 育儿假叠加 共存
sql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and distributionMode=8";
recordSet.executeQuery(sql, ruleId);
if (recordSet.next()) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(546858, user.getLanguage()));
return resultMap;
}
}
String searchSql = "select * from kq_LeaveRulesDetail where (isDelete is null or isDelete<>1) and ruleId=? and id<>?";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(searchSql, ruleId, ruleDetailId);
while (recordSet.next()) {
int scopeTypeTemp = Util.getIntValue(recordSet.getString("scopeType"), 0);
String scopeValueTemp = recordSet.getString("scopeValue");
if (scopeType == 0 && scopeTypeTemp == 0) {
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505667, user.getLanguage()));//该假期类型下已经新建过总部的假期规则,请勿重复新建
return resultMap;
}
if (scopeType == 1 && scopeTypeTemp == 1) {
List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
for (String temp : scopeValueList)
if (scopeValueTempList.contains(temp)) {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
String subcomName = subCompanyComInfo.getSubCompanyname(temp);
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(505668, user.getLanguage()).replace("$", subcomName));//该假期类型下已经新建过分部的假期规则,请勿重复新建
return resultMap;
}
}
if (scopeType == 2 && scopeTypeTemp == 2) {
List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
for (String temp : scopeValueList)
if (scopeValueTempList.contains(temp)) {
DepartmentComInfo comInfo = new DepartmentComInfo();
String name = comInfo.getDepartmentname(temp);
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(534890, user.getLanguage()).replace("$", name));//该假期类型下已经新建过部门的假期规则,请勿重复新建
return resultMap;
}
}
if (scopeType == 3 && scopeTypeTemp == 3) {
List<String> scopeValueTempList = Util.TokenizerString(scopeValueTemp, ",");
List<String> scopeValueList = Util.TokenizerString(scopeValue, ",");
for (String temp : scopeValueList)
if (scopeValueTempList.contains(temp)) {
ResourceComInfo comInfo = new ResourceComInfo();
String name = comInfo.getLastname(temp);
resultMap.put("status", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(534891, user.getLanguage()).replace("$", name));//该假期类型下已经新建过人员的假期规则,请勿重复新建
return resultMap;
}
}
}
boolean flag = false;//数据是否更新成功
String sql = "update kq_LeaveRulesDetail set ruleId=?,ruleName=?,scopeType=?,scopeValue=?," +
"distributionMode=?,annualAmount=?,legalKey=?,welfareKey=?,priority=?,validityRule=?,effectiveDays=?,effectiveMonths=?,expirationMonth=?,expirationDay=?,extensionEnable=?,extendedDays=?,releaseRule=?,calcMethod=?,convertMode=?,excludeSubAccount=?,beforeFormal=?,severalChildren=?,yearsOld=?,isprovince=? ,carryOver=?,carryOverDays=?,deductorder=? where id=?";
flag = recordSet.executeUpdate(sql, ruleId, ruleName, scopeType, scopeValue,
distributionMode, annualAmount, legalKey, welfareKey, priority, validityRule, effectiveDays, effectiveMonths, expirationMonth, expirationDay, extensionEnable, extendedDays, releaseRule, calcMethod, convertMode, excludeSubAccount, beforeFormal,severalChildren,yearsOld,isprovince,carryOver,carryOverDays,deductorder,ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
if ((distributionMode == 2 || distributionMode == 7) && ruleDetailId != 0) {
sql = "delete from kq_EntryToLeave where leaveRulesId=?";
flag = recordSet.executeUpdate(sql, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
int lowerLimit = 0;//司龄下限
int upperLimit = 0;//司龄上限
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int timePoint = jsonObject.getIntValue("timePoint");
double amount = jsonObject.getDoubleValue("amount");
lowerLimit = i == 0 ? 0 : timePoint;
upperLimit = i == jsonArray.size() - 1 ? 9999 : jsonArray.getJSONObject(i + 1).getIntValue("timePoint");
sql = "insert into kq_EntryToLeave(leaveRulesId,lowerLimit,upperLimit,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, lowerLimit, upperLimit, amount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 3 && ruleDetailId != 0) {
sql = "delete from kq_WorkingAgeToLeave where leaveRulesId=?";
flag = recordSet.executeUpdate(sql, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
int lowerLimit = 0;//工龄下限
int upperLimit = 0;//工龄上限
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int timePoint = jsonObject.getIntValue("timePoint");
double amount = jsonObject.getDoubleValue("amount");
lowerLimit = i == 0 ? 0 : timePoint;
upperLimit = i == jsonArray.size() - 1 ? 9999 : jsonArray.getJSONObject(i + 1).getIntValue("timePoint");
sql = "insert into kq_WorkingAgeToLeave(leaveRulesId,lowerLimit,upperLimit,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, lowerLimit, upperLimit, amount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 6 && ruleDetailId != 0) {
sql = "delete from kq_MixModeToLegalLeave where leaveRulesId=?";
flag = recordSet.executeUpdate(sql, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
sql = "delete from kq_MixModeToWelfareLeave where leaveRulesId=?";
flag = recordSet.executeUpdate(sql, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
String mixModeData = Util.null2String(params.get("legalRule"));
JSONArray jsonArray = JSONArray.parseArray(mixModeData);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int workYear = jsonObject.getIntValue("workYear");
int entryTime = jsonObject.getIntValue("entryTime");
double legalAmount = jsonObject.getDoubleValue("legalAmount");
sql = "insert into kq_MixModeToLegalLeave(leaveRulesId,limit1,limit2,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, workYear, entryTime, legalAmount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
mixModeData = Util.null2String(params.get("welfareRule"));
jsonArray = JSONArray.parseArray(mixModeData);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int workYear = jsonObject.getIntValue("workYear");
int entryTime = jsonObject.getIntValue("entryTime");
double welfareAmount = jsonObject.getDoubleValue("welfareAmount");
sql = "insert into kq_MixModeToWelfareLeave(leaveRulesId,limit1,limit2,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, workYear, entryTime, welfareAmount);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (distributionMode == 8 && ruleDetailId != 0) {
sql = "delete from kq_provinceToLeave where leaveRulesId=?";
flag = recordSet.executeUpdate(sql, ruleDetailId);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
int provinceidValue = 0;//省份id
int yearsOldValue = 0;//孩子周岁
double amountValue = 0;//假期天数
String data = Util.null2String(params.get("detailRule"));
JSONArray jsonArray = JSONArray.parseArray(data);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
provinceidValue = jsonObject.getIntValue("provinceid");
yearsOldValue = jsonObject.getIntValue("yearsOld");
amountValue = jsonObject.getDoubleValue("amount");
sql = "insert into kq_provinceToLeave(leaveRulesId,provinceid,yearsOld,amount) values(?,?,?,?)";
flag = recordSet.executeUpdate(sql, ruleDetailId, provinceidValue, yearsOldValue, amountValue);
if (!flag) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
return resultMap;
}
}
}
if (flag) {
resultMap.put("sign", "1");
resultMap.put("message", SystemEnv.getHtmlLabelName(83551, user.getLanguage()));//保存成功
}
} catch (Exception e) {
writeLog(e);
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(84544, user.getLanguage()));//保存失败
} finally {
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
detailComInfo.removeCache();
}
return resultMap;
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,234 @@
package com.engine.kq.entity;
/**
*
*/
public class KQBalanceOfLeaveEntity {
/**
* ID
*/
int id;
/**
* ID
*/
int leaveRulesId;
/**
* ID
*/
int resourceId;
/**
*
* yyyy
*/
String belongYear;
/**
*
*
*/
double baseAmount = 0.00;
/**
*
*
*/
double usedAmount = 0.00;
/**
*
*
*/
double extraAmount = 0.00;
/**
*
*/
double baseAmount2 = 0.00;
/**
*
*/
double usedAmount2 = 0.00;
/**
*
*/
double extraAmount2 = 0.00;
/**
* 0-1-
*/
int status;
/**
*
*/
String expirationDate;
/**
*
*/
String effectiveDate;
/**
*
*/
int minimumUnit;
public KQBalanceOfLeaveEntity() {
}
public KQBalanceOfLeaveEntity(int id, int leaveRulesId, int resourceId, String belongYear, double baseAmount, double usedAmount, double extraAmount, double baseAmount2, double usedAmount2, double extraAmount2, int status, String expirationDate) {
this.id = id;
this.leaveRulesId = leaveRulesId;
this.resourceId = resourceId;
this.belongYear = belongYear;
this.baseAmount = baseAmount;
this.usedAmount = usedAmount;
this.extraAmount = extraAmount;
this.baseAmount2 = baseAmount2;
this.usedAmount2 = usedAmount2;
this.extraAmount2 = extraAmount2;
this.status = status;
this.expirationDate = expirationDate;
}
public KQBalanceOfLeaveEntity(int id, int leaveRulesId, int resourceId, String belongYear, double baseAmount, double usedAmount, double extraAmount, double baseAmount2, double usedAmount2, double extraAmount2, int status, String expirationDate ,String effectiveDate) {
this.id = id;
this.leaveRulesId = leaveRulesId;
this.resourceId = resourceId;
this.belongYear = belongYear;
this.baseAmount = baseAmount;
this.usedAmount = usedAmount;
this.extraAmount = extraAmount;
this.baseAmount2 = baseAmount2;
this.usedAmount2 = usedAmount2;
this.extraAmount2 = extraAmount2;
this.status = status;
this.expirationDate = expirationDate;
this.effectiveDate = effectiveDate;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getLeaveRulesId() {
return leaveRulesId;
}
public void setLeaveRulesId(int leaveRulesId) {
this.leaveRulesId = leaveRulesId;
}
public int getResourceId() {
return resourceId;
}
public void setResourceId(int resourceId) {
this.resourceId = resourceId;
}
public String getBelongYear() {
return belongYear;
}
public void setBelongYear(String belongYear) {
this.belongYear = belongYear;
}
public double getBaseAmount() {
return baseAmount;
}
public void setBaseAmount(double baseAmount) {
this.baseAmount = baseAmount;
}
public double getUsedAmount() {
return usedAmount;
}
public void setUsedAmount(double usedAmount) {
this.usedAmount = usedAmount;
}
public double getExtraAmount() {
return extraAmount;
}
public void setExtraAmount(double extraAmount) {
this.extraAmount = extraAmount;
}
public double getBaseAmount2() {
return baseAmount2;
}
public void setBaseAmount2(double baseAmount2) {
this.baseAmount2 = baseAmount2;
}
public double getUsedAmount2() {
return usedAmount2;
}
public void setUsedAmount2(double usedAmount2) {
this.usedAmount2 = usedAmount2;
}
public double getExtraAmount2() {
return extraAmount2;
}
public void setExtraAmount2(double extraAmount2) {
this.extraAmount2 = extraAmount2;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(String expirationDate) {
this.expirationDate = expirationDate;
}
public String getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(String effectiveDate) {
this.effectiveDate = effectiveDate;
}
public int getMinimumUnit() {
return minimumUnit;
}
public void setMinimumUnit(int minimumUnit) {
this.minimumUnit = minimumUnit;
}
public boolean equals(KQBalanceOfLeaveEntity entity) {
if (this.baseAmount != entity.getBaseAmount()
|| this.extraAmount != entity.getExtraAmount()
|| this.usedAmount != entity.getUsedAmount()
|| this.baseAmount2 != entity.getBaseAmount2()
|| this.extraAmount2 != entity.getExtraAmount2()
|| this.usedAmount2 != entity.getUsedAmount2()) {
return false;
} else {
return true;
}
}
public boolean equalsByBaseAmount(KQBalanceOfLeaveEntity entity) {
if (this.baseAmount != entity.getBaseAmount()
|| this.baseAmount2 != entity.getBaseAmount2()) {
return false;
} else {
return true;
}
}
}

@ -0,0 +1,253 @@
package com.engine.kq.entity;
/**
*
*/
public class KQOvertimeRulesDetailEntity {
/**
* ID
*/
int id;
/**
* ID
*/
int ruleId;
/**
* 1-2-3-
*/
int dayType;
/**
* 0-1-
*/
int overtimeEnable = 0;
/**
*
* 1-
* 2-
* 3-
* 4-
*/
int computingMode = -1;
/**
*
*/
int startTime = -1;
/**
*
*/
int minimumLen = -1;
int maxmumLen = -1;
/**
* 0-1-
*/
int paidLeaveEnable = 0;
/**
*
*/
double lenOfOvertime = -1;
/**
*
*/
double lenOfLeave = -1;
/**
*
*/
int hasRestTime = 0;
/**
*
*/
int before_startTime = 0;
/**
*
*/
int has_cut_point = 0;
/**
*
*/
int isovertimecal=0;
/**
*
*/
String cut_point = "";
/**
* 1-2-
*/
int paidLeaveEnableType = 1;
/**
* : 1-2-3-
*/
int paidLeaveEnableDefaultType = 1;
/**
* : 1-2-3-
*/
int paidLeaveEnableFlowType = 1;
/**
* : 1-2-
*/
int restTimeType = 1;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getRuleId() {
return ruleId;
}
public void setRuleId(int ruleId) {
this.ruleId = ruleId;
}
public int getDayType() {
return dayType;
}
public void setDayType(int dayType) {
this.dayType = dayType;
}
public int getOvertimeEnable() {
return overtimeEnable;
}
public void setOvertimeEnable(int overtimeEnable) {
this.overtimeEnable = overtimeEnable;
}
public int getComputingMode() {
return computingMode;
}
public void setComputingMode(int computingMode) {
this.computingMode = computingMode;
}
public int getStartTime() {
return startTime;
}
public void setStartTime(int startTime) {
this.startTime = startTime;
}
public int getMinimumLen() {
return minimumLen;
}
public void setMinimumLen(int minimumLen) {
this.minimumLen = minimumLen;
}
public int getMaxmumLen() {
return maxmumLen;
}
public void setMaxmumLen(int maxmumLen) {
this.maxmumLen = maxmumLen;
}
public int getPaidLeaveEnable() {
return paidLeaveEnable;
}
public void setPaidLeaveEnable(int paidLeaveEnable) {
this.paidLeaveEnable = paidLeaveEnable;
}
public double getLenOfOvertime() {
return lenOfOvertime;
}
public void setLenOfOvertime(double lenOfOvertime) {
this.lenOfOvertime = lenOfOvertime;
}
public double getLenOfLeave() {
return lenOfLeave;
}
public void setLenOfLeave(double lenOfLeave) {
this.lenOfLeave = lenOfLeave;
}
public int getHasRestTime() {
return hasRestTime;
}
public void setHasRestTime(int hasRestTime) {
this.hasRestTime = hasRestTime;
}
public int getBefore_startTime() {
return before_startTime;
}
public void setBefore_startTime(int before_startTime) {
this.before_startTime = before_startTime;
}
public String getCut_point() {
return cut_point;
}
public void setCut_point(String cut_point) {
this.cut_point = cut_point;
}
public int getHas_cut_point() {
return has_cut_point;
}
public void setHas_cut_point(int has_cut_point) {
this.has_cut_point = has_cut_point;
}
public int getIsOvertimeCal() {
return isovertimecal;
}
public void setIsOvertimeCal(int isovertimecal) {
this.isovertimecal = isovertimecal;
}
public int getPaidLeaveEnableType() {
return paidLeaveEnableType;
}
public void setPaidLeaveEnableType(int paidLeaveEnableType) {
this.paidLeaveEnableType = paidLeaveEnableType;
}
public int getPaidLeaveEnableDefaultType() {
return paidLeaveEnableDefaultType;
}
public void setPaidLeaveEnableDefaultType(int paidLeaveEnableDefaultType) {
this.paidLeaveEnableDefaultType = paidLeaveEnableDefaultType;
}
public int getPaidLeaveEnableFlowType() {
return paidLeaveEnableFlowType;
}
public void setPaidLeaveEnableFlowType(int paidLeaveEnableFlowType) {
this.paidLeaveEnableFlowType = paidLeaveEnableFlowType;
}
public int getRestTimeType() {
return restTimeType;
}
public void setRestTimeType(int restTimeType) {
this.restTimeType = restTimeType;
}
}
Loading…
Cancel
Save