0603 - 调整新增企业时企业名称重复判断的时机
parent
5ed43e8fc3
commit
c68d52c596
|
|
@ -56,6 +56,12 @@ public class CorpInfoAddExe {
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long execute(CorpInfoAddCmd cmd) {
|
public Long execute(CorpInfoAddCmd cmd) {
|
||||||
|
|
||||||
|
Long corpCount = corpInfoRepository.getCorpCountByCorpName(cmd.getCorpName());
|
||||||
|
if(corpCount > 0){
|
||||||
|
throw new BizException("企业名称已存在");
|
||||||
|
}
|
||||||
|
|
||||||
CorpInfoE examTypeE = new CorpInfoE();
|
CorpInfoE examTypeE = new CorpInfoE();
|
||||||
if (!ObjectUtils.isEmpty(cmd.getCode())){
|
if (!ObjectUtils.isEmpty(cmd.getCode())){
|
||||||
List<CorpInfoDO> corpinfoByCode = corpInfoRepository.getCorpinfoByCode(cmd.getCode());
|
List<CorpInfoDO> corpinfoByCode = corpInfoRepository.getCorpinfoByCode(cmd.getCode());
|
||||||
|
|
@ -68,11 +74,7 @@ public class CorpInfoAddExe {
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(cmd, examTypeE);
|
BeanUtils.copyProperties(cmd, examTypeE);
|
||||||
Long corpInfoId ;
|
Long corpInfoId ;
|
||||||
try {
|
|
||||||
corpInfoId = corpInfoGateway.add(examTypeE);
|
corpInfoId = corpInfoGateway.add(examTypeE);
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
if (corpInfoId == null) {
|
if (corpInfoId == null) {
|
||||||
throw new BizException("保存失败");
|
throw new BizException("保存失败");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,6 @@ public class CorpInfoGatewayImpl implements CorpInfoGateway {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long add(CorpInfoE corpInfoE) {
|
public Long add(CorpInfoE corpInfoE) {
|
||||||
Long corpCount = corpInfoRepository.getCorpCountByCorpName(corpInfoE.getCorpName());
|
|
||||||
if(corpCount>0){
|
|
||||||
throw new BizException("企业名称已存在");
|
|
||||||
}
|
|
||||||
CorpInfoDO d = new CorpInfoDO();
|
CorpInfoDO d = new CorpInfoDO();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue