Commit 7fe558de authored by hongguangwu's avatar hongguangwu

优化导入,精简字段

parent 87c5da5e
......@@ -308,5 +308,9 @@ public class TSalaryAccountVo implements Serializable {
@ExcelProperty("个税-单位承担")
private BigDecimal salaryTaxUnit;
@ExcelAttribute(name = "是否新员工(默认否)")
@ExcelProperty("是否新员工(默认否)")
private String isNewEmployee;
private List<TSalaryAccountItemVo> saiList = new ArrayList<>(); //工资组成部分明细
}
......@@ -710,7 +710,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
//年终奖优化方案 2:自动计算
if (CommonConstants.TWO_STRING.equals(checkYearFinalStyle)) {
checkYearFinalStyle = checkYearFinalStyle(isActual, saiList, checkYearFinalStyle, asList, sdSum
, costReduction, personTax, sai, saiList, relaySalary, annualBonus, annousTax);
, costReduction, personTax, sai, saiList, relaySalary, annualBonus, annousTax, a);
}
//年终奖单独扣税
if (CommonConstants.ONE_STRING.equals(checkYearFinalStyle)) {
......@@ -728,20 +728,19 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
}
// 薪资扣税 1:扣税
//if (Common.isNotNull(a.getSalaryTaxFlag()) && CommonConstants.ONE.equals(a.getSalaryTaxFlag())) {
// 应发顺推个税
if (!isActual) {
personalDebt = personalDebt.add(this.saveNewItems(sai, saiList, SalaryConstants.SALARY_TAX,
SalaryConstants.SALARY_TAX_JAVA,
calculation2PersonSalary(isActual, saiList, checkYearFinalStyle, asList, sdSum
, costReduction, personTax, sai, saiList, relaySalary), CommonConstants.ZERO_INT));
, costReduction, personTax, sai, saiList, relaySalary, a), CommonConstants.ZERO_INT));
} else {
// 实发倒推个税应发
if (!isLabor) {
this.saveNewItems(sai, saiList, SalaryConstants.SALARY_TAX,
SalaryConstants.SALARY_TAX_JAVA,
calculation2PersonSalary(isActual, saiList, checkYearFinalStyle, asList, sdSum
, costReduction, personTax, sai, saiList, relaySalary), CommonConstants.ZERO_INT);
, costReduction, personTax, sai, saiList, relaySalary, a), CommonConstants.ZERO_INT);
} else {
// 实发劳务费,按月累计扣税 2022-3-2 17:32:40 樊青青提的需求
this.saveNewItems(sai, saiList, SalaryConstants.SALARY_TAX,
......@@ -749,9 +748,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
calculation2Labor(saiList, asList
, saiList), CommonConstants.ZERO_INT);
}
}
//}
if (!isActual) { //导入应发,顺推实发
// 个人实发合计
......@@ -1157,7 +1154,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
private static BigDecimal calculation2PersonSalary(boolean isActual, List<TSalaryAccountItem> itemList
, String checkYearFinalStyle, List<TSalaryAccountItem> itemHistoryList, BigDecimal specialDeductionSum
, BigDecimal costReduction, List<TSalaryTaxConfig> subs, TSalaryAccountItem sai
, List<TSalaryAccountItem> saiList, BigDecimal relaySalary) {
, List<TSalaryAccountItem> saiList, BigDecimal relaySalary, TSalaryAccount a) {
//本次纳税额
BigDecimal res = SalaryConstants.B_ZERO;
BigDecimal annualBonus = SalaryConstants.B_ZERO;
......@@ -1178,9 +1175,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
realDeduSalary = realDeduSalary.add(item.getSalaryMoney());
actualSalarySumNow = actualSalarySumNow.add(item.getSalaryMoney());
}
/*if (SalaryConstants.ANNUAL_BONUS_TAX_JAVA.equals(item.getJavaFiedName())) {
sumTax = sumTax.add(item.getSalaryMoney());
}*/
if (CommonConstants.ONE_INT == item.getIsTax()) {
res = res.subtract(item.getSalaryMoney());
realDeduSalary = realDeduSalary.subtract(item.getSalaryMoney());
......@@ -1196,9 +1190,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if (SalaryConstants.SALARY_TAX_JAVA.equals(item.getJavaFiedName())) {
sumTax = sumTax.add(item.getSalaryMoney());
}
/*if (SalaryConstants.ANNUAL_BONUS_TAX_JAVA.equals(item.getJavaFiedName())) {
sumTax = sumTax.add(item.getSalaryMoney());
}*/
if (SalaryConstants.RELAY_SALARY_JAVA.equals(item.getJavaFiedName())) {
res = res.add(item.getSalaryMoney());
realSalaryHistory = realSalaryHistory.add(item.getSalaryMoney());
......@@ -1214,18 +1205,12 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if (specialDeductionSum != null) {
res = res.subtract(specialDeductionSum);
realDeduSalary = realDeduSalary.subtract(specialDeductionSum);
//addRelaySalary = addRelaySalary.add(specialDeductionSum);
}
if (costReduction != null) {
res = res.subtract(costReduction);
realDeduSalary = realDeduSalary.subtract(costReduction);
addRelaySalary = addRelaySalary.add(costReduction);
}
//不合并年终奖扣税
/*if (CommonConstants.ONE.equals(checkYearFinalStyle)) {
res = res.subtract(annualBonus);
addRelaySalary = addRelaySalary.add(annualBonus);
}*/
if (!isActual) {
for (TSalaryTaxConfig sub : subs) {
if (res.compareTo(sub.getMinIncome()) == SalaryConstants.MORE_THAN
......@@ -1248,7 +1233,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
for (TSalaryTaxConfig sub : subs) {
//res = realDeduSalary / (1- (double) ((sub.getTaxRate() * 1.0) / 100))
// - (sub.getQuick()/ (1- (double) ((sub.getTaxRate() * 1.0) / 100)))
// + addRelaySalary;
// + addRelaySalary
res = realDeduSalary.divide(new BigDecimal("1").subtract(new BigDecimal(sub.getWithholdingRate()).divide(
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP)), SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP)
.subtract(sub.getQuickDeducation().divide(new BigDecimal("1").subtract(new BigDecimal(sub.getWithholdingRate()).divide(
......@@ -1270,8 +1255,10 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
sai.setIsTax(CommonConstants.ZERO_INT);
if (res.compareTo(SalaryConstants.B_ZERO) != SalaryConstants.MORE_THAN) {
sai.setSalaryMoney(actualSalarySumNow);
a.setRelaySalary(actualSalarySumNow);
} else {
sai.setSalaryMoney(relaySalary);
a.setRelaySalary(relaySalary);
}
saiList.add(sai);
break;
......@@ -1281,7 +1268,9 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if (res.compareTo(SalaryConstants.B_ZERO) == SalaryConstants.LESS_THAN) {
return SalaryConstants.B_ZERO;
}
return res.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
res = res.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
a.setSalaryTax(res);
return res;
}
......@@ -1369,9 +1358,10 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
public static String checkYearFinalStyle(boolean isActual, List<TSalaryAccountItem> itemList
, String checkYearFinalStyle, List<TSalaryAccountItem> asList, BigDecimal sdSum
, BigDecimal costReduction, List<TSalaryTaxConfig> personTax, TSalaryAccountItem sai
, List<TSalaryAccountItem> saiList, BigDecimal relaySalary, BigDecimal annualBonus, List<TSalaryTaxConfig> annousTax) {
, List<TSalaryAccountItem> saiList, BigDecimal relaySalary, BigDecimal annualBonus
, List<TSalaryTaxConfig> annousTax, TSalaryAccount a) {
BigDecimal finalSalaryWithSalary = calculation2PersonSalary(isActual, saiList, checkYearFinalStyle, asList, sdSum
, costReduction, personTax, sai, saiList, relaySalary);
, costReduction, personTax, sai, saiList, relaySalary, a);
BigDecimal finalSalaryNoSalary = calculation2FinalSalary(annualBonus, annousTax);
if (finalSalaryWithSalary.compareTo(finalSalaryNoSalary) == SalaryConstants.MORE_THAN) {
return "1";
......
......@@ -158,6 +158,12 @@ public class SalaryAccountUtil implements Serializable {
if (SalaryConstants.RELAY_SALARY_JAVA.equals(scs.getJavaFiedName())) {
try {
relaySalary = new BigDecimal(cellValueStr);
sai = new TSalaryAccountItemVo();
sai.setCnName(dbFiedName);
sai.setJavaFiedName(scs.getJavaFiedName());
sai.setIsTax(CommonConstants.ZERO_INT);
sai.setSalaryMoney(relaySalary);
saiList.add(sai);
} catch (Exception e) {
error = "第" + (i + 2) + "行:应发工资:'" + cellValueStr + "'错误,请检查数据";
errorList.add(new ErrorMessage((i + 2), error));
......@@ -167,6 +173,7 @@ public class SalaryAccountUtil implements Serializable {
if (SalaryConstants.ACTUAL_SALARY_SUM_JAVA.equals(scs.getJavaFiedName())) {
try {
actualSalarySum = new BigDecimal(cellValueStr);
entity.setActualSalary(actualSalarySum);
} catch (Exception e) {
error = "第" + (i + 2) + "行:实发工资:'" + cellValueStr + "'错误,请检查数据";
errorList.add(new ErrorMessage((i + 2), error));
......@@ -293,7 +300,8 @@ public class SalaryAccountUtil implements Serializable {
+ CommonConstants.DOWN_LINE_STRING + salaryType + CommonConstants.DOWN_LINE_STRING + relaySalary) != null) {
entity.setIsRepeat(CommonConstants.ONE_INT);
}
if (new BigDecimal("3500").equals(relaySalary) || new BigDecimal("5000").equals(relaySalary)) {
if (new BigDecimal("3500").compareTo(relaySalary) == CommonConstants.ZERO_INT
|| new BigDecimal("5000").compareTo(relaySalary) == CommonConstants.ZERO_INT) {
entity.setHaveSpecialFlag(CommonConstants.ONE_INT);
}
}
......
......@@ -50,6 +50,12 @@
</select>
<!--获取自有员工身份证-->
<select id="getOwnEmpList" resultType="String">
SELECT EMP_IDCARD FROM view_own_employee
SELECT
e.EMP_IDCARD
FROM
t_own_dept d
LEFT JOIN t_salary_employee e ON e.DEPT_ID = d.dept_id
WHERE
e.FILE_STATUS = '0'
</select>
</mapper>
......@@ -264,7 +264,7 @@
<!-- 获取当前年最小计税月 -->
<select id="getMinTaxMonthByNowYear" resultType="java.lang.String">
select
min(a.TAX_MONTH - 0)
concat(min(a.TAX_MONTH - 0),'')
from t_salary_account a
where a.EMP_IDCARD = #{empIdCard} and a.DELETE_FLAG = 0 and a.SETTLEMENT_MONTH like concat(#{nowYear},"%")
and a.FORM_TYPE != '3'
......
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