Browse Source

Merge remote-tracking branch 'origin/dev/one' into dev/one

# Conflicts:
#	diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java
Zhaops 6 years ago
parent
commit
773946a7c2

+ 3 - 17
diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java

@@ -1,6 +1,5 @@
 package com.diagbot.facade;
 
-import ch.qos.logback.core.pattern.ConverterUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.client.UserServiceClient;
@@ -25,11 +24,9 @@ import com.diagbot.vo.AddProductsVO;
 import com.diagbot.vo.LantoneProductSelectVO;
 import com.diagbot.vo.OppendedProductVO;
 import com.diagbot.vo.UpdateProductVO;
-import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.lang.reflect.Array;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -163,17 +160,6 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         return RespDTO.onSuc(this.productLine(list));
     }
 
-
-    /**
-     * 根据产品id查询产品
-     *
-     * @param id 产品id
-     * @return 产品信息
-     */
-    public LantoneProduct selectLanProduct(Long id) {
-        return getById(id);
-    }
-
     /**
      * 根据产品id查询当条产品线下所有订单信息
      *
@@ -184,10 +170,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         OpenedProductsIndex openedProductsIndex = new OpenedProductsIndex();
         Long curren = oppendedProductVO.getCurrent();
         Long size = oppendedProductVO.getSize();
-        if (curren == null || curren == 0) {
+        if (curren == null || curren==0) {
             oppendedProductVO.setCurrent(1L);
         }
-        if (size == null || curren == 0) {
+        if (size == null || curren==0) {
             oppendedProductVO.setSize(10L);
         }
         BeanUtil.copyProperties(oppendedProductVO, openedProductsIndex);
@@ -207,7 +193,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         for (OpendProductWrapper bean : list) {
             UserOrgDTO uo = dataMap.get(bean.getUserId());
             if (uo != null) {
-                BeanUtil.copyProperties(uo, bean);
+                BeanUtil.copyProperties(uo,bean);
             }
         }
         return list;

+ 5 - 5
diagbotman-service/src/main/java/com/diagbot/facade/ProductOrderFacade.java

@@ -6,7 +6,6 @@ import com.diagbot.dto.ProductAuthProgressDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UserOrgDTO;
 import com.diagbot.dto.WaitExamOrderCouDTO;
-import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.OrderDetailStatus;
 import com.diagbot.entity.OrderDetails;
 import com.diagbot.entity.ProductOrder;
@@ -114,11 +113,9 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         }
         OrderDetails orderDetails = null;
         List<OrderDetails> list =new ArrayList();
+        List<Long> lantoneProductId =new ArrayList<>();
         for (Long o : addOrderVO.getProductId()) {
-            LantoneProduct lantoneProduct = lantoneProductFacade.selectLanProduct(o);
-            if (null == lantoneProduct) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取产品信息失败:" + o);
-            }
+            lantoneProductId.add(o);
             orderDetails = new OrderDetails();
             orderDetails.setUserId(userId);
             orderDetails.setOrderNum(orderNum);
@@ -127,6 +124,9 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
             orderDetails.setProductId(o);
             list.add(orderDetails);
         }
+        if (0 == lantoneProductFacade.listByIds(lantoneProductId).size()) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取产品信息失败:");
+        }
         if(orderDetailsFacade.saveOrderDetails(list)){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "添加订单失败");
         }