Commit 93ed88e9 authored by huyuchen's avatar huyuchen

薪资年终奖计算修改

parent 8b05ab54
......@@ -184,8 +184,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
BigDecimal isTax;
//减除费用
BigDecimal costReduction;
//年终奖上限
BigDecimal maxAnualSalary;
//年终奖单独扣税12月税费
BigDecimal finalSalaryNoSalary;
//年终奖合并扣税12月税费
......@@ -240,7 +238,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
//薪资扣税合计
sumTax = BigDecimal.ZERO;
minSalary = BigDecimal.ZERO;
maxAnualSalary = BigDecimal.ZERO;
costReduction = BigDecimal.ZERO;
isTax = BigDecimal.ZERO;
twlSalaryTax = BigDecimal.ZERO;
......@@ -352,114 +349,126 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
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).
compareTo(new BigDecimal("36000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("36000")) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
compareTo(oneBecimal) <= 0) {
if (wSalary.compareTo(oneBecimal) <= 0) {
if (!isSend) {
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
maxAnualSalary = new BigDecimal("36000");
if (isSend) {
minSalary = subOneBecimal;
} else {
minSalary = subOneBecimal.compareTo(socialFundTax) >0 ? subOneBecimal : socialFundTax;
}
}
} else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("72000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("36000")) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
if (wSalary.compareTo(oneBecimal) <= 0) {
if (!isSend) {
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
maxAnualSalary = new BigDecimal("36000");
if (isSend) {
minSalary = subOneBecimal;
} else {
minSalary = subOneBecimal.compareTo(socialFundTax) >0 ? subOneBecimal : socialFundTax;
}
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("203100")) <= 0) {
if (wSalary.compareTo(new BigDecimal("36000")) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
if (wSalary.compareTo(oneBecimal) <= 0) {
if (!isSend) {
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
maxAnualSalary = new BigDecimal("36000");
if (isSend) {
minSalary = subOneBecimal;
} else {
minSalary = subOneBecimal.compareTo(socialFundTax) >0 ? subOneBecimal : socialFundTax;
}
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("288000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("144000")) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
if (wSalary.compareTo(twoBecimal) <= 0) {
if (!isSend) {
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("144000"));
maxAnualSalary = new BigDecimal("144000");
if (isSend) {
minSalary = subTwoBecimal;
} else {
minSalary = subTwoBecimal.compareTo(socialFundTax) >0 ? subTwoBecimal : socialFundTax;
}
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("672000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("144000")) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
if (wSalary.compareTo(twoBecimal) <= 0) {
if (!isSend) {
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
maxAnualSalary = new BigDecimal("36000");
if (isSend) {
minSalary = subTwoBecimal;
} else {
minSalary = subTwoBecimal.compareTo(socialFundTax) >0 ? subTwoBecimal : socialFundTax;
}
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("1277500")) <= 0) {
if (wSalary.compareTo(new BigDecimal("300000")) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
BigDecimal threeBecimal = new BigDecimal("300000");
BigDecimal subThreeBecimal = BigDecimalUtils.safeSubtract(wSalary,threeBecimal);
if (wSalary.compareTo(threeBecimal) <= 0) {
if (!isSend) {
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("300000"));
maxAnualSalary = new BigDecimal("300000");
if (isSend) {
minSalary = subThreeBecimal;
} else {
minSalary = subThreeBecimal.compareTo(socialFundTax) >0 ? subThreeBecimal : socialFundTax;
}
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("1452500")) <= 0) {
if (wSalary.compareTo(new BigDecimal("420000")) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
BigDecimal fourBecimal = new BigDecimal("420000");
BigDecimal subFourBecimal = BigDecimalUtils.safeSubtract(wSalary,fourBecimal);
if (wSalary.compareTo(fourBecimal) <= 0) {
if (!isSend) {
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("420000"));
maxAnualSalary = new BigDecimal("420000");
if (isSend) {
minSalary = subFourBecimal;
} else {
minSalary = subFourBecimal.compareTo(socialFundTax) >0 ? subFourBecimal : socialFundTax;
}
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("1452500")) > 0) {
if (wSalary.compareTo(new BigDecimal("660000")) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
BigDecimal fiveBecimal = new BigDecimal("660000");
BigDecimal subFiveBecimal = BigDecimalUtils.safeSubtract(wSalary,fiveBecimal);
if (wSalary.compareTo(fiveBecimal) <= 0) {
if (!isSend) {
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("660000"));
maxAnualSalary = new BigDecimal("660000");
if (isSend) {
minSalary = subFiveBecimal;
} else {
minSalary = subFiveBecimal.compareTo(socialFundTax) >0 ? subFiveBecimal : socialFundTax;
}
}
}
JSONObject jsonObject = calculationPersonSalary(personTax, annousTax, minSalary, maxAnualSalary,
wSalary, sumTax, ySalary, sumDeductSalary, twlSalaryTax);
JSONObject jsonObject = calculationPersonSalary(personTax, annousTax, minSalary, wSalary, sumTax,
ySalary, sumDeductSalary, twlSalaryTax);
res = jsonObject.getBigDecimal("zySalary");
BigDecimal anRes = BigDecimal.ZERO;
if (Common.isNotNull(jsonObject.getBigDecimal("anRes"))) {
......@@ -501,7 +510,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
* @param personTax 薪资扣税阶梯表list
* @param annousTax 年终奖扣税阶梯表list
* @param minSalary 工资下限
* @param maxAnualSalary 年终奖上限
* @param wSalary 未发金额
* @param ySalary 应发工资合计
* @param sumTax 薪资扣税合计
......@@ -512,15 +520,14 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
* @return: java.math.BigDecimal
**/
private static JSONObject calculationPersonSalary(List<TSalaryTaxConfig> personTax, List<TSalaryTaxConfig> annousTax,
BigDecimal minSalary, BigDecimal maxAnualSalary,
BigDecimal wSalary, BigDecimal sumTax, BigDecimal ySalary,
BigDecimal minSalary, BigDecimal wSalary, BigDecimal sumTax, BigDecimal ySalary,
BigDecimal sumDeductSalary, BigDecimal twlSalaryTax) {
JSONObject jsonObject = new JSONObject();
BigDecimal anRes;
BigDecimal res;
List<BigDecimal> zySalary = new ArrayList<>();
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;
//本次年终奖纳税额
......
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