|
@@ -0,0 +1,105 @@
|
|
|
+package com.fdkankan.job.repair;
|
|
|
+
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+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.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.job.entity.SceneEditInfo;
|
|
|
+import com.fdkankan.job.entity.ScenePlus;
|
|
|
+import com.fdkankan.job.entity.ScenePlusExt;
|
|
|
+import com.fdkankan.job.service.ISceneEditInfoService;
|
|
|
+import com.fdkankan.job.service.IScenePlusExtService;
|
|
|
+import com.fdkankan.job.service.IScenePlusService;
|
|
|
+import com.fdkankan.model.constants.UploadFilePath;
|
|
|
+import com.fdkankan.model.utils.SceneUtil;
|
|
|
+import com.fdkankan.redis.constant.RedisKey;
|
|
|
+import com.fdkankan.redis.util.RedisUtil;
|
|
|
+import com.xxl.job.core.context.XxlJobHelper;
|
|
|
+import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 根据floorplan_cad.json生成floorpan.json
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author dengsixing
|
|
|
+ * @since 2022/12/16
|
|
|
+ **/
|
|
|
+@Slf4j
|
|
|
+@Component
|
|
|
+public class RepairMixtureHandler {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ private IScenePlusExtService scenePlusExtService;
|
|
|
+ @Autowired
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
+ @Autowired
|
|
|
+ private ISceneEditInfoService sceneEditInfoService;
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
+
|
|
|
+ @XxlJob("repairMixtureHandler")
|
|
|
+ private void repairMixtureHandler(){
|
|
|
+ XxlJobHelper.log("repairMixtureHandler start.....");
|
|
|
+
|
|
|
+ List<ScenePlusExt> list = scenePlusExtService.list(new LambdaQueryWrapper<ScenePlusExt>().eq(ScenePlusExt::getLocation, 6));
|
|
|
+ if(CollUtil.isNotEmpty(list)){
|
|
|
+ list.stream().forEach(scenePlusExt -> {
|
|
|
+ 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());
|
|
|
+
|
|
|
+ String url = "/laser/4dage/mixture/{{sceneCode}}";
|
|
|
+ url = url.replace("{sceneCode}", scenePlus.getNum());
|
|
|
+ HttpUtil.post(url, "");
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ XxlJobHelper.log("repairMixtureHandler end.....");
|
|
|
+ }
|
|
|
+
|
|
|
+}
|