福利方案判断重复
This commit is contained in:
parent
4bd082efb0
commit
604d3d453e
|
|
@ -364,7 +364,7 @@ public class SIArchivesBiz {
|
|||
InsuranceArchivesFundSchemeDTO data = InsuranceArchivesBO.convertFundPOtoDTO(insuranceArchivesFundSchemePO, employeeId);
|
||||
if (insuranceArchivesFundSchemePO == null) {
|
||||
data.setEmployeeId(employeeId);
|
||||
data.setUnderTake(UndertakerEnum.SCOPE_COMPANY);
|
||||
data.setUnderTake(UndertakerEnum.SCOPE_PERSON);
|
||||
}
|
||||
return data;
|
||||
}finally {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
|
|||
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
||||
import com.engine.salary.util.SalaryAssert;
|
||||
import com.engine.salary.util.SalaryEnumUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
|
|
@ -240,6 +241,9 @@ public class
|
|||
try{
|
||||
//保存福利项目主表
|
||||
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
|
||||
List<InsuranceSchemePO> listResult = insuranceSchemeMapper.listByName(saveParam.getInsuranceScheme().getSchemeName());
|
||||
SalaryAssert.isEmpty(listResult, "该福利名称已经存在");
|
||||
|
||||
InsuranceSchemePO insuranceSchemePO = InsuranceSchemeBO.convert2BatchPO(saveParam.getInsuranceScheme(), employeeId);
|
||||
insuranceSchemeMapper.insert(insuranceSchemePO);
|
||||
//日志
|
||||
|
|
@ -275,10 +279,11 @@ public class
|
|||
throw new SalaryRunTimeException("福利方案不存在");
|
||||
}
|
||||
|
||||
//福利方案名称重复(待写)
|
||||
//福利方案名称重复
|
||||
List<InsuranceSchemePO> insuranceSchemePOList = insuranceSchemeMapper.listByName(updateParam.getInsuranceScheme().getSchemeName());
|
||||
if (CollectionUtils.isNotEmpty(insuranceSchemePOList)) {
|
||||
throw new SalaryRunTimeException("福利方案名称重复");
|
||||
if(CollectionUtils.isNotEmpty(insuranceSchemePOList)) {
|
||||
boolean repeat = insuranceSchemePOList.stream().anyMatch(item -> !Objects.equals(item.getId(), updateParam.getInsuranceScheme().getId()));
|
||||
SalaryAssert.isTrue(!repeat,"福利方案名称重复");
|
||||
}
|
||||
|
||||
//更新福利方案主表
|
||||
|
|
|
|||
Loading…
Reference in New Issue