|
@@ -61,17 +61,34 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
|
|
userId = operatorId;
|
|
userId = operatorId;
|
|
}
|
|
}
|
|
LantoneProduct lantoneProduct = lantoneProductFacade.getById(productServiceSaveVO.getProductId());
|
|
LantoneProduct lantoneProduct = lantoneProductFacade.getById(productServiceSaveVO.getProductId());
|
|
- if (lantoneProduct == null || lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey()) || lantoneProduct.getServiceStatus().equals(StatusEnum.Disable.getKey())) {
|
|
|
|
|
|
+ if (lantoneProduct == null) {
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
- "产品异常,请刷新页面");
|
|
|
|
|
|
+ "产品未找到");
|
|
|
|
+ } else if (lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey())) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
|
|
+ "无法操作,该产品线已删除");
|
|
|
|
+ } else if (lantoneProduct.getServiceStatus().equals(StatusEnum.Disable.getKey())) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
|
|
+ "无法操作,该产品线已停用");
|
|
}
|
|
}
|
|
QueryWrapper<OpenedProducts> openedProductsQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<OpenedProducts> openedProductsQueryWrapper = new QueryWrapper<>();
|
|
- openedProductsQueryWrapper.eq("product_id", lantoneProduct.getId()).eq("user_id", userId).eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
|
|
+ openedProductsQueryWrapper.eq("product_id", lantoneProduct.getId()).eq("user_id", userId);
|
|
|
|
+ List<OpenedProducts> openedProductsList = openedProductsFacade.list(openedProductsQueryWrapper);
|
|
|
|
+ openedProductsQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
OpenedProducts openedProducts = openedProductsFacade.getOne(openedProductsQueryWrapper);
|
|
OpenedProducts openedProducts = openedProductsFacade.getOne(openedProductsQueryWrapper);
|
|
if (!productServiceSaveVO.getType().equals(TokenTypeEnum.Trial.getKey())) {
|
|
if (!productServiceSaveVO.getType().equals(TokenTypeEnum.Trial.getKey())) {
|
|
- if (openedProducts == null || openedProducts.getServiceStatus().equals(StatusEnum.Disable.getKey()) || openedProducts.getEndTime().before(new Date())) {
|
|
|
|
|
|
+ if (openedProductsList.size() == 0) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
|
|
+ "无法操作,该产品未开通");
|
|
|
|
+ } else if (openedProducts == null) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
|
|
+ "无法操作,该产品已删除");
|
|
|
|
+ } else if (openedProducts.getServiceStatus().equals(StatusEnum.Disable.getKey())) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
|
|
+ "无法操作,该产品已停用");
|
|
|
|
+ } else if (openedProducts.getEndTime().before(new Date())) {
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
- "产品异常,请刷新页面");
|
|
|
|
|
|
+ "无法操作,该产品已到期");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ServiceInfo serviceInfo = serviceInfoFacade.getById(productServiceSaveVO.getServiceId());
|
|
ServiceInfo serviceInfo = serviceInfoFacade.getById(productServiceSaveVO.getServiceId());
|