dsx пре 2 година
родитељ
комит
3579eef8f5

+ 2 - 1
4dkankan-common-utils/src/main/java/com/fdkankan/common/constant/FileBizType.java

@@ -13,7 +13,8 @@ public enum FileBizType {
     TAG_ICON("tag-icon", "热点图标"),
     LINK_STYLE("link-style", "场景关联图标"),
     WATERMARK("waterMark", "水印"),
-    BOX_POSTER("box-poster", "空间视频封面图")
+    BOX_POSTER("box-poster", "空间视频封面图"),
+    BILLBOARD_ICON("billboard-icon", "指示牌")
     ;
 
     private String code;

+ 9 - 9
4dkankan-utils-fyun-oss/src/main/java/com/fdkankan/fyun/oss/OssFileService.java

@@ -363,15 +363,15 @@ public class OssFileService extends AbstractFYunFileService {
             RestoreConfiguration configuration = new RestoreConfiguration(1, jobParameters);
             //开始解冻
             ossClient.restoreObject(bucket, objectName, configuration);
-            // 等待解冻完成。
-            do {
-                try {
-                    Thread.sleep(1000);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-                objectMetadata = ossClient.getObjectMetadata(bucket, objectName);
-            } while (!objectMetadata.isRestoreCompleted());
+//            // 等待解冻完成。
+//            do {
+//                try {
+//                    Thread.sleep(1000);
+//                } catch (InterruptedException e) {
+//                    e.printStackTrace();
+//                }
+//                objectMetadata = ossClient.getObjectMetadata(bucket, objectName);
+//            } while (!objectMetadata.isRestoreCompleted());
         }
     }
 

+ 5 - 0
4dkankan-utils-redis/src/main/java/com/fdkankan/redis/constant/RedisKey.java

@@ -120,6 +120,11 @@ public class RedisKey {
     public static final String SCENE_LINKPAN_STYLES = "scene:LinkPanStyles:num:%s";
 
     /**
+     * 场景关联styles数据列表
+     */
+    public static final String SCENE_BILLBOARDS_STYLES = "scene:billboardsStyles:num:%s";
+
+    /**
      * 场景指示牌数据列表
      */
     public static final String SCENE_BILLBOARDS = "scene:billboards:num:%s";

+ 5 - 0
4dkankan-utils-redis/src/main/java/com/fdkankan/redis/constant/RedisLockKey.java

@@ -90,6 +90,11 @@ public class RedisLockKey {
     public static String LOCK_LINKPAN_STYLES_SYNC = "lock:linkpan:styles:sync:num:%s";
 
     /**
+     * 场景关联styles数据恢复锁
+     */
+    public static String LOCK_BILLBOARDS_STYLES_SYNC = "lock:Billboards:styles:sync:num:%s";
+
+    /**
      * 场景指示牌数据恢复锁
      */
     public static String LOCK_BILLBOARDS_SYNC = "lock:billboards:sync:num:%s";

+ 7 - 0
4dkankan-utils-rubber-sheeting/pom.xml

@@ -38,6 +38,13 @@
             <artifactId>commons-codec</artifactId>
             <version>${commons-codec.verion}</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.tencentcloudapi</groupId>
+            <artifactId>tencentcloud-sdk-java</artifactId>
+            <version>3.1.322</version>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 81 - 0
4dkankan-utils-rubber-sheeting/src/main/java/com/fdkankan/rubbersheeting/TencentScalingService.java

@@ -0,0 +1,81 @@
+package com.fdkankan.rubbersheeting;
+
+import com.tencentcloudapi.as.v20180419.AsClient;
+import com.tencentcloudapi.as.v20180419.models.ScaleOutInstancesRequest;
+import com.tencentcloudapi.as.v20180419.models.ScaleOutInstancesResponse;
+import com.tencentcloudapi.as.v20180419.models.StopAutoScalingInstancesRequest;
+import com.tencentcloudapi.as.v20180419.models.StopAutoScalingInstancesResponse;
+import com.tencentcloudapi.common.Credential;
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * Created by Hb_zzZ on 2020/8/25.
+ */
+@Slf4j
+@Component
+@ConditionalOnProperty(name = "scaling.type",havingValue = "tencent")
+public class TencentScalingService implements ScalingService{
+
+    @Value("${accessKey.id:xxx}")
+    private static String accessKeyId;
+    @Value("${accessKey.secret:xxx}")
+    private static String accessKeySecret;
+    @Value("${scaling.region:ap-guangzhou}")
+    private String region;
+    @Value("${scaling.group.id:asg-hv68oe36}")
+    private String groupId;
+
+    private AsClient getAsClient(){
+        Credential cred = new Credential(accessKeyId, accessKeySecret);
+        AsClient client = new AsClient(cred, region);
+        return client;
+    }
+
+
+    @Override
+    public String createEcs(){
+        AsClient asClient = this.getAsClient();
+        ScaleOutInstancesRequest req = new ScaleOutInstancesRequest();
+        req.setAutoScalingGroupId(groupId);
+        req.setScaleOutNumber(1L);
+        ScaleOutInstancesResponse resp = null;
+        try {
+            resp = asClient.ScaleOutInstances(req);
+        } catch (TencentCloudSDKException e) {
+            log.error("启动弹性伸缩示例失败", e);
+            return null;
+        }
+        return ScaleOutInstancesResponse.toJsonString(resp);
+    }
+
+    @Override
+    public String createEcsByConfig(Map<String, String> configs) {
+        return null;
+    }
+
+
+    @Override
+    public  String deleteEcs(String id){
+        AsClient asClient = this.getAsClient();
+        StopAutoScalingInstancesRequest req2 = new StopAutoScalingInstancesRequest();
+        req2.setAutoScalingGroupId(groupId);
+        req2.setInstanceIds(new String[]{id});
+        req2.setStoppedMode("STOP_CHARGING");
+        StopAutoScalingInstancesResponse response = null;
+        try {
+            response = asClient.StopAutoScalingInstances(req2);
+        } catch (TencentCloudSDKException e) {
+            log.error("停止弹性伸缩示例失败,实例id:{}",id);
+            return null;
+        }
+        return StopAutoScalingInstancesResponse.toJsonString(response);
+    }
+
+
+}