|
@@ -0,0 +1,121 @@
|
|
|
|
+package com.fdkankan.manage_jp.service.impl;
|
|
|
|
+
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
|
+import com.fdkankan.manage_jp.entity.ProjectSceneGps;
|
|
|
|
+import com.fdkankan.manage_jp.entity.ScenePlus;
|
|
|
|
+import com.fdkankan.manage_jp.entity.ScenePlusExt;
|
|
|
|
+import com.fdkankan.manage_jp.httpClient.service.LaserService;
|
|
|
|
+import com.fdkankan.manage_jp.mapper.IProjectSceneGpsMapper;
|
|
|
|
+import com.fdkankan.manage_jp.service.IProjectSceneGpsService;
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.fdkankan.manage_jp.service.IScenePlusExtService;
|
|
|
|
+import com.fdkankan.manage_jp.service.IScenePlusService;
|
|
|
|
+import com.fdkankan.manage_jp.vo.response.SceneExtGpsVo;
|
|
|
|
+import com.fdkankan.manage_jp.vo.response.SceneGpsVo;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * <p>
|
|
|
|
+ * 服务实现类
|
|
|
|
+ * </p>
|
|
|
|
+ *
|
|
|
|
+ * @author
|
|
|
|
+ * @since 2024-08-16
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+@Slf4j
|
|
|
|
+public class ProjectSceneGpsServiceImpl extends ServiceImpl<IProjectSceneGpsMapper, ProjectSceneGps> implements IProjectSceneGpsService {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ IScenePlusService scenePlusService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IScenePlusExtService scenePlusExtService;
|
|
|
|
+ @Autowired
|
|
|
|
+ FYunFileServiceInterface fYunFileServiceInterface;
|
|
|
|
+ @Autowired
|
|
|
|
+ LaserService laserService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<String> getNotGpsScene() {
|
|
|
|
+ return this.getBaseMapper().getNotGpsScene();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void addGps(String num) {
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
|
+ String dataSource = scenePlusExt.getDataSource();
|
|
|
|
+ SceneGpsVo sceneGpsVo = null;
|
|
|
|
+ if(scenePlus.getSceneStatus() == 4 || scenePlus.getSceneStatus() == 5){
|
|
|
|
+ sceneGpsVo = getByLaserEdit(num);
|
|
|
|
+ }else {
|
|
|
|
+ sceneGpsVo = getByHomeParameters(dataSource);
|
|
|
|
+ }
|
|
|
|
+ if(sceneGpsVo == null && StrUtil.isNotBlank(scenePlusExt.getGps())){
|
|
|
|
+ String gps = scenePlusExt.getGps();
|
|
|
|
+ SceneExtGpsVo extGpsVo = JSONObject.parseObject(gps,SceneExtGpsVo.class);
|
|
|
|
+ sceneGpsVo = new SceneGpsVo(extGpsVo.getLatitude(),extGpsVo.getLongitude(),extGpsVo.getAltitude(),2);
|
|
|
|
+ }
|
|
|
|
+ if(sceneGpsVo != null
|
|
|
|
+ && StrUtil.isNotBlank(sceneGpsVo.getLat())
|
|
|
|
+ && StrUtil.isNotBlank(sceneGpsVo.getLon())
|
|
|
|
+ && StrUtil.isNotBlank(sceneGpsVo.getAlt())){
|
|
|
|
+
|
|
|
|
+ ProjectSceneGps sceneGps = new ProjectSceneGps();
|
|
|
|
+ sceneGps.setNum(num);
|
|
|
|
+ sceneGps.setWebSite(scenePlusExt.getWebSite());
|
|
|
|
+ sceneGps.setLat(sceneGpsVo.getLat());
|
|
|
|
+ sceneGps.setLon(sceneGpsVo.getLon());
|
|
|
|
+ sceneGps.setAlt(sceneGpsVo.getAlt());
|
|
|
|
+ sceneGps.setGpsSource(sceneGpsVo.getGpsSource());
|
|
|
|
+ sceneGps.setSceneSource(scenePlus.getSceneSource());
|
|
|
|
+ this.save(sceneGps);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private SceneGpsVo getByLaserEdit(String num) {
|
|
|
|
+ return laserService.getLocation(num);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private SceneGpsVo getByHomeParameters(String dataSource) {
|
|
|
|
+ dataSource = dataSource.replaceAll("/mnt/data", "home");
|
|
|
|
+ boolean parametersFlag = fYunFileServiceInterface.fileExist(dataSource+"/parameters.json");
|
|
|
|
+ if (parametersFlag) {
|
|
|
|
+ JSONObject parameters = JSONObject.parseObject(fYunFileServiceInterface.getFileContent(dataSource));
|
|
|
|
+ JSONArray parametersArray = parameters.getJSONArray("parameters");
|
|
|
|
+ for (Object o : parametersArray) {
|
|
|
|
+ JSONObject parameter = (JSONObject) o;
|
|
|
|
+ JSONObject ggaLocation = parameter.getJSONObject("value").getJSONObject("ggaLocation");
|
|
|
|
+ if (ObjectUtil.isNotEmpty(ggaLocation)
|
|
|
|
+ && StrUtil.isNotEmpty(ggaLocation.getString("lon"))
|
|
|
|
+ && StrUtil.isNotEmpty(ggaLocation.getString("lat"))
|
|
|
|
+ && StrUtil.isNotEmpty(ggaLocation.getString("alt"))) {
|
|
|
|
+ log.info("从rtk获取gps信息:{}", parameters);
|
|
|
|
+ return new SceneGpsVo(ggaLocation.getString("lat"),ggaLocation.getString("lon"),ggaLocation.getString("alt"),0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void updateGps(String num,String lat,String lon,Integer type) {
|
|
|
|
+ LambdaUpdateWrapper<ProjectSceneGps> wrapper = new LambdaUpdateWrapper<>();
|
|
|
|
+ wrapper.eq(ProjectSceneGps::getNum,num);
|
|
|
|
+ wrapper.set(ProjectSceneGps::getLat,lat);
|
|
|
|
+ wrapper.set(ProjectSceneGps::getLon,lon);
|
|
|
|
+ wrapper.set(ProjectSceneGps::getGpsSource,type);
|
|
|
|
+ this.update(wrapper);
|
|
|
|
+ }
|
|
|
|
+}
|