Commit 00ae7d63 authored by hongguangwu's avatar hongguangwu

1.7.22-薪资计税月改版

parent 8a53f881
......@@ -14,5 +14,8 @@ import java.math.BigDecimal;
@Data
public class KeyMoneyVo implements Serializable {
private String keyValue;
// 之前为减除费用而设的,暂时不用了
private BigDecimal moneyValue;
// 1.7.22版本改为先查计税月
private String textValue;
}
......@@ -306,10 +306,10 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
**/
List<TSalaryAccount> getIdCardListBySalaryId(@Param("salaryId") String salaryId);
List<KeyMoneyVo> getCostReductionToAll(@Param("deptNo") String deptNo, @Param("invoiceTitle") String invoiceTitle
List<KeyMoneyVo> getTaxMonthToAll(@Param("deptNo") String deptNo, @Param("invoiceTitle") String invoiceTitle
, @Param("tableName") String tableName, @Param("lastSettleMonth") String lastSettleMonth);
BigDecimal getCostReductionToCard(@Param("idCard") String idCard, @Param("invoiceTitle") String invoiceTitle
String getTaxMonthToCard(@Param("idCard") String idCard, @Param("invoiceTitle") String invoiceTitle
, @Param("tableName") String tableName, @Param("lastSettleMonth") String lastSettleMonth);
}
......@@ -258,8 +258,8 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
List<TSalaryAccount> getIdCardListBySalaryId(String salaryId);
// 获取上月减除费用,按项目
Map<String, BigDecimal> getCostReductionToAll(String deptNo, String invoiceTitle);
Map<String, String> getTaxMonthToAll(String deptNo, String invoiceTitle);
// 获取上月减除费用,单个身份证的
BigDecimal getCostReductionToCard(String idCard, String invoiceTitle);
String getTaxMonthToCard(String idCard, String invoiceTitle);
}
......@@ -212,7 +212,8 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
SalaryAccountUtil util1 = new SalaryAccountUtil();
// 初始化减除费用:
Map<String, BigDecimal> costReductionMap = tSalaryAccountService.getCostReductionToAll(dept.getDepartNo(), invoiceTitle);
// 1.7.22版本改造为初始化计税月
Map<String, String> taxMonthMap = tSalaryAccountService.getTaxMonthToAll(dept.getDepartNo(), invoiceTitle);
TSalaryEmployee empSearch = new TSalaryEmployee();
empSearch.setUnitId(dept.getCustomerId());
......@@ -274,7 +275,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
util1.getJsonStringToList(user, vo, dept, configSalary, salaryConfigMap, isMustMap,
empIdCardMap, checkListY, invoiceTitle,
employeeService, checkMap, specialMap, ownEmployeeMap, ownDeptMap, tSalaryAccountService, bankMap, costReductionMap);
employeeService, checkMap, specialMap, ownEmployeeMap, ownDeptMap, tSalaryAccountService, bankMap, taxMonthMap);
List<TSalaryAccountVo> saList = util1.getEntityList();
if ((null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty())) {
......
......@@ -1038,52 +1038,25 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
}
// 获取上月减除费用,按项目
@Override
public Map<String, BigDecimal> getCostReductionToAll(String deptNo, String invoiceTitle) {
Map<String, BigDecimal> map = new HashMap<>();
LocalDateTime now = LocalDateTime.now();
int month = now.getMonthValue();
// 1月自动5000,不查不计算
if (month != CommonConstants.ONE_INT) {
String tableName = getTableName();
String lastSettleMonth = DateUtil.addMonth(-1);
List<KeyMoneyVo> list = baseMapper.getCostReductionToAll(deptNo, invoiceTitle, tableName, lastSettleMonth);
if (Common.isNotNull(list)) {
BigDecimal money;
for (KeyMoneyVo vo : list) {
money = vo.getMoneyValue();
money = judgeMoneyAndAdd(money);
map.put(vo.getKeyValue(), money);
}
public Map<String, String> getTaxMonthToAll(String deptNo, String invoiceTitle) {
Map<String, String> map = new HashMap<>();
String tableName = getTableName();
String lastSettleMonth = DateUtil.addMonth(-1);
List<KeyMoneyVo> list = baseMapper.getTaxMonthToAll(deptNo, invoiceTitle, tableName, lastSettleMonth);
if (Common.isNotNull(list)) {
for (KeyMoneyVo vo : list) {
map.put(vo.getKeyValue(), vo.getTextValue());
}
}
return map;
}
private BigDecimal judgeMoneyAndAdd(BigDecimal money) {
if (money != null) {
money = money.add(SalaryConstants.COST_MONEY).setScale(CommonConstants.ZERO_INT, RoundingMode.HALF_UP);
// 判断a是否超过60000,超过则返回6000
if (money.compareTo(SalaryConstants.MAX_COST_MONEY) > CommonConstants.ZERO_INT) {
money = SalaryConstants.MAX_COST_MONEY;
}
}
return money;
}
// 获取上月减除费用,单个身份证的
@Override
public BigDecimal getCostReductionToCard(String idCard, String invoiceTitle) {
public String getTaxMonthToCard(String idCard, String invoiceTitle) {
String tableName = getTableName();
String lastSettleMonth = DateUtil.addMonth(-1);
LocalDateTime now = LocalDateTime.now();
int month = now.getMonthValue();
BigDecimal money = SalaryConstants.COST_MONEY;
// 1月自动5000,不查不计算
if (month != CommonConstants.ONE_INT) {
money = baseMapper.getCostReductionToCard(idCard, invoiceTitle, tableName, lastSettleMonth);
money = judgeMoneyAndAdd(money);
}
return money;
return baseMapper.getTaxMonthToCard(idCard, invoiceTitle, tableName, lastSettleMonth);
}
}
......@@ -75,7 +75,7 @@ public class SalaryAccountUtil implements Serializable {
, List<String> checkListY, String invoiceTitle, TSalaryEmployeeService tSalaryEmployeeService
, Map<String, Integer> checkMap, Map<String, BigDecimal> specialMap, Map<String, Integer> ownEmployeeMap
, Map<String, Integer> ownDeptMap, TSalaryAccountService tSalaryAccountService, Map<String, String> bankMap
, Map<String, BigDecimal> costReductionMap) {
, Map<String, String> taxMonthMap) {
String jsonStr = vo.getJsonString();
String salaryType = vo.getSalaryType();
// 新员工是否更新:0否;1是 hgw 2024-7-18 16:36:31
......@@ -162,6 +162,7 @@ public class SalaryAccountUtil implements Serializable {
if (Common.isNotNull(vo.getDataNum())) {
dataRow = 1 + vo.getDataNum();
}
String taxMonth;
for (int i = 0; i < rows; i++) {
annualBonusFlag = false;
errorFlag = true;
......@@ -377,6 +378,17 @@ public class SalaryAccountUtil implements Serializable {
}
}
}
// 1.7.22版本新计税月份的规则:
taxMonth = taxMonthMap.get(entity.getEmpIdcard());
if (taxMonth == null) {
taxMonth = tSalaryAccountService.getTaxMonthToCard(entity.getEmpIdcard(), invoiceTitle);
}
if (taxMonth == null) {
taxMonth = DateUtil.getThisMonth();
}
entity.setTaxMonth(taxMonth);
if (errorFlag) {
must = null;
for (Map.Entry<String, Boolean> entry : isMustMap.entrySet()) {
......@@ -489,7 +501,7 @@ public class SalaryAccountUtil implements Serializable {
if (setEntityByEmpInfo(dept, ownEmployeeMap, ownDeptMap, salaryType, isIssue, errorList
, entity, emp, saiList, salaryGiveTimeFlag, isNewEmployee, empName, salaryStyle
, nowMonth, updateEmpList, checkBankInfoEmpList, i + dataRow, bankMap
, newEmpUpdateFlag, updateEmpBankList, updateEmpBankMap, costReductionMap
, newEmpUpdateFlag, updateEmpBankList, updateEmpBankMap, taxMonthMap
, tSalaryAccountService, invoiceTitle))
continue;
}
......@@ -566,7 +578,7 @@ public class SalaryAccountUtil implements Serializable {
if (!this.setNewEmpBase(newEmps, newEmps.getLineNums() + dataRow, errorList, notLabour
, entity, salaryType, dept, user, entity.getSalaryStyle()
, CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime()), invoiceTitle
, entity.getSaiList(), bankMap, costReductionMap, tSalaryAccountService)) {
, entity.getSaiList(), bankMap, taxMonthMap, tSalaryAccountService)) {
isContinue = false;
continue;
}
......@@ -591,7 +603,7 @@ public class SalaryAccountUtil implements Serializable {
, CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())
, otherEmp.getEmpName(), entity.getSalaryStyle()
, nowMonth, updateEmpList, checkBankInfoEmpList, newEmps.getLineNums() + dataRow
, bankMap, newEmpUpdateFlag, updateEmpBankList, updateEmpBankMap, costReductionMap
, bankMap, newEmpUpdateFlag, updateEmpBankList, updateEmpBankMap, taxMonthMap
, tSalaryAccountService, invoiceTitle)) {
isContinue = false;
}
......@@ -701,7 +713,7 @@ public class SalaryAccountUtil implements Serializable {
, boolean salaryGiveTimeFlag, boolean isNewEmployee, String empName, String salaryStyle, String nowMonth
, List<TSalaryEmployee> updateEmpList, List<TSalaryEmployee> checkBankInfoEmpList, int i
, Map<String, String> bankMap, String newEmpUpdateFlag, List<TSalaryEmployee> updateEmpBankList
, Map<String, TSalaryEmployee> updateEmpBankMap, Map<String, BigDecimal> costReductionMap
, Map<String, TSalaryEmployee> updateEmpBankMap, Map<String, String> taxMonthMap
, TSalaryAccountService tSalaryAccountService, String invoiceTitle) {
TSalaryAccountItemVo sai;
String error;
......@@ -739,7 +751,7 @@ public class SalaryAccountUtil implements Serializable {
if (Common.isEmpty(emp.getTaxMonth()) && !"3".equals(salaryType) && !"4".equals(salaryType)) {
if (Common.isNotNull(entity.getTaxMonth())) {
if (entity.getTaxMonth().length() > CommonConstants.dingleDigitIntArray[6]) {
entity.setTaxMonth(emp.getTaxMonth().substring(0, 6));
//entity.setTaxMonth(emp.getTaxMonth().substring(0, 6));
} else if (entity.getTaxMonth().length() < CommonConstants.dingleDigitIntArray[6]) {
error = "第" + i + "行:工资模板里-计税月份-长度小于6:" + entity.getTaxMonth() + ",请在工资模板修改!";
errorList.add(new ErrorMessage(i, error));
......@@ -956,13 +968,13 @@ public class SalaryAccountUtil implements Serializable {
}
if (!"3".equals(salaryType) && !"4".equals(salaryType)) {
if (emp.getTaxMonth().length() > CommonConstants.dingleDigitIntArray[6]) {
entity.setTaxMonth(emp.getTaxMonth().substring(0, 6));
//entity.setTaxMonth(emp.getTaxMonth().substring(0, 6));
} else if (emp.getTaxMonth().length() < CommonConstants.dingleDigitIntArray[6]) {
error = "第" + i + "行:薪酬人员查询处-计税月份-长度小于6:" + entity.getTaxMonth() + ",请去薪酬人员查询处更新!在工资模板修改无效!";
errorList.add(new ErrorMessage(i, error));
return true;
} else {
entity.setTaxMonth(emp.getTaxMonth());
//entity.setTaxMonth(emp.getTaxMonth());
}
if (DateUtil.compareYearMonth(entity.getTaxMonth(), nowMonth)) {
error = "第" + i + "行:薪酬人员查询处-计税月份-大于当前年月或错误,请去薪酬人员查询处调整:" + entity.getTaxMonth();
......@@ -972,14 +984,8 @@ public class SalaryAccountUtil implements Serializable {
sai = new TSalaryAccountItemVo();
sai.setCnName(SalaryConstants.COST_REDUCTION);
sai.setJavaFiedName(SalaryConstants.COST_REDUCTION_JAVA);
BigDecimal costReduction = costReductionMap.get(entity.getEmpIdcard());
if (costReduction == null) {
costReduction = tSalaryAccountService.getCostReductionToCard(entity.getEmpIdcard(), invoiceTitle);
}
if (costReduction == null) {
costReduction = SalaryConstants.COST_MONEY;
}
sai.setSalaryMoney(costReduction);
sai.setSalaryMoney(DateUtil.getTaxMonthMoney(entity.getTaxMonth()));
sai.setIsTax(CommonConstants.ZERO_INT);
saiList.add(sai);
}
......@@ -1157,7 +1163,7 @@ public class SalaryAccountUtil implements Serializable {
private boolean setNewEmpBase(TSalaryEmployee newEmp, int i, List<ErrorMessage> errorList, boolean notLabour
, TSalaryAccountVo entity, String salaryType, TSettleDomainSelectVo dept, YifuUser user, String salaryStyle
, boolean salaryGiveTimeFlag, String invoiceTitle, List<TSalaryAccountItemVo> saiList, Map<String, String> bankMap
, Map<String, BigDecimal> costReductionMap, TSalaryAccountService tSalaryAccountService) {
, Map<String, String> taxMonthMap, TSalaryAccountService tSalaryAccountService) {
String newEmpStr = "新员工";
if (!notLabour) {
newEmpStr = "劳务费";
......@@ -1209,14 +1215,8 @@ public class SalaryAccountUtil implements Serializable {
TSalaryAccountItemVo sai = new TSalaryAccountItemVo();
sai.setCnName(SalaryConstants.COST_REDUCTION);
sai.setJavaFiedName(SalaryConstants.COST_REDUCTION_JAVA);
BigDecimal costReduction = costReductionMap.get(entity.getEmpIdcard());
if (costReduction == null) {
costReduction = tSalaryAccountService.getCostReductionToCard(entity.getEmpIdcard(), invoiceTitle);
}
if (costReduction == null) {
costReduction = SalaryConstants.COST_MONEY;
}
sai.setSalaryMoney(costReduction);
sai.setSalaryMoney(DateUtil.getTaxMonthMoney(entity.getTaxMonth()));
sai.setIsTax(CommonConstants.ZERO_INT);
saiList.add(sai);
newEmp.setTaxMonth(entity.getTaxMonth());
......
......@@ -2188,34 +2188,34 @@
</select>
<!-- 获取减除费用 -->
<select id="getCostReductionToAll" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.KeyMoneyVo">
select a.keyValue,a.moneyValue from (
<select id="getTaxMonthToAll" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.KeyMoneyVo">
select a.keyValue,a.textValue from (
SELECT
a.EMP_IDCARD as keyValue,
a.cost_reduction as moneyValue
a.tax_month as textValue
FROM t_salary_account a
where a.DELETE_FLAG = 0 and a.DEPT_NO = #{deptNo} and a.INVOICE_TITLE = #{invoiceTitle} and a.SETTLEMENT_MONTH = #{lastSettleMonth}
union all
SELECT
a.EMP_IDCARD as keyValue,
a.cost_reduction as moneyValue
a.tax_month as textValue
FROM ${tableName} a
where a.DELETE_FLAG = 0 and a.DEPT_NO = #{deptNo} and a.INVOICE_TITLE = #{invoiceTitle} and a.SETTLE_MONTH = #{lastSettleMonth}
) a GROUP BY a.keyValue
</select>
<!-- 获取减除费用-单个身份证的 -->
<select id="getCostReductionToCard" resultType="java.math.BigDecimal">
select a.moneyValue from (
<select id="getTaxMonthToCard" resultType="java.lang.String">
select a.textValue from (
SELECT
a.EMP_IDCARD as keyValue,
a.cost_reduction as moneyValue
a.tax_month as textValue
FROM t_salary_account a
where a.DELETE_FLAG = 0 and a.EMP_IDCARD = #{idCard} and a.INVOICE_TITLE = #{invoiceTitle} and a.SETTLEMENT_MONTH = #{lastSettleMonth}
union all
SELECT
a.EMP_IDCARD as keyValue,
a.cost_reduction as moneyValue
a.tax_month as textValue
FROM ${tableName} a
where a.DELETE_FLAG = 0 and a.EMP_IDCARD = #{idCard} and a.INVOICE_TITLE = #{invoiceTitle} and a.SETTLE_MONTH = #{lastSettleMonth}
) a limit 1
......
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