优化供应商和客户的校验逻辑

This commit is contained in:
季圣华
2021-12-03 00:28:22 +08:00
parent f24733fd12
commit 3abb818f5e
4 changed files with 37 additions and 7 deletions

View File

@@ -153,7 +153,7 @@ public class SupplierService {
//新增客户时给当前用户自动授权
if("客户".equals(supplier.getType())) {
Long userId = userService.getUserId(request);
Supplier sInfo = supplierMapperEx.getSupplierByName(supplier.getSupplier());
Supplier sInfo = supplierMapperEx.getSupplierByNameAndType(supplier.getSupplier(), supplier.getType());
String ubKey = "[" + sInfo.getId() + "]";
List<UserBusiness> ubList = userBusinessService.getBasicData(userId.toString(), "UserCustomer");
if(ubList ==null || ubList.size() == 0) {
@@ -271,6 +271,19 @@ public class SupplierService {
return list==null?0:list.size();
}
public int checkIsNameAndTypeExist(Long id, String name, String type)throws Exception {
SupplierExample example = new SupplierExample();
example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andTypeEqualTo(type)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Supplier> list=null;
try{
list= supplierMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateAdvanceIn(Long supplierId, BigDecimal advanceIn)throws Exception{
Supplier supplier=null;