|
@@ -50,6 +50,13 @@ public class SrmSupplierServiceImpl extends BaseServiceImpl<ISrmSupplierDao, Srm
|
|
|
if(StringUtils.isEmpty(entity.getType())){
|
|
|
throw new AppException("供应商类型为空,新建供应商失败!");
|
|
|
}
|
|
|
+ if(StringUtils.isEmpty(entity.getPerson())){
|
|
|
+ throw new AppException("供应商联系人为空,新建供应商失败!");
|
|
|
+ }
|
|
|
+ SrmSupplier byPerson = findByPerson(entity.getPerson());
|
|
|
+ if(byPerson != null){
|
|
|
+ throw new AppException("供应商联系人重复,新建供应商失败!");
|
|
|
+ }
|
|
|
entity.setGmtCreate(new Date());
|
|
|
entity.setGmtModified(entity.getGmtCreate());
|
|
|
entity.setSysId(SystemUtils.getCurrentSystemId());
|
|
@@ -87,6 +94,14 @@ public class SrmSupplierServiceImpl extends BaseServiceImpl<ISrmSupplierDao, Srm
|
|
|
if(entity == null || entity.getId() == null){
|
|
|
throw new AppException("参数错误,更新供应商失败!");
|
|
|
}
|
|
|
+ if(StringUtils.isBlank(entity.getPerson())){
|
|
|
+ entity.setPerson(null);
|
|
|
+ } else{
|
|
|
+ SrmSupplier byPerson = findByPerson(entity.getPerson());
|
|
|
+ if(byPerson != null && !byPerson.getId().equals(entity.getId())){
|
|
|
+ throw new AppException("供应商联系人重复,更新供应商失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
entity.setGmtModified(new Date());
|
|
|
boolean f = mapper.update(entity) > 0;
|
|
|
if(!f){
|
|
@@ -111,6 +126,12 @@ public class SrmSupplierServiceImpl extends BaseServiceImpl<ISrmSupplierDao, Srm
|
|
|
return build;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public SrmSupplier findByPerson(String personId){
|
|
|
+ return mapper.selectOneByCondition(SRM_SUPPLIER.PERSON.eq(personId));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Page<SrmSupplierDO> page(String name, String type, String state, List<String> products, Integer pageNum,
|
|
|
Integer pageSize){
|