|
@@ -11,7 +11,6 @@ import com.ym.mec.common.entity.OrderCancelModel;
|
|
|
import com.ym.mec.common.entity.RefundModel;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
|
-import com.ym.mec.thirdparty.adapay.Payment;
|
|
|
import com.ym.mec.thirdparty.adapay.entity.BaseResult;
|
|
|
import com.ym.mec.web.WebFeignService;
|
|
|
import com.yonge.cooleshow.mall.common.api.CommonPage;
|
|
@@ -152,7 +151,8 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
userOrderPayment.setId(null);
|
|
|
userOrderPaymentService.saveOrUpdate(userOrderPayment);
|
|
|
|
|
|
- return feignMecCreateOrder(order.getCouponId(), oldOrderNo, orderSn, null, detail.getMemberId().intValue(), detail.getTotalAmount());
|
|
|
+ return feignMecCreateOrder(order.getCouponId(), oldOrderNo, orderSn, null, detail.getMemberId().intValue(), detail.getTotalAmount(),
|
|
|
+ JSON.toJSONString(detail));
|
|
|
} else {
|
|
|
throw new BizException("订单信息获取失败");
|
|
|
}
|
|
@@ -204,9 +204,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
}
|
|
|
|
|
|
BigDecimal amount = calcTotalAmount(orderItemList);
|
|
|
-
|
|
|
- Map data = feignMecCreateOrder(orderParam.getCouponId(),orderParam.getOrderNo(), orderSn,
|
|
|
- orderParam.getTeacherId()==null?null:orderParam.getTeacherId().intValue(), currentMember.getId().intValue(), amount);
|
|
|
+ Map data = feignMecCouponAmount(orderParam.getCouponId(), orderParam.getOrderAmount());
|
|
|
|
|
|
BigDecimal couponAmount = MapUtil.get(data, "mallCouponAmount", BigDecimal.class);
|
|
|
if (couponAmount == null) {
|
|
@@ -373,23 +371,31 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
userOrderPayment.setStatus(TradeStatusEnum.succeeded.getCode());
|
|
|
}
|
|
|
userOrderPaymentService.save(userOrderPayment);
|
|
|
- result.put("pay",data);
|
|
|
|
|
|
+ // 生成订单
|
|
|
// 保存商品信息到管乐迷
|
|
|
OmsOrderDetail detail = detail(order.getOrderSn());
|
|
|
+ data = feignMecCreateOrder(orderParam.getCouponId(),orderParam.getOrderNo(), orderSn,
|
|
|
+ orderParam.getTeacherId()==null?null:orderParam.getTeacherId().intValue(),
|
|
|
+ currentMember.getId().intValue(), amount,JSON.toJSONString(detail));
|
|
|
+ result.put("pay",data);
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map feignMecCouponAmount(String couponId,BigDecimal amount) {
|
|
|
|
|
|
MallCreateOrderModel model = new MallCreateOrderModel();
|
|
|
- model.setOrderNo(order.getOrderSn());
|
|
|
- model.setOrderInfo(JSON.toJSONString(detail));
|
|
|
- HttpResponseResult<Map> mapHttpResponseResult = webFeignService.mallSaveOrderInfo(model);
|
|
|
+ model.setCouponIdList(StringUtil.toIntegerList(couponId));
|
|
|
+ model.setAmount(amount);
|
|
|
+ HttpResponseResult<Map> mapHttpResponseResult = webFeignService.couponAmount(model);
|
|
|
if (!mapHttpResponseResult.getStatus()) {
|
|
|
- throw new BizException(mapHttpResponseResult.getMsg());
|
|
|
+ throw new BizException("管乐迷获取优惠券优惠失败");
|
|
|
}
|
|
|
-
|
|
|
- return result;
|
|
|
+ return mapHttpResponseResult.getData();
|
|
|
}
|
|
|
|
|
|
- private Map feignMecCreateOrder(String couponId, String oldOrderNo, String orderSn, Integer teacherId, Integer userId, BigDecimal amount) {
|
|
|
+ private Map feignMecCreateOrder(String couponId, String oldOrderNo, String orderSn, Integer teacherId, Integer userId, BigDecimal amount, String orderDetail) {
|
|
|
// 远程调用管乐迷订单记录
|
|
|
MallCreateOrderModel model = new MallCreateOrderModel();
|
|
|
model.setAmount(amount);
|
|
@@ -400,6 +406,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|
|
model.setUserId(userId);
|
|
|
model.setCouponIdList(StringUtil.toIntegerList(couponId));
|
|
|
model.setOldOrderNo(oldOrderNo);
|
|
|
+ model.setOrderInfo(orderDetail);
|
|
|
HttpResponseResult<Map> mapHttpResponseResult = webFeignService.mallCreateOrder(model);
|
|
|
if (!mapHttpResponseResult.getStatus()) {
|
|
|
throw new BizException("管乐迷订单生成失败");
|