Commit 93ed88e9 authored by huyuchen's avatar huyuchen

薪资年终奖计算修改

parent 8b05ab54
...@@ -184,8 +184,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -184,8 +184,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
BigDecimal isTax; BigDecimal isTax;
//减除费用 //减除费用
BigDecimal costReduction; BigDecimal costReduction;
//年终奖上限
BigDecimal maxAnualSalary;
//年终奖单独扣税12月税费 //年终奖单独扣税12月税费
BigDecimal finalSalaryNoSalary; BigDecimal finalSalaryNoSalary;
//年终奖合并扣税12月税费 //年终奖合并扣税12月税费
...@@ -240,7 +238,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -240,7 +238,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
//薪资扣税合计 //薪资扣税合计
sumTax = BigDecimal.ZERO; sumTax = BigDecimal.ZERO;
minSalary = BigDecimal.ZERO; minSalary = BigDecimal.ZERO;
maxAnualSalary = BigDecimal.ZERO;
costReduction = BigDecimal.ZERO; costReduction = BigDecimal.ZERO;
isTax = BigDecimal.ZERO; isTax = BigDecimal.ZERO;
twlSalaryTax = BigDecimal.ZERO; twlSalaryTax = BigDecimal.ZERO;
...@@ -352,114 +349,126 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -352,114 +349,126 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
sumDeductSalary = BigDecimalUtils.safeAdd(isTax,infoVo.getDeductTaxSalary()); sumDeductSalary = BigDecimalUtils.safeAdd(isTax,infoVo.getDeductTaxSalary());
} }
//最优解计算区间
BigDecimal oneBecimal = new BigDecimal("36000");
BigDecimal twoBecimal = new BigDecimal("144000");
BigDecimal subOneBecimal = BigDecimalUtils.safeSubtract(wSalary,oneBecimal);
BigDecimal subTwoBecimal = BigDecimalUtils.safeSubtract(wSalary,twoBecimal);
if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary). if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("36000")) <= 0) { compareTo(oneBecimal) <= 0) {
if (wSalary.compareTo(new BigDecimal("36000")) <= 0) { if (wSalary.compareTo(oneBecimal) <= 0) {
if (isSend) { if (!isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = socialFundTax; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000")); if (isSend) {
maxAnualSalary = new BigDecimal("36000"); minSalary = subOneBecimal;
} else {
minSalary = subOneBecimal.compareTo(socialFundTax) >0 ? subOneBecimal : socialFundTax;
}
} }
} else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary). } else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("72000")) <= 0) { compareTo(new BigDecimal("72000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("36000")) <= 0) { if (wSalary.compareTo(oneBecimal) <= 0) {
if (isSend) { if (!isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = socialFundTax; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000")); if (isSend) {
maxAnualSalary = new BigDecimal("36000"); minSalary = subOneBecimal;
} else {
minSalary = subOneBecimal.compareTo(socialFundTax) >0 ? subOneBecimal : socialFundTax;
}
} }
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary). }else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("203100")) <= 0) { compareTo(new BigDecimal("203100")) <= 0) {
if (wSalary.compareTo(new BigDecimal("36000")) <= 0) { if (wSalary.compareTo(oneBecimal) <= 0) {
if (isSend) { if (!isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = socialFundTax; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000")); if (isSend) {
maxAnualSalary = new BigDecimal("36000"); minSalary = subOneBecimal;
} else {
minSalary = subOneBecimal.compareTo(socialFundTax) >0 ? subOneBecimal : socialFundTax;
}
} }
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary). }else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("288000")) <= 0) { compareTo(new BigDecimal("288000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("144000")) <= 0) { if (wSalary.compareTo(twoBecimal) <= 0) {
if (isSend) { if (!isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = socialFundTax; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("144000")); if (isSend) {
maxAnualSalary = new BigDecimal("144000"); minSalary = subTwoBecimal;
} else {
minSalary = subTwoBecimal.compareTo(socialFundTax) >0 ? subTwoBecimal : socialFundTax;
}
} }
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary). }else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("672000")) <= 0) { compareTo(new BigDecimal("672000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("144000")) <= 0) { if (wSalary.compareTo(twoBecimal) <= 0) {
if (isSend) { if (!isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = socialFundTax; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000")); if (isSend) {
maxAnualSalary = new BigDecimal("36000"); minSalary = subTwoBecimal;
} else {
minSalary = subTwoBecimal.compareTo(socialFundTax) >0 ? subTwoBecimal : socialFundTax;
}
} }
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary). }else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("1277500")) <= 0) { compareTo(new BigDecimal("1277500")) <= 0) {
if (wSalary.compareTo(new BigDecimal("300000")) <= 0) { BigDecimal threeBecimal = new BigDecimal("300000");
if (isSend) { BigDecimal subThreeBecimal = BigDecimalUtils.safeSubtract(wSalary,threeBecimal);
maxAnualSalary = wSalary; if (wSalary.compareTo(threeBecimal) <= 0) {
} else { if (!isSend) {
minSalary = socialFundTax; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("300000")); if (isSend) {
maxAnualSalary = new BigDecimal("300000"); minSalary = subThreeBecimal;
} else {
minSalary = subThreeBecimal.compareTo(socialFundTax) >0 ? subThreeBecimal : socialFundTax;
}
} }
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary). }else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("1452500")) <= 0) { compareTo(new BigDecimal("1452500")) <= 0) {
if (wSalary.compareTo(new BigDecimal("420000")) <= 0) { BigDecimal fourBecimal = new BigDecimal("420000");
if (isSend) { BigDecimal subFourBecimal = BigDecimalUtils.safeSubtract(wSalary,fourBecimal);
maxAnualSalary = wSalary; if (wSalary.compareTo(fourBecimal) <= 0) {
} else { if (!isSend) {
minSalary = socialFundTax; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("420000")); if (isSend) {
maxAnualSalary = new BigDecimal("420000"); minSalary = subFourBecimal;
} else {
minSalary = subFourBecimal.compareTo(socialFundTax) >0 ? subFourBecimal : socialFundTax;
}
} }
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary). }else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("1452500")) > 0) { compareTo(new BigDecimal("1452500")) > 0) {
if (wSalary.compareTo(new BigDecimal("660000")) <= 0) { BigDecimal fiveBecimal = new BigDecimal("660000");
if (isSend) { BigDecimal subFiveBecimal = BigDecimalUtils.safeSubtract(wSalary,fiveBecimal);
maxAnualSalary = wSalary; if (wSalary.compareTo(fiveBecimal) <= 0) {
} else { if (!isSend) {
minSalary = socialFundTax; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("660000")); if (isSend) {
maxAnualSalary = new BigDecimal("660000"); minSalary = subFiveBecimal;
} else {
minSalary = subFiveBecimal.compareTo(socialFundTax) >0 ? subFiveBecimal : socialFundTax;
}
} }
} }
JSONObject jsonObject = calculationPersonSalary(personTax, annousTax, minSalary, maxAnualSalary, JSONObject jsonObject = calculationPersonSalary(personTax, annousTax, minSalary, wSalary, sumTax,
wSalary, sumTax, ySalary, sumDeductSalary, twlSalaryTax); ySalary, sumDeductSalary, twlSalaryTax);
res = jsonObject.getBigDecimal("zySalary"); res = jsonObject.getBigDecimal("zySalary");
BigDecimal anRes = BigDecimal.ZERO; BigDecimal anRes = BigDecimal.ZERO;
if (Common.isNotNull(jsonObject.getBigDecimal("anRes"))) { if (Common.isNotNull(jsonObject.getBigDecimal("anRes"))) {
...@@ -501,7 +510,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -501,7 +510,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
* @param personTax 薪资扣税阶梯表list * @param personTax 薪资扣税阶梯表list
* @param annousTax 年终奖扣税阶梯表list * @param annousTax 年终奖扣税阶梯表list
* @param minSalary 工资下限 * @param minSalary 工资下限
* @param maxAnualSalary 年终奖上限
* @param wSalary 未发金额 * @param wSalary 未发金额
* @param ySalary 应发工资合计 * @param ySalary 应发工资合计
* @param sumTax 薪资扣税合计 * @param sumTax 薪资扣税合计
...@@ -512,15 +520,14 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -512,15 +520,14 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
* @return: java.math.BigDecimal * @return: java.math.BigDecimal
**/ **/
private static JSONObject calculationPersonSalary(List<TSalaryTaxConfig> personTax, List<TSalaryTaxConfig> annousTax, private static JSONObject calculationPersonSalary(List<TSalaryTaxConfig> personTax, List<TSalaryTaxConfig> annousTax,
BigDecimal minSalary, BigDecimal maxAnualSalary, BigDecimal minSalary, BigDecimal wSalary, BigDecimal sumTax, BigDecimal ySalary,
BigDecimal wSalary, BigDecimal sumTax, BigDecimal ySalary,
BigDecimal sumDeductSalary, BigDecimal twlSalaryTax) { BigDecimal sumDeductSalary, BigDecimal twlSalaryTax) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
BigDecimal anRes; BigDecimal anRes;
BigDecimal res; BigDecimal res;
List<BigDecimal> zySalary = new ArrayList<>(); List<BigDecimal> zySalary = new ArrayList<>();
Map<String,BigDecimal> map = new HashMap<>(); Map<String,BigDecimal> map = new HashMap<>();
for (BigDecimal i = minSalary; i.compareTo(maxAnualSalary) <= 0; i = BigDecimalUtils.safeAdd(i,new BigDecimal(100)) ) { for (BigDecimal i = minSalary; i.compareTo(wSalary) <= 0; i = BigDecimalUtils.safeAdd(i,new BigDecimal(100)) ) {
//本次薪资纳税额 //本次薪资纳税额
res = BigDecimal.ZERO; res = BigDecimal.ZERO;
//本次年终奖纳税额 //本次年终奖纳税额
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment