v1.0.27 #37

Merged
timi merged 4 commits from dev into master 2026-08-29 17:49:23 +00:00
Showing only changes of commit 94c99e3444 - Show all commits
@@ -157,17 +157,18 @@ public class GaoCustomerServiceImplement extends AbstractEntityService<GaoCustom
logger.setContent(jackson.writeValueAsString(customer));
GaoCustomer dbCustomer = get(customer.getId());
TimiException.requiredTrue(dbCustomer.getStoreId().equals(customer.getStoreId()), "customer.storeId invalid");
dbCustomer.setCode(TimiJava.defaultIfEmpty(customer.getCode(), null));
String code = TimiJava.defaultIfEmpty(customer.getCode(), null);
{
if (!Objects.equals(dbCustomer.getCode(), customer.getCode()) && TimiJava.isNotEmpty(customer.getCode())) {
GaoCustomer byCode = getByCode(customer.getStoreId(), customer.getCode());
TimiException.requiredTrue(byCode == null || !byCode.getId().equals(dbCustomer.getId()), "姓名客户已登记");
if (!Objects.equals(dbCustomer.getCode(), code) && TimiJava.isNotEmpty(code)) {
GaoCustomer byCode = getByCode(customer.getStoreId(), code);
TimiException.requiredTrue(byCode == null || byCode.getId().equals(dbCustomer.getId()), "编码客户已登记");
}
if (!Objects.equals(dbCustomer.getName(), customer.getName())) {
GaoCustomer byName = getByName(customer.getStoreId(), customer.getName());
TimiException.requiredTrue(byName == null || !byName.getId().equals(dbCustomer.getId()), "该姓名客户已登记");
}
}
dbCustomer.setCode(code);
dbCustomer.setName(customer.getName());
fillPinyin(dbCustomer);
dbCustomer.setGender(customer.getGender());