|
|
@ -37,6 +37,8 @@ import java.util.regex.Pattern;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class KQBalanceOfLeaveBiz {
|
|
|
|
public class KQBalanceOfLeaveBiz {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static BaseBean bb = new BaseBean();
|
|
|
|
|
|
|
|
|
|
|
|
private static KQLog logger = new KQLog();//用于记录日志信息
|
|
|
|
private static KQLog logger = new KQLog();//用于记录日志信息
|
|
|
|
|
|
|
|
|
|
|
|
public static String getBalanceOfLeave(String resourceId, String ruleId, String date) {
|
|
|
|
public static String getBalanceOfLeave(String resourceId, String ruleId, String date) {
|
|
|
@ -87,6 +89,7 @@ public class KQBalanceOfLeaveBiz {
|
|
|
|
* @return 如果传入的指定假期没有开启假期余额,则返回0.00
|
|
|
|
* @return 如果传入的指定假期没有开启假期余额,则返回0.00
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static String getRestAmount(String resourceId, String ruleId, String searchDate, boolean calcByCurrentDate, boolean isAll) {
|
|
|
|
public static String getRestAmount(String resourceId, String ruleId, String searchDate, boolean calcByCurrentDate, boolean isAll) {
|
|
|
|
|
|
|
|
bb.writeLog("getRestAmount start");
|
|
|
|
//员工的假期余额
|
|
|
|
//员工的假期余额
|
|
|
|
String balanceOfLeave = "0";
|
|
|
|
String balanceOfLeave = "0";
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
@ -123,11 +126,19 @@ public class KQBalanceOfLeaveBiz {
|
|
|
|
/**********************************************************************************************************/
|
|
|
|
/**********************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
//假期规则缓存类
|
|
|
|
//假期规则缓存类
|
|
|
|
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
|
|
|
|
KQLeaveRulesDetail detailComInfo = new KQLeaveRulesDetail();
|
|
|
|
|
|
|
|
String seclevel = resourceComInfo.getSeclevel(resourceId);
|
|
|
|
|
|
|
|
String rulesDetailId = detailComInfo.getKqLeaveRulesId(resourceId, Util.getIntValue(seclevel, 0), ruleId);
|
|
|
|
|
|
|
|
detailComInfo = detailComInfo.initCache(rulesDetailId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
|
|
|
|
//余额发放方式:1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、5-加班时长自动计入余额、6-按司龄+工龄自动发放
|
|
|
|
//余额发放方式:1-手动发放、2-按司龄自动发放、3-按工龄自动发放、4-每年自动发放固定天数、5-加班时长自动计入余额、6-按司龄+工龄自动发放
|
|
|
|
int distributionMode = Util.getIntValue(detailComInfo.getDistributionMode(ruleId, subCompanyId), 1);
|
|
|
|
int distributionMode = Util.getIntValue(""+detailComInfo.getDistributionMode());
|
|
|
|
|
|
|
|
bb.writeLog("distributionMode: " + distributionMode);
|
|
|
|
|
|
|
|
bb.writeLog("distributionMode: " + ""+detailComInfo.getDistributionMode());
|
|
|
|
//
|
|
|
|
//
|
|
|
|
int decimalDigit = Util.getIntValue(detailComInfo.getDecimalDigit(ruleId, subCompanyId), 2);
|
|
|
|
int decimalDigit = Util.getIntValue(""+detailComInfo.getDecimalDigit());
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************************************************/
|
|
|
|
/**********************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
@ -152,7 +163,13 @@ public class KQBalanceOfLeaveBiz {
|
|
|
|
String date = calcByCurrentDate ? currentDate : searchDate;
|
|
|
|
String date = calcByCurrentDate ? currentDate : searchDate;
|
|
|
|
|
|
|
|
|
|
|
|
//如果是调休,获取假期余额的逻辑会不太一样
|
|
|
|
//如果是调休,获取假期余额的逻辑会不太一样
|
|
|
|
|
|
|
|
bb.writeLog("distributionMode: " + distributionMode);
|
|
|
|
if (distributionMode == 5) {
|
|
|
|
if (distributionMode == 5) {
|
|
|
|
|
|
|
|
bb.writeLog("ruleId: " + ruleId);
|
|
|
|
|
|
|
|
bb.writeLog("resourceId: " + resourceId);
|
|
|
|
|
|
|
|
bb.writeLog("searchDate: " + searchDate);
|
|
|
|
|
|
|
|
bb.writeLog("calcByCurrentDate: " + calcByCurrentDate);
|
|
|
|
|
|
|
|
bb.writeLog("isAll: " + isAll);
|
|
|
|
restAmount = getRestAmountByDis5(ruleId, resourceId, searchDate, calcByCurrentDate, isAll);
|
|
|
|
restAmount = getRestAmountByDis5(ruleId, resourceId, searchDate, calcByCurrentDate, isAll);
|
|
|
|
return restAmount.setScale(decimalDigit, RoundingMode.HALF_UP).toPlainString();
|
|
|
|
return restAmount.setScale(decimalDigit, RoundingMode.HALF_UP).toPlainString();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -263,13 +280,18 @@ public class KQBalanceOfLeaveBiz {
|
|
|
|
/*********************************************************************************/
|
|
|
|
/*********************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
//获取此假期类型下,该人员所在分部对应的假期规则
|
|
|
|
//获取此假期类型下,该人员所在分部对应的假期规则
|
|
|
|
KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
|
|
|
|
KQLeaveRulesDetail detailComInfo = new KQLeaveRulesDetail();
|
|
|
|
|
|
|
|
String seclevel = resourceComInfo.getSeclevel(resourceId);
|
|
|
|
|
|
|
|
String rulesDetailId = detailComInfo.getKqLeaveRulesId(resourceId, Util.getIntValue(seclevel, 0), ruleId);
|
|
|
|
|
|
|
|
detailComInfo = detailComInfo.initCache(rulesDetailId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// KQLeaveRulesDetailComInfo detailComInfo = new KQLeaveRulesDetailComInfo();
|
|
|
|
//余额发放方式
|
|
|
|
//余额发放方式
|
|
|
|
int distributionMode = Util.getIntValue(detailComInfo.getDistributionMode(ruleId, subCompanyId), 1);
|
|
|
|
int distributionMode = Util.getIntValue(""+detailComInfo.getDistributionMode());
|
|
|
|
//释放规则:0-不限制、1-按天释放、2-按月释放
|
|
|
|
//释放规则:0-不限制、1-按天释放、2-按月释放
|
|
|
|
int releaseRule = Util.getIntValue(detailComInfo.getReleaseRule(ruleId, subCompanyId), 0);
|
|
|
|
int releaseRule = Util.getIntValue(""+detailComInfo.getReleaseRule());
|
|
|
|
//小数位数
|
|
|
|
//小数位数
|
|
|
|
int decimalDigit = Util.getIntValue(detailComInfo.getDecimalDigit(ruleId, subCompanyId), 2);
|
|
|
|
int decimalDigit = Util.getIntValue(""+detailComInfo.getDecimalDigit());
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************************/
|
|
|
|
/*********************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
@ -3484,6 +3506,8 @@ public class KQBalanceOfLeaveBiz {
|
|
|
|
sql += " and belongYear='" + searchYear + "'";
|
|
|
|
sql += " and belongYear='" + searchYear + "'";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bb.writeLog("balance of leave restamount sql: " + sql );
|
|
|
|
recordSet.executeQuery(sql);
|
|
|
|
recordSet.executeQuery(sql);
|
|
|
|
while (recordSet.next()) {
|
|
|
|
while (recordSet.next()) {
|
|
|
|
BigDecimal _baseAmount = new BigDecimal(Util.null2s(recordSet.getString("allBaseAmount"), "0"));
|
|
|
|
BigDecimal _baseAmount = new BigDecimal(Util.null2s(recordSet.getString("allBaseAmount"), "0"));
|
|
|
|