Merge branch 'refs/heads/dev_zh_ty_20260108' into dev
This commit is contained in:
+11
@@ -4,14 +4,17 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.mhd.user.domain.userAggregate.entity.DriverVehicleBind;
|
import com.mhd.user.domain.userAggregate.entity.DriverVehicleBind;
|
||||||
|
import com.mhd.user.domain.userAggregate.repository.mapper.DriverVehicleBindMapper;
|
||||||
import com.mhd.user.domain.userAggregate.repository.po.DriverVehicleBindPo;
|
import com.mhd.user.domain.userAggregate.repository.po.DriverVehicleBindPo;
|
||||||
import com.mhd.user.domain.userAggregate.repository.todo.DriverVehicleBindDo;
|
import com.mhd.user.domain.userAggregate.repository.todo.DriverVehicleBindDo;
|
||||||
import com.mhd.user.domain.userAggregate.service.DriverVehicleBindDomainService;
|
import com.mhd.user.domain.userAggregate.service.DriverVehicleBindDomainService;
|
||||||
import com.mhd.user.domain.userAggregate.service.UserDriverDomainService;
|
import com.mhd.user.domain.userAggregate.service.UserDriverDomainService;
|
||||||
import com.mhd.system.api.TransportFeign;
|
import com.mhd.system.api.TransportFeign;
|
||||||
import com.mhd.user.interfaces.dto.DriverVehicleBindDto;
|
import com.mhd.user.interfaces.dto.DriverVehicleBindDto;
|
||||||
|
import com.mhd.user.interfaces.dto.addDTO.UserDriverDTO;
|
||||||
import com.mhd.user.interfaces.facadeApi.Po.VehicleDriverBindAppPo;
|
import com.mhd.user.interfaces.facadeApi.Po.VehicleDriverBindAppPo;
|
||||||
import com.mhd.common.core.domain.dto.VehicleDto;
|
import com.mhd.common.core.domain.dto.VehicleDto;
|
||||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||||
@@ -49,6 +52,9 @@ public class DriverVehicleBindApplicationService {
|
|||||||
private CommonApplicationService commonApplicationService;
|
private CommonApplicationService commonApplicationService;
|
||||||
@Resource
|
@Resource
|
||||||
private UserDriverDomainService userDriverDomainService;
|
private UserDriverDomainService userDriverDomainService;
|
||||||
|
@Autowired
|
||||||
|
private DriverVehicleBindMapper driverVehicleBindMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询司机车辆绑定关系列表
|
* 分页查询司机车辆绑定关系列表
|
||||||
*/
|
*/
|
||||||
@@ -355,4 +361,9 @@ public class DriverVehicleBindApplicationService {
|
|||||||
}
|
}
|
||||||
return isTrue;
|
return isTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int delectDriverBind(UserDriverDTO userDriverDTO) {
|
||||||
|
return driverVehicleBindMapper.delete(new LambdaQueryWrapper<DriverVehicleBind>().eq(DriverVehicleBind::getDriverBindId,userDriverDTO.getUserId())
|
||||||
|
.eq(DriverVehicleBind::getVehicleId,userDriverDTO.getVehicleId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+21
@@ -44,6 +44,8 @@ import com.mhd.user.domain.roleAggregate.entity.RoleEntity;
|
|||||||
import com.mhd.user.domain.roleAggregate.repository.todo.RoleDo;
|
import com.mhd.user.domain.roleAggregate.repository.todo.RoleDo;
|
||||||
import com.mhd.user.domain.roleAggregate.service.RoleDomainService;
|
import com.mhd.user.domain.roleAggregate.service.RoleDomainService;
|
||||||
import com.mhd.user.domain.userAggregate.entity.*;
|
import com.mhd.user.domain.userAggregate.entity.*;
|
||||||
|
import com.mhd.user.domain.userAggregate.repository.mapper.DriverVehicleBindMapper;
|
||||||
|
import com.mhd.user.domain.userAggregate.repository.mapper.UserMapper;
|
||||||
import com.mhd.user.domain.userAggregate.repository.po.*;
|
import com.mhd.user.domain.userAggregate.repository.po.*;
|
||||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo;
|
import com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo;
|
||||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||||
@@ -178,6 +180,10 @@ public class UserDriverApplicationService {
|
|||||||
private MotorcadeCollectionDomainService motorcadeCollectionDomainService;
|
private MotorcadeCollectionDomainService motorcadeCollectionDomainService;
|
||||||
@Resource
|
@Resource
|
||||||
private VehicleBindingStrategyFactory vehicleBindingStrategyFactory;
|
private VehicleBindingStrategyFactory vehicleBindingStrategyFactory;
|
||||||
|
@Autowired
|
||||||
|
private DriverVehicleBindMapper driverVehicleBindMapper;
|
||||||
|
@Autowired
|
||||||
|
private UserMapper userMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description 承运人列表查询
|
* @Description 承运人列表查询
|
||||||
@@ -2870,5 +2876,20 @@ public class UserDriverApplicationService {
|
|||||||
// }
|
// }
|
||||||
return motorcade.getDriverEnterpriseCode();
|
return motorcade.getDriverEnterpriseCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int bindVehicleForHome(UserDriverDO userDriverDO) {
|
||||||
|
DriverVehicleBind driverVehicleBind = new DriverVehicleBind();
|
||||||
|
driverVehicleBind.setUserId(userDriverDO.getUserId());
|
||||||
|
driverVehicleBind.setVehicleId(userDriverDO.getVehicleId());
|
||||||
|
driverVehicleBind.setDefaultFlag(1);
|
||||||
|
driverVehicleBind.setDelFlag(1);
|
||||||
|
driverVehicleBind.setDriverBindId(userDriverDO.getUserId());
|
||||||
|
UserPo userPo = userMapper.selectByUserId(userDriverDO.getUserId());
|
||||||
|
driverVehicleBind.setBindDriverName(userPo.getUserName());
|
||||||
|
driverVehicleBind.setBindDriverPhone(userPo.getUserPhone());
|
||||||
|
//向网货同步添加绑定关系
|
||||||
|
// wlhyDomainService.binding(driverVehicleBind);
|
||||||
|
return driverVehicleBindMapper.insert(driverVehicleBind);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,20 @@ public class UserDriverAPI extends BaseController {
|
|||||||
UserDriverDO userDriverDO = userDriverAssember.toUserDriverDO(userDriverDTO);
|
UserDriverDO userDriverDO = userDriverAssember.toUserDriverDO(userDriverDTO);
|
||||||
return toAjax(userDriverApplicationService.bindVehicle(userDriverDO));
|
return toAjax(userDriverApplicationService.bindVehicle(userDriverDO));
|
||||||
}
|
}
|
||||||
|
@Log(title = "承运人管理-绑定车辆", description ="绑定车辆",businessType = BusinessType.UPDATE)
|
||||||
|
@ApiOperation("绑定车辆")
|
||||||
|
@PostMapping("/bindVehicleForHome")
|
||||||
|
public AjaxResult bindVehicleForHome(@RequestBody UserDriverDTO userDriverDTO){
|
||||||
|
UserDriverDO userDriverDO = userDriverAssember.toUserDriverDO(userDriverDTO);
|
||||||
|
return toAjax(userDriverApplicationService.bindVehicleForHome(userDriverDO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除司机绑定关系")
|
||||||
|
@PostMapping("/driverVehicleBindApi/delectDriverBind")
|
||||||
|
public AjaxResult delectDriverBind(@RequestBody UserDriverDTO userDriverDTO) {
|
||||||
|
return toAjax(driverVehicleBindApplicationService.delectDriverBind(userDriverDTO));
|
||||||
|
|
||||||
|
}
|
||||||
@Log(title = "承运人管理-个体承运人新增绑定车辆", description ="个体承运人新增绑定车辆",businessType = BusinessType.UPDATE)
|
@Log(title = "承运人管理-个体承运人新增绑定车辆", description ="个体承运人新增绑定车辆",businessType = BusinessType.UPDATE)
|
||||||
@ApiOperation("个体承运人新增绑定车辆")
|
@ApiOperation("个体承运人新增绑定车辆")
|
||||||
@PostMapping("/bindVehicle1")
|
@PostMapping("/bindVehicle1")
|
||||||
|
|||||||
+55
-9
@@ -3089,14 +3089,16 @@ public class VehicleApplicationService {
|
|||||||
*
|
*
|
||||||
* @param vehicleDto
|
* @param vehicleDto
|
||||||
* @return
|
* @return
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer updatePilotDriver(VehicleDto vehicleDto) {
|
public Integer updatePilotDriver(VehicleDto vehicleDto) {
|
||||||
if (vehicleDto.getVehicleId() == null) {
|
if (vehicleDto.getVehicleId() == null) {
|
||||||
throw new IllegalArgumentException("车辆ID不能为空");
|
throw new IllegalArgumentException("车辆ID不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasPilot1 = StringUtils.hasText(vehicleDto.getPilot1());
|
boolean hasPilot1 = StringUtils.hasText(vehicleDto.getPilot1Id());
|
||||||
boolean hasPilot2 = StringUtils.hasText(vehicleDto.getPilot2());
|
boolean hasPilot2 = StringUtils.hasText(vehicleDto.getPilot2Id());
|
||||||
|
|
||||||
// 两个都传了
|
// 两个都传了
|
||||||
if (hasPilot1 && hasPilot2) {
|
if (hasPilot1 && hasPilot2) {
|
||||||
@@ -3106,17 +3108,61 @@ public class VehicleApplicationService {
|
|||||||
if (!hasPilot1 && !hasPilot2) {
|
if (!hasPilot1 && !hasPilot2) {
|
||||||
throw new IllegalArgumentException("请选择副驾");
|
throw new IllegalArgumentException("请选择副驾");
|
||||||
}
|
}
|
||||||
UserDriverDTO userDriverDTO = new UserDriverDTO();
|
|
||||||
//将pilot1或是pilot2的id传给userDriverDTO,判断一下谁有值传谁
|
Vehicle vehicle = vehicleMapper.selectById(vehicleDto.getVehicleId());
|
||||||
userDriverDTO.setUserId(Long.valueOf(hasPilot1 ? vehicleDto.getPilot1Id() : vehicleDto.getPilot2Id()));
|
String modifyPilotId = vehicleDto.getModifyPilotId();
|
||||||
userDriverDTO.setVehicleId(vehicleDto.getVehicleId());
|
if (modifyPilotId != null){
|
||||||
|
UserDriverDTO userDriverDTO1 = new UserDriverDTO();
|
||||||
|
userDriverDTO1.setUserId(Long.valueOf(modifyPilotId));
|
||||||
|
userDriverDTO1.setVehicleId(vehicleDto.getVehicleId());
|
||||||
|
userServiceFeign.delectDriverBind(userDriverDTO1);
|
||||||
|
}
|
||||||
|
if (hasPilot1){
|
||||||
|
|
||||||
// 更新
|
AjaxResult result = userServiceFeign.getDriverInfoByUserId(Long.valueOf(vehicleDto.getPilot1Id()));
|
||||||
vehicleMapper.updatePilotDriver(vehicleDto);
|
UserDriverPo driverInfo = null;
|
||||||
|
if(result != null && "200".equals(String.valueOf(result.get("code")))){
|
||||||
|
// 提取数据
|
||||||
|
driverInfo = JSONUtil.toBean(JSONUtil.toJsonStr(result.get("data")), UserDriverPo.class);
|
||||||
|
vehicle.setPilot1(driverInfo.getUserName());
|
||||||
|
vehicle.setPilot1Id(vehicleDto.getPilot1Id());
|
||||||
|
|
||||||
|
// 更新车辆信息到数据库
|
||||||
|
vehicleDomainService.updateVehicle(vehicle);
|
||||||
|
|
||||||
|
// 在user库中的driver_vehicle_bind表中添加一条绑定信息
|
||||||
|
UserDriverDTO userDriverDTO = new UserDriverDTO();
|
||||||
|
userDriverDTO.setUserId(Long.valueOf(vehicleDto.getPilot1Id()));
|
||||||
|
userDriverDTO.setVehicleId(vehicleDto.getVehicleId());
|
||||||
|
userDriverDTO.setVehicleLicensePlateNumber(vehicle.getVehicleLicensePlateNumber());
|
||||||
|
userDriverDTO.setBindSource(2); // 2-副驾绑定
|
||||||
|
userServiceFeign.bindVehicleForHome(userDriverDTO);
|
||||||
|
}
|
||||||
|
|
||||||
userServiceFeign.bindVehicle(userDriverDTO);
|
} else if (hasPilot2) {
|
||||||
|
// 如果是pilot2的情况,需要类似处理
|
||||||
|
AjaxResult result = userServiceFeign.getDriverInfoByUserId(Long.valueOf(vehicleDto.getPilot2Id()));
|
||||||
|
UserDriverPo driverInfo = null;
|
||||||
|
if(result != null && "200".equals(String.valueOf(result.get("code")))){
|
||||||
|
// 提取数据
|
||||||
|
driverInfo = JSONUtil.toBean(JSONUtil.toJsonStr(result.get("data")), UserDriverPo.class);
|
||||||
|
vehicle.setPilot2(driverInfo.getUserName());
|
||||||
|
vehicle.setPilot2Id(vehicleDto.getPilot2Id());
|
||||||
|
|
||||||
|
// 更新车辆信息到数据库
|
||||||
|
vehicleDomainService.updateVehicle(vehicle);
|
||||||
|
|
||||||
|
// 在user库中的driver_vehicle_bind表中添加一条绑定信息
|
||||||
|
UserDriverDTO userDriverDTO = new UserDriverDTO();
|
||||||
|
userDriverDTO.setUserId(Long.valueOf(vehicleDto.getPilot2Id()));
|
||||||
|
userDriverDTO.setVehicleId(vehicleDto.getVehicleId());
|
||||||
|
userDriverDTO.setVehicleLicensePlateNumber(vehicle.getVehicleLicensePlateNumber());
|
||||||
|
userDriverDTO.setBindSource(2); // 2-副驾绑定
|
||||||
|
|
||||||
|
userServiceFeign.bindVehicleForHome(userDriverDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|||||||
+14
@@ -28,6 +28,19 @@ public interface UserServiceFeign {
|
|||||||
@PostMapping("/userDriverApi/bindVehicle")
|
@PostMapping("/userDriverApi/bindVehicle")
|
||||||
public AjaxResult bindVehicle(@RequestBody UserDriverDTO userDriverDTO);
|
public AjaxResult bindVehicle(@RequestBody UserDriverDTO userDriverDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加绑定关系
|
||||||
|
*/
|
||||||
|
@PostMapping("/userDriverApi/bindVehicleForHome")
|
||||||
|
public AjaxResult bindVehicleForHome(@RequestBody UserDriverDTO userDriverDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除司机绑定关系
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除司机绑定关系")
|
||||||
|
@PostMapping("/driverVehicleBindApi/delectDriverBind")
|
||||||
|
void delectDriverBind(@RequestBody UserDriverDTO userDriverDTO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description 绑定车辆
|
* @Description 绑定车辆
|
||||||
* @Author Alex
|
* @Author Alex
|
||||||
@@ -204,4 +217,5 @@ public interface UserServiceFeign {
|
|||||||
@GetMapping("/driverVehicleBindApi/isVehicleBinding/{vehicleLicensePlateNumber}")
|
@GetMapping("/driverVehicleBindApi/isVehicleBinding/{vehicleLicensePlateNumber}")
|
||||||
R<Boolean> isVehicleBinding(
|
R<Boolean> isVehicleBinding(
|
||||||
@PathVariable("vehicleLicensePlateNumber") String vehicleLicensePlateNumber);
|
@PathVariable("vehicleLicensePlateNumber") String vehicleLicensePlateNumber);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -437,4 +437,7 @@ public class VehicleDto extends BaseVOEntity implements Serializable
|
|||||||
|
|
||||||
@ApiModelProperty(value = "车辆主体")
|
@ApiModelProperty(value = "车辆主体")
|
||||||
private Integer vehicleBody;
|
private Integer vehicleBody;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "被修改副驾id")
|
||||||
|
private String modifyPilotId;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -69,8 +69,8 @@ public class VehicleApi extends BaseController
|
|||||||
* 车辆绑定副驾
|
* 车辆绑定副驾
|
||||||
*/
|
*/
|
||||||
@Log(title = "车辆管理-车辆绑定副驾", description = "车辆绑定副驾", businessType = BusinessType.UPDATE)
|
@Log(title = "车辆管理-车辆绑定副驾", description = "车辆绑定副驾", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/bindVehicle")
|
@GetMapping("/bindVehicle")
|
||||||
public R<Integer> bindVehicle(@RequestBody VehicleDto vehicleDto){
|
public R<Integer> bindVehicle(VehicleDto vehicleDto){
|
||||||
return R.ok(vehicleApplicationService.updatePilotDriver(vehicleDto));
|
return R.ok(vehicleApplicationService.updatePilotDriver(vehicleDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user