Explorar o código

开通产品修改

rgb %!s(int64=6) %!d(string=hai) anos
pai
achega
407f6bcad6

+ 8 - 6
diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java

@@ -242,11 +242,15 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
     	
     	LantoneProduct lantoneProduct =new LantoneProduct();
         lantoneProduct.setId(openProductCheckVO.getProductId());
-        LantoneProduct lantoneProducts = lantoneProductFacade.getById(lantoneProduct);
+        lantoneProduct = lantoneProductFacade.getById(lantoneProduct);
+        
+    	if(lantoneProduct==null){
+    		throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该产品不存在,请刷新页面");
+    	}
     	
     	if(openProductCheckVO.getOpenId()!=null){
     		OpenedProducts openedProducts = baseMapper.selectById(openProductCheckVO.getOpenId());
-    		if(openedProducts==null){
+    		if(openedProducts==null||openedProducts.getProductId()!=openProductCheckVO.getProductId()){
     			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "您的产品不存在,请刷新页面");
     		}
     		if(openedProducts.getIsDeleted().equals("Y")){
@@ -256,13 +260,10 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
     			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "您的产品已停用,请刷新页面");
     		}
     		if(openedProducts.getEndTime().getTime()<DateUtil.now().getTime()){
-    			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "【"+lantoneProducts.getName()+"】已到期,请刷新页面");
+    			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "【"+lantoneProduct.getName()+"】已到期,请刷新页面");
     		}
     	}
     	
-    	if(lantoneProduct==null){
-    		throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该产品不存在,请刷新页面");
-    	}
     	if(lantoneProduct.getIsDeleted().equals("Y")){
 			 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "【"+lantoneProduct.getName()+"】已删除,请刷新页面");
 		}
@@ -270,6 +271,7 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
 			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "【"+lantoneProduct.getName()+"】已停用,请刷新页面");
 		}
     	
+    	openProductCheckDTO.setHasPermission(true);
     	return openProductCheckDTO;
     }