Browse Source

产品多人操作判断

wangyu 6 years ago
parent
commit
93d8f3ea17

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

@@ -107,6 +107,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
                     "产品名称重复");
         }
         LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y)){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "该产品已删除");
+        }
         BeanUtil.copyProperties(updateProductVO, lantoneProduct);
         lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
         lantoneProduct.setGmtModified(DateUtil.now());
@@ -135,6 +139,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      */
     public Boolean stopProduct(UpdateProductVO updateProductVO) {
         LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y)){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "该产品已删除");
+        }
         if(updateProductVO.getServiceStatus() == lantoneProduct.getServiceStatus() && updateProductVO.getServiceStatus() == StatusEnum.Enable.getKey()){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "该产品已启用,启用失败");
@@ -186,6 +194,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      */
     public Boolean deleteProduct(UpdateProductVO updateProductVO) {
         LantoneProduct lantoneProduct = getById(updateProductVO.getId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y)){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "该产品已删除");
+        }
         if(lantoneProduct.getServiceStatus()==StatusEnum.Enable.getKey()){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "当前产品正在使用中不可删除");
@@ -314,6 +326,11 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      * @return 当条产品线下所有订单信息
      */
     public IPage<OpendProductDTO> opendedProduct(OppendedProductVO oppendedProductVO) {
+        LantoneProduct lantoneProduct = getById(oppendedProductVO.getProductId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y)){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "该产品已删除");
+        }
         Page page =new Page();
         BeanUtil.copyProperties(oppendedProductVO,page);
         OpenedProductsIndex openedProductsIndex = new OpenedProductsIndex();