Commit 2da8b4b9 authored by 周健威's avatar 周健威

修改bug

parent ce2ae719
...@@ -6,6 +6,7 @@ package com.github.wxiaoqi.security.common.constant; ...@@ -6,6 +6,7 @@ package com.github.wxiaoqi.security.common.constant;
public class CommonConstants { public class CommonConstants {
public static final Integer SYS_TRUE = 1; public static final Integer SYS_TRUE = 1;
public static final Integer SYS_FALSE = 0; public static final Integer SYS_FALSE = 0;
public static final Integer SYS_JSON_TRUE = 200;
public final static String RESOURCE_TYPE_MENU = "menu"; public final static String RESOURCE_TYPE_MENU = "menu";
public final static String RESOURCE_TYPE_BTN = "button"; public final static String RESOURCE_TYPE_BTN = "button";
// 用户token异常 // 用户token异常
......
...@@ -53,12 +53,8 @@ public class BaseException extends RuntimeException { ...@@ -53,12 +53,8 @@ public class BaseException extends RuntimeException {
this.status = code; this.status = code;
} }
// public BaseException(int code, Map<String, Object> map) { public BaseException(int code, Map<String, Object> map) {
// String msg = ResultCode.getMsg(code); super(ResultCode.getMsg(code) + (map == null? "" : map.toString()));
// if(null != map && map.size() > 0){ this.status = code;
// for(String) }
//
// }
// this.status = code;
// }
} }
...@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil; ...@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum; import com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.constant.CommonConstants;
import com.github.wxiaoqi.security.common.context.BaseContextHandler; import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
...@@ -251,6 +252,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -251,6 +252,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
rentVehicleBookDTO.setModelId(detail.getModelId()); rentVehicleBookDTO.setModelId(detail.getModelId());
rentVehicleBookDTO.setUserName(BaseContextHandler.getName()); rentVehicleBookDTO.setUserName(BaseContextHandler.getName());
ObjectRestResponse<VehicleBookRecord> orr = vehicleFeign.rentApplyVehicle(rentVehicleBookDTO); ObjectRestResponse<VehicleBookRecord> orr = vehicleFeign.rentApplyVehicle(rentVehicleBookDTO);
if(! CommonConstants.SYS_JSON_TRUE.equals(orr.getStatus())) {
throw new BaseException(orr.getMessage(), orr.getStatus());
}
detail.setVehicleId(orr.getData().getVehicleId()); detail.setVehicleId(orr.getData().getVehicleId());
detail.setBookRecordId(orr.getData().getId()); detail.setBookRecordId(orr.getData().getId());
} }
......
...@@ -5,7 +5,7 @@ import com.xxfc.platform.vehicle.common.RestResponse; ...@@ -5,7 +5,7 @@ import com.xxfc.platform.vehicle.common.RestResponse;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice //@RestControllerAdvice
public class BaseExceptionHandler { public class BaseExceptionHandler {
@ExceptionHandler(BaseException.class) @ExceptionHandler(BaseException.class)
......
...@@ -401,7 +401,9 @@ public class VehicleController extends BaseController<VehicleBiz> { ...@@ -401,7 +401,9 @@ public class VehicleController extends BaseController<VehicleBiz> {
//查询可车辆信息 //查询可车辆信息
PageDataVO<Vehicle> pageDataVO = vehicleBiz.searchUsableVehicle(dto); PageDataVO<Vehicle> pageDataVO = vehicleBiz.searchUsableVehicle(dto);
if (pageDataVO.getData().size() <= 0) { if (pageDataVO.getData().size() <= 0) {
throw new BaseException(ResultCode.NOTEXIST_CODE); throw new BaseException(ResultCode.NOTEXIST_CODE, new HashMap<String, Object>(){{
put("可用车辆", "不存在");
}});
} }
bookVehicleVo.setVehicleId(pageDataVO.getData().get(0).getId()); bookVehicleVo.setVehicleId(pageDataVO.getData().get(0).getId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment