|
@@ -16,13 +16,17 @@ import com.fdkankan.download.constant.UserEditDataType;
|
|
|
import com.fdkankan.download.entity.*;
|
|
|
import com.fdkankan.download.factory.UserEditData.UserEditDataHandler;
|
|
|
import com.fdkankan.download.factory.UserEditData.UserEditDataHandlerFactory;
|
|
|
+import com.fdkankan.download.httpclient.MyClient;
|
|
|
import com.fdkankan.download.service.*;
|
|
|
+import com.fdkankan.download.util.RsaUtils;
|
|
|
import com.fdkankan.fyun.config.FYunFileConfig;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
+import com.fdkankan.web.response.ResultData;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -33,6 +37,9 @@ import java.util.*;
|
|
|
@Service
|
|
|
public class ScrbServiceImpl implements IScrbService {
|
|
|
|
|
|
+ @Value("${main.url}")
|
|
|
+ private String mainUrl;
|
|
|
+
|
|
|
@Resource
|
|
|
private FYunFileServiceInterface fYunFileService;
|
|
|
@Autowired
|
|
@@ -47,8 +54,11 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
private ISceneEditInfoExtService sceneEditInfoExtService;
|
|
|
@Autowired
|
|
|
private ISceneEditControlsService sceneEditControlsService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private RedisUtil redisUtil;
|
|
|
+ @Resource
|
|
|
+ private MyClient httpClient;
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -93,12 +103,37 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
fYunFileService.uploadFile(file.getAbsolutePath(), file.getAbsolutePath().replace(scenePath, ""));
|
|
|
});
|
|
|
|
|
|
+ //上传mapping
|
|
|
+ files = FileUtil.loopFiles(scenePath + "scene_edit_data/");
|
|
|
+ files.stream().forEach(file -> {
|
|
|
+ fYunFileService.uploadFile(file.getAbsolutePath(), file.getAbsolutePath().replace(scenePath, ""));
|
|
|
+ });
|
|
|
+
|
|
|
//插入数据库,如果是重推,不需要执行这部
|
|
|
ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
if(Objects.isNull(scenePlus)){
|
|
|
+
|
|
|
+ String cameraObjStr = FileUtil.readUtf8String(scenePath + "camera.txt");
|
|
|
+ JSONObject cameraObj = JSON.parseObject(cameraObjStr);
|
|
|
+ Integer cameraType = cameraObj.getInteger("cameraType");
|
|
|
+ String snCode = cameraObj.getString("snCode");
|
|
|
+ //调用接口入库
|
|
|
+ Map<String, Object> signPlayload = new HashMap<>();
|
|
|
+ signPlayload.put("appId", "ucenter");
|
|
|
+ signPlayload.put("timestamp", Calendar.getInstance().getTimeInMillis());
|
|
|
+ String sign = RsaUtils.encipher(JSON.toJSONString(signPlayload), RsaUtils.publicKey);
|
|
|
+
|
|
|
+ JSONObject params = new JSONObject();
|
|
|
+ params.put("cameraType", cameraType);
|
|
|
+ params.put("snCode", snCode);
|
|
|
+ ResultData resultData = httpClient.postJson("http://127.0.0.1:8081/ucenter/_inner/cameraInStore", sign, params);
|
|
|
+ Object data = resultData.getData();
|
|
|
+ Long cameraId = ((JSONObject)data).getLong("id");
|
|
|
+
|
|
|
String scenePlusStr = FileUtil.readUtf8String(scenePath + "scenePlus.txt");
|
|
|
scenePlus = JSON.parseObject(scenePlusStr, ScenePlus.class);
|
|
|
scenePlus.setId(null);
|
|
|
+ scenePlus.setCameraId(cameraId);
|
|
|
scenePlusService.save(scenePlus);
|
|
|
|
|
|
String scenePlusExtStr = FileUtil.readUtf8String(scenePath + "scenePlusExt.txt");
|
|
@@ -109,12 +144,14 @@ public class ScrbServiceImpl implements IScrbService {
|
|
|
scenePlusExt.setPlusId(scenePlus.getId());
|
|
|
scenePlusExt.setYunFileBucket(null);
|
|
|
scenePlusExt.getVideos().replaceAll("https://4dkk.4dage.com/", fYunFileConfig.getHost());
|
|
|
+ scenePlusExt.setWebSite(scenePlusExt.getWebSite().replace("https://test.4dkankan.com", mainUrl).replace("https://www.4dkankan.com", mainUrl));
|
|
|
scenePlusExtService.save(scenePlusExt);
|
|
|
|
|
|
String sceneEditInfoStr = FileUtil.readUtf8String(scenePath + "sceneEditInfo.txt");
|
|
|
SceneEditInfo sceneEditInfo = JSON.parseObject(sceneEditInfoStr, SceneEditInfo.class);
|
|
|
sceneEditInfo.setId(null);
|
|
|
sceneEditInfo.setScenePlusId(scenePlus.getId());
|
|
|
+ sceneEditInfo.setTags((byte)0);
|
|
|
sceneEditInfoService.save(sceneEditInfo);
|
|
|
|
|
|
String sceneEditInfoExtStr = FileUtil.readUtf8String(scenePath + "sceneEditInfoExt.txt");
|