lyhzzz 2 hete
szülő
commit
00ccd79a78

+ 16 - 0
src/main/java/com/fdkankan/openApi/config/OpenApiConfig.java

@@ -0,0 +1,16 @@
+package com.fdkankan.openApi.config;
+
+import lombok.Data;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@RefreshScope
+@Data
+public class OpenApiConfig {
+
+    @Value("${to-haixin.server-url}")
+    private String serverUrl;
+
+}

+ 8 - 3
src/main/java/com/fdkankan/openApi/dto/www/DownSceneDto.java

@@ -9,29 +9,34 @@ public class DownSceneDto {
     private String msg;
     private String url;
     private Integer percent;
+    private String serverUrl;
 
-    public DownSceneDto(String url) {
+    public DownSceneDto(String url,String serverUrl) {
         this.status = 1;
         this.msg ="下载成功";
         this.url = url;
         this.percent = 100;
+        this.serverUrl = serverUrl;
     }
 
-    public DownSceneDto(String url,Integer percent) {
+    public DownSceneDto(String url,Integer percent,String serverUrl) {
         this.status = 0;
         this.url = url;
         this.percent = percent;
+        this.serverUrl = serverUrl;
         if(percent == 100){
             this.msg ="下载成功";
+            this.status = 1;
         }else {
             this.msg ="打包中。。。";
         }
     }
 
-    public DownSceneDto(String url,Integer percent,Integer status) {
+    public DownSceneDto(String url,Integer percent,Integer status,String serverUrl) {
         this.status = status;
         this.msg ="下载失败";
         this.url = url;
         this.percent = percent;
+        this.serverUrl = serverUrl;
     }
 }

+ 4 - 0
src/main/java/com/fdkankan/openApi/entity/www/ScenePlus.java

@@ -119,5 +119,9 @@ public class ScenePlus implements Serializable {
     @TableLogic(value = "A", delval = "I")
     private String recStatus;
 
+    @TableField("task_id")
+    private String taskId;
 
+    @TableField("k_no")
+    private String kNo;
 }

+ 7 - 4
src/main/java/com/fdkankan/openApi/service/fuison/CaseService.java

@@ -3,6 +3,7 @@ package com.fdkankan.openApi.service.fuison;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.openApi.config.OpenApiConfig;
 import com.fdkankan.openApi.constant.JmgaConstant;
 import com.fdkankan.openApi.dto.www.DownSceneDto;
 import com.fdkankan.openApi.httpclient.client.JmgaClient;
@@ -18,11 +19,13 @@ public class CaseService {
 
     @Autowired
     JmgaClient jmgaClient;
+    @Autowired
+    OpenApiConfig openApiConfig;
+
     public ResultData caseList(CaseParam param) {
         return  jmgaClient.post(JmgaConstant.API_GET_LIST_CASE ,param);
 
     }
-
     public static String caseDownKey = "open-api:fusion:case:";
     @Autowired
     RedisUtil redisUtil;
@@ -40,7 +43,7 @@ public class CaseService {
             Integer checkStatus = checkObject.getInteger("downloadStatus");
             String checkUrl = checkObject.getString("downloadUrl");
             if(StringUtils.isNotBlank(checkUrl)){
-                return new DownSceneDto(checkUrl);
+                return new DownSceneDto(checkUrl,openApiConfig.getServerUrl());
             }
             if(checkStatus !=1){
                 ResultData downResult = jmgaClient.get(JmgaConstant.API_GET_DOWN_SCENE_CASE + "?caseId=" + caseId );
@@ -62,12 +65,12 @@ public class CaseService {
         Integer processStatus = processObj.getInteger("status");
         if(processStatus == 1003){
             redisUtil.del(redisKey);
-            return new DownSceneDto(processUrl,percent,-1);
+            return new DownSceneDto(processUrl,percent,-1,openApiConfig.getServerUrl());
         }
         if((percent == 100 || percent == 0) && processStatus == 1000 ){
             redisUtil.del(redisKey);
         }
-        return new DownSceneDto(processUrl,percent);
+        return new DownSceneDto(processUrl,percent,openApiConfig.getServerUrl());
     }
 
     public ResultData sceneList(Integer caseId) {

+ 2 - 0
src/main/java/com/fdkankan/openApi/service/www/IScenePlusService.java

@@ -42,4 +42,6 @@ public interface IScenePlusService extends IService<ScenePlus> {
     ResultData getSceneViewUserFile(String sceneCode, Long userId);
 
     ResultData getSceneVideo(String sceneCode, Long userId);
+
+    ScenePlus getByTaskId(String num);
 }

+ 17 - 3
src/main/java/com/fdkankan/openApi/service/www/impl/DownSceneServiceImpl.java

@@ -4,11 +4,14 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.openApi.config.OpenApiConfig;
 import com.fdkankan.openApi.constant.JmgaConstant;
 import com.fdkankan.openApi.dto.www.DownSceneDto;
+import com.fdkankan.openApi.entity.www.ScenePlus;
 import com.fdkankan.openApi.httpclient.client.FdKKClient;
 import com.fdkankan.openApi.httpclient.client.JmgaClient;
 import com.fdkankan.openApi.service.www.IDownSceneService;
+import com.fdkankan.openApi.service.www.IScenePlusService;
 import com.fdkankan.web.response.ResultData;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +24,10 @@ public class DownSceneServiceImpl implements IDownSceneService {
 
     @Autowired
     JmgaClient jmgaClient;
+    @Autowired
+    IScenePlusService scenePlusService;
+    @Autowired
+    OpenApiConfig openApiConfig;
 
 
     @Override
@@ -28,6 +35,13 @@ public class DownSceneServiceImpl implements IDownSceneService {
         if(StringUtils.isBlank(num)){
             throw new BusinessException(ErrorCode.PARAM_ERROR);
         }
+        ScenePlus scenePlus = scenePlusService.getByNum(num);
+        if(scenePlus == null){
+            scenePlus = scenePlusService.getByTaskId(num);
+        }
+        if(scenePlus == null){
+            throw new BusinessException(ErrorCode.NOT_RECORD);
+        }
         ResultData checkResult = jmgaClient.get(JmgaConstant.API_GET_CHECK_DOWNLOAD + "?num=" + num +"&isObj="+type);
         if(checkResult.getCode() != 0 || checkResult.getData() == null){
             throw new BusinessException(checkResult.getCode(),checkResult.getMessage());
@@ -36,7 +50,7 @@ public class DownSceneServiceImpl implements IDownSceneService {
         Integer checkStatus = checkObject.getInteger("downloadStatus");
         String checkUrl = checkObject.getString("downloadUrl");
         if(StringUtils.isNotBlank(checkUrl)){
-            return new DownSceneDto(checkUrl);
+            return new DownSceneDto(checkUrl,openApiConfig.getServerUrl());
         }
         if(checkStatus !=1){
             ResultData downResult = jmgaClient.get(JmgaConstant.API_GET_DOWN_SCENE + "?num=" + num +"&isObj="+type);
@@ -55,9 +69,9 @@ public class DownSceneServiceImpl implements IDownSceneService {
         Integer percent = processObj.getInteger("percent");
         Integer processStatus = processObj.getInteger("status");
         if(processStatus == 1003){
-            return new DownSceneDto(processUrl,percent,-1);
+            return new DownSceneDto(processUrl,percent,-1,openApiConfig.getServerUrl());
         }
 
-        return new DownSceneDto(processUrl,percent);
+        return new DownSceneDto(processUrl,percent,openApiConfig.getServerUrl());
     }
 }

+ 5 - 0
src/main/java/com/fdkankan/openApi/service/www/impl/ScenePlusServiceImpl.java

@@ -97,6 +97,11 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
     }
 
     @Override
+    public ScenePlus getByTaskId(String num) {
+        return this.getOne(new LambdaQueryWrapper<ScenePlus>().eq(ScenePlus::getTaskId, num));
+    }
+
+    @Override
     public ResultData createVirtualScene(CreateFicTitiousSceneParamVO param) throws Exception {
 
         this.checkParams4createVirtualScene(param);