|
@@ -2,11 +2,13 @@ package com.fdkankan.contro.mq.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.contro.mq.service.ICommonService;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.constants.UploadFilePath;
|
|
|
+import com.fdkankan.model.utils.FloorPlanUserUtil;
|
|
|
import com.fdkankan.model.utils.SceneUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -16,6 +18,7 @@ import java.io.File;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
@@ -88,4 +91,20 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
//开始上传
|
|
|
fYunFileServiceInterface.uploadMulFiles(uploadMap);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void uploadFloorplanJson(String num, String dataSource) throws Exception{
|
|
|
+ String floorPlanCardFilePath = dataSource + File.separator + "results/floorplan_cad.json";
|
|
|
+ if (!new File(floorPlanCardFilePath).exists()) {
|
|
|
+ log.error("floorplan_cad.json 文件不存在,文件路径:{}", floorPlanCardFilePath);
|
|
|
+ throw new Exception("floorplan_cad.json 文件不存在,文件路径:" + floorPlanCardFilePath);
|
|
|
+ }
|
|
|
+ JSONObject json = FloorPlanUserUtil.createFloorPlanUserJson(floorPlanCardFilePath);
|
|
|
+ if(Objects.isNull(json)){
|
|
|
+ log.error("生成floorplan.json失败,cadPath:", floorPlanCardFilePath);
|
|
|
+ throw new Exception("生成floorplan.json失败,cadPath:" + floorPlanCardFilePath);
|
|
|
+ }
|
|
|
+ String hourseTypeJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "floorplan.json";
|
|
|
+ fYunFileServiceInterface.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
|
|
|
+ }
|
|
|
}
|