Explorar o código

控制中心-选项卡更新

rgb %!s(int64=6) %!d(string=hai) anos
pai
achega
0bb5971093

+ 20 - 0
diagbotman-service/src/main/java/com/diagbot/dto/EnShowOptionDTO.java

@@ -0,0 +1,20 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class EnShowOptionDTO {
+	
+	/**
+	 * 可开通产品数量
+	 */
+	private Integer openedCount;
+	
+	/**
+	 * 可试用产品数量
+	 */
+	private Integer onTrialCount;
+
+}

+ 13 - 0
diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java

@@ -7,6 +7,7 @@ import java.util.Map;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import com.diagbot.dto.EnShowOptionDTO;
 import com.diagbot.dto.GetConsoleOnTrialDTO;
 import com.diagbot.dto.GetConsoleOpenedDTO;
 import com.diagbot.dto.OpenUpOnTrialDTO;
@@ -77,5 +78,17 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
     	
     	return openUpOnTrialDTO;	
     }
+    
+    public EnShowOptionDTO enShowOption(){
+    	Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+    	int openedCount = baseMapper.getConsoleOpenedCount(userId);
+    	int onTrialCount = baseMapper.getConsoleOnTrialCount(userId);
+    	
+    	EnShowOptionDTO enShowOptionDTO = new EnShowOptionDTO();
+    	enShowOptionDTO.setOpenedCount(openedCount);
+    	enShowOptionDTO.setOnTrialCount(onTrialCount);
+    	
+    	return enShowOptionDTO;
+    }
 
 }

+ 15 - 1
diagbotman-service/src/main/java/com/diagbot/mapper/OpenedProductsMapper.java

@@ -50,11 +50,25 @@ public interface OpenedProductsMapper extends BaseMapper<OpenedProducts> {
      * @return
      */
     List<GetConsoleOpenedDTO> getConsoleOpened(Long userId);
+    
+    /**
+     * 控制台已开通产品数量查询
+     * @param userId
+     * @return
+     */
+    int getConsoleOpenedCount(Long userId);
 
     /**
-     * 控制台已开通产品查询
+     * 控制台可试用产品查询
      * @param userId
      * @return
      */
     List<GetConsoleOnTrialDTO> getConsoleOnTrial(Long userId);
+    
+    /**
+     * 控制台可试用产品数量查询
+     * @param userId
+     * @return
+     */
+    int getConsoleOnTrialCount(Long userId);
 }

+ 9 - 0
diagbotman-service/src/main/java/com/diagbot/web/ProductOrderController.java

@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.EnShowOptionDTO;
 import com.diagbot.dto.GetConsoleOnTrialDTO;
 import com.diagbot.dto.GetConsoleOpenedDTO;
 import com.diagbot.dto.OpenUpOnTrialDTO;
@@ -62,5 +63,13 @@ public class ProductOrderController {
 	public RespDTO<OpenUpOnTrialDTO> openUpOnTrial(OpenUpOnTrialVO openUpOnTrialVO) {
 		return RespDTO.onSuc(openedProductsFacade.openUpOnTrial(openUpOnTrialVO));
 	}
+	
+	@ApiOperation(value = "控制台-可展示的选项卡",notes="控制台-可展示的选项卡")
+	@PostMapping("/enShowOption")
+	@SysLogger("enShowOption")
+	public RespDTO<EnShowOptionDTO> enShowOption() {
+		return RespDTO.onSuc(openedProductsFacade.enShowOption());
+	}
+	
 
 }

+ 20 - 2
diagbotman-service/src/main/resources/mapper/OpenedProductsMapper.xml

@@ -52,8 +52,13 @@
 		from diag_opened_products a join diag_lantone_product b on a.product_id=b.id
 		where a.is_deleted='N' and b.is_deleted='N' and a.user_id=#{userId};
     </select>
-
-
+    
+    <select id="getConsoleOpenedCount" parameterType="long" resultType="int">
+    	SELECT
+			count(1)
+		from diag_opened_products a join diag_lantone_product b on a.product_id=b.id
+		where a.is_deleted='N' and b.is_deleted='N' and a.user_id=#{userId};
+    </select>
 
     <select id="getConsoleOnTrial" parameterType="long" resultType="com.diagbot.dto.GetConsoleOnTrialDTO">
     	SELECT
@@ -73,6 +78,19 @@
 		and c.user_id=#{userId}
 		and a.id not in (SELECT product_id FROM diag_opened_products where user_id=#{userId})
     </select>
+    
+    <select id="getConsoleOnTrialCount" parameterType="long" resultType="int">
+    	SELECT
+			count(1)
+		FROM diag_lantone_product a LEFT JOIN diag_product_service b on a.id=b.product_id
+		JOIN diag_service_info c on b.service_id=c.id
+		JOIN diag_service_token d on b.id=d.product_sevice_id
+		where a.is_deleted='N' and b.is_deleted='N' and c.is_deleted='N' and d.is_deleted='N'
+		and a.trial_status=1
+		and c.type=2
+		and c.user_id=#{userId}
+		and a.id not in (SELECT product_id FROM diag_opened_products where user_id=#{userId})
+    </select>
 
 
 </mapper>