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

更多服务开通产品判断

wangyu 6 лет назад
Родитель
Сommit
1c67e4963b

+ 6 - 0
diagbotman-service/src/main/java/com/diagbot/dto/ProductLineDTO.java

@@ -24,6 +24,12 @@ public class ProductLineDTO {
      * 产品名称
      */
     private String name;
+
+    /**
+     * 是否删除 N:未删除,Y:删除
+     */
+    private String isDeleted;
+
     /**
      * 产品介绍
      */

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

@@ -111,7 +111,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
         if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey())){
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
-                    "该产品已删除");
+                    "该产品已删除,请刷新页面");
         }
         BeanUtil.copyProperties(updateProductVO, lantoneProduct);
         lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
@@ -143,7 +143,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
         if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey())){
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
-                    "该产品已删除");
+                    "该产品已删除,请刷新页面");
         }
         if(updateProductVO.getServiceStatus() == lantoneProduct.getServiceStatus() && updateProductVO.getServiceStatus() == StatusEnum.Enable.getKey()){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
@@ -201,7 +201,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
         if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey())){
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
-                    "该产品已删除");
+                    "该产品已删除,请刷新页面");
         }
         if(lantoneProduct.getServiceStatus()==StatusEnum.Enable.getKey()){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
@@ -345,7 +345,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         LantoneProduct lantoneProducts = this.getById(lantoneProduct.getId());
         if(lantoneProducts.getIsDeleted().equals(IsDeleteEnum.Y.getKey())){
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
-                    "该产品已删除");
+                    "该产品已删除,请刷新页面");
         }
         Page page =new Page();
         BeanUtil.copyProperties(oppendedProductVO,page);

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

@@ -6,6 +6,7 @@ import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.AuthDetailDTO;
 import com.diagbot.dto.OrderDetialsDTO;
 import com.diagbot.dto.ProductAuthProgressDTO;
+import com.diagbot.dto.ProductLineDTO;
 import com.diagbot.dto.ProductOrderDTO;
 import com.diagbot.dto.ProductOrderExportDTO;
 import com.diagbot.dto.RespDTO;
@@ -19,6 +20,7 @@ import com.diagbot.entity.User;
 import com.diagbot.entity.wrapper.ProductOrderWrapper;
 import com.diagbot.enums.AuditStatusEnum;
 import com.diagbot.enums.AuthStatusEnum;
+import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.NotPassEnum;
 import com.diagbot.enums.VisibleIdTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
@@ -44,7 +46,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * 订单业务
@@ -157,6 +158,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         List<Long> opendId = openedProductsFacade.getOpendCountByUserId(userId);
         List<Long> orderDetailsId = orderDetailsFacade.getOrderDetailsByUser(userId);
+        List<ProductLineDTO> productList = lantoneProductFacade.productLinesB();
         List<Long> userIdList =new ArrayList<>();
         userIdList.add(userId);
         RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(userIdList);
@@ -171,6 +173,12 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
                     "账号信息系不完善,请先认证");
         }
         for (int i =0; i<addOrderVO.getProductId().size();i++){
+            for(int l = 0; l< productList.size(); l++){
+                if(addOrderVO.getProductId().get(l).intValue() == productList.get(l).getId().intValue() && productList.get(l).getIsDeleted().equals(IsDeleteEnum.Y.getKey())){
+                        throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                                "【"+productList.get(l).getName()+"】产品已删除,请刷新重试");
+                }
+            }
             for (int j =0; j<opendId.size();j++){
                 if(addOrderVO.getProductId().get(i)==opendId.get(j)){
                     throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请勿重复提交已开通产品");

+ 6 - 0
diagbotman-service/src/main/java/com/diagbot/facade/UserRenewalsFacade.java

@@ -7,6 +7,7 @@ import com.diagbot.dto.ProductLineDTO;
 import com.diagbot.dto.RenewalsInfosDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UserOrgDTO;
+import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.OpenedProducts;
 import com.diagbot.entity.User;
 import com.diagbot.entity.UserRenewals;
@@ -61,6 +62,11 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
      * @return Boolean
      */
     public RespDTO<Boolean> addRenewalsInfos(AddRenewalsInfoVO addRenewalsInfoVO){
+        LantoneProduct lantoneProduct = lantoneProductFacade.getById(addRenewalsInfoVO.getProductId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey())){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "该产品已删除,请刷新页面");
+        }
         UserRenewals userRenewals =new UserRenewals();
         Map map =new HashMap();
         String user = UserUtils.getCurrentPrincipleID();