薪酬系统-福利台账,优化福利台账补缴模板中账单月份和补缴月份校验逻辑

This commit is contained in:
sy 2023-08-07 16:46:17 +08:00
parent 95525d42d8
commit 9d0194acd3
1 changed files with 14 additions and 8 deletions

View File

@ -1544,12 +1544,18 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
excelComments.add(errorMessageMap);
}
if (!checkBillMonth(billMonth)) {
if (billMonth.length() < 7 || !SalaryDateUtil.checkYearMonth(billMonth.substring(0, 7))) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "账单月份输入有误请参照“2022-09”这种格式进行检查"));
excelComments.add(errorMessageMap);
}
if (headers.contains("补缴月份") && (supplementaryMonth.length() < 7 || !SalaryDateUtil.checkYearMonth(supplementaryMonth.substring(0, 7)))) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "补缴月份输入有误请参照“2022-09”这种格式进行检查"));
excelComments.add(errorMessageMap);
}
//遍历表头
for (int j = 0; j < headers.size(); j++) {
@ -1611,9 +1617,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//根据员工id个税扣缴义务人id账单月份查询
//根据表头字段来区分正常缴纳和补缴两类数据
if (!headers.contains("补缴月份")) {
list = getInsuranceAccountDetailMapper().queryNormalList(billMonth, paymentOrganization, employeeIds.get(0));
list = getInsuranceAccountDetailMapper().queryNormalList(billMonth.substring(0, 7), paymentOrganization, employeeIds.get(0));
} else {
list = getInsuranceAccountDetailMapper().querySupplementList(billMonth, paymentOrganization, employeeIds.get(0), supplementaryMonth);
list = getInsuranceAccountDetailMapper().querySupplementList(billMonth.substring(0, 7), paymentOrganization, employeeIds.get(0), supplementaryMonth.substring(0, 7));
}
if (list.isEmpty()) {
@ -1973,7 +1979,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("账单月份", "").toString())) {
insuranceAccountDetailPO.setBillMonth(baseMap.get("账单月份").toString());
insuranceAccountDetailPO.setBillMonth(baseMap.get("账单月份").toString().substring(0, 7));
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("社保合计", "").toString())) {
@ -2007,7 +2013,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//如果导入的时补缴数据还会包含补缴月份
if (!StringUtils.isEmpty(baseMap.getOrDefault("补缴月份", "").toString())) {
insuranceAccountDetailPO.setSupplementaryMonth(baseMap.get("补缴月份").toString());
insuranceAccountDetailPO.setSupplementaryMonth(baseMap.get("补缴月份").toString().substring(0, 7));
}
insuranceAccountDetailPO.setUpdateTime(new Date());
@ -2996,7 +3002,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
excelComments.add(errorMessageMap);
}
if (!checkBillMonth(billMonth)) {
if (billMonth.length() < 7 || !SalaryDateUtil.checkYearMonth(billMonth.substring(0, 7))) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "账单月份输入有误请参照“2022-09”这种格式进行检查"));
@ -3071,7 +3077,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
list = getInsuranceAccountDetailMapper().queryBalanceList(InsuranceAccountDetailPO.builder()
.employeeId(employeeId)
.paymentOrganization(paymentOrganization)
.billMonth(billMonth)
.billMonth(billMonth.substring(0, 7))
.build());
if (list.isEmpty()) {
@ -3346,7 +3352,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
insuranceAccountDetailPO.setId(IdGenerator.generate());
insuranceAccountDetailPO.setEmployeeId(employeeId);
insuranceAccountDetailPO.setBillMonth(billMonth);
insuranceAccountDetailPO.setBillMonth(billMonth.substring(0, 7));
insuranceAccountDetailPO.setBillStatus(BillStatusEnum.NOT_ARCHIVED.getValue());
insuranceAccountDetailPO.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue());
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.IMPORT.getValue());