浏览代码

Merge branch 'zx_saas_goods' of http://git.dayaedu.com/yonge/mec into zx_saas_goods

刘俊驰 1 年之前
父节点
当前提交
ab334e9bdc

+ 7 - 2
mec-application/src/main/java/com/ym/mec/web/controller/GoodsController.java

@@ -14,6 +14,7 @@ import com.ym.mec.biz.service.GoodsService;
 import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.dto.BrandDto;
+import com.ym.mec.common.dto.ProductAttributeCategoryDto;
 import com.ym.mec.common.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -24,6 +25,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -50,7 +52,7 @@ public class GoodsController extends BaseController {
     @ApiOperation(value = "新增商品(教材、辅件)")
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('goods/add')")
-    public Object add(GoodsWrapper.Goods goods){
+    public Object add(@RequestBody GoodsWrapper.Goods goods){
         goodsService.addGoods(goods,sysUserService.getUserId());
         return succeed();
     }
@@ -89,7 +91,7 @@ public class GoodsController extends BaseController {
     @ApiOperation(value = "修改商品(教材、辅件)")
     @PostMapping("/update")
     @PreAuthorize("@pcs.hasPermissions('goods/update')")
-    public Object update(GoodsWrapper.Goods goods){
+    public Object update(@RequestBody GoodsWrapper.Goods goods){
         goods.setUpdateTime(new Date());
         goodsService.updateGoods(goods);
         return succeed();
@@ -125,8 +127,11 @@ public class GoodsController extends BaseController {
         List<Goods> rows = page.getRows();
         if (!rows.isEmpty()) {
             Map<String, String> brandIdNameMap = goodsService.queryGoodsBrandList().stream().collect(Collectors.toMap(next -> next.getId().toString(), BrandDto::getName));
+            Map<Integer, String> categoryIdNameMap = goodsService.queryGoodsCategoryList().stream().collect(Collectors.toMap(next -> next.getId().intValue(), ProductAttributeCategoryDto::getName));
+
             for (Goods row : rows) {
                 row.setBrandName(brandIdNameMap.getOrDefault(row.getBrand(), row.getBrand()));
+                row.setGoodsCategoryName(categoryIdNameMap.getOrDefault(row.getGoodsCategoryId(), ""));
             }
         }
         return succeed(page);

+ 63 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/GoodsSubWrapper.java

@@ -0,0 +1,63 @@
+package com.ym.mec.biz.dal.wrapper;
+
+import com.alibaba.fastjson.JSON;
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.Optional;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * 组合商品,子商品信息
+ * 2024-02-26 15:42:42
+ */
+@ApiModel(value = "GoodsSubWrapper对象", description = "组合商品,子商品信息查询对象")
+public class GoodsSubWrapper {
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ApiModel(" GoodsSubQuery-组合商品,子商品信息")
+    public static class GoodsSubQuery implements QueryInfo {
+
+        @ApiModelProperty("当前页")
+        private Integer page;
+
+        @ApiModelProperty("分页行数")
+        private Integer rows;
+
+        @ApiModelProperty("关键字匹配")
+        private String keyword;
+
+        public String getKeyword() {
+            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
+        }
+
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+
+        public static GoodsSubQuery from(String json) {
+            return JSON.parseObject(json, GoodsSubQuery.class);
+        }
+    }
+
+    @ApiModel(" GoodsSub-组合商品,子商品信息")
+    public static class GoodsSub {
+
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+
+        public static GoodsSub from(String json) {
+            return JSON.parseObject(json, GoodsSub.class);
+        }
+    }
+
+}

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/GoodsWrapper.java

@@ -201,6 +201,9 @@ public class GoodsWrapper {
         @ApiModelProperty("成本")
         private BigDecimal goodsPrice;
 
+        @ApiModelProperty("货号")
+        private String productSn;
+
         public String jsonString() {
             return JSON.toJSONString(this);
         }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.biz.dal.wrapper.GoodsWrapper;
 import com.ym.mec.common.dto.BrandDto;
 import com.ym.mec.common.dto.PmsProductDto;
+import com.ym.mec.common.dto.ProductAttributeCategoryDto;
 import com.ym.mec.common.dto.ProductCategoryDto;
 import com.ym.mec.common.entity.GoodsSubModel;
 import com.ym.mec.common.entity.GoodsSubStockModel;
@@ -159,5 +160,5 @@ public interface GoodsService extends BaseService<Integer, Goods> {
 
     List<BrandDto> queryGoodsBrandList();
 
-    Object queryGoodsCategoryList();
+    List<ProductAttributeCategoryDto> queryGoodsCategoryList();
 }

+ 15 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsSubService.java

@@ -0,0 +1,15 @@
+package com.ym.mec.biz.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.biz.dal.entity.GoodsSub;
+import com.ym.mec.biz.dal.mapper.GoodsSubMapper;
+
+/**
+ * 组合商品,子商品信息
+ * 2024-02-26 15:42:42
+ */
+public interface GoodsSubService extends IService<GoodsSub> {
+
+    GoodsSubMapper getBaseMapper();
+
+}

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SellOrderService.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.SellOrder;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.common.dto.OrderCreate;
 import com.ym.mec.common.service.BaseService;
 
 import java.math.BigDecimal;
@@ -79,4 +80,5 @@ public interface SellOrderService extends BaseService<Integer, SellOrder> {
      */
     Map<String,BigDecimal> getSellAmount(String orderNo);
 
+    List<OrderCreate.OrderItem> convertMallOrder(List<SellOrder> sellOrderList);
 }

+ 8 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -39,6 +39,7 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.dto.BrandDto;
 import com.ym.mec.common.dto.PmsProductDto;
 import com.ym.mec.common.dto.PmsProductQueryParamDto;
+import com.ym.mec.common.dto.ProductAttributeCategoryDto;
 import com.ym.mec.common.dto.ProductCategoryDto;
 import com.ym.mec.common.entity.GoodsSubModel;
 import com.ym.mec.common.entity.GoodsSubStockModel;
@@ -222,8 +223,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		Integer stock = productList.stream().map(PmsProductDto::getStock).min(Integer::compareTo).get();
 		goods.setStockCount(stock);
 		goods.setSellCount(0);
-		Goods goodsRecord = new Goods();
-		BeanUtils.copyProperties(goods,goodsRecord);
+		Goods goodsRecord = JSON.parseObject(JSON.toJSONString(goods), Goods.class);
 		goodsRecord.setStatus(YesOrNoEnum.NO);
 		BigDecimal organCostPrice = goodsSubList.stream().map(GoodsWrapper.GoodsSub::getGoodsPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
 		goodsRecord.setOrganCostPrice(organCostPrice);
@@ -343,6 +343,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 					next.setGoodsStatus(dto.getPublishStatus() == 1);
 				}
 				next.setMallGoodsName(dto.getName());
+				next.setProductSn(dto.getProductSn());
 			}
 		});
 		return goodsSubList;
@@ -1073,8 +1074,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		if(StringUtils.isNotEmpty(goods.getFreeFeeShowOrganId())){
 			goods.setFreeFeeShowOrganName(StringUtils.join(organizationDao.findByOrganIds(goods.getFreeFeeShowOrganId()),","));
 		}
-		GoodsWrapper.Goods detail = new GoodsWrapper.Goods();
-		BeanUtils.copyProperties(goods, detail);
+		GoodsWrapper.Goods detail = JSON.parseObject(JSON.toJSONString(goods), GoodsWrapper.Goods.class);
 		detail.setGoodsSubList(queryGoodsSub(goodsId));
 		return detail;
 	}
@@ -1101,8 +1101,8 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		if (StringUtils.isEmpty(goodsInfo.getComplementGoodsIdList()) && goodsSubList.isEmpty()) {
 			throw new BizException("子商品信息不能为空");
 		}
+		goodsInfo = JSON.parseObject(JSON.toJSONString(goods), Goods.class);
 		goodsInfo.setStatus(null);
-		BeanUtils.copyProperties(goods, goodsInfo);
 		if (!goodsSubList.isEmpty()) {
 			goodsInfo.setComplementGoodsIdList(null);
 			UpdateWrapper<GoodsSub> delWrapper = new UpdateWrapper<>();
@@ -1149,9 +1149,9 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		if (CollectionUtils.isEmpty(goodsSubs)) {
 			return true;
 		}
-		Map<Integer, Boolean> keyStatusMap = goodsSubModelList.stream().collect(Collectors.toMap(GoodsSubModel::getMallGoodsId, GoodsSubModel::getGoodsStatus));
+		Map<String, Boolean> keyStatusMap = goodsSubModelList.stream().collect(Collectors.toMap(next -> next.getMallGoodsId() + "_" + next.getSkuId(), GoodsSubModel::getGoodsStatus));
 		log.info(Thread.currentThread().getName() + "开始同步商品状态:0/" + goodsSubs.size());
-		List<GoodsSub> goodsSubList = goodsSubs.stream().peek(next -> next.setGoodsStatus(keyStatusMap.get(next.getMallGoodsId()))).collect(Collectors.toList());
+		List<GoodsSub> goodsSubList = goodsSubs.stream().peek(next -> next.setGoodsStatus(keyStatusMap.get(next.getMallGoodsId() + "_" + next.getSku()))).collect(Collectors.toList());
 		// 下架的商品
 		List<GoodsSub> downGoods = goodsSubList.stream().filter(next -> Boolean.FALSE.equals(next.getGoodsStatus())).collect(Collectors.toList());
 		if(!CollectionUtils.isEmpty(downGoods)){
@@ -1215,7 +1215,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 	}
 
 	@Override
-	public Object queryGoodsCategoryList() {
+	public List<ProductAttributeCategoryDto> queryGoodsCategoryList() {
 		return mallFeignService.getProductAttributeCategoryList();
 	}
 }

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsSubServiceImpl.java

@@ -0,0 +1,23 @@
+package com.ym.mec.biz.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.biz.dal.entity.GoodsSub;
+import com.ym.mec.biz.dal.mapper.GoodsSubMapper;
+import com.ym.mec.biz.service.GoodsSubService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/**
+ * 组合商品,子商品信息
+ * 2024-02-26 15:42:42
+ */
+@Slf4j
+@Service
+public class GoodsSubServiceImpl extends ServiceImpl<GoodsSubMapper, GoodsSub> implements GoodsSubService {
+
+    @Override
+    public GoodsSubMapper getBaseMapper() {
+        return baseMapper;
+    }
+
+}

+ 20 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -26,6 +26,7 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.mall.MallFeignService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import org.apache.commons.collections.CollectionUtils;
@@ -138,6 +139,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     @Autowired
     private CloudCoachPaymentProgramDao cloudCoachPaymentProgramDao;
 
+    @Autowired
+    private MallFeignService mallFeignService;
+
     @Override
     public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
         return musicGroupPaymentCalenderDao;
@@ -1034,7 +1038,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                 classGroupService.spanGroupClassAdjustPass(adjust.getMasterClassGroupId()
                         , studentIds, courseIds, classGroupStudents, allLockCourseIds, batchNo, adjust.getMasterTotalPrice());
             } else if (calender.getPaymentType() == GOODS_PURCHASE) {
-                //TODO 推送订单到商城
                 MusicGroupPaymentCalenderAddress address = musicGroupPaymentCalenderAddressService.lambdaQuery()
                         .eq(MusicGroupPaymentCalenderAddress::getCalenderId, calender.getId()).one();
                 if (address == null) {
@@ -1093,6 +1096,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                     }
                 }
                 orderCreate.setOrderItemList(orderItems);
+                boolean b = mallFeignService.productOrderCreate(orderCreate);
+                if (!b) {
+                    throw new BizException("同步商城订单失败");
+                }
             }
             for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenders) {
                 //将0元未缴费学员缴费状态更新为已缴费
@@ -1436,15 +1443,18 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             throw new BizException("操作失败:缴费项目中已存在学员");
         }
         //商品采购订单
+        MusicGroupPaymentCalenderAddress address = null;
         if(calender.getPaymentType() == GOODS_PURCHASE){
             //TODO 商品采购订单是否已经发货
-            MusicGroupPaymentCalenderAddress address = musicGroupPaymentCalenderAddressService.lambdaQuery().eq(MusicGroupPaymentCalenderAddress::getCalenderId, id).one();
+            address = musicGroupPaymentCalenderAddressService.lambdaQuery().eq(MusicGroupPaymentCalenderAddress::getCalenderId, id).one();
             if(address != null){
                 if (address.getDeliveryFlag()) {
                     throw new BizException("操作失败:商品采购订单已发货");
                 }
                 musicGroupPaymentCalenderAddressService.removeById(address.getId());
             }
+            //商品采购订单是否已经录入
+            
             musicGroupPaymentCalenderGoodsService.lambdaUpdate().eq(MusicGroupPaymentCalenderGoods::getCalenderId,id).remove();
         }
 
@@ -1498,6 +1508,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                 musicGroupDao.update(musicGroup);
             }
         }
+        //商品采购订单
+        if(calender.getPaymentType() == GOODS_PURCHASE && address != null){
+            //关闭商城订单
+            boolean b = mallFeignService.productUpdateOrderStatus(address.getOrderNo(), 4);
+            if (!b) {
+                throw new BizException("操作失败:关闭商城订单失败");
+            }
+        }
     }
 
     @Override

+ 45 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java

@@ -4,6 +4,7 @@ package com.ym.mec.biz.service.impl;
 import static com.ym.mec.biz.dal.enums.GroupType.GOODS_SELL;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -11,6 +12,13 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
+import com.alibaba.fastjson.JSON;
+import com.ym.mec.biz.dal.dto.ComplementGoodsDto;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.mapper.GoodsSubMapper;
+import com.ym.mec.biz.service.*;
+import com.ym.mec.common.dto.OrderCreate;
+import com.ym.mec.common.page.WrapperUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,13 +33,6 @@ import com.ym.mec.biz.dal.dao.SporadicChargeInfoDao;
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
 import com.ym.mec.biz.dal.dao.StudentRepairDao;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.SellOrder;
-import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountLog;
 import com.ym.mec.biz.dal.enums.AccountType;
 import com.ym.mec.biz.dal.enums.GoodsType;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
@@ -42,11 +43,6 @@ import com.ym.mec.biz.dal.enums.ReturnFeeEnum;
 import com.ym.mec.biz.dal.enums.SellStatus;
 import com.ym.mec.biz.dal.enums.SellTypeEnum;
 import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.SellOrderService;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
-import com.ym.mec.biz.service.SysPaymentConfigService;
-import com.ym.mec.biz.service.SysUserCashAccountLogService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 
@@ -72,6 +68,8 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
     private SporadicChargeInfoDao sporadicChargeInfoDao;
     @Autowired
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
+    @Autowired
+    private GoodsSubService goodsSubService;
 
     @Override
     public BaseDAO<Integer, SellOrder> getDAO() {
@@ -511,6 +509,41 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
         return sellAmount;
     }
 
+    @Override
+    public List<OrderCreate.OrderItem> convertMallOrder(List<SellOrder> sellOrderList) {
+        List<OrderCreate.OrderItem> orderItems = new ArrayList<>();
+        for (SellOrder e : sellOrderList) {
+            List<GoodsSub> list = goodsSubService.lambdaQuery().eq(GoodsSub::getGoodsId, e.getGoodsId()).list();
+            if(CollectionUtils.isEmpty(list)){
+                throw new RuntimeException("子商品不存在,请联系管理员");
+            }
+            BigDecimal totalPrice = e.getExpectAmount().divide(new BigDecimal(e.getNum()), 2, RoundingMode.HALF_UP);
+            //总金额按比例分配
+            //待分配
+            BigDecimal waitRemitFee = totalPrice;
+            BigDecimal totalAmount = WrapperUtil.sumList(list, GoodsSub::getGoodsPrice);
+            for (int i = 0; i < list.size(); i++) {
+                GoodsSub goodsDto = list.get(i);
+                OrderCreate.OrderItem orderItemCreate = new OrderCreate.OrderItem();
+                orderItemCreate.setProductQuantity(e.getNum());
+                orderItemCreate.setProductSkuId(goodsDto.getSku().longValue());
+                //如果是最后一件商品
+                if (i == list.size() - 1) {
+                    orderItemCreate.setRealAmount(waitRemitFee);
+                } else {
+                    //获取比例
+                    BigDecimal ratioAmount = goodsDto.getGoodsPrice().divide(totalAmount, 6, RoundingMode.HALF_UP);
+                    //获取分配的金额
+                    BigDecimal multiply = ratioAmount.multiply(totalPrice).setScale(2, RoundingMode.HALF_UP);
+                    orderItemCreate.setRealAmount(multiply);
+                    waitRemitFee = waitRemitFee.subtract(multiply);
+                }
+                orderItems.add(orderItemCreate);
+            }
+        }
+        return orderItems;
+    }
+
     public Map<String, BigDecimal> calcSellAmount(StudentPaymentOrder order,BigDecimal cloudBalanceIncome,BigDecimal cloudIncome) {
         List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailDao.getOrderDetail(order.getId());
         //总余额支付

+ 39 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java

@@ -14,8 +14,10 @@ import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.MusicGroupCalenderRefundPeriodService;
+import com.ym.mec.common.dto.OrderCreate;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.tenant.TenantContextHolder;
+import com.ym.mec.mall.MallFeignService;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.excel.POIUtil;
 import com.ym.mec.util.ini.IniFileUtil;
@@ -74,6 +76,8 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
     @Autowired
     private MusicGroupCalenderRefundPeriodService musicGroupCalenderRefundPeriodService;
+    @Autowired
+    private MallFeignService mallFeignService;
 
     @Override
     public BaseDAO<Long, StudentPaymentRouteOrder> getDAO() {
@@ -202,8 +206,9 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
             if(studentPaymentRouteOrder.getSchoolId() != null) {
                 studentPaymentOrder.setCooperationId(studentPaymentRouteOrder.getSchoolId());
             }
+            MusicGroupPaymentCalender calender = null;
             if(studentPaymentRouteOrder.getCalenderId() != null){
-                MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(studentPaymentRouteOrder.getCalenderId());
+                calender = musicGroupPaymentCalenderDao.get(studentPaymentRouteOrder.getCalenderId());
                 studentPaymentOrder.setMusicGroupId(calender.getMusicGroupId());
                 studentPaymentOrder.setCalenderId(studentPaymentRouteOrder.getCalenderId());
             }
@@ -302,6 +307,39 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                     }
                 }
                 sellOrderDao.batchInsert(sellOrderList);
+                if(calender != null && calender.getPaymentType() != MusicGroupPaymentCalender.PaymentType.GOODS_PURCHASE){
+                    OrderCreate mallOrder = new OrderCreate();
+                    mallOrder.setOrchestraId(studentPaymentOrder.getMusicGroupId());
+                    mallOrder.setStatus(3);
+                    mallOrder.setOrderNo(studentPaymentRouteOrder.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);
+                    }
+                    if (studentPaymentRouteOrder.getType() == OrderTypeEnum.SCHOOL){
+                        mallOrder.setMemberId(studentPaymentRouteOrder.getSchoolId().longValue());
+                        mallOrder.setPlatformType("SCHOOL");
+                        mallOrder.setSourceType(2);
+                    }else {
+                        mallOrder.setMemberId(studentPaymentOrder.getUserId().longValue());
+                        mallOrder.setPlatformType("STUDENT");
+                        mallOrder.setSourceType(3);
+                    }
+                    if(studentPaymentRouteOrder.getType() == OrderTypeEnum.OTHER){
+                        mallOrder.setSourceType(4);
+                    }
+                    List<OrderCreate.OrderItem> items = sellOrderService.convertMallOrder(sellOrderList);
+                    mallOrder.setOrderItemList(items);
+                    boolean b = mallFeignService.productOrderCreate(mallOrder);
+                    if (!b) {
+                        throw new BizException("同步商城订单失败");
+                    }
+                }
             }
 
             if (studentPaymentRouteOrder.getCalenderId() == null) {

+ 3 - 2
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -308,8 +308,9 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="Goods" parameterType="map">
-        SELECT g.*,gc.name_ goods_category_name_ FROM goods g
-        LEFT JOIN goods_category gc ON g.goods_category_id_ = gc.id_
+        SELECT g.* FROM goods g
+<!--        SELECT g.*,gc.name_ goods_category_name_ FROM goods g-->
+<!--        LEFT JOIN goods_category gc ON g.goods_category_id_ = gc.id_-->
         <include refid="queryGoodsPageSql"/>
         GROUP BY g.id_
         ORDER BY g.id_ DESC

+ 0 - 2
mec-client-api/src/main/java/com/ym/mec/mall/MallFeignService.java

@@ -1,7 +1,5 @@
 package com.ym.mec.mall;
 
-import com.baomidou.mybatisplus.extension.api.R;
-import com.baomidou.mybatisplus.extension.enums.ApiErrorCode;
 import com.ym.mec.common.config.FeignConfiguration;
 import com.ym.mec.common.dto.*;
 import com.ym.mec.common.page.PageInfo;