|
@@ -1,14 +1,32 @@
|
|
|
package com.fdkankan.contro.controller;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.fdkankan.common.constant.CommonStatus;
|
|
|
+import com.fdkankan.contro.entity.ScenePlus;
|
|
|
+import com.fdkankan.contro.entity.ScenePlusExt;
|
|
|
import com.fdkankan.contro.service.ICommonService;
|
|
|
import com.fdkankan.contro.service.IScene3dNumService;
|
|
|
+import com.fdkankan.contro.service.IScenePlusExtService;
|
|
|
+import com.fdkankan.contro.service.IScenePlusService;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.model.utils.SceneUtil;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* </p>
|
|
@@ -16,6 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
* @author dengsixing
|
|
|
* @since 2022/12/12
|
|
|
**/
|
|
|
+@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping("/test")
|
|
|
public class TestController {
|
|
@@ -26,10 +45,75 @@ public class TestController {
|
|
|
private ICommonService commonService;
|
|
|
@Value("${4dkk.laserService.bucket}")
|
|
|
private String bucket;
|
|
|
+ @Autowired
|
|
|
+ private IScenePlusExtService scenePlusExtService;
|
|
|
+ @Resource
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
+ @Autowired
|
|
|
+ private IScenePlusService scenePlusService;
|
|
|
+ @Value("${4dkk.laserService.basePath}")
|
|
|
+ private String laserHost;
|
|
|
|
|
|
@GetMapping("/test")
|
|
|
public ResultData test(String num) throws Exception {
|
|
|
return ResultData.ok(bucket);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/repairMixture")
|
|
|
+ public ResultData repairMixture(){
|
|
|
+ List<ScenePlusExt> list = scenePlusExtService.list(new LambdaQueryWrapper<ScenePlusExt>().eq(ScenePlusExt::getLocation, 6));
|
|
|
+ if(CollUtil.isNotEmpty(list)){
|
|
|
+ list.stream().forEach(scenePlusExt -> {
|
|
|
+ try {
|
|
|
+ Integer shootCount = 0;
|
|
|
+ Integer mixture = Objects.isNull(scenePlusExt.getMixture()) ? 0 : scenePlusExt.getMixture();
|
|
|
+ String homePath = SceneUtil.getHomePath(scenePlusExt.getDataSource());
|
|
|
+ JSONObject dataFdageObj = JSON.parseObject(fYunFileService.getFileContent(homePath.concat("data.fdage")));
|
|
|
+ if(Objects.nonNull(dataFdageObj)){
|
|
|
+ JSONArray points = dataFdageObj.getJSONArray("points");
|
|
|
+ if(CollUtil.isNotEmpty(points)){
|
|
|
+ shootCount = points.size();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(Objects.nonNull(shootCount) && shootCount > 0){
|
|
|
+ if(scenePlusExt.getLocation() == 6){
|
|
|
+ mixture = CommonStatus.YES.code().intValue();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ String slamDataStr = fYunFileService.getFileContent(homePath.concat("slam_data.json"));
|
|
|
+ JSONObject slamDataObj = JSON.parseObject(slamDataStr);
|
|
|
+ if(Objects.nonNull(slamDataObj)){
|
|
|
+ JSONArray viewsInfo = slamDataObj.getJSONArray("views_info");
|
|
|
+ if(CollUtil.isNotEmpty(viewsInfo)){
|
|
|
+ shootCount = viewsInfo.stream().mapToInt(info -> {
|
|
|
+ return ((JSONObject) info).getJSONArray("list_pose").size();
|
|
|
+ }).sum();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mixture = CommonStatus.NO.code().intValue();
|
|
|
+ }
|
|
|
+ scenePlusExt.setMixture(mixture);
|
|
|
+ scenePlusExt.setShootCount(shootCount);
|
|
|
+ scenePlusExtService.updateById(scenePlusExt);
|
|
|
+
|
|
|
+ ScenePlus scenePlus = scenePlusService.getById(scenePlusExt.getPlusId());
|
|
|
+
|
|
|
+ if(mixture == 1){
|
|
|
+ String url = laserHost + "/laser/4dage/mixture/{sceneCode}";
|
|
|
+ url = url.replace("{sceneCode}", scenePlus.getNum());
|
|
|
+ HttpUtil.post(url, "");
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("修复mixture失败,num:{}", scenePlusExt.getWebSite(), e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|