Browse Source

乐器品牌

刘俊驰 1 year ago
parent
commit
01e1adccce

+ 3 - 0
mec-application/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentActivityController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.beust.jcommander.internal.Lists;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.biz.dal.dao.ReplacementInstrumentActivityDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
@@ -89,6 +90,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
         ReplacementInstrumentCooperation byCooperationId = replacementInstrumentCooperationService.get(oldReplacementInstrumentActivity.getReplacementInstrumentCooperationId());
         if (byCooperationId.getOpenPay().equals(YesOrNoEnum.YES) && oldReplacementInstrumentActivity.getInstrumentsId() == null && replacementInstrumentActivity.getInstrumentsId() != null) {
             Goods goods = goodsService.get(replacementInstrumentActivity.getInstrumentsId());
+            goods.setBrand(goodsService.getBrandMap().getOrDefault(goods.getBrand(),goods.getBrand()));
             Map<Integer, String> userMap = new HashMap<>();
             Map<Integer, String> userPhoneMap = new HashMap<>();
             Integer userId = oldReplacementInstrumentActivity.getUserId();
@@ -126,6 +128,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
         }
         if (openFlag == 1) {
             Goods goods = goodsService.get(replacementInstrumentActivity.getInstrumentsId());
+            goods.setBrand(goodsService.getBrandMap().getOrDefault(goods.getBrand(),goods.getBrand()));
             Map<Integer, String> userMap = new HashMap<>();
             Map<Integer, String> userPhoneMap = new HashMap<>();
             Integer userId = replacementInstrumentActivity.getUserId();

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service;
 
 import java.util.List;
+import java.util.Map;
 
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.biz.dal.wrapper.GoodsWrapper;
@@ -161,4 +162,6 @@ public interface GoodsService extends BaseService<Integer, Goods> {
     List<BrandDto> queryGoodsBrandList();
 
     List<ProductCategoryDto> queryGoodsCategoryList();
+
+    Map<String,String> getBrandMap();
 }

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

@@ -15,18 +15,14 @@ import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.GoodsSellDto;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.GoodsCategory;
-import com.ym.mec.biz.dal.entity.GoodsProcurement;
 import com.ym.mec.biz.dal.entity.GoodsSub;
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.entity.SellOrder;
 import com.ym.mec.biz.dal.enums.AccountType;
 import com.ym.mec.biz.dal.enums.GoodsType;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-import com.ym.mec.biz.dal.enums.SellStatus;
-import com.ym.mec.biz.dal.enums.StockType;
 import com.ym.mec.biz.dal.enums.TemplateTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
-import com.ym.mec.biz.dal.mapper.GoodsSubMapper;
 import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsQuery;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
@@ -40,7 +36,6 @@ 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;
-import com.ym.mec.common.entity.UploadReturnBean;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
@@ -61,7 +56,6 @@ import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.ss.usermodel.WorkbookFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.system.ApplicationHome;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.stereotype.Service;
@@ -79,7 +73,6 @@ import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.text.SimpleDateFormat;
 import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -1525,4 +1518,16 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		}
 		return "";
 	}
+
+    @Override
+    public Map<String,String> getBrandMap(){
+
+        try {
+            return mallFeignService.getList().stream().collect(Collectors.toMap(o ->o.getId().toString(), BrandDto::getName));
+
+        }catch (Exception e){
+            log.error("获取品牌信息失败",e);
+        }
+        return new HashMap<>();
+    }
 }

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

@@ -172,6 +172,7 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
         if (sendPush && replacementInstrumentActivity.getOpenFlag().equals(1) && replacementInstrumentActivity.getInstrumentsId() != null) {
             //换成商品列表中商品4.25
             Goods goods = goodsDao.get(replacementInstrumentActivity.getGoodsId());
+            goods.setBrand(goodsService.getBrandMap().getOrDefault(goods.getBrand(),goods.getBrand()));
             Map<Integer, String> userMap = new HashMap<>();
             Map<Integer, String> userPhoneMap = new HashMap<>();
             Integer userId = replacementInstrumentActivity.getUserId();
@@ -255,6 +256,7 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
         if (sendPush && replacementInstrumentActivity.getOpenFlag().equals(1) && replacementInstrumentActivity.getInstrumentsId() != null) {
             //换成商品列表中商品4.25
             Goods goods = goodsDao.get(replacementInstrumentActivity.getGoodsId());
+            goods.setBrand(goodsService.getBrandMap().getOrDefault(goods.getBrand(),goods.getBrand()));
             Map<Integer, String> userMap = new HashMap<>();
             Map<Integer, String> userPhoneMap = new HashMap<>();
             Integer userId = replacementInstrumentActivity.getUserId();

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

@@ -12,10 +12,7 @@ import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
-import com.ym.mec.biz.service.StudentGoodsSellService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysTenantConfigService;
-import com.ym.mec.biz.service.TenantInfoService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
@@ -46,6 +43,9 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
     @Autowired
     private SysCouponCodeDao sysCouponCodeDao;
 
+    @Autowired
+    private GoodsService goodsService;
+
     @Override
     public BaseDAO<Integer, StudentGoodsSell> getDAO() {
         return studentGoodsSellDao;
@@ -147,6 +147,10 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
             return null;
         }
         List<Goods> goodies = goodsDao.getGoodiesAndCate(goodsIds);
+        Map<String, String> brandMap = goodsService.getBrandMap();
+        for (Goods goody : goodies) {
+            goody.setBrand(brandMap.getOrDefault(goody.getBrand(),goody.getBrand()));
+        }
         List<StudentInstrument> studentInstruments = new ArrayList<>();
         for (Goods goods : goodies) {
             StudentInstrument studentInstrument = new StudentInstrument();

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

@@ -306,6 +306,8 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
     @Override
     public StudentInstrument addStudentInstrument(StudentInstrument studentInstrument) {
         Goods goods = goodsService.get(studentInstrument.getGoodsId());
+
+        goods.setBrand(goodsService.getBrandMap().getOrDefault(goods.getBrand(),goods.getBrand()));
         GoodsCategory goodsCategory = goodsCategoryService.get(goods.getGoodsCategoryId());
         studentInstrument.setGoodsCategoryId(goods.getGoodsCategoryId());
         studentInstrument.setGoodsCategoryName(goodsCategory.getName());
@@ -352,6 +354,8 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
     @Override
     public StudentInstrument updateStudentInstrument(StudentInstrument studentInstrument) {
         Goods goods = goodsService.get(studentInstrument.getGoodsId());
+
+        goods.setBrand(goodsService.getBrandMap().getOrDefault(goods.getBrand(),goods.getBrand()));
         GoodsCategory goodsCategory = goodsCategoryService.get(goods.getGoodsCategoryId());
         studentInstrument.setGoodsCategoryId(goods.getGoodsCategoryId());
         studentInstrument.setGoodsCategoryName(goodsCategory.getName());
@@ -395,6 +399,8 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
         }
         
         Goods goods = goodsService.get(studentInstrument.getGoodsId());
+
+        goods.setBrand(goodsService.getBrandMap().getOrDefault(goods.getBrand(),goods.getBrand()));
         GoodsCategory goodsCategory = goodsCategoryService.get(goods.getGoodsCategoryId());
         studentInstrument.setGoodsCategoryId(goods.getGoodsCategoryId());
         studentInstrument.setGoodsCategoryName(goodsCategory.getName());

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -198,6 +198,9 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     @Resource
     private StudentGoodsSellDao studentGoodsSellDao;
 
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
+
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
     @Override
     public BaseDAO<Long, StudentPaymentOrder> getDAO() {
@@ -730,7 +733,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
                 memberRankSettingService.liveBuyOrderCallback(order);
             } else if (order.getType().equals(OrderTypeEnum.MALL_BUY)) {
                 // 商城购买订单回调
-                this.mallBuyOrderCallback(order);
+                studentPaymentOrderService.mallBuyOrderCallback(order);
             }
         }
     }