Commit cf2573cc authored by huyuchen's avatar huyuchen

接口修改

parent cc5022a8
......@@ -1531,10 +1531,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
TSalaryAccountItem sai;
for (int i = CommonConstants.ZERO_INT; i < size; i++) {
a = new TSalaryAccount();
// 本次实发
BigDecimal actualSalarySumNow = BigDecimal.ZERO;
// 当月实发合计
BigDecimal actualSalarySum = BigDecimal.ZERO;
try {
SalaryAccountUtil.reflectionAttr(savList.get(i), a);
if (!haveSalaryFlag && a.getHaveSalaryFlag() != null && a.getHaveSalaryFlag() == CommonConstants.ONE_INT) {
......@@ -1549,11 +1545,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
for (int j = 0; j < savList.get(i).getSaiList().size(); j++) {
sai = new TSalaryAccountItem();
SalaryAccountUtil.reflectionAttr(savList.get(i).getSaiList().get(j), sai);
//个人实发合计
if (SalaryConstants.ACTUAL_SALARY_SUM_JAVA.equals(sai.getJavaFiedName())) {
actualSalarySum = actualSalarySum.add(sai.getSalaryMoney());
actualSalarySumNow = actualSalarySumNow.add(sai.getSalaryMoney());
}
saiList.add(sai);
}
}
......@@ -1645,7 +1636,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
* @Date: 2022/3/3 11:30
* @return: java.math.BigDecimal
**/
private static BigDecimal calculationLabor(List<TSalaryAccountItem> itemList, List<TSalaryAccountItem> itemHistoryList,
private BigDecimal calculationLabor(List<TSalaryAccountItem> itemList, List<TSalaryAccountItem> itemHistoryList,
List<TSalaryAccountItem> saiList, TSalaryAccount a) {
// B7 = 当月实发合计
// 税=ROUND(IF(B7<=800,0,IF(B7<=3360,(B7-800)/4,IF(B7<=21000,0.16*B7/0.84,IF(B7<=49500,(0.24*B7-2000)/0.76,(0.32*B7-7000)/0.68)))),2)
......@@ -1655,12 +1646,16 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
BigDecimal actualSalarySumT;
// 当月实发合计
BigDecimal actualSalarySum = BigDecimal.ZERO;
// 历史个税合计
BigDecimal sumTax = BigDecimal.ZERO;
// 个人承担部分历史个税合计
BigDecimal sumOtherTax;
BigDecimal sumOtherTax = BigDecimal.ZERO;
// 历史应发合计
BigDecimal sumSalaryTax = BigDecimal.ZERO;
List<TSalaryAccount> list = tSalaryAccountService.list(Wrappers.<TSalaryAccount>query().lambda()
.eq(TSalaryAccount::getEmpIdcard,a.getEmpIdcard())
.eq(TSalaryAccount::getSalaryMonth,a.getSalaryMonth())
.eq(TSalaryAccount::getDeleteFlag,CommonConstants.ZERO_INT));
// 本次实发
for (TSalaryAccountItem item : itemList) {
if (SalaryConstants.ACTUAL_SALARY_SUM_JAVA.equals(item.getJavaFiedName())) {
......@@ -1668,17 +1663,10 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
actualSalarySumNow = actualSalarySumNow.add(item.getSalaryMoney());
}
}
// 历史实发、个税
for (TSalaryAccountItem item : itemHistoryList) {
if (SalaryConstants.SALARY_TAX_JAVA.equals(item.getJavaFiedName())) {
sumTax = sumTax.add(item.getSalaryMoney());
}
if (SalaryConstants.RELAY_SALARY_JAVA.equals(item.getJavaFiedName())) {
sumSalaryTax = sumSalaryTax.add(item.getSalaryMoney());
}
if (SalaryConstants.ACTUAL_SALARY_SUM_JAVA.equals(item.getJavaFiedName())) {
actualSalarySum = actualSalarySum.add(item.getSalaryMoney());
}
for (TSalaryAccount account: list) {
sumOtherTax = sumOtherTax.add(BigDecimalUtils.safeAdd(account.getSalaryTax(),account.getSalaryTaxUnit()));
sumSalaryTax = sumSalaryTax.add(account.getRelaySalaryUnit());
actualSalarySum = actualSalarySum.add(account.getRelaySalary());
}
//个人承担部分税费
BigDecimal nowTaxT;
......@@ -1689,17 +1677,15 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
// 1个人承担部分
if (SalaryConstants.IS_PERSON_TAX_ARR[1].equals(a.getIsPersonTax())) {
nowTaxT = getNowTax(actualSalarySumNow);
if (actualSalarySum.compareTo(actualSalarySumNow) != 0) {
//计算历史税费
sumOtherTax = getNowTaxNew(sumSalaryTax);
//计算本月实发合计
if (sumSalaryTax.compareTo(BigDecimal.ZERO) != 0) {
//计算本月应发合计
actualSalarySumT = BigDecimalUtils.safeAdd(nowTaxT, sumSalaryTax, actualSalarySumNow).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
//累计税费
nowTaxY = getNowTaxNew(actualSalarySumT);
if (sumOtherTax.compareTo(BigDecimal.ZERO) != 0) {
nowTaxY = BigDecimalUtils.safeSubtract(nowTaxY, sumOtherTax).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
nowTaxY = BigDecimalUtils.safeSubtract(false,nowTaxY, sumOtherTax).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
}
salaryTax = BigDecimalUtils.safeSubtract(nowTaxY, nowTaxT);
salaryTax = BigDecimalUtils.safeSubtract(false,nowTaxY, nowTaxT);
} else {
nowTaxY = nowTaxT;
}
......@@ -1708,15 +1694,14 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
a.setSalaryTax(salaryTax);
a.setSalaryTaxUnit(nowTaxT);
a.setActualSalary(BigDecimalUtils.safeSubtract(actualSalarySumNow, salaryTax));
a.setActualSalary(BigDecimalUtils.safeSubtract(false,actualSalarySumNow, salaryTax));
} else if (SalaryConstants.IS_PERSON_TAX_ARR[0].equals(a.getIsPersonTax())) {
// 0公司承担全部
nowTaxY = getNowTax(actualSalarySum);
a.setActualSalary(actualSalarySumNow);
if (sumSalaryTax.compareTo(BigDecimal.ZERO) != 0) {
if (sumOtherTax.compareTo(BigDecimal.ZERO) != 0) {
//历史应发税费
sumOtherTax = getNowTax(sumSalaryTax);
nowTaxY = BigDecimalUtils.safeSubtract(nowTaxY, sumOtherTax).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
nowTaxY = BigDecimalUtils.safeSubtract(false,nowTaxY, sumOtherTax).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
}
a.setSalaryTaxUnit(nowTaxY);
relaySalary = BigDecimalUtils.safeAdd(actualSalarySumNow, nowTaxY).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
......
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