|
@@ -27,6 +27,7 @@ import com.cyksj.service.wechat.WeChatService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
@@ -106,7 +107,11 @@ public class AdminController {
|
|
|
throw BusinessRuntimeException.getInstance("请输入正确的手机号");
|
|
throw BusinessRuntimeException.getInstance("请输入正确的手机号");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- adminService.saveOrUpdate(admin);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ adminService.saveOrUpdate(admin);
|
|
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("手机号重复");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|