瀏覽代碼

Merge branch 'zx_saas_goods' into test

刘俊驰 1 年之前
父節點
當前提交
608904e409

+ 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();

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReplacementInstrumentActivityStatDto.java

@@ -19,6 +19,8 @@ public class ReplacementInstrumentActivityStatDto extends ReplacementInstrumentA
     /** 品牌 */
     private String brand;
 
+    private String brandName;
+
     /** 型号 */
     private String specification;
 
@@ -158,4 +160,12 @@ public class ReplacementInstrumentActivityStatDto extends ReplacementInstrumentA
     public void setBalance(BigDecimal balance) {
         this.balance = balance;
     }
+
+    public String getBrandName() {
+        return brandName;
+    }
+
+    public void setBrandName(String brandName) {
+        this.brandName = brandName;
+    }
 }

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrument.java

@@ -17,6 +17,8 @@ public class ReplacementInstrument extends BaseEntity {
 	
 	/** 品牌 */
 	private String brand;
+
+	private String brandName;
 	
 	/** 型号 */
 	private String specification;
@@ -129,7 +131,15 @@ public class ReplacementInstrument extends BaseEntity {
 	public java.util.Date getUpdateTime(){
 		return this.updateTime;
 	}
-			
+
+	public String getBrandName() {
+		return brandName;
+	}
+
+	public void setBrandName(String brandName) {
+		this.brandName = brandName;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/GoodsQuery.java

@@ -27,6 +27,8 @@ public class GoodsQuery {
 
     private Integer subjectId;
 
+    private Boolean delFlag;
+
     public String getType() {
         return type;
     }
@@ -90,4 +92,12 @@ public class GoodsQuery {
     public void setReplacementShowOrganId(Integer replacementShowOrganId) {
         this.replacementShowOrganId = replacementShowOrganId;
     }
+
+    public Boolean getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Boolean delFlag) {
+        this.delFlag = delFlag;
+    }
 }

+ 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<>();
+    }
 }

+ 20 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java

@@ -8,7 +8,11 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.dto.BrandDto;
+import com.ym.mec.mall.MallFeignService;
+import org.apache.commons.lang.math.NumberUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,19 +37,6 @@ import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityDto;
 import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
 import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatHead;
 import com.ym.mec.biz.dal.dto.ReplacementPayDto;
-import com.ym.mec.biz.dal.entity.CooperationOrgan;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.QuestionnaireQuestion;
-import com.ym.mec.biz.dal.entity.QuestionnaireQuestionItem;
-import com.ym.mec.biz.dal.entity.QuestionnaireTopic;
-import com.ym.mec.biz.dal.entity.QuestionnaireUserResult;
-import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
-import com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation;
-import com.ym.mec.biz.dal.entity.SellOrder;
-import com.ym.mec.biz.dal.entity.Student;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
 import com.ym.mec.biz.dal.enums.AccountType;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GoodsType;
@@ -68,6 +59,8 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.http.HttpUtil;
 
+import javax.annotation.Resource;
+
 @Service
 public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<Integer, ReplacementInstrumentActivity> implements ReplacementInstrumentActivityService {
 
@@ -121,6 +114,8 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
     private QuestionnaireQuestionItemDao questionnaireQuestionItemDao;
     @Autowired
     private SysCouponCodeService sysCouponCodeService;
+    @Resource
+    private MallFeignService mallFeignService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -172,6 +167,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 +251,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();
@@ -553,6 +550,16 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
                     replacementInstrumentActivityStatDto.setBalance(activityOrders.get(0).getBalancePaymentAmount());
                 }
             }
+            List<String> brandIdList = dataList.stream().map(ReplacementInstrumentActivityStatDto::getBrand).filter(StringUtils::isNotEmpty).distinct().collect(Collectors.toList());
+            if (!brandIdList.isEmpty()) {
+                Map<Long, String> idNameMap = mallFeignService.getList().stream().collect(Collectors.toMap(BrandDto::getId, BrandDto::getName));
+                for (ReplacementInstrumentActivityStatDto statDto : dataList) {
+                    String brand = statDto.getBrand();
+                    if (StringUtils.isNotEmpty(brand) && NumberUtils.isNumber(brand)) {
+                        statDto.setBrandName(idNameMap.getOrDefault(Long.valueOf(brand), ""));
+                    }
+                }
+            }
         }
         pageInfo.setRows(dataList);
         return pageInfo;

+ 18 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentServiceImpl.java

@@ -4,19 +4,25 @@ import com.ym.mec.biz.dal.dao.GoodsDao;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.page.ReplacementInstrumentQueryInfo;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.dto.BrandDto;
 import com.ym.mec.common.page.PageInfo;
 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.lang.math.NumberUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import com.ym.mec.biz.dal.entity.ReplacementInstrument;
 import com.ym.mec.biz.service.ReplacementInstrumentService;
 import com.ym.mec.biz.dal.dao.ReplacementInstrumentDao;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class ReplacementInstrumentServiceImpl extends BaseServiceImpl<Integer, ReplacementInstrument> implements ReplacementInstrumentService {
@@ -25,6 +31,8 @@ public class ReplacementInstrumentServiceImpl extends BaseServiceImpl<Integer, R
     private ReplacementInstrumentDao replacementInstrumentDao;
     @Autowired
     private GoodsDao goodsDao;
+    @Resource
+    private MallFeignService mallFeignService;
 
     @Override
     public BaseDAO<Integer, ReplacementInstrument> getDAO() {
@@ -44,6 +52,16 @@ public class ReplacementInstrumentServiceImpl extends BaseServiceImpl<Integer, R
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = goodsDao.getReplacementGoodsPage(params);
+            List<String> brandIdList = dataList.stream().map(ReplacementInstrument::getBrand).filter(StringUtils::isNotEmpty).distinct().collect(Collectors.toList());
+            if (!brandIdList.isEmpty()) {
+                Map<Long, String> idNameMap = mallFeignService.getList().stream().collect(Collectors.toMap(BrandDto::getId, BrandDto::getName));
+                for (ReplacementInstrument instrument : dataList) {
+                    String brand = instrument.getBrand();
+                    if (StringUtils.isNotEmpty(brand) && NumberUtils.isNumber(brand)) {
+                        instrument.setBrandName(idNameMap.getOrDefault(Long.valueOf(brand), ""));
+                    }
+                }
+            }
         }
         pageInfo.setRows(dataList);
         return pageInfo;

+ 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);
             }
         }
     }

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

@@ -405,7 +405,10 @@
 
     <sql id="queryOrganIdSql">
         <where>
-            AND g.status_ != 0 and g.tenant_id_ = #{goodsQuery.tenantId} and g.del_flag_ = 0
+            AND g.status_ != 0 and g.tenant_id_ = #{goodsQuery.tenantId}
+            <if test="goodsQuery.delFlag != null">
+                AND g.del_flag_ = #{goodsQuery.delFlag}
+            </if>
             <if test="goodsQuery.subjectId != null">
                 AND sgm.subject_id_ = #{goodsQuery.subjectId}
             </if>

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

@@ -25,6 +25,7 @@
         <result column="minuend_stock_goods_id_list_" property="minuendStockGoodsIdList"/>
         <result column="user_id_" property="userId"/>
         <result column="delivery_batch_no_" property="deliveryBatchNo"/>
+        <result column="remit_fee_" property="remitFee"/>
         <collection property="goodsList" ofType="com.ym.mec.biz.dal.entity.Goods">
             <result column="goods_id_" property="id"/>
             <result column="goods_name_" property="name"/>