承运人添加车辆bug
This commit is contained in:
@@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class)
|
||||
public interface YmsServiceFeign {
|
||||
|
||||
/**
|
||||
|
||||
+11
@@ -416,6 +416,17 @@ public class UserDriverApplicationService {
|
||||
VehiclePo vehicleData = vehicle.getData();
|
||||
log.info("查到到车辆信息:{}",vehicleData);
|
||||
|
||||
// 如果车辆存在且当前用户与该车辆的绑定关系已存在,则跳过绑定,避免重复创建绑定记录
|
||||
if (vehicleData != null && vehicleData.getVehicleId() != null) {
|
||||
DriverVehicleBind existingBind = driverVehicleBindDomainService.getBindInfoListByVehicle(
|
||||
vehicleData.getVehicleId(), driver.getUserId());
|
||||
if (ObjectUtil.isNotNull(existingBind)) {
|
||||
log.info("用户[{}]与车辆[{}]的绑定关系已存在,跳过绑定操作",
|
||||
driver.getUserId(), driver.getVehicleLicensePlateNumber());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DriverVehicleBind driverVehicleBind = driverVehicleBindDomainService.isVehicleBinding(driver.getVehicleLicensePlateNumber());
|
||||
Boolean isBound=false;
|
||||
if(ObjectUtil.isNotNull(driverVehicleBind)&&!driverVehicleBind.getDriverBindId().equals(driver.getUserId())){
|
||||
|
||||
+3
@@ -326,6 +326,9 @@ public class UserDriverDomainService {
|
||||
|
||||
public UserDriverPo getDriverDataByUserId(Long userId) {
|
||||
UserDriverPo userDriverPo=userDriverRepositoryInterface.getDriverDataByUserId(userId);
|
||||
if (userDriverPo == null) {
|
||||
return null;
|
||||
}
|
||||
R<List<VehiclePo>> vehicleR=transportFeign.getVehiclePosByUserId(userDriverPo.getUserId());
|
||||
if (R.SUCCESS == vehicleR.getCode() && vehicleR.getData() != null && !vehicleR.getData().isEmpty()) {
|
||||
userDriverPo.setVehicleList(vehicleR.getData());
|
||||
|
||||
+10
-8
@@ -573,12 +573,15 @@ public class VehicleApplicationService {
|
||||
if (! "200".equals(String.valueOf(userInfoResult.get("code")))) {
|
||||
throw new ServiceException("用户信息获取失败: " + userInfoResult.get("msg"));
|
||||
}
|
||||
// 司机数据可能不存在(用户尚未在用户中台完成注册),此时使用车辆表单携带的用户信息
|
||||
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"));
|
||||
}
|
||||
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("用户信息获取失败");
|
||||
}
|
||||
// 司机数据可能不存在(用户尚未在用户中台完成注册),此时使用车辆表单携带的用户信息
|
||||
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())) {
|
||||
|
||||
Reference in New Issue
Block a user