Commit 490f0aad by levphon

工单标准接口-提示语优化

1 parent df0e64ea
...@@ -15,6 +15,8 @@ public class StdInterfaceException extends RuntimeException { ...@@ -15,6 +15,8 @@ public class StdInterfaceException extends RuntimeException {
private String message; private String message;
private Object data;
public StdInterfaceException() { public StdInterfaceException() {
} }
...@@ -24,6 +26,13 @@ public class StdInterfaceException extends RuntimeException { ...@@ -24,6 +26,13 @@ public class StdInterfaceException extends RuntimeException {
this.message = message; this.message = message;
} }
public StdInterfaceException(String errorCode, String message, Object data) {
super(message);
this.errorCode = errorCode;
this.message = message;
this.data = data;
}
public StdInterfaceException(ResultEnum resultEnum) { public StdInterfaceException(ResultEnum resultEnum) {
this.errorCode = resultEnum.getCode(); this.errorCode = resultEnum.getCode();
this.message = resultEnum.getMessage(); this.message = resultEnum.getMessage();
......
...@@ -20,7 +20,7 @@ public class StdInterfaceExceptionHandler extends GlobalExceptionHandler { ...@@ -20,7 +20,7 @@ public class StdInterfaceExceptionHandler extends GlobalExceptionHandler {
@ExceptionHandler(StdInterfaceException.class) @ExceptionHandler(StdInterfaceException.class)
public R handleAdminException(StdInterfaceException e) { public R handleAdminException(StdInterfaceException e) {
return R.error(e.getErrorCode(), e.getMessage()); return R.error(e.getErrorCode(), e.getMessage()).data(e.getData());
} }
/** /**
......
...@@ -642,7 +642,9 @@ public class WorkOrderService { ...@@ -642,7 +642,9 @@ public class WorkOrderService {
}.getType()); }.getType());
gpsBsDataList.forEach(gdb -> { gpsBsDataList.forEach(gdb -> {
if (!gdb.getGpsVerifyResult() && !gdb.getBsVerifyResult()) { if (!gdb.getGpsVerifyResult() && !gdb.getBsVerifyResult()) {
throw new StdInterfaceException("2145415", String.format("%s设备有效位置验证不通过", gdb.getSn())); Map<String, String> errorMap = Maps.newHashMap();
errorMap.put(gdb.getSn(), "设备有效位置验证不通过");
throw new StdInterfaceException("2145415", String.format("设备%s有效位置验证不通过", gdb.getSn()), Lists.newArrayList(errorMap));
} }
}); });
return gpsBsDataList; return gpsBsDataList;
...@@ -687,7 +689,13 @@ public class WorkOrderService { ...@@ -687,7 +689,13 @@ public class WorkOrderService {
Set<String> existSnSet = vdList.stream().map(VehicleDevice::getSn).collect(Collectors.toSet()); Set<String> existSnSet = vdList.stream().map(VehicleDevice::getSn).collect(Collectors.toSet());
if (vdList.size() > 0) { if (vdList.size() > 0) {
throw new StdInterfaceException("656565", String.format("设备%s已绑定车辆,请更换设备", existSnSet)); List<Map<String, String>> errorMapList = Lists.newArrayList();
vdList.forEach(vd -> {
Map<String, String> errorMap = Maps.newHashMap();
errorMap.put(vd.getSn(), "设备已绑定其它车辆");
errorMapList.add(errorMap);
});
throw new StdInterfaceException("656565", String.format("设备%s已绑定车辆,请更换设备", existSnSet), errorMapList);
} }
} }
...@@ -793,6 +801,8 @@ public class WorkOrderService { ...@@ -793,6 +801,8 @@ public class WorkOrderService {
} }
activatedVehicleInfoDTO.setActivatedTime(new Date()); activatedVehicleInfoDTO.setActivatedTime(new Date());
activatedVehicleInfoDTO.setBindingDevices(bindingDevices); activatedVehicleInfoDTO.setBindingDevices(bindingDevices);
log.info("激活工单概要信息:{}", JSONUtil.toJsonStr(activatedVehicleInfoDTO));
return activatedVehicleInfoDTO; return activatedVehicleInfoDTO;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!