|
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.io.IOException;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Collection;
|
|
|
import java.util.HashMap;
|
|
@@ -45,12 +46,17 @@ public class SceneDynamicPanelServiceImpl extends ServiceImpl<ISceneDynamicPanel
|
|
|
private FYunFileServiceInterface fileServiceInterface;
|
|
|
|
|
|
@Override
|
|
|
- public void save(Long userId, SceneDynamicPanelParamVO param) {
|
|
|
+ public void save(Long userId, SceneDynamicPanelParamVO param) throws IOException {
|
|
|
|
|
|
ScenePlus scenePlus = scenePlusService.getByNumAndUserId(userId, param.getNum());
|
|
|
if(Objects.isNull(scenePlus)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
+
|
|
|
+ //上传文件
|
|
|
+ String editPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "dynamicPanel.json";
|
|
|
+ String viewPath = String.format(UploadFilePath.USER_VIEW_PATH, param.getNum()) + "dynamicPanel.json";
|
|
|
+
|
|
|
SceneDynamicPanel one = this.getOne(new LambdaQueryWrapper<SceneDynamicPanel>().eq(SceneDynamicPanel::getNum, param.getNum()));
|
|
|
String sid = null;
|
|
|
if(Objects.isNull(one)){
|
|
@@ -58,16 +64,19 @@ public class SceneDynamicPanelServiceImpl extends ServiceImpl<ISceneDynamicPanel
|
|
|
one = new SceneDynamicPanel();
|
|
|
one.setSid(sid);
|
|
|
one.setNum(param.getNum());
|
|
|
+
|
|
|
+ if(fileServiceInterface.fileExist(editPath)){
|
|
|
+ fileServiceInterface.deleteFile(editPath);
|
|
|
+ }
|
|
|
+ if(fileServiceInterface.fileExist(viewPath)){
|
|
|
+ fileServiceInterface.deleteFile(viewPath);
|
|
|
+ }
|
|
|
+
|
|
|
}else{
|
|
|
sid = one.getSid();
|
|
|
}
|
|
|
this.saveOrUpdate(one);
|
|
|
|
|
|
-
|
|
|
- //上传文件
|
|
|
- String editPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "dynamicPanel.json";
|
|
|
- String viewPath = String.format(UploadFilePath.USER_VIEW_PATH, param.getNum()) + "dynamicPanel.json";
|
|
|
-
|
|
|
Map<String, JSONObject> map = new HashMap<>();
|
|
|
if(fileServiceInterface.fileExist(editPath)){
|
|
|
String fileContent = fileServiceInterface.getFileContent(editPath);
|