|
@@ -7,6 +7,7 @@ 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.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.job.entity.SceneEditInfo;
|
|
@@ -26,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
@@ -47,7 +49,7 @@ public class RepairMixtureHandler {
|
|
|
private IScenePlusService scenePlusService;
|
|
|
@Autowired
|
|
|
private IScenePlusExtService scenePlusExtService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private FYunFileServiceInterface fYunFileService;
|
|
|
@Autowired
|
|
|
private ISceneEditInfoService sceneEditInfoService;
|
|
@@ -65,41 +67,51 @@ public class RepairMixtureHandler {
|
|
|
list.stream().forEach(scenePlusExt -> {
|
|
|
try {
|
|
|
Integer shootCount = 0;
|
|
|
- Integer mixture = Objects.isNull(scenePlusExt.getMixture()) ? 0 : scenePlusExt.getMixture();
|
|
|
+ Integer slamCount = 0;
|
|
|
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(fYunFileService.fileExist(homePath.concat("data.fdage"))){
|
|
|
+ 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{
|
|
|
+ if(fYunFileService.fileExist(homePath.concat("slam_data.json"))){
|
|
|
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 -> {
|
|
|
+ slamCount = 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);
|
|
|
+
|
|
|
+ Integer mixture = CommonStatus.NO.code().intValue();
|
|
|
+ if(shootCount > 0 && slamCount > 0){
|
|
|
+ mixture = CommonStatus.YES.code().intValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ scenePlusExtService.update(
|
|
|
+ new LambdaUpdateWrapper<ScenePlusExt>()
|
|
|
+ .set(ScenePlusExt::getShootCount, shootCount)
|
|
|
+ .set(ScenePlusExt::getSlamCount, slamCount)
|
|
|
+ .set(ScenePlusExt::getMixture, mixture)
|
|
|
+ .eq(ScenePlusExt::getId, scenePlusExt.getId()));
|
|
|
|
|
|
ScenePlus scenePlus = scenePlusService.getById(scenePlusExt.getPlusId());
|
|
|
|
|
|
if(mixture == 1){
|
|
|
- String url = laserHost + "/laser/4dage/mixture/{sceneCode}";
|
|
|
+ boolean isMix = mixture == 0 ? false : true;
|
|
|
+ String url = laserHost + "/laser/4dage/fixSlamCount/{sceneCode}/{slamCount}/{mixture}/{shootCount}";
|
|
|
url = url.replace("{sceneCode}", scenePlus.getNum());
|
|
|
+ url = url.replace("{slamCount}", slamCount+"");
|
|
|
+ url = url.replace("{mixture}", scenePlus.getNum());
|
|
|
+ url = url.replace("{shootCount}", shootCount+"");
|
|
|
HttpUtil.post(url, "");
|
|
|
}
|
|
|
|