Commit d4fd0a03 authored by 332784038@qq.com's avatar 332784038@qq.com

订单审批类型更新bug修复

parent 5a147911
......@@ -101,7 +101,7 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
@Resource
private ApplicationContext applicationContext;
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public Long createFeeApplication(OrderFeeApplicationCreateReqVO createReqVO) throws Exception {
//该订单是否有待处理异常或待处理审核则抛出异常
......@@ -150,7 +150,7 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
}
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public void createFeeBatchApplication(OrderFeeBatchApplicationCreateReqVO createReqVO) {
// OrderDO orderDO = orderService.getById(createReqVO.getOrderId());
// if (orderDO.getAuditType() != 0) {
......@@ -202,6 +202,7 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFeeApplication(OrderFeeApplicationUpdateReqVO updateReqVO) {
OrderDO orderDO = orderService.getById(updateReqVO.getOrderId());
......
......@@ -4327,16 +4327,14 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (Objects.nonNull(auditType)) {
// TODO 这里可能出现并行的审批任务,当结束一个审批任务变更为0时,需要同步查询当前正在进行的其他审批任务
currentOrderDO.setAuditType(auditType);
currentOrderDO.setAuditResult(auditResult);
if (StringUtils.isNotBlank(auditResult)) {
// 获取固定中文说明描述
msg = I18nMessage.getZhMessage(auditResult);
}
if (auditType == 0) {
this.checkOrderProcessingApprovalType(orderId, currentOrderDO, auditType, auditResult);
msg = currentOrderDO.getMsg();
} else {
currentOrderDO.setAuditType(auditType);
currentOrderDO.setAuditResult(auditResult);
if (StringUtils.isNotBlank(auditResult)) {
// 获取固定中文说明描述
msg = I18nMessage.getZhMessage(auditResult);
}
this.checkOrderProcessingApprovalType(currentOrderDO, auditType, auditResult);
}
}
if (currentOrderDO.getAuditType() == 0 && StringUtils.isBlank(currentOrderDO.getAuditResult())) {
......@@ -4391,29 +4389,24 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
/**
* 订单审批更新
*
* @param orderId 订单id
* @param containerNumber 自编号
* @param orderDO 订单信息
* @param auditType 审批类型
* @param auditResult 审批结果
*/
private void checkOrderProcessingApprovalType(Long orderId, OrderDO orderDO, Integer auditType, String auditResult) {
private void checkOrderProcessingApprovalType( OrderDO orderDO, Integer auditType, String auditResult) {
// 出货审批更新
if (StringUtils.isNotBlank(orderDO.getContainerNumber())){
BoxCheckOrderApprovalEvent boxCheckOrderApprovalEvent = new BoxCheckOrderApprovalEvent(orderId, orderDO.getContainerNumber(), auditType, auditResult, false);
BoxCheckOrderApprovalEvent boxCheckOrderApprovalEvent = new BoxCheckOrderApprovalEvent(orderDO.getOrderId(), orderDO.getContainerNumber(), auditType, auditResult, false);
applicationContext.publishEvent(boxCheckOrderApprovalEvent);
if (boxCheckOrderApprovalEvent.getIsExists()) {
orderDO.setAuditType(auditType);
orderDO.setAuditResult(auditResult);
if (StringUtils.isNotBlank(auditResult)) {
// 获取固定中文说明描述
orderDO.setMsg(I18nMessage.getZhMessage(auditResult));
}
return;
}
}
// 入仓审批更新
OrderWarehouseApprovalDO warehouseApprovalDO = orderWarehouseApprovalService.getOne(new LambdaQueryWrapper<OrderWarehouseApprovalDO>()
.eq(OrderWarehouseApprovalDO::getOrderIds, orderId)
.eq(OrderWarehouseApprovalDO::getOrderIds, orderDO.getOrderId())
.eq(OrderWarehouseApprovalDO::getStatus, 1)
.orderByDesc(OrderWarehouseApprovalDO::getId)
.last("limit 1"));
......@@ -4423,28 +4416,22 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 入仓修改
orderDO.setAuditType(warehouse_update_processing.getType());
orderDO.setAuditResult(warehouse_update_processing.getDesc());
// 获取固定中文说明描述
orderDO.setMsg(I18nMessage.getZhMessage(warehouse_update_processing.getDesc()));
return;
case 2:
// 调仓
orderDO.setAuditType(warehouse_adjust_processing.getType());
orderDO.setAuditResult(warehouse_adjust_processing.getDesc());
// 获取固定中文说明描述
orderDO.setMsg(I18nMessage.getZhMessage(warehouse_update_processing.getDesc()));
return;
case 3:
// 退仓
orderDO.setAuditType(warehouse_rollback_processing.getType());
orderDO.setAuditResult(warehouse_rollback_processing.getDesc());
// 获取固定中文说明描述
orderDO.setMsg(I18nMessage.getZhMessage(warehouse_rollback_processing.getDesc()));
return;
}
}
// 订单审批更新
OrderApprovalDO approvalDO = orderApprovalService.getOne(new LambdaQueryWrapper<OrderApprovalDO>()
.eq(OrderApprovalDO::getOrderId, orderId)
.eq(OrderApprovalDO::getOrderId, orderDO.getOrderId())
.eq(OrderApprovalDO::getStatus, 1)
.orderByDesc(OrderApprovalDO::getOrderApprovalId)
.last("limit 1"));
......@@ -4452,8 +4439,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderApprovalTypeResultEnum resultEnum = OrderApprovalTypeResultEnum.typeAndResultOf(approvalDO.getType(), approvalDO.getStatus());
orderDO.setAuditType(resultEnum.getType());
orderDO.setAuditResult(resultEnum.getDesc());
// 获取固定中文说明描述
orderDO.setMsg(I18nMessage.getZhMessage(resultEnum.getDesc()));
}
}
......
......@@ -84,7 +84,7 @@ public class OrderFeeApplicationController {
@PostMapping("/create/batch")
@ApiOperation("批量创建订单费用申请")
@Idempotent(timeout = 5)
@Idempotent(timeout = 10)
public CommonResult<Boolean> createFeeBatchApplication(@Valid @RequestBody OrderFeeBatchApplicationCreateReqVO createReqVO) throws Exception {
String redisKey = MessageFormat.format(ORDER_FEE_APPLICATION_KEY, createReqVO.getOrderId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
......@@ -118,6 +118,7 @@ public class OrderFeeApplicationController {
@PutMapping("/update")
@ApiOperation("更新订单费用申请")
@Idempotent(timeout = 10)
public CommonResult<Boolean> updateFeeApplication(@Valid @RequestBody OrderFeeApplicationUpdateReqVO updateReqVO) {
String redisKey = MessageFormat.format(ORDER_FEE_APPLICATION_KEY, updateReqVO.getOrderId().toString());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment