瀏覽代碼

管乐迷商城改造

zouxuan 1 年之前
父節點
當前提交
b249dd10e2

+ 51 - 23
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java

@@ -6,9 +6,11 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.dto.OrderCreate;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.mall.MallFeignService;
 import com.ym.mec.util.collection.MapUtil;
 
 import org.apache.commons.collections.CollectionUtils;
@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
@@ -29,49 +32,50 @@ import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
 @Service
 public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long, StudentPaymentOrderDetail> implements StudentPaymentOrderDetailService {
 
-    @Autowired
+    @Resource
     private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
-    @Autowired
+    @Resource
     private GoodsService goodsService;
-    @Autowired
+    @Resource
     private TeacherDao teacherDao;
-    @Autowired
+    @Resource
     private MusicGroupDao musicGroupDao;
-    @Autowired
+    @Resource
     private OrganizationDao organizationDao;
-    @Autowired
+    @Resource
     private MusicGroupPurchaseListDao musicGroupPurchaseListDao;
-    @Autowired
+    @Resource
     private StudentRegistrationDao studentRegistrationDao;
-    @Autowired
+    @Resource
     private SubjectDao subjectDao;
-    @Autowired
+    @Resource
     private SubjectChangeDao subjectChangeDao;
-    @Autowired
+    @Resource
     private StudentCourseFeeDetailDao studentCourseFeeDetailDao;
-    @Autowired
+    @Resource
     private SellOrderService sellOrderService;
-    @Autowired
+    @Resource
     private ActivityUserMapperService activityUserMapperService;
-    @Autowired
+    @Resource
     private StudentInstrumentService studentInstrumentService;
-    @Autowired
+    @Resource
     private CloudTeacherOrderService cloudTeacherOrderService;
-    @Autowired
+    @Resource
     private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderDetailService musicGroupPaymentCalenderDetailService;
-    @Autowired
+    @Resource
     private ChargeTypeSubjectMapperDao chargeTypeSubjectMapperDao;
-    @Autowired
+    @Resource
     private StudentMusicCourseFeeService studentMusicCourseFeeService;
-    @Autowired
+    @Resource
     private MemberFeeSettingService memberFeeSettingService;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderMemberDao musicGroupPaymentCalenderMemberDao;
-
-    @Autowired
+    @Resource
     private ImUserFriendService imUserFriendService;
+    @Resource
+    private MallFeignService mallFeignService;
     @Override
     public BaseDAO<Long, StudentPaymentOrderDetail> getDAO() {
         return studentPaymentOrderDetailDao;
@@ -705,7 +709,31 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
                 //获取分配的减免金额
                 couponRemitFee = couponRemitFee.multiply(ratioAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
             }
-            sellOrderService.addOrderDetail2SellOrder(allDetails, studentPaymentOrder, musicGroup, couponRemitFee);
+            List<SellOrder> sellOrders = sellOrderService.addOrderDetail2SellOrder(allDetails, studentPaymentOrder, musicGroup, couponRemitFee);
+            //同步销售订单到商城
+            List<OrderCreate.OrderItem> orderItems = sellOrderService.convertMallOrder(sellOrders);
+            OrderCreate mallOrder = new OrderCreate();
+            mallOrder.setOrderItemList(orderItems);
+            mallOrder.setOrchestraId(studentPaymentOrder.getMusicGroupId());
+            mallOrder.setStatus(2);
+            mallOrder.setOrderNo(studentPaymentOrder.getOrderNo());
+            mallOrder.setTotalAmount(studentPaymentOrder.getExpectAmount());
+            String paymentBusinessChannel = studentPaymentOrder.getPaymentBusinessChannel();
+            if (StringUtils.endsWithIgnoreCase(paymentBusinessChannel, "wx_pub") ||
+                    StringUtils.endsWithIgnoreCase(paymentBusinessChannel, "WECHAT") ||
+                    StringUtils.endsWithIgnoreCase(paymentBusinessChannel, "WXPay")) {
+                mallOrder.setPayType(2);
+            } else {
+                mallOrder.setPayType(1);
+            }
+            mallOrder.setMemberId(studentPaymentOrder.getUserId().longValue());
+            mallOrder.setPlatformType("STUDENT");
+            mallOrder.setSourceType(1);
+
+            boolean b = mallFeignService.productOrderCreate(mallOrder);
+            if (!b) {
+                throw new BizException("同步商城订单失败");
+            }
         }
 
         //活动小课包处理

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml

@@ -269,7 +269,7 @@
         </foreach>
     </update>
     <update id="updateShippedStatus">
-        update sell_order SET delivery_time_ = NOW() where order_no_
+        update sell_order SET delivery_time_ = NOW() where order_no_ IN
         <foreach collection="orderNos" item="orderNo" open="(" close=")" separator=",">
             #{orderNo}
         </foreach>