Commit 7fe558de authored by hongguangwu's avatar hongguangwu

优化导入,精简字段

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