Commit f505475f6dcec18c49e97305759bcf94489eaadf

Authored by yeqianyong
1 parent e851a082

楚江ERP-客户池名称重复校验

... ... @@ -113,6 +113,10 @@ public class CustomerServiceImpl extends BaseMpServiceImpl<CustomerMapper, Custo
113 113 if (getBaseMapper().selectCount(checkWrapper) > 0) {
114 114 throw new DefaultClientException("编号重复,请重新输入!");
115 115 }
  116 + Customer customer = this.getByName(vo.getName());
  117 + if (customer != null) {
  118 + throw new DefaultClientException("名称重复,请重新输入!");
  119 + }
116 120
117 121 Customer data = new Customer();
118 122 data.setId(IdUtil.getId());
... ... @@ -191,6 +195,10 @@ public class CustomerServiceImpl extends BaseMpServiceImpl<CustomerMapper, Custo
191 195 if (getBaseMapper().selectCount(checkWrapper) > 0) {
192 196 throw new DefaultClientException("编号重复,请重新输入!");
193 197 }
  198 + Customer customer = this.getByName(vo.getName());
  199 + if (customer != null && !customer.getId().equals(vo.getId())) {
  200 + throw new DefaultClientException("名称重复,请重新输入!");
  201 + }
194 202
195 203 LambdaUpdateWrapper<Customer> updateWrapper = Wrappers.lambdaUpdate(Customer.class)
196 204 .set(Customer::getCode, vo.getCode()).set(Customer::getName, vo.getName())
... ...
... ... @@ -40,7 +40,7 @@ public class UpdateCustomerVo implements BaseVo, Serializable {
40 40 * 简码
41 41 */
42 42 @ApiModelProperty(value = "简码", required = true)
43   - @NotBlank(message = "请输入简码!")
  43 +// @NotBlank(message = "请输入简码!")
44 44 private String mnemonicCode;
45 45
46 46 /**
... ...
... ... @@ -43,7 +43,7 @@ public class CustomerCreditImportListener extends ExcelImportListener<CustomerCr
43 43 Customer customer = customerService.getByName(data.getName());
44 44 if (customer == null) {
45 45 throw new DefaultClientException(
46   - "第" + context.readRowHolder().getRowIndex() + "行“客户不存在”不能为空");
  46 + "第" + context.readRowHolder().getRowIndex() + "行“客户名称”不存在");
47 47 } else {
48 48 data.setCompanyId(customer.getId());
49 49 }
... ...