|
@@ -61,7 +61,17 @@ public class ApiController extends BaseController {
|
|
|
@PostMapping("/device")
|
|
|
public AjaxResult device(@RequestBody DeviceInfo deviceInfo) {
|
|
|
deviceInfo.setRegisterTime(new Date());
|
|
|
- return toAjax(deviceInfoService.insertDeviceInfo(deviceInfo));
|
|
|
+ int i = 0;
|
|
|
+ try {
|
|
|
+ i = deviceInfoService.insertDeviceInfo(deviceInfo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ if (e.getMessage().contains("Duplicate entry")) {
|
|
|
+ return AjaxResult.error("DEVICE_ID重复");
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return toAjax(1);
|
|
|
}
|
|
|
|
|
|
/**
|