浏览代码

朗通后台产品申请审核接口完善
创建审核状态枚举类

wangyu 6 年之前
父节点
当前提交
a4ee8911e8

+ 9 - 4
diagbotman-service/src/main/java/com/diagbot/entity/OpenedProducts.java

@@ -79,10 +79,15 @@ public class OpenedProducts implements Serializable {
     /**
      * 订单id
      */
-    private Integer orderId;
+    private Long orderId;
 
+    /**
+     * 接入方式
+     */
     private Integer accessType;
-
+    /**
+     * 支付方式
+     */
     private Integer chargeType;
 
 
@@ -174,11 +179,11 @@ public class OpenedProducts implements Serializable {
         this.serviceStatus = serviceStatus;
     }
 
-    public Integer getOrderId() {
+    public Long getOrderId() {
         return orderId;
     }
 
-    public void setOrderId(Integer orderId) {
+    public void setOrderId(Long orderId) {
         this.orderId = orderId;
     }
 

+ 50 - 0
diagbotman-service/src/main/java/com/diagbot/enums/AuditStatusEnum.java

@@ -0,0 +1,50 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description: 审核状态枚举类
+ * @author: wangyu
+ * @time: 2018/9/25 16:51
+ */
+public enum AuditStatusEnum implements KeyedNamed {
+    Veto(0, "不通过"),
+    Adopt(1, "通过");
+
+    @Setter
+    private Integer key;
+
+    @Setter
+    private String name;
+
+    AuditStatusEnum(Integer key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static AuditStatusEnum getEnum(Integer key) {
+        for (AuditStatusEnum item : AuditStatusEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(Integer key) {
+        AuditStatusEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}
+

+ 39 - 8
diagbotman-service/src/main/java/com/diagbot/facade/ProductOrderFacade.java

@@ -6,6 +6,7 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UserOrgDTO;
 import com.diagbot.dto.WaitExamOrderCouDTO;
 import com.diagbot.entity.LantoneProduct;
+import com.diagbot.entity.OpenedProducts;
 import com.diagbot.entity.OrderDetails;
 import com.diagbot.entity.OrderDetailsIndex;
 import com.diagbot.entity.ProductOrder;
@@ -13,6 +14,8 @@ import com.diagbot.entity.ProductOrderIndex;
 import com.diagbot.entity.ServiceInfo;
 import com.diagbot.entity.wrapper.OrderDetailsWapper;
 import com.diagbot.entity.wrapper.ProductOrderWrapper;
+import com.diagbot.enums.AuditStatusEnum;
+import com.diagbot.enums.TokenTypeEnum;
 import com.diagbot.enums.VisibleIdTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
@@ -56,6 +59,8 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
 	private UserServiceClient userServiceClient;
 	@Autowired
 	private ProductOrderFacade productOrderFacade;
+	@Autowired
+	private OpenedProductsFacade openedProductsFacade;
 
 	/**
 	 * 获取产品的认证进度
@@ -228,25 +233,51 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
 	 */
 	@Transactional
 	public Boolean updateAuditStatus(AuditStatusVO auditStatusVO){
-		OrderDetails orderDetails =new OrderDetails();
-		orderDetails.setId(auditStatusVO.getId());
+		OrderDetails orderDetails =orderDetailsFacade.getById(auditStatusVO.getId());
+		if(orderDetails==null){
+			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+					"订单明细不存在");
+		}
 		orderDetails.setGmtModified(DateUtil.now());
 		orderDetails.setModifier(UserUtils.getCurrentPrincipleID());
-		orderDetails.setAuditStatus(1);
+		orderDetails.setAuditStatus(auditStatusVO.getAuditStatus());
+		//TODO 审核不通过
+		if(auditStatusVO.getAuditStatus()== AuditStatusEnum.Veto.getKey()){
+			if(!orderDetailsFacade.updateById(orderDetails)){
+				throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+						"审核状态修改失败");
+			}
+			return true;
+		}
+		//TODO 审核通过 添加已开通产品  判断产品类型是否有online(添加服务  服务产品表  token表)
 		if(!orderDetailsFacade.updateById(orderDetails)){
-			throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
+			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+					"审核状态修改失败");
 		}
+		Long userId =Long.parseLong(UserUtils.getCurrentPrincipleID());
+		OpenedProducts openedProducts =new OpenedProducts();
+		openedProducts.setGmtCreate(DateUtil.now());
+		openedProducts.setCreator(UserUtils.getCurrentPrincipleID());
+		openedProducts.setProductId(1L);
+		openedProducts.setUserId(userId);
+		openedProducts.setStartTime(auditStatusVO.getStartTime());
+		openedProducts.setEndTime(auditStatusVO.getEndTime());
+		openedProducts.setOrderId(1L);
+		openedProductsFacade.save(openedProducts);
 		LantoneProduct lantoneProduct =new LantoneProduct();
-		lantoneProduct.setId(auditStatusVO.getId());
+		if(lantoneProductFacade.getById(lantoneProduct).getAccessType().indexOf(TokenTypeEnum.Online.getKey())==-1){
+			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+					"该产品没有线上模式");
+		}
 		ServiceSaveVO serviceSaveVO =new ServiceSaveVO();
-		ProductServiceSaveVO productServiceSaveVO =new ProductServiceSaveVO();
 		serviceSaveVO.setDescription(lantoneProduct.getDecription());
 		serviceSaveVO.setName(lantoneProduct.getName());
-		serviceSaveVO.setType(1);
+		serviceSaveVO.setType(TokenTypeEnum.Online.getKey());
 		ServiceInfo serviceInfo = serviceInfoFacade.createService(serviceSaveVO);
+		ProductServiceSaveVO productServiceSaveVO =new ProductServiceSaveVO();
 		productServiceSaveVO.setProductId(auditStatusVO.getId());
 		productServiceSaveVO.setServiceId(serviceInfo.getId());
-		productServiceSaveVO.setType(1);
+		productServiceSaveVO.setType(TokenTypeEnum.Online.getKey());
 		productServiceFacade.genProductService(productServiceSaveVO);
 		return true;
 	}

+ 0 - 6
diagbotman-service/src/main/java/com/diagbot/service/impl/LantoneProductServiceImpl.java

@@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.client.UserServiceClient;
-import com.diagbot.dto.RespDTO;
-import com.diagbot.dto.UserOrgDTO;
 import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.wrapper.LantoneProductWrapper;
 import com.diagbot.mapper.LantoneProductMapper;
@@ -13,7 +11,6 @@ import com.diagbot.service.LantoneProductService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -46,9 +43,6 @@ public class LantoneProductServiceImpl extends ServiceImpl<LantoneProductMapper,
      */
     @Override
     public IPage<LantoneProduct> selectProduct(Page<LantoneProduct> page, String name) {
-        List<Long> list =new ArrayList<>();
-        list.add(2l);
-        RespDTO<Map<Long,UserOrgDTO>> map = userServiceClient.getUserAndOrg(list);
         return baseMapper.selectProduct(page,name);
     }
 

+ 7 - 1
diagbotman-service/src/main/java/com/diagbot/vo/AuditStatusVO.java

@@ -4,6 +4,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
+import java.util.Date;
 
 /**
  * @Description:
@@ -13,6 +14,11 @@ import javax.validation.constraints.NotBlank;
 @Getter
 @Setter
 public class AuditStatusVO {
-    @NotBlank(message = "请输入产品明细Id!")
+    @NotBlank(message = "请输入订单明细Id!")
     public Long id;
+    @NotBlank(message = "请输入订单审核状态!")
+    private Integer auditStatus;
+
+    private Date startTime;
+    private Date endTime;
 }