承运人添加车辆bug

This commit is contained in:
赵辉
2026-06-11 11:30:24 +08:00
parent f2950d5bb8
commit c21ebcdc1b
4 changed files with 37 additions and 21 deletions
@@ -573,12 +573,15 @@ public class VehicleApplicationService {
if (! "200".equals(String.valueOf(userInfoResult.get("code")))) {
throw new ServiceException("用户信息获取失败: " + userInfoResult.get("msg"));
}
UserDriverPo userPo = JSONUtil.toBean(JSONUtil.toJsonStr(userInfoResult.get("data")),
UserDriverPo.class);
vehicle.setUserName(userPo.getUserName());
vehicle.setUserPhone(userPo.getUserPhone());
// 司机数据可能不存在(用户尚未在用户中台完成注册),此时使用车辆表单携带的用户信息
if (ObjectUtil.isNotNull(userInfoResult.get("data"))) {
UserDriverPo userPo = JSONUtil.toBean(JSONUtil.toJsonStr(userInfoResult.get("data")),
UserDriverPo.class);
vehicle.setUserName(userPo.getUserName());
vehicle.setUserPhone(userPo.getUserPhone());
}
List<String> roleCodeList;
List<String> roleCodeList = new ArrayList<>();
AjaxResult<?> roleListAjaxResult = userServiceFeign.getRoleListByUserId(vehicle.getUserId());
if ("200".equals(String.valueOf(roleListAjaxResult.get("code"))) && ObjectUtil.isNotNull(
roleListAjaxResult.get("data"))) {
@@ -586,8 +589,6 @@ public class VehicleApplicationService {
RolePO.class);
if (CollUtil.isNotEmpty(rolePOS)) {
roleCodeList = rolePOS.stream().map(RolePO :: getRoleCode).collect(Collectors.toList());
} else {
throw new ServiceException("账号未授权角色信息!");
}
} else {
throw new ServiceException("获取用户角色列表失败: " + roleListAjaxResult.get("msg"));
@@ -865,12 +866,14 @@ public class VehicleApplicationService {
if (! "200".equals(String.valueOf(userInfoResult.get("code")))) {
throw new ServiceException("用户信息获取失败: " + userInfoResult.get("msg"));
}
UserDriverPo userPo = JSONUtil.toBean(JSONUtil.toJsonStr(userInfoResult.get("data")),
UserDriverPo.class);
vehicle.setUserName(userPo.getUserName());
vehicle.setUserPhone(userPo.getUserPhone());
if (ObjectUtil.isNotNull(userInfoResult.get("data"))) {
UserDriverPo userPo = JSONUtil.toBean(JSONUtil.toJsonStr(userInfoResult.get("data")),
UserDriverPo.class);
vehicle.setUserName(userPo.getUserName());
vehicle.setUserPhone(userPo.getUserPhone());
}
List<String> roleCodeList;
List<String> roleCodeList = new ArrayList<>();
AjaxResult<?> roleListAjaxResult = userServiceFeign.getRoleListByUserId(vehicle.getUserId());
if ("200".equals(String.valueOf(roleListAjaxResult.get("code"))) && ObjectUtil.isNotNull(
roleListAjaxResult.get("data"))) {
@@ -878,8 +881,6 @@ public class VehicleApplicationService {
RolePO.class);
if (CollUtil.isNotEmpty(rolePOS)) {
roleCodeList = rolePOS.stream().map(RolePO :: getRoleCode).collect(Collectors.toList());
} else {
throw new ServiceException("账号未授权角色信息!");
}
} else {
throw new ServiceException("获取用户角色列表失败: " + roleListAjaxResult.get("msg"));
@@ -1935,10 +1936,13 @@ public class VehicleApplicationService {
if (! "200".equals(String.valueOf(info.get("code")))) {
throw new ServiceException("用户信息获取失败");
}
UserDriverPo userPo = JSONObject.parseObject(JSONObject.toJSONString(info.get("data")),
UserDriverPo.class);
vehicle.setUserName(userPo.getUserName());
vehicle.setUserPhone(userPo.getUserPhone());
// 司机数据可能不存在(用户尚未在用户中台完成注册),此时使用车辆表单携带的用户信息
if (ObjectUtil.isNotNull(info.get("data"))) {
UserDriverPo userPo = JSONObject.parseObject(JSONObject.toJSONString(info.get("data")),
UserDriverPo.class);
vehicle.setUserName(userPo.getUserName());
vehicle.setUserPhone(userPo.getUserPhone());
}
List<String> roleCodeList = new ArrayList<>();
AjaxResult roleListAjaxResult = userServiceFeign.getRoleListByUserId(vehicle.getUserId());
if ("200".equals(String.valueOf(roleListAjaxResult.get("code"))) && ObjectUtil.isNotNull(
@@ -1948,8 +1952,6 @@ public class VehicleApplicationService {
if (rolePOS != null && ! rolePOS.isEmpty()) {
roleCodeList.addAll(
rolePOS.stream().map(RolePO :: getRoleCode).collect(Collectors.toList()));
} else {
throw new ServiceException("账号未授权角色信息!");
}
}
if (! roleCodeList.contains(RoleEnum.DRIVER.getCode())) {