|
@@ -8,13 +8,11 @@ import com.fdkankan.fusion.common.ResultCode;
|
|
import com.fdkankan.fusion.common.ResultData;
|
|
import com.fdkankan.fusion.common.ResultData;
|
|
import com.fdkankan.fusion.common.ai.BBoxHierarchyBuilder;
|
|
import com.fdkankan.fusion.common.ai.BBoxHierarchyBuilder;
|
|
import com.fdkankan.fusion.common.ai.FloorUser;
|
|
import com.fdkankan.fusion.common.ai.FloorUser;
|
|
|
|
+import com.fdkankan.fusion.common.ai.Floors;
|
|
import com.fdkankan.fusion.common.util.Openai;
|
|
import com.fdkankan.fusion.common.util.Openai;
|
|
import com.fdkankan.fusion.common.util.UploadToOssUtil;
|
|
import com.fdkankan.fusion.common.util.UploadToOssUtil;
|
|
import com.fdkankan.fusion.config.FusionConfig;
|
|
import com.fdkankan.fusion.config.FusionConfig;
|
|
-import com.fdkankan.fusion.entity.CaseFiles;
|
|
|
|
-import com.fdkankan.fusion.entity.CaseFilesType;
|
|
|
|
-import com.fdkankan.fusion.entity.CaseInquestInfo;
|
|
|
|
-import com.fdkankan.fusion.entity.CaseNumEntity;
|
|
|
|
|
|
+import com.fdkankan.fusion.entity.*;
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
import com.fdkankan.fusion.request.AiParam;
|
|
import com.fdkankan.fusion.request.AiParam;
|
|
import com.fdkankan.fusion.response.FloorPathVo;
|
|
import com.fdkankan.fusion.response.FloorPathVo;
|
|
@@ -30,6 +28,7 @@ import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -50,8 +49,8 @@ public class AiController {
|
|
AiService aiService;
|
|
AiService aiService;
|
|
|
|
|
|
@PostMapping("/test")
|
|
@PostMapping("/test")
|
|
- public ResultData test( ) throws IOException {
|
|
|
|
- FloorUser floorPlanResults = aiService.coverFloorPlanJson("C:\\Users\\4DAGE\\Downloads\\floorplan-ai.json");
|
|
|
|
|
|
+ public ResultData test(@RequestParam(required = false) String path ) throws IOException {
|
|
|
|
+ FloorUser floorPlanResults = aiService.coverFloorPlanJson(path);
|
|
// BBoxHierarchy.buildHierarchy(floorPlanResults.getFloors());
|
|
// BBoxHierarchy.buildHierarchy(floorPlanResults.getFloors());
|
|
JSONArray jsonArray = BBoxHierarchyBuilder.buildHierarchyStart(floorPlanResults.getFloors());
|
|
JSONArray jsonArray = BBoxHierarchyBuilder.buildHierarchyStart(floorPlanResults.getFloors());
|
|
return ResultData.ok(jsonArray);
|
|
return ResultData.ok(jsonArray);
|
|
@@ -73,24 +72,20 @@ public class AiController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
ICaseNumService caseNumService;
|
|
ICaseNumService caseNumService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IScenePlusService scenePlusService;
|
|
@GetMapping("/getFloor/{caseId}")
|
|
@GetMapping("/getFloor/{caseId}")
|
|
public ResultData getFloor(@PathVariable Integer caseId){
|
|
public ResultData getFloor(@PathVariable Integer caseId){
|
|
String foorPath = "/oss/4dkankan/scene_view_data/%s/user";
|
|
String foorPath = "/oss/4dkankan/scene_view_data/%s/user";
|
|
- String fileName = "cad";
|
|
|
|
- String extName = "jpg";
|
|
|
|
|
|
+ String fileName = "floorplan-ai";
|
|
|
|
+ String extName = "json";
|
|
List<CaseNumEntity> byCaseId = caseNumService.getByCaseId(caseId);
|
|
List<CaseNumEntity> byCaseId = caseNumService.getByCaseId(caseId);
|
|
- List<FloorPathVo> pathVos = new ArrayList<>();
|
|
|
|
- for (CaseNumEntity caseNumEntity : byCaseId) {
|
|
|
|
- if(caseNumEntity.getNumType() == 3){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ List<String> numList = byCaseId.stream().filter(e -> e.getNumType() != 3 && e.getNumType() != 2 && e.getNumType()!=5).map(CaseNumEntity::getNum).collect(Collectors.toList());
|
|
|
|
+ List<ScenePlus> scenePluses = scenePlusService.getByNumListAndAi(numList);
|
|
|
|
|
|
- if(pathVos.stream().anyMatch(e -> e.getNum().equals(caseNumEntity.getNum()))){
|
|
|
|
- continue;
|
|
|
|
- };
|
|
|
|
|
|
+ List<FloorPathVo> pathVos = new ArrayList<>();
|
|
|
|
+ for (ScenePlus caseNumEntity : scenePluses) {
|
|
|
|
|
|
- FloorPathVo pathVo = new FloorPathVo();
|
|
|
|
- pathVo.setNum(caseNumEntity.getNum());
|
|
|
|
String path = String.format(foorPath, caseNumEntity.getNum());
|
|
String path = String.format(foorPath, caseNumEntity.getNum());
|
|
File file = new File(path);
|
|
File file = new File(path);
|
|
File[] files = file.listFiles();
|
|
File[] files = file.listFiles();
|
|
@@ -99,14 +94,36 @@ public class AiController {
|
|
}
|
|
}
|
|
for (File file1 : files) {
|
|
for (File file1 : files) {
|
|
if(file1.getName().contains(fileName) && file1.getName().contains(extName)){
|
|
if(file1.getName().contains(fileName) && file1.getName().contains(extName)){
|
|
- pathVo.getUrls().add(file1.getPath().replace("4dkankan/",""));
|
|
|
|
|
|
+ try {
|
|
|
|
+ FloorUser floorPlanResults = aiService.coverFloorPlanJson(file1.getPath());
|
|
|
|
+ for (Floors floor : floorPlanResults.getFloors()) {
|
|
|
|
+ if(floor == null ){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ JSONObject jsonObject = BBoxHierarchyBuilder.buildHierarchyStart(floor);
|
|
|
|
+ if(jsonObject == null ){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ FloorPathVo pathVo = new FloorPathVo();
|
|
|
|
+ pathVo.setNum(caseNumEntity.getNum());
|
|
|
|
+ pathVo.setTitle(caseNumEntity.getTitle() + floor.getFloorsName());
|
|
|
|
+ pathVo.setParams(jsonObject);
|
|
|
|
+ pathVo.setUrl(foorPath.replace("4dkankan/","")+"/cad-style-3-"+floor.getSubgroup()+".jpg");
|
|
|
|
+ pathVos.add(pathVo);
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.info("getFloor-error:{}",e);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- pathVos.add(pathVo);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
return ResultData.ok(pathVos);
|
|
return ResultData.ok(pathVos);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|