upcreate:提交订单接口
This commit is contained in:
parent
bfa2212148
commit
6799b16ac3
|
|
@ -68,6 +68,13 @@ public class OrdersController {
|
|||
ordersService.auditOrders(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
@PutMapping("/submit")
|
||||
@Operation(summary = "提交订单")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:orders:submit')")
|
||||
public CommonResult<Boolean> submitOrders(@Valid @RequestBody OrdersSaveReqVO updateReqVO) {
|
||||
ordersService.submitOrders(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除订单")
|
||||
|
|
|
|||
|
|
@ -202,5 +202,19 @@ public class OrdersSaveReqVO {
|
|||
private String face;
|
||||
@Schema(description = "订单联系状态码")
|
||||
private Long callStatus;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
@Schema(description = "请求参数")
|
||||
private String orderCreateRequest;
|
||||
/**
|
||||
* 返回参数
|
||||
*/
|
||||
@Schema(description = "返回参数")
|
||||
private String orderCreateResponse;
|
||||
/**
|
||||
* 是否加急 0或空 不加急 1 加急
|
||||
*/
|
||||
@Schema(description = "是否加急")
|
||||
private Integer isUrgent;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,4 +63,10 @@ public interface OrdersService extends IService<OrdersDO> {
|
|||
* @return orderId
|
||||
*/
|
||||
public Long reCreateOrder(Long orderId);
|
||||
|
||||
/**
|
||||
* 提交订单
|
||||
* @param updateReqVO
|
||||
*/
|
||||
void submitOrders(OrdersSaveReqVO updateReqVO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,9 +175,25 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
|||
validateOrdersExists(updateReqVO.getId());
|
||||
// 更新
|
||||
OrdersDO updateObj = BeanUtils.toBean(updateReqVO, OrdersDO.class);
|
||||
ordersMapper.updateById(updateObj);
|
||||
// 判断自动发货还是手动发货
|
||||
Long productId = updateObj.getProductId();
|
||||
updateObj.setProducerId(1L);
|
||||
ordersMapper.updateById(updateObj);
|
||||
Long status = updateObj.getStatus();
|
||||
// 进入审核流程
|
||||
if (ObjectUtil.equals(status, 450)) {
|
||||
// 450 审核通过
|
||||
createOrder(updateObj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交订单
|
||||
* @param updateReqVO
|
||||
*/
|
||||
@Override
|
||||
public void submitOrders(OrdersSaveReqVO updateReqVO) {
|
||||
OrdersDO updateObj = BeanUtils.toBean(updateReqVO, OrdersDO.class);
|
||||
createOrder(updateObj);
|
||||
}
|
||||
|
||||
|
|
@ -187,28 +203,27 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
|||
* @param ordersDO
|
||||
*/
|
||||
private void createOrder(OrdersDO ordersDO) {
|
||||
Long status = ordersDO.getStatus();
|
||||
if (ObjectUtil.equals(status, 450)) {
|
||||
// 进入审核流程且下单
|
||||
OrderApiCreateParam param = new OrderApiCreateParam();
|
||||
BeanUtils.copyProperties(ordersDO, param);
|
||||
ApiDealResp<OrderApiCreateResp> orderResponse = apiDealStrategyService.createOrder(param);
|
||||
// 是否是是上游黑名单 如果是 存本地黑名单
|
||||
Boolean isBlack = orderResponse.getIsBlack();
|
||||
// 上游是否支持这个接口
|
||||
// Boolean isSupport = orderResponse.getIsSupport(); 都支持创建订单的 查询不一定
|
||||
// 成功?
|
||||
Boolean success = orderResponse.getSuccess();
|
||||
// 响应信息
|
||||
String msg = orderResponse.getMsg();
|
||||
// 订单创结果
|
||||
OrderApiCreateResp orderData = orderResponse.getData();
|
||||
// 上游订单ID
|
||||
orderData.getSupplierOrderId();
|
||||
// 向上游提交订单
|
||||
OrderApiCreateParam param = new OrderApiCreateParam();
|
||||
BeanUtils.copyProperties(ordersDO, param);
|
||||
ApiDealResp<OrderApiCreateResp> orderResponse = apiDealStrategyService.createOrder(param);
|
||||
// 是否是是上游黑名单 如果是 存本地黑名单 todo
|
||||
Boolean isBlack = orderResponse.getIsBlack();
|
||||
// 上游是否支持这个接口
|
||||
// Boolean isSupport = orderResponse.getIsSupport(); 都支持创建订单的 查询不一定
|
||||
// 成功?
|
||||
Boolean success = orderResponse.getSuccess();
|
||||
// 响应信息
|
||||
String msg = orderResponse.getMsg();
|
||||
// 订单创结果
|
||||
OrderApiCreateResp orderData = orderResponse.getData();
|
||||
// 上游订单ID
|
||||
String supplierOrderId = orderData.getSupplierOrderId();
|
||||
|
||||
// ordersDO 记录 create param 和 响应信息
|
||||
|
||||
}
|
||||
// ordersDO 记录 create param 和 响应信息
|
||||
ordersDO.setOrderCreateResponse(orderData.getOrderCreateResponse());
|
||||
ordersDO.setUpstreamOrderId(supplierOrderId);
|
||||
ordersMapper.updateById(ordersDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue