|
@@ -2,18 +2,23 @@ package com.fdkankan.external.service.impl;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.external.entity.*;
|
|
|
+import com.fdkankan.external.httpclient.HttpClient;
|
|
|
import com.fdkankan.external.service.*;
|
|
|
+import com.fdkankan.external.util.ScrbObsUtil;
|
|
|
+import com.fdkankan.fyun.config.FYunFileConfig;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class ScrbServiceImpl implements IScrbService {
|
|
@@ -22,6 +27,12 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
|
|
|
@Resource
|
|
|
private FYunFileServiceInterface fYunFileService;
|
|
|
+ @Resource
|
|
|
+ private FYunFileConfig fYunFileConfig;
|
|
|
+ @Resource
|
|
|
+ private ScrbObsUtil scrbObsUtil;
|
|
|
+ @Resource
|
|
|
+ private HttpClient httpClient;
|
|
|
|
|
|
@Autowired
|
|
|
private IScenePlusService scenePlusService;
|
|
@@ -33,13 +44,15 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
private ISceneEditInfoExtService sceneEditInfoExtService;
|
|
|
@Autowired
|
|
|
private ISceneEditControlsService sceneEditControlsService;
|
|
|
+ @Autowired
|
|
|
+ private IDepartmentService departmentService;
|
|
|
|
|
|
@Override
|
|
|
public void packageScene(JSONObject jsonObject) {
|
|
|
|
|
|
String num = jsonObject.getString("num");
|
|
|
String path = basePath + num + "/";
|
|
|
- String sourcePath = path + "source/";
|
|
|
+ String sourcePath = path + num + "/";
|
|
|
String zipPath = path + num + ".zip";
|
|
|
FileUtil.mkdir(sourcePath);
|
|
|
|
|
@@ -50,7 +63,9 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfo.getId());
|
|
|
SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfo.getId());
|
|
|
FileUtil.writeUtf8String(JSON.toJSONString(scenePlus), sourcePath + "scenePlus.txt");
|
|
|
- FileUtil.writeUtf8String(JSON.toJSONString(scenePlusExt), sourcePath + "scenePlusExt.txt");
|
|
|
+ String scenePlusExtStr = JSON.toJSONString(scenePlusExt);
|
|
|
+ scenePlusExtStr.replace(fYunFileConfig.getHost(), scrbObsUtil.getHost());
|
|
|
+ FileUtil.writeUtf8String(scenePlusExtStr, sourcePath + "scenePlusExt.txt");
|
|
|
FileUtil.writeUtf8String(JSON.toJSONString(sceneEditInfo), sourcePath + "sceneEditInfo.txt");
|
|
|
FileUtil.writeUtf8String(JSON.toJSONString(sceneEditInfoExt), sourcePath + "sceneEditInfoExt.txt");
|
|
|
FileUtil.writeUtf8String(JSON.toJSONString(sceneEditControls), sourcePath + "sceneEditControls.txt");
|
|
@@ -76,6 +91,22 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
}
|
|
|
|
|
|
//上传obs
|
|
|
+ String key = "scene/zip/" + num + ".zip";
|
|
|
+ scrbObsUtil.uploadFile(zipPath, key, null);
|
|
|
+
|
|
|
+ FileUtil.del(sourcePath);
|
|
|
+ FileUtil.del(zipPath);
|
|
|
+
|
|
|
+ Department department = departmentService.getByCode("scrb");
|
|
|
+ String url = department.getDestUrl();
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("num", num);
|
|
|
+ param.put("key", key);
|
|
|
+// JSONObject result = httpClient.postJson(url, param);
|
|
|
+// result.getInteger("code");
|
|
|
+// if(){
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
|
|
|
}
|