可重复接单
parent
b9154f900d
commit
1742e2f576
|
|
@ -174,7 +174,7 @@ public class BizDriverService extends ServiceImpl<BizDriverMapper, BizDriverEnti
|
|||
SearchCompanyResult searchCompanyResult = baseMapper.selectCompanyByUserId(userDetail.getUserId());
|
||||
|
||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<BizDriverEntity>lambdaQuery()
|
||||
.eq(BizDriverEntity::getBusy, false)
|
||||
// .eq(BizDriverEntity::getBusy, false)
|
||||
.eq(BizDriverEntity::getCompanyId, searchCompanyResult.getId())
|
||||
.eq(BizDriverEntity::getAuditStatus, AuditStatus.TongGuo)
|
||||
.and(StrUtil.isNotBlank(keywords), it ->
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ public class BizTruckService extends ServiceImpl<BizTruckMapper, BizTruckEntity>
|
|||
SearchCompanyResult searchCompanyResult = baseMapper.selectCompanyByUserId(userDetail.getUserId());
|
||||
Assert.notNull(searchCompanyResult, () -> Exceptions.exception("未查询到公司信息"));
|
||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<BizTruckEntity>lambdaQuery()
|
||||
.eq(BizTruckEntity::getBusy, false)
|
||||
// .eq(BizTruckEntity::getBusy, false)
|
||||
.eq(BizTruckEntity::getAuditStatus, AuditStatus.TongGuo)
|
||||
.eq(BizTruckEntity::getCompanyId, searchCompanyResult.getId())
|
||||
.and(StrUtil.isNotBlank(keywords), it ->
|
||||
|
|
|
|||
|
|
@ -56,4 +56,8 @@ public interface OrderInfoMapper extends BaseMapper<OrderInfoEntity> {
|
|||
|
||||
@SuppressWarnings("MybatisXMapperMethodInspection")
|
||||
List<Map<String, Object>> statisticsByAreaGoods(@Param("ew") QueryWrapper<Object> ew);
|
||||
|
||||
Boolean driverIsBusy(@Param("driverId") Long driverId);
|
||||
|
||||
Boolean truckIsBusy(@Param("truckId") Long truckId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -786,7 +786,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
throw Exceptions.clierr("公司账户余额不足");
|
||||
}
|
||||
}
|
||||
baseMapper.busyDriver(driverId, Boolean.TRUE);
|
||||
// baseMapper.busyDriver(driverId, Boolean.TRUE);
|
||||
|
||||
OrderCategory orderCategory = orderInfo.getOrderCategory();
|
||||
if (orderCategory == OrderCategory.DuanBoChu) {
|
||||
|
|
@ -864,7 +864,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
long userId = SecurityUtil.currentUserId();
|
||||
Long driverId_ = baseMapper.getDriverId(userId);
|
||||
Assert.isTrue(driverId_ != null && driverId == driverId_, () -> Exceptions.clierr("您没有权限确认此单"));
|
||||
baseMapper.busyTruck(truckId, Boolean.TRUE);
|
||||
// baseMapper.busyTruck(truckId, Boolean.TRUE);
|
||||
OrderCargoPlaceEntity cargoPlaceEntity = orderCargoPlaceService.getById(orderInfo.getCargoPlaceId());
|
||||
String area = cargoPlaceEntity.getArea();
|
||||
BizAuditConfigEntity bizAuditConfigEntity = bizAuditConfigService.getOne(Wrappers.lambdaQuery(BizAuditConfigEntity.class).eq(BizAuditConfigEntity::getArea, area));
|
||||
|
|
@ -937,6 +937,12 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
Assert.notNull(orderInfo, () -> Exceptions.clierr("订单不存在"));
|
||||
Assert.isTrue(orderInfo.getOrderStatus() == OrderStatus.YiJieDan, () -> Exceptions.clierr("当前订单状态,无法开始运输"));
|
||||
Assert.isTrue(orderInfo.getAuditStatus() == AuditStatus.TongGuo, () -> Exceptions.clierr("当前订单未审核完成,无法开始运输"));
|
||||
Long truckId = orderInfo.getTruckId();
|
||||
Long driverId = orderInfo.getDriverId();
|
||||
Boolean driverIsBusy = baseMapper.driverIsBusy(driverId);
|
||||
Assert.isFalse(driverIsBusy, () -> Exceptions.exception("有未完成的订单,不能清运"));
|
||||
Boolean truckIsBusy = baseMapper.truckIsBusy(truckId);
|
||||
Assert.isFalse(truckIsBusy, () -> Exceptions.exception("有未完成的订单,不能清运"));
|
||||
Long orderInfoId = orderInfo.getId();
|
||||
|
||||
OrderGoodsEntity entity = orderGoodsService.getById(orderInfo.getGoodsId());
|
||||
|
|
@ -948,6 +954,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
handleCompanyPay(orderInfo, Boolean.TRUE, new BigDecimal("0"), Boolean.FALSE);
|
||||
}
|
||||
|
||||
baseMapper.busyDriver(driverId, Boolean.TRUE);
|
||||
baseMapper.busyTruck(truckId, Boolean.TRUE);
|
||||
this.updateById(new OrderInfoEntity()
|
||||
.setId(orderInfoId)
|
||||
.setCargoPhoto(startTransportOrderParam.getCargoPhoto())
|
||||
|
|
@ -955,7 +963,6 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
.setTransTime(LocalDateTime.now())
|
||||
);
|
||||
|
||||
Long truckId = orderInfo.getTruckId();
|
||||
Assert.notNull(truckId, () -> Exceptions.clierr("订单未分配车辆"));
|
||||
BizTruckEntity truckInfo = baseMapper.getTruckInfo(truckId);
|
||||
Assert.notNull(truckInfo, () -> Exceptions.clierr("车辆不存在"));
|
||||
|
|
|
|||
|
|
@ -400,4 +400,16 @@
|
|||
INNER JOIN goods_info t2 ON t2.id = t1.goods_id
|
||||
INNER JOIN sys_district t3 ON t3.id = t1.area_code
|
||||
</select>
|
||||
<select id="driverIsBusy" resultType="java.lang.Boolean">
|
||||
SELECT COUNT(*) > 0 busy
|
||||
FROM biz_driver
|
||||
WHERE busy = 0
|
||||
AND id = #{driverId}
|
||||
</select>
|
||||
<select id="truckIsBusy" resultType="java.lang.Boolean">
|
||||
SELECT COUNT(*) > 0 busy
|
||||
FROM biz_truck
|
||||
WHERE busy = 0
|
||||
AND id = #{truckId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue