|
|
@@ -29,6 +29,7 @@ import com.yami.shop.security.comment.dao.AppConnectMapper;
|
|
|
import com.yami.shop.security.comment.model.AppConnect;
|
|
|
import com.yami.shop.security.platform.util.SecurityUtils;
|
|
|
import com.yami.shop.service.*;
|
|
|
+import com.yami.shop.service.hb.IHBOrderService;
|
|
|
import com.yami.shop.sys.service.SysUserService;
|
|
|
import com.yami.shop.utils.CullenUtils;
|
|
|
import com.yami.shop.utils.SmqjhUtil;
|
|
|
@@ -74,6 +75,9 @@ public class OrderController {
|
|
|
@Autowired
|
|
|
private SysUserService sysUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IHBOrderService hbOrderService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ExportTaskService exportTaskService;
|
|
|
|
|
|
@@ -396,4 +400,39 @@ public class OrderController {
|
|
|
orderService.deleteTempSubOrder(subOrderNumber);
|
|
|
return R.SUCCESS();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 商家主动取消市民请集合订单
|
|
|
+ * 推送取消到海博 + 通知smqjh-oms处理退款
|
|
|
+ */
|
|
|
+ @PostMapping("/cancelOrder")
|
|
|
+ @ApiOperation(value = "商家主动取消订单", notes = "商家主动取消订单")
|
|
|
+ public R<String> cancelOrder(@RequestBody CancelOrderParam cancelOrderParam) {
|
|
|
+ Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNumber, cancelOrderParam.getOrderNumber()));
|
|
|
+ if (order == null) {
|
|
|
+ throw new GlobalException("订单不存在");
|
|
|
+ }
|
|
|
+ if (!Objects.equals(order.getIsPayed(), 1)) {
|
|
|
+ throw new GlobalException("当前订单还未付款,无法取消");
|
|
|
+ }
|
|
|
+ if (Objects.equals(order.getHbOrderStatus(), OrderStatus.CLOSE.value())) {
|
|
|
+ throw new GlobalException("当前订单已取消");
|
|
|
+ }
|
|
|
+ if (Objects.equals(order.getHbOrderStatus(), OrderStatus.SUCCESS.value())) {
|
|
|
+ throw new GlobalException("当前订单已完成,无法取消");
|
|
|
+ }
|
|
|
+ // 1. 推送取消状态到海博
|
|
|
+ hbOrderService.changeOrderStatus(order.getOrderNumber(), 60);
|
|
|
+ // 2. 更新本地订单状态
|
|
|
+ order.setHbOrderStatus(60);
|
|
|
+ orderService.updateById(order);
|
|
|
+ // 3. 市民请集合订单推送到smqjh-oms,触发退款处理
|
|
|
+ if (order.getOrderType() != null && order.getOrderType() == 4) {
|
|
|
+ Map<Object, Object> map = new LinkedTreeMap<>();
|
|
|
+ map.put("orderNumber", order.getOrderNumber());
|
|
|
+ map.put("hbOrderStatus", 60);
|
|
|
+ HttpUtil.post(smqjhUtil.getOmsBaseUrl() + "/api/v1/xsb/order/updateHbOrderStatus", map);
|
|
|
+ }
|
|
|
+ return R.SUCCESS("ok");
|
|
|
+ }
|
|
|
}
|