|
@@ -1133,18 +1133,15 @@ public class KwfDriverService {
|
|
|
* @date 2023/7/6
|
|
* @date 2023/7/6
|
|
|
**/
|
|
**/
|
|
|
public HttpResult bindTruck(KwfBindTruckDto params) {
|
|
public HttpResult bindTruck(KwfBindTruckDto params) {
|
|
|
- /**数据校验**/
|
|
|
|
|
- if (params.getId() == null) {
|
|
|
|
|
- return HttpResult.error(HttpStatus.PARAMETERS_PATTERN_ERROR_CODE,"司机主键id不能为空!");
|
|
|
|
|
- }
|
|
|
|
|
if (StringUtils.isBlank(params.getTruckId())) {
|
|
if (StringUtils.isBlank(params.getTruckId())) {
|
|
|
return HttpResult.ok("未选择需要绑定的车辆!");
|
|
return HttpResult.ok("未选择需要绑定的车辆!");
|
|
|
}
|
|
}
|
|
|
- //查询是否存在已有车辆司机关系数据
|
|
|
|
|
|
|
+ //查询司机是否存在已绑定的车辆
|
|
|
KwfTruckReport truckReport = truckReportRepository.getOne(Wrappers.<KwfTruckReport>lambdaQuery()
|
|
KwfTruckReport truckReport = truckReportRepository.getOne(Wrappers.<KwfTruckReport>lambdaQuery()
|
|
|
.eq(KwfTruckReport::getEntId, LoginUserHolder.getEntId())
|
|
.eq(KwfTruckReport::getEntId, LoginUserHolder.getEntId())
|
|
|
.eq(KwfTruckReport::getDriverId, params.getId())
|
|
.eq(KwfTruckReport::getDriverId, params.getId())
|
|
|
- .eq(KwfTruckReport::getDelFlag, Global.NO));
|
|
|
|
|
|
|
+ .eq(KwfTruckReport::getDelFlag, Global.NO)
|
|
|
|
|
+ .eq(KwfTruckReport::getStatus, Global.YES));
|
|
|
if(truckReport == null) {
|
|
if(truckReport == null) {
|
|
|
KwfTruckReport newTruckReport = new KwfTruckReport();
|
|
KwfTruckReport newTruckReport = new KwfTruckReport();
|
|
|
newTruckReport.setTruckId(params.getTruckId());
|
|
newTruckReport.setTruckId(params.getTruckId());
|
|
@@ -1369,18 +1366,18 @@ public class KwfDriverService {
|
|
|
* @date 2023/7/6
|
|
* @date 2023/7/6
|
|
|
**/
|
|
**/
|
|
|
public HttpResult unbindTruck(KwfBindTruckDto params) {
|
|
public HttpResult unbindTruck(KwfBindTruckDto params) {
|
|
|
- //查询是否存在已有车辆司机关系数据
|
|
|
|
|
|
|
+ //查询司机是否存在已绑定的车辆
|
|
|
KwfTruckReport truckReport = truckReportRepository.getOne(Wrappers.<KwfTruckReport>lambdaQuery()
|
|
KwfTruckReport truckReport = truckReportRepository.getOne(Wrappers.<KwfTruckReport>lambdaQuery()
|
|
|
.eq(KwfTruckReport::getEntId, LoginUserHolder.getEntId())
|
|
.eq(KwfTruckReport::getEntId, LoginUserHolder.getEntId())
|
|
|
.eq(KwfTruckReport::getDriverId, params.getId())
|
|
.eq(KwfTruckReport::getDriverId, params.getId())
|
|
|
.eq(KwfTruckReport::getDelFlag, Global.NO)
|
|
.eq(KwfTruckReport::getDelFlag, Global.NO)
|
|
|
- .eq(KwfTruckReport::getStatus, Global.NO));
|
|
|
|
|
|
|
+ .eq(KwfTruckReport::getStatus, Global.YES));
|
|
|
if(truckReport == null) {
|
|
if(truckReport == null) {
|
|
|
- throw new BusinessPlatfromException(ErrorCodeEnum.WAYBILL_ORDER_STATUS_ERROR, "此司机无车辆绑定信息!");
|
|
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.WAYBILL_ORDER_STATUS_ERROR, "此司机无车辆解绑信息!");
|
|
|
}
|
|
}
|
|
|
- truckReport.setStatus(Global.YES);
|
|
|
|
|
|
|
+ truckReport.setStatus(Global.NO);
|
|
|
boolean saveResult = truckReportRepository.updateById(truckReport);
|
|
boolean saveResult = truckReportRepository.updateById(truckReport);
|
|
|
- return saveResult ? HttpResult.ok("车辆绑定成功!") : HttpResult.error("车辆绑定失败!");
|
|
|
|
|
|
|
+ return saveResult ? HttpResult.ok("车辆解绑成功!") : HttpResult.error("车辆解绑失败!");
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|