Commit 304a027f authored by lcl's avatar lcl

逻辑优化

parent 3a9a23d3
......@@ -82,17 +82,18 @@ public class CustomerServiceImpl implements ICustomerService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean add(Customer customer) {
dealWithcustomerData(customer);
customer.setUipId(enterpriseCommonService.getUipIdByCompanyNameOrCompanyId(customer.getCompanyName(), customer.getCompanyId()));
Long userId = LoginHelper.getUserId();
customer.setCreateId(userId);
customer.setUpdateId(userId);
customer.setTenantId(LoginHelper.getTenantId());
//查重
Customer verifyCustomer = baseMapper.selectByCompanyNameAndUserId(customer.getCompanyName(), userId);
if (!ObjectUtils.isEmpty(verifyCustomer)) {
throw new ServiceException("当前客户信息已存在,请勿重复添加!");
}
dealWithcustomerData(customer);
customer.setUipId(enterpriseCommonService.getUipIdByCompanyNameOrCompanyId(customer.getCompanyName(), customer.getCompanyId()));
customer.setCreateId(userId);
customer.setUpdateId(userId);
customer.setTenantId(LoginHelper.getTenantId());
int i = baseMapper.insert(customer);
if (i == 0) throw new ServiceException("客户信息添加错误!");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment