hsf
parent
db8d2479a6
commit
20222eff99
|
|
@ -5,3 +5,4 @@
|
|||
/**/.DS_Store
|
||||
/**/.back*
|
||||
db-model/*/
|
||||
/njzscloud-svr/docs
|
||||
|
|
|
|||
|
|
@ -151,6 +151,15 @@ public class OrderInfoController {
|
|||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量审核
|
||||
*/
|
||||
@PostMapping("/batch_audit")
|
||||
public R<?> batchAudit(@RequestBody BatchAuditOrderParam param) {
|
||||
orderInfoService.batchAudit(param);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 看料
|
||||
*/
|
||||
|
|
@ -169,6 +178,28 @@ public class OrderInfoController {
|
|||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量指派司机
|
||||
*
|
||||
* @param param 批量指派参数
|
||||
*/
|
||||
@PostMapping("/batch_assignment")
|
||||
public R<?> batchAssignment(@RequestBody BatchAssignmentOrderParam param) {
|
||||
orderInfoService.batchAssignment(param);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量确认接单
|
||||
*
|
||||
* @param param 批量确认接单参数
|
||||
*/
|
||||
@PostMapping("/batch_confirm")
|
||||
public R<?> batchConfirm(@RequestBody BatchConfirmOrderParam param) {
|
||||
orderInfoService.batchConfirm(param);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机确认接单
|
||||
*
|
||||
|
|
|
|||
|
|
@ -60,4 +60,6 @@ public interface OrderInfoMapper extends BaseMapper<OrderInfoEntity> {
|
|||
Boolean driverIsBusy(@Param("driverId") Long driverId);
|
||||
|
||||
Boolean truckIsBusy(@Param("truckId") Long truckId);
|
||||
|
||||
Boolean hasInProgressOrder(@Param("driverId") Long driverId, @Param("orderStatuses") List<String> orderStatuses);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.njzscloud.supervisory.order.pojo.param;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class BatchAssignmentOrderParam {
|
||||
/**
|
||||
* 订单Id列表
|
||||
*/
|
||||
private List<Long> orderIds;
|
||||
/**
|
||||
* 司机Id
|
||||
*/
|
||||
private Long driverId;
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.njzscloud.supervisory.order.pojo.param;
|
||||
|
||||
import com.njzscloud.supervisory.biz.constant.AuditStatus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class BatchAuditOrderParam {
|
||||
/**
|
||||
* 订单 Id 列表
|
||||
*/
|
||||
private List<Long> orderIds;
|
||||
|
||||
/**
|
||||
* 审核状态; 字典代码:audit_status
|
||||
*/
|
||||
private AuditStatus auditStatus;
|
||||
|
||||
/**
|
||||
* 审核备注
|
||||
*/
|
||||
private String auditMemo;
|
||||
|
||||
/**
|
||||
* 审核图片
|
||||
*/
|
||||
private String auditPicture;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.njzscloud.supervisory.order.pojo.param;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class BatchConfirmOrderParam {
|
||||
/**
|
||||
* 订单Id列表
|
||||
*/
|
||||
private List<Long> orderIds;
|
||||
/**
|
||||
* 车辆Id
|
||||
*/
|
||||
private Long truckId;
|
||||
}
|
||||
|
|
@ -1,5 +1,11 @@
|
|||
package com.njzscloud.supervisory.order.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
|
|
@ -80,10 +86,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -599,6 +602,20 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
return PageResult.of(baseMapper.paging(page, ew));
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchAudit(BatchAuditOrderParam param) {
|
||||
List<Long> orderIds = param.getOrderIds();
|
||||
Assert.notEmpty(orderIds, () -> Exceptions.clierr("订单ID列表不能为空"));
|
||||
for (Long orderId : orderIds) {
|
||||
AuditOrderParam auditOrderParam = new AuditOrderParam()
|
||||
.setId(orderId)
|
||||
.setAuditStatus(param.getAuditStatus())
|
||||
.setAuditMemo(param.getAuditMemo())
|
||||
.setAuditPicture(param.getAuditPicture());
|
||||
audit(auditOrderParam);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void audit(AuditOrderParam auditOrderParam) {
|
||||
OrderPagingResult detail = detail(auditOrderParam.getId());
|
||||
|
|
@ -755,6 +772,31 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
// truckLeaving(new TruckLeavingOrderParam().setOrderId(orderId), 0);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchAssignment(BatchAssignmentOrderParam param) {
|
||||
List<Long> orderIds = param.getOrderIds();
|
||||
Assert.notEmpty(orderIds, () -> Exceptions.clierr("订单ID列表不能为空"));
|
||||
Assert.notNull(param.getDriverId(), () -> Exceptions.clierr("司机ID不能为空"));
|
||||
for (Long orderId : orderIds) {
|
||||
AssignmentOrderParam assignmentOrderParam = new AssignmentOrderParam()
|
||||
.setOrderId(orderId)
|
||||
.setDriverId(param.getDriverId());
|
||||
OrderInfoEntity oldOrder = this.getById(orderId);
|
||||
Assert.notNull(oldOrder, () -> Exceptions.clierr("订单不存在, orderId: " + orderId));
|
||||
assignmentDriver(assignmentOrderParam, oldOrder);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchConfirm(BatchConfirmOrderParam param) {
|
||||
List<Long> orderIds = param.getOrderIds();
|
||||
Assert.notEmpty(orderIds, () -> Exceptions.clierr("订单ID列表不能为空"));
|
||||
Assert.notNull(param.getTruckId(), () -> Exceptions.clierr("车辆ID不能为空"));
|
||||
for (Long orderId : orderIds) {
|
||||
confirm(orderId, param.getTruckId());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void assignment(AssignmentOrderParam assignmentOrderParam) {
|
||||
OrderInfoEntity oldOrder = this.getById(assignmentOrderParam.getOrderId());
|
||||
|
|
@ -939,10 +981,9 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
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("有未完成的订单,不能清运"));
|
||||
Boolean driverHasInProgress = baseMapper.hasInProgressOrder(driverId,
|
||||
Arrays.asList(OrderStatus.QingYunZhong.getVal(), OrderStatus.YiJinChang.getVal(), OrderStatus.YiChuChang.getVal()));
|
||||
Assert.isFalse(driverHasInProgress, () -> Exceptions.clierr("您有正在进行中的订单,不能清运"));
|
||||
Long orderInfoId = orderInfo.getId();
|
||||
|
||||
OrderGoodsEntity entity = orderGoodsService.getById(orderInfo.getGoodsId());
|
||||
|
|
|
|||
|
|
@ -412,4 +412,14 @@
|
|||
WHERE busy = 0
|
||||
AND id = #{truckId}
|
||||
</select>
|
||||
<select id="hasInProgressOrder" resultType="java.lang.Boolean">
|
||||
SELECT COUNT(*) > 0
|
||||
FROM order_info
|
||||
WHERE driver_id = #{driverId}
|
||||
AND order_status IN
|
||||
<foreach collection="orderStatuses" item="status" open="(" separator="," close=")">
|
||||
#{status}
|
||||
</foreach>
|
||||
AND deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue