|
@@ -6,12 +6,10 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.common.constant.ConstantFilePath;
|
|
|
import com.fdkankan.common.constant.SceneKind;
|
|
|
import com.fdkankan.common.constant.SceneResolution;
|
|
|
import com.fdkankan.common.constant.UploadFilePath;
|
|
|
-import com.fdkankan.common.response.Result;
|
|
|
import com.fdkankan.common.response.ResultData;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.common.util.MatrixToImageWriterUtil;
|
|
@@ -27,7 +25,6 @@ import com.fdkankan.repair.entity.ScenePlus;
|
|
|
import com.fdkankan.repair.entity.ScenePlusExt;
|
|
|
import com.fdkankan.repair.entity.ScenePro;
|
|
|
import com.fdkankan.repair.entity.SceneProExt;
|
|
|
-import com.fdkankan.repair.httpclient.FdkankanMiniClient;
|
|
|
import com.fdkankan.repair.service.ISceneEditInfoService;
|
|
|
import com.fdkankan.repair.service.IScenePlusExtService;
|
|
|
import com.fdkankan.repair.service.IScenePlusService;
|
|
@@ -42,7 +39,6 @@ import java.util.Objects;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -83,10 +79,6 @@ public class SceneRepairController {
|
|
|
private RedisUtil redisUtil;
|
|
|
@Autowired
|
|
|
private RabbitMqProducer rabbitMqProducer;
|
|
|
- @Autowired
|
|
|
- private FdkankanMiniClient fdkankanMiniClient;
|
|
|
- @Value("${http.host.4dkankanMini}")
|
|
|
- private String fkankanMiniHost;
|
|
|
@Value("${main.url}")
|
|
|
private String mainUrl;
|
|
|
@Value("${scene.pro.new.url}")
|
|
@@ -267,45 +259,49 @@ public class SceneRepairController {
|
|
|
}
|
|
|
for (ScenePlus scenePlus : scenePlusList) {
|
|
|
|
|
|
- //修复数据库
|
|
|
- ScenePlusExt scenePlusExt = scenePlusExtService.getOne(
|
|
|
- new LambdaQueryWrapper<ScenePlusExt>()
|
|
|
- .eq(ScenePlusExt::getPlusId, scenePlus.getId()));
|
|
|
- if(SceneResolution.TILES.code().equals(scenePlusExt.getSceneResolution())){
|
|
|
- scenePlusExt.setSceneKind(SceneKind.FACE.code());
|
|
|
- }else{
|
|
|
- scenePlusExt.setSceneKind(SceneKind.TILES.code());
|
|
|
- }
|
|
|
-
|
|
|
- if(scenePlus.getSceneSource() == 1){
|
|
|
- scenePlusExt.setSceneResolution("2k");
|
|
|
- }else if(scenePlus.getSceneSource() == 2){
|
|
|
- scenePlusExt.setSceneResolution("1k");
|
|
|
- }else if(scenePlus.getSceneSource() == 3 || scenePlus.getSceneSource() == 4){
|
|
|
- scenePlusExt.setSceneResolution("4k");
|
|
|
+ try {
|
|
|
+ //修复数据库
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getOne(
|
|
|
+ new LambdaQueryWrapper<ScenePlusExt>()
|
|
|
+ .eq(ScenePlusExt::getPlusId, scenePlus.getId()));
|
|
|
+ if(SceneResolution.TILES.code().equals(scenePlusExt.getSceneResolution())){
|
|
|
+ scenePlusExt.setSceneKind(SceneKind.FACE.code());
|
|
|
+ }else{
|
|
|
+ scenePlusExt.setSceneKind(SceneKind.TILES.code());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(scenePlus.getSceneSource() == 1){
|
|
|
+ scenePlusExt.setSceneResolution("2k");
|
|
|
+ }else if(scenePlus.getSceneSource() == 2){
|
|
|
+ scenePlusExt.setSceneResolution("1k");
|
|
|
+ }else if(scenePlus.getSceneSource() == 3 || scenePlus.getSceneSource() == 4){
|
|
|
+ scenePlusExt.setSceneResolution("4k");
|
|
|
+ }
|
|
|
+ scenePlusExtService.updateById(scenePlusExt);
|
|
|
+
|
|
|
+ //更新版本号
|
|
|
+ SceneEditInfo sceneEditInfo = sceneEditInfoService.getOne(new LambdaQueryWrapper<SceneEditInfo>().eq(SceneEditInfo::getScenePlusId, scenePlus.getId()));
|
|
|
+ sceneEditInfo.setVersion(sceneEditInfo.getVersion() + 1);
|
|
|
+ sceneEditInfoService.updateById(sceneEditInfo);
|
|
|
+
|
|
|
+ //修复scene.json
|
|
|
+ String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, scenePlus.getNum()) + "scene.json";
|
|
|
+ String sceneJsonStr = uploadToOssUtil.getObjectContent(this.bucket, sceneJsonPath);
|
|
|
+ if(StrUtil.isNotEmpty(sceneJsonStr)){
|
|
|
+ JSONObject sceneJsonObject = JSON.parseObject(sceneJsonStr);
|
|
|
+ sceneJsonObject.put("sceneResolution", scenePlusExt.getSceneResolution());
|
|
|
+ sceneJsonObject.put("sceneKind", scenePlusExt.getSceneKind());
|
|
|
+ sceneJsonObject.put("version", sceneEditInfo.getVersion());
|
|
|
+ uploadToOssUtil.upload(sceneJsonObject.toJSONString().getBytes(StandardCharsets.UTF_8), sceneJsonPath);
|
|
|
+ }else{
|
|
|
+ log.error("没有找到scene.json,路径=" + sceneJsonPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ //清除scene.json缓存
|
|
|
+ redisUtil.del(String.format(RedisKey.SCENE_JSON, scenePlus.getNum()));
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("修复sceneKind字段失败,num=" + scenePlus.getNum(), e);
|
|
|
}
|
|
|
- scenePlusExtService.updateById(scenePlusExt);
|
|
|
-
|
|
|
- //更新版本号
|
|
|
- SceneEditInfo sceneEditInfo = sceneEditInfoService.getOne(new LambdaQueryWrapper<SceneEditInfo>().eq(SceneEditInfo::getScenePlusId, scenePlus.getId()));
|
|
|
- sceneEditInfo.setVersion(sceneEditInfo.getVersion() + 1);
|
|
|
- sceneEditInfoService.updateById(sceneEditInfo);
|
|
|
-
|
|
|
- //修复scene.json
|
|
|
- String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, scenePlus.getNum()) + "scene.json";
|
|
|
- String sceneJsonStr = uploadToOssUtil.getObjectContent(this.bucket, sceneJsonPath);
|
|
|
- if(StrUtil.isNotEmpty(sceneJsonStr)){
|
|
|
- JSONObject sceneJsonObject = JSON.parseObject(sceneJsonStr);
|
|
|
- sceneJsonObject.put("sceneResolution", scenePlusExt.getSceneResolution());
|
|
|
- sceneJsonObject.put("sceneKind", scenePlusExt.getSceneKind());
|
|
|
- sceneJsonObject.put("version", sceneEditInfo.getVersion());
|
|
|
- uploadToOssUtil.upload(sceneJsonObject.toJSONString().getBytes(StandardCharsets.UTF_8), sceneJsonPath);
|
|
|
- }else{
|
|
|
- log.error("没有找到scene.json,路径=" + sceneJsonPath);
|
|
|
- }
|
|
|
-
|
|
|
- //清除scene.json缓存
|
|
|
- redisUtil.del(String.format(RedisKey.SCENE_JSON, scenePlus.getNum()));
|
|
|
|
|
|
}
|
|
|
|