Переглянути джерело

朗通后台产品线管理相关接口入参修改

wangyu 6 роки тому
батько
коміт
f7660e5496

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

@@ -9,6 +9,7 @@ import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.OpenedProductsIndex;
 import com.diagbot.entity.wrapper.LantoneProductWrapper;
 import com.diagbot.entity.wrapper.OpendProductWrapper;
+import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.LantoneProductServiceImpl;
@@ -17,6 +18,7 @@ import com.diagbot.util.DateUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.AddProductsVO;
 import com.diagbot.vo.OppendedProductVO;
+import com.diagbot.vo.UpdateProductVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -48,32 +50,37 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         lantoneProduct.setCreator(UserUtils.getCurrentPrincipleID());
         BeanUtil.copyProperties(addProductsVO,lantoneProduct);
         if (!save(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.FAIL);
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "产品添加失败");
         }
         return true;
     }
 
     /**
-     * @Description: 修改产品业务逻辑
+     * @Description: 朗通产品线管理修改产品
      * @Author: wangyu
      * @Date: 19:59 2018/9/18
      */
-    public Boolean updateProduct(LantoneProduct lantoneProduct) {
+    public Boolean updateProduct(UpdateProductVO updateProductVO) {
+        LantoneProduct lantoneProduct =this.getById(updateProductVO.getId());
+        BeanUtil.copyProperties(updateProductVO,lantoneProduct);
         if (!updateById(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.FAIL);
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "产品修改失败");
         }
         return true;
     }
-
     /**
      * @Description: 删除产品业务逻辑
      * @Author: wangyu
      * @Date: 19:59 2018/9/18
      */
-    public Boolean deleteProduct(LantoneProduct lantoneProduct) {
-        lantoneProduct.setIsDeleted("Y");
+    public Boolean deleteProduct(UpdateProductVO updateProductVO) {
+        LantoneProduct lantoneProduct = getById(updateProductVO.getId());
+        lantoneProduct.setIsDeleted(IsDeleteEnum.Y.getName());
         if (!updateById(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.FAIL);
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "产品删除失败");
         }
         return true;
     }

+ 51 - 0
diagbotman-service/src/main/java/com/diagbot/vo/UpdateProductVO.java

@@ -0,0 +1,51 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: zhaops
+ * @time: 2018/9/18 18:53
+ */
+@Getter
+@Setter
+public class UpdateProductVO {
+    /**
+     * 产品id
+     */
+    private Long id;
+    /**
+     * 产品名称
+     */
+    private String name;
+    /**
+     * 产品介绍
+     */
+    private String decription;
+    /**
+     * 收费方式
+     */
+    private String chargeType;
+    /**
+     * 产品路径
+     */
+    private String url;
+    /**
+     * 试用状态
+     */
+    private Integer trialStatus;
+    /**
+     * 试用地址
+     */
+    private String trialUrl;
+
+    /**
+     * 接入方式(1:嵌入式,2:接口方式,3:online)
+     */
+    private String accessType;
+    /**
+     * 停用状态
+     */
+    private Integer serviceStatus;
+}

+ 16 - 15
diagbotman-service/src/main/java/com/diagbot/web/DiagLantoneProductController.java

@@ -11,6 +11,7 @@ import com.diagbot.entity.wrapper.OpendProductWrapper;
 import com.diagbot.facade.LantoneProductFacade;
 import com.diagbot.vo.AddProductsVO;
 import com.diagbot.vo.OppendedProductVO;
+import com.diagbot.vo.UpdateProductVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -56,13 +57,22 @@ public class DiagLantoneProductController {
         return RespDTO.onSuc(pages);
     }
 
-    @ApiOperation(value = "修改产品(产品启用同接口)[by:wangyu]",
+    @ApiOperation(value = "朗通产品线管理修改产品[by:wangyu]",
             notes = "id:根据产品id修改产品内容,必填<br>")
     @PostMapping("/updateProduct")
     @SysLogger("updateProduct")
     @Transactional
-    public RespDTO<Boolean> updateProduct(LantoneProduct lantoneProduct){
-        return RespDTO.onSuc(lantoneProductFacade.updateProduct(lantoneProduct));
+    public RespDTO<Boolean> updateProduct(UpdateProductVO updateProductVO){
+        return RespDTO.onSuc(lantoneProductFacade.updateProduct(updateProductVO));
+    }
+
+    @ApiOperation(value = "产品(启用/禁用)接口[by:wangyu]",
+            notes = "id:根据产品id修改产品内容,必填<br>")
+    @PostMapping("/updateServiceStatus")
+    @SysLogger("updateServiceStatus")
+    @Transactional
+    public RespDTO<Boolean> updateServiceStatus(UpdateProductVO updateProductVO){
+        return RespDTO.onSuc(lantoneProductFacade.updateProduct(updateProductVO));
     }
 
     @ApiOperation(value = "删除产品[by:wangyu]",
@@ -70,19 +80,10 @@ public class DiagLantoneProductController {
     @PostMapping("/deleteProduct")
     @SysLogger("deleteProduct")
     @Transactional
-    public RespDTO<Boolean> deleteProduct(LantoneProduct lantoneProduct){
-        return RespDTO.onSuc(lantoneProductFacade.deleteProduct(lantoneProduct));
+    public RespDTO<Boolean> deleteProduct(UpdateProductVO updateProductVO){
+        return RespDTO.onSuc(lantoneProductFacade.deleteProduct(updateProductVO));
     }
-
-    @ApiOperation(value = "更改产品状态(启用/停用)[by:wangyu]",
-            notes = "id:根据产品id更改产品状态,必填<br>")
-    @PostMapping("/productStatus")
-    @SysLogger("productStatus")
-    @Transactional
-    public RespDTO<Boolean> productStatus(LantoneProduct lantoneProduct){
-        return RespDTO.onSuc(lantoneProductFacade.productStatus(lantoneProduct));
-    }
-
+    
     @ApiOperation(value = "查询当条产品线所有已开通用户[by:wangyu]",
             notes = "id:根据产品id查询所有已开通本产品用户,必填<br>"+
                     "current:页数<br>"+