Просмотр исходного кода

用户更多服务订单生成循环中出现查询(修改)

wangyu 6 лет назад
Родитель
Сommit
2bce7433de

+ 1 - 13
diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java

@@ -23,7 +23,6 @@ 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;
 
@@ -131,18 +130,7 @@ 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查询当条产品线下所有订单信息
      *

+ 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, "添加订单失败");
         }