|
@@ -702,7 +702,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData uploadDxf(MultipartFile file, String num) throws Exception {
|
|
|
+ public ResultData uploadDxf(MultipartFile file, String num, Integer subgroup) throws Exception {
|
|
|
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
@@ -717,6 +717,25 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
try {
|
|
|
String editUserPath = String.format(UploadFilePath.USER_EDIT_PATH, num);
|
|
|
FdJsonToDxfUtil.dxfToFdJson(dfxPath, floorplanUserPath);
|
|
|
+
|
|
|
+ String floorplanUserStr = FileUtil.readUtf8String(floorplanUserPath);
|
|
|
+ JSONObject floorplanUserObj = JSON.parseObject(floorplanUserStr);
|
|
|
+ JSONArray floors = floorplanUserObj.getJSONArray("floors");
|
|
|
+ JSONObject floor = floors.getJSONObject(0);
|
|
|
+
|
|
|
+ String ossFloorplanUserStr = fYunFileService.getFileContent(editUserPath + "floorplan.json");
|
|
|
+ JSONObject ossFloorplanUserObj = JSON.parseObject(ossFloorplanUserStr);
|
|
|
+ JSONArray ossFloors = ossFloorplanUserObj.getJSONArray("floors");
|
|
|
+ for(int i = 0; i < ossFloors.size(); i++){
|
|
|
+ JSONObject item = (JSONObject) ossFloors.get(i);
|
|
|
+ Integer itemSubgroup = item.getInteger("subgroup");
|
|
|
+ if(itemSubgroup == subgroup){
|
|
|
+ ossFloors.set(i, floor);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ FileUtil.writeUtf8String(ossFloorplanUserObj.toJSONString(), floorplanUserPath);
|
|
|
+
|
|
|
fYunFileService.uploadFile(scenePlusExt.getYunFileBucket(), floorplanUserPath, editUserPath + "floorplan.json");
|
|
|
JSONObject houseTypeJson = CreateHouseJsonUtil
|
|
|
.createHouseTypeJsonByUser(floorplanUserPath);
|
|
@@ -746,20 +765,20 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData downloadDxf(String num) throws Exception {
|
|
|
+ public ResultData downloadDxf(String num, Integer subgroup) throws Exception {
|
|
|
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
|
|
|
- if(Objects.isNull(sceneEditInfo.getFloorPlanUser()) || sceneEditInfo.getFloorPlanUser() == CommonStatus.NO.code()){
|
|
|
- return ResultData.ok();
|
|
|
+ String ossFloorplanPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "floorplan.json";
|
|
|
+ if(Objects.nonNull(sceneEditInfo.getFloorPlanUser()) && sceneEditInfo.getFloorPlanUser() == CommonStatus.YES.code().intValue()){
|
|
|
+ ossFloorplanPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "floorplan.json";
|
|
|
}
|
|
|
|
|
|
String localFloorplan = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + UUID.randomUUID() + ".json";
|
|
|
- fYunFileService.downloadFile(scenePlusExt.getYunFileBucket(),
|
|
|
- String.format(UploadFilePath.USER_EDIT_PATH, num) + "floorplan.json", localFloorplan);
|
|
|
+ fYunFileService.downloadFile(scenePlusExt.getYunFileBucket(), ossFloorplanPath, localFloorplan);
|
|
|
String localDxf = String.format(ConstantFilePath.SCENE_USER_PATH_V4, num) + UUID.randomUUID() + ".dxf";
|
|
|
- FdJsonToDxfUtil.fdJsonToDxf(localFloorplan, localDxf);
|
|
|
+ FdJsonToDxfUtil.fdJsonToDxf(localFloorplan, localDxf, subgroup);
|
|
|
String key = OssFileUtil.getUploadTempFileKey(null, "dxf");
|
|
|
fYunFileService.uploadFile(scenePlusExt.getYunFileBucket(), localDxf, key);
|
|
|
String url = fYunFileConfig.getHost() + key;
|