Jelajahi Sumber

Merge remote-tracking branch 'origin/dev/one' into dev/one

wangyu 6 tahun lalu
induk
melakukan
3a2e0f895e

+ 25 - 0
diagbotman-service/src/main/java/com/diagbot/dto/GetConsoleOnTrialDTO.java

@@ -33,6 +33,11 @@ public class GetConsoleOnTrialDTO implements Serializable {
      * 接入模式信息
      */
     private String accessTypeMsg;
+    
+    /**
+     * 产品停用状态
+     */
+    private Integer serviceStatus;
 
     /**
      * 是否已试用
@@ -44,6 +49,26 @@ public class GetConsoleOnTrialDTO implements Serializable {
      */
     private String trialUrl;
 
+    /**
+     * 
+     */
+    private String appKeyId;
+    
+    /**
+     * 
+     */
+    private String appKeySecret;
+    
+    /**
+     * token状态
+     */
+    private Integer tokenStatus;
+    
+    /**
+     * token状态信息
+     */
+    private String tokenStatusMsg;
+    
     /**
      * 开通日期
      */

+ 11 - 13
diagbotman-service/src/main/java/com/diagbot/facade/ServiceInfoFacade.java

@@ -1,7 +1,6 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.entity.ProductService;
@@ -38,8 +37,8 @@ public class ServiceInfoFacade extends ServiceInfoServiceImpl {
     public ServiceInfo createService(ServiceSaveVO serviceSaveVO) {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         QueryWrapper<ServiceInfo> qw = new QueryWrapper<>();
-        qw.eq("name", serviceSaveVO.getName());
-        qw.eq("is_deleted", IsDeleteEnum.N.getKey());
+        qw.eq("name", serviceSaveVO.getName()).
+                eq("is_deleted", IsDeleteEnum.N.getKey());
         ServiceInfo serviceInfo = this.getOne(qw);
         if (serviceInfo != null) {
             throw new CommonException(CommonErrorCode.IS_EXISTS,
@@ -90,8 +89,8 @@ public class ServiceInfoFacade extends ServiceInfoServiceImpl {
                     "服务端【" + serviceInfo.getName() + "】关联用户与当前登录用户不匹配,不允许删除");
         }
         QueryWrapper<ProductService> qwps = new QueryWrapper<>();
-        qwps.eq("is_deleted", IsDeleteEnum.N.getKey());
-        qwps.eq("service_id", serviceId);
+        qwps.eq("is_deleted", IsDeleteEnum.N.getKey()).
+                eq("service_id", serviceId);
         List<ProductService> psList = productServiceFacade.list(qwps);
         if (psList.size() > 0) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
@@ -110,10 +109,9 @@ public class ServiceInfoFacade extends ServiceInfoServiceImpl {
     public List<ServiceInfo> getServiceListByCurrentUser() {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         QueryWrapper<ServiceInfo> qw = new QueryWrapper<>();
-        qw.eq("user_id", userId);
-        //服务端类型(1:用户建立,2:系统生成)
-        qw.eq("type", ServiceTypeEnum.User_Create.getKey());
-        qw.eq("is_deleted", "N");
+        qw.eq("user_id", userId).
+                eq("type", ServiceTypeEnum.User_Create.getKey()).
+                eq("is_deleted", "N");
         List<ServiceInfo> list = this.list(qw);
         return list;
     }
@@ -130,10 +128,10 @@ public class ServiceInfoFacade extends ServiceInfoServiceImpl {
         serviceInfoVO.setUserId(userId);
         serviceInfoVO.setType(ServiceTypeEnum.User_Create.getKey());
         QueryWrapper<ServiceInfo> qw = new QueryWrapper<>();
-        qw.eq("is_deleted", "N");
-        qw.eq("type", ServiceTypeEnum.User_Create.getKey());
-        qw.eq("user_id", userId);
-        qw.orderByDesc("gmt_create");
+        qw.eq("is_deleted", "N").
+                eq("type", ServiceTypeEnum.User_Create.getKey()).
+                eq("user_id", userId).
+                orderByDesc("gmt_create");
         IPage<ServiceInfo> pagelist = this.page(page, qw);
         return pagelist;
     }

+ 6 - 6
diagbotman-service/src/main/java/com/diagbot/facade/ServiceTokenFacade.java

@@ -55,8 +55,8 @@ public class ServiceTokenFacade extends ServiceTokenServiceImpl {
         paramMap.put("secret", secret);
         //ServiceToken st = this.getServiceToken(paramMap);
         QueryWrapper<ServiceToken> qw = new QueryWrapper<>();
-        qw.eq("app_key_id", appkey);
-        qw.eq("app_key_secret", secret);
+        qw.eq("app_key_id", appkey).
+                eq("app_key_secret", secret);
         ServiceToken st = this.selectOneRecord(qw);
         if (null == st) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "appkey或secret错误,appkey=【" + appkey + "】," + "secret=【" + secret + "】");
@@ -129,8 +129,8 @@ public class ServiceTokenFacade extends ServiceTokenServiceImpl {
     public Integer enableToken(Long productServiceId) {
         checkCurrentUser(productServiceId);
         UpdateWrapper<ServiceToken> uw = new UpdateWrapper<>();
-        uw.eq("product_service_id", productServiceId);
-        uw.eq("type", TokenTypeEnum.Manual.getKey());
+        uw.eq("product_service_id", productServiceId).
+                eq("type", TokenTypeEnum.Manual.getKey());
         ServiceToken serviceToken = new ServiceToken();
         serviceToken.setStatus(StatusEnum.Enable.getKey());
         return this.updateRecord(serviceToken, uw);
@@ -145,8 +145,8 @@ public class ServiceTokenFacade extends ServiceTokenServiceImpl {
     public Integer disableToken(Long productServiceId) {
         checkCurrentUser(productServiceId);
         UpdateWrapper<ServiceToken> uw = new UpdateWrapper<>();
-        uw.eq("product_service_id", productServiceId);
-        uw.eq("type", TokenTypeEnum.Manual.getKey());
+        uw.eq("product_service_id", productServiceId).
+                eq("type", TokenTypeEnum.Manual.getKey());
         ServiceToken serviceToken = new ServiceToken();
         serviceToken.setStatus(StatusEnum.Disable.getKey());
         return this.updateRecord(serviceToken, uw);

+ 44 - 18
diagbotman-service/src/main/resources/mapper/OpenedProductsMapper.xml

@@ -83,24 +83,50 @@
     </select>
 
     <select id="getConsoleOnTrial" parameterType="long"
-            resultType="com.diagbot.dto.GetConsoleOnTrialDTO">
-    	SELECT
-			a.id as id,
-			a.name as name,
-			a.access_type as accessType,
-			case when d.id is null then 'N' else 'Y' end as isUsed,
-			a.trial_url as trialUrl,
-			DATE_FORMAT(d.starting_date,'%Y-%m-%d') as startingDate,
-			DATE_FORMAT(d.expiring_date,'%Y-%m-%d') as expiringDate
-		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_service_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>
+		resultType="com.diagbot.dto.GetConsoleOnTrialDTO">
+		SELECT
+		a.id as id,
+		a.name as name,
+		a.service_status as serviceStatus,
+		a.access_type as accessType,
+		a.trial_url as trialUrl,
+		b.app_key_id as appKeyId,
+		b.app_key_secret as appKeySecret,
+		b.`STATUS` as tokenStatus,
+		DATE_FORMAT(b.starting_date,'%Y-%m-%d') as expiringDate,
+		DATE_FORMAT(b.expiring_date,'%Y-%m-%d') as expiringDate
+		FROM
+		diag_lantone_product a
+		LEFT JOIN (
+		SELECT
+		b.product_id,
+		c.app_key_id,
+		c.app_key_secret,
+		c.`status`,
+		c.starting_date,
+		c.expiring_date
+		FROM
+		diag_service_info a
+		JOIN diag_product_service b ON a.id = b.service_id
+		JOIN diag_service_token c ON b.id = c.product_service_id
+		WHERE
+		a.is_deleted = 'N'
+		AND b.is_deleted = 'N'
+		AND c.is_deleted = 'N'
+		AND a.user_id = #{userId}
+		AND a.type = 2
+		AND c.type = 3
+		) b ON a.id = b.product_id
+		WHERE
+		a.is_deleted = 'N' and a.trial_status=1
+		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

+ 10 - 10
user-service/src/main/java/com/diagbot/facade/UserAuthenticationFacade.java

@@ -61,8 +61,8 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
         }
         //更新机构信息
         QueryWrapper<Organization> qwOrganization = new QueryWrapper<>();
-        qwOrganization.eq("name", userAuthenticationVO.getOrganization());
-        qwOrganization.eq("is_deleted", IsDeleteEnum.N.getKey());
+        qwOrganization.eq("name", userAuthenticationVO.getOrganization()).
+                eq("is_deleted", IsDeleteEnum.N.getKey());
         Organization organization = organizationFacade.getOne(qwOrganization);
         if (organization == null) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
@@ -81,8 +81,8 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
 
         //更新验证信息
         QueryWrapper<UserAuthentication> qwAuthentication = new QueryWrapper<>();
-        qwAuthentication.eq("user_id", userId);
-        qwAuthentication.eq("is_deleted", IsDeleteEnum.N.getKey());
+        qwAuthentication.eq("user_id", userId).
+                eq("is_deleted", IsDeleteEnum.N.getKey());
         UserAuthentication userAuthentication = this.getOne(qwAuthentication);
         if (userAuthentication == null) {
             userAuthentication = new UserAuthentication();
@@ -120,8 +120,8 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
         user.setPassword(null);
         Organization organization = organizationFacade.getByUserId(userId);
         QueryWrapper<UserAuthentication> qw = new QueryWrapper<>();
-        qw.eq("user_id", userId);
-        qw.eq("is_deleted", IsDeleteEnum.N.getKey());
+        qw.eq("user_id", userId).
+                eq("is_deleted", IsDeleteEnum.N.getKey());
         UserAuthentication userAuthentication = this.getOne(qw);
         UserAuthenticationDTO userAuthenticationDTO = new UserAuthenticationDTO();
         userAuthenticationDTO.setUser(user);
@@ -143,8 +143,8 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
     public Map<Integer, Object> getUserAuthenticationStatus() {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         QueryWrapper<UserAuthentication> qw = new QueryWrapper<>();
-        qw.eq("user_id", userId);
-        qw.eq("is_deleted", IsDeleteEnum.N.getKey());
+        qw.eq("user_id", userId).
+                eq("is_deleted", IsDeleteEnum.N.getKey());
         UserAuthentication userAuthentication = this.getOne(qw);
         Map<Integer, Object> map = new HashMap<>();
         if (userAuthentication == null) {
@@ -165,8 +165,8 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
     public QueryAuthProgressDTO queryAuthProgress() {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         QueryWrapper<UserAuthentication> qw = new QueryWrapper<>();
-        qw.eq("user_id", userId);
-        qw.eq("is_deleted", IsDeleteEnum.N.getKey());
+        qw.eq("user_id", userId).
+                eq("is_deleted", IsDeleteEnum.N.getKey());
         UserAuthentication userAuthentication = this.getOne(qw);
 
         QueryAuthProgressDTO queryAuthProgressDTO = new QueryAuthProgressDTO();

+ 3 - 3
user-service/src/main/java/com/diagbot/facade/UserFacade.java

@@ -433,15 +433,15 @@ public class UserFacade extends UserServiceImpl {
         User user = this.getById(userId);
         Organization organization = organizationFacade.getByUserId(userId);
         QueryWrapper<UserAuthentication> qw = new QueryWrapper<>();
-        qw.eq("user_id", userId);
-        qw.eq("is_deleted", IsDeleteEnum.N.getKey());
+        qw.eq("user_id", userId).
+                eq("is_deleted", IsDeleteEnum.N.getKey());
         UserAuthentication userAuthentication = userAuthenticationFacade.getOne(qw);
 
         GetConsoleUserInfoDTO getConsoleUserInfoDTO = new GetConsoleUserInfoDTO();
         getConsoleUserInfoDTO.setUserName(user.getUsername());
         getConsoleUserInfoDTO.setOrganizationName(organization.getName());
         getConsoleUserInfoDTO.setUserStatus(AuthStatusEnum.getName(userAuthentication.getStatus()));
-        
+
 //        getConsoleUserInfoDTO.setUser(user);
 //        getConsoleUserInfoDTO.setOrganization(organization);
 //        getConsoleUserInfoDTO.setUserAuthentication(userAuthentication);