liujunchi 2 gadi atpakaļ
vecāks
revīzija
98ae440053

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -1044,6 +1044,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     private StudentGoodsSellDao studentGoodsSellDao;
 
     @Override
+    @Transactional
     public Map createOrder(MallCreateOrderModel model) throws Exception {
 
         if(model == null ||model.getUserId() == null) {
@@ -1191,6 +1192,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
+    @Transactional
     public void mallBuyOrderCallback(StudentPaymentOrder studentPaymentOrder) {
         Date nowDate = new Date();
         //更新订单信息
@@ -1249,6 +1251,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
+    @Transactional
     public void mallSaveOrderInfo(MallCreateOrderModel model) {
 
         StudentGoodsSell studentGoodsSell = studentGoodsSellDao.findByOrderNo(model.getOrderNo());
@@ -1261,6 +1264,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
+    @Transactional
     public OrderCancelModel cancelOrder(StudentPaymentOrder order) {
         OrderCancelModel model = new OrderCancelModel();
         try {
@@ -1293,6 +1297,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
+    @Transactional
     public BaseResult<Map<String, Object>> refund(String orderNo, String notifyUrl, String refundNo) {
 
         StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo);
@@ -1321,6 +1326,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
+    @Transactional
     public void receive(String orderNo, boolean autoReceive) {
 
         StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo);

+ 9 - 3
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/OmsPortalOrderController.java

@@ -1,5 +1,7 @@
 package com.yonge.cooleshow.portal.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.common.exception.BizException;
 import com.yonge.cooleshow.mall.common.api.CommonPage;
 import com.yonge.cooleshow.mall.common.api.CommonResult;
@@ -45,7 +47,8 @@ public class OmsPortalOrderController {
 
     @Autowired
     private UserOrderPaymentService userOrderPaymentService;
-
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
     @Value("${message.debugMode}")
     private boolean debugMode;
 
@@ -96,8 +99,11 @@ public class OmsPortalOrderController {
     @RequestMapping(value = "/teacher/generateOrder", method = RequestMethod.POST)
     @ResponseBody
     public CommonResult teacherGenerateOrder(@RequestBody OrderParam orderParam) {
-        UmsMember currentMember = memberService.getCurrentMember();
-        orderParam.setTeacherId(currentMember.getId());
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null || sysUser.getId() == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        orderParam.setTeacherId(sysUser.getId().longValue());
         final Map<String, Object>[] result = new Map[]{new HashMap<>()};
         if (StringUtil.isEmpty(orderParam.getOrderNo())) {
             result[0] = portalOrderService.generateOrder(orderParam);

+ 6 - 7
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/open/OpenShareController.java

@@ -4,13 +4,11 @@ import com.ym.mec.common.controller.BaseController;
 import com.yonge.cooleshow.portal.dto.StockOperateModel;
 import com.yonge.cooleshow.portal.service.PmsPortalProductService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -42,10 +40,11 @@ public class OpenShareController extends BaseController {
     //     return CommonResult.failed("分享功能暂未开放");
     // }
 
-    public void updateStock(@RequestBody List<StockOperateModel> model, @RequestParam String stockType) {
+    @ApiOperation(value = "同步库存")
+    @PostMapping(value="/updateStock/{stockType}")
+    @ResponseBody
+    public void updateStock(@RequestBody List<StockOperateModel> model, @PathVariable String stockType) {
         // 库存操作 stockType  add:添加   reduce:减少  lock:锁定  unlock:解锁
         portalProductService.reduceStock(model,stockType);
-
-
     }
 }

+ 1 - 1
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/OmsPortalOrderServiceImpl.java

@@ -153,7 +153,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
                 userOrderPaymentService.saveOrUpdate(userOrderPayment);
 
                 return feignMecCreateOrder(order.getCouponId(), oldOrderNo, orderSn, null, detail.getMemberId().intValue(), detail.getTotalAmount(),
-                                           JSON.toJSONString(detail),detail.getPayType() == 3);
+                       JSON.toJSONString(detail),detail.getPayType()!= null && detail.getPayType() == 3);
             } else {
                 throw new BizException("订单信息获取失败");
             }

+ 2 - 0
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/PmsPortalProductServiceImpl.java

@@ -19,6 +19,7 @@ import com.yonge.cooleshow.portal.service.PmsPortalProductService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.util.ArrayList;
@@ -216,6 +217,7 @@ public class PmsPortalProductServiceImpl implements PmsPortalProductService {
     }
 
     @Override
+    @Transactional
     public void reduceStock(List<StockOperateModel> model, String stockType) {
 
         // 商品库存变动