薪酬系统-福利档案,档案编辑功能增加对年月的格式校验

This commit is contained in:
sy 2023-04-25 17:38:54 +08:00
parent 1f7c271519
commit cb36dc2904
2 changed files with 25 additions and 4 deletions

View File

@ -40,9 +40,7 @@ import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryFormItemUtil;
import com.engine.salary.util.*;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
@ -649,6 +647,13 @@ public class SIArchivesBiz {
InsuranceArchivesOtherSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesOtherSaveParam.class);
SalaryAssert.notNull("员工id为空", param, param.getEmployeeId());
if (param.getOtherStartTime() != null && !SalaryDateUtil.checkYearMonth(param.getOtherStartTime())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542532, "其他福利起始缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
}
if (param.getOtherEndTime() != null && !SalaryDateUtil.checkYearMonth(param.getOtherEndTime())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542533, "其他福利最后缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
}
// List<InsuranceArchivesOtherSchemePO> oldOtherInfoList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(param.getEmployeeId()));
List<InsuranceArchivesOtherSchemePO> oldOtherInfoList = otherSchemeMapper.getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(param.getEmployeeId())
@ -700,6 +705,13 @@ public class SIArchivesBiz {
InsuranceArchivesFundSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesFundSaveParam.class);
SalaryAssert.notNull("员工id为空", param, param.getEmployeeId());
if (param.getFundStartTime() != null && !SalaryDateUtil.checkYearMonth(param.getFundStartTime())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542530, "公积金起始缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
}
if (param.getFundEndTime() != null && !SalaryDateUtil.checkYearMonth(param.getFundEndTime())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542531, "公积金最后缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
}
// List<InsuranceArchivesFundSchemePO> oldFundInfoList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(param.getEmployeeId()));
List<InsuranceArchivesFundSchemePO> oldFundInfoList = fundSchemeMapper.getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(param.getEmployeeId())
@ -755,6 +767,15 @@ public class SIArchivesBiz {
InsuranceArchivesSocialSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesSocialSaveParam.class);
SalaryAssert.notNull("员工id为空", param, param.getEmployeeId());
boolean c = SalaryDateUtil.checkYearMonth(param.getSocialStartTime());
if (param.getSocialStartTime() != null && !SalaryDateUtil.checkYearMonth(param.getSocialStartTime())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542528, "社保起始缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
}
if (param.getSocialEndTime() != null && !SalaryDateUtil.checkYearMonth(param.getSocialEndTime())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542529, "社保最后缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
}
// //删除社保数据
// socialSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId()));

View File

@ -46,7 +46,7 @@ public class SalaryDateUtil {
/**
* yyyy-MM
**/
private static final String MONTH_REGEX = "^([1-9]\\d{3})-(([0]{0,1}[1-9])|([1][0-2]))$";
private static final String MONTH_REGEX = "^([1-9]\\d{3})-(([0][1-9])|([1][0-2]))$";
/**
* yyyy-MM-dd
**/