|
|
@@ -13,14 +13,13 @@ import cn.hutool.core.util.ZipUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.fdkankan.common.constant.CommonStatus;
|
|
|
-import com.fdkankan.common.constant.CommonSuccessStatus;
|
|
|
-import com.fdkankan.common.constant.FileSizeUnitType;
|
|
|
-import com.fdkankan.common.constant.SceneSource;
|
|
|
+import com.fdkankan.common.constant.*;
|
|
|
import com.fdkankan.common.util.DateExtUtil;
|
|
|
import com.fdkankan.common.util.FileSizeUtil;
|
|
|
import com.fdkankan.external.bean.DownloadProcessBean;
|
|
|
import com.fdkankan.external.bean.LaserDownloadBean;
|
|
|
+import com.fdkankan.external.bean.SceneEditControlsBean;
|
|
|
+import com.fdkankan.external.bean.SceneInfoBean;
|
|
|
import com.fdkankan.external.callback.ErrorCallback;
|
|
|
import com.fdkankan.external.callback.SuccessCallback;
|
|
|
import com.fdkankan.external.entity.*;
|
|
|
@@ -28,6 +27,7 @@ import com.fdkankan.external.httpclient.HttpClient;
|
|
|
import com.fdkankan.external.mapper.SceneOfflinePackagePushMapper;
|
|
|
import com.fdkankan.external.service.*;
|
|
|
import com.fdkankan.external.util.CmdUtils;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
import com.fdkankan.web.response.Result;
|
|
|
@@ -100,6 +100,8 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
|
|
|
private ICameraService cameraService;
|
|
|
@Resource
|
|
|
private RedisUtil redisUtil;
|
|
|
+ @Resource
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -181,9 +183,10 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
|
|
|
SceneOfflinePackagePush lastPush = sceneOfflinePackagePushService.getLastByCondition(condition);
|
|
|
|
|
|
//查询版本号
|
|
|
- String getInfo = fdkkSceneHost.concat(String.format(getInfoUrl, scenePlus.getNum()));
|
|
|
- ResultData<Map<String, Object>> mapResultData = httpClient.get(getInfo, new HashMap<>(), new SuccessCallback(), new ErrorCallback());
|
|
|
- int version = (int)mapResultData.getData().get("version");
|
|
|
+// String getInfo = fdkkSceneHost.concat(String.format(getInfoUrl, scenePlus.getNum()));
|
|
|
+// ResultData<Map<String, Object>> mapResultData = httpClient.get(getInfo, new HashMap<>(), new SuccessCallback(), new ErrorCallback());
|
|
|
+ SceneInfoBean sceneInfoBean = this.getSceneInfo(scenePlus.getNum());
|
|
|
+ int version = sceneInfoBean.getVersion();
|
|
|
|
|
|
//如果没有推送过或者推送过但是版本号不一致,就需要推送
|
|
|
if(Objects.isNull(lastPush) || lastPush.getVersion() != version){
|
|
|
@@ -204,6 +207,46 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ private SceneInfoBean getSceneInfo(String num){
|
|
|
+
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
+
|
|
|
+
|
|
|
+ String key = String.format(RedisKey.SCENE_JSON, num);
|
|
|
+ String sceneJson = redisUtil.get(key);
|
|
|
+ //先查询redis
|
|
|
+ if(StrUtil.isEmpty(sceneJson)) {
|
|
|
+ String objectName = String.format("scene_view_data/%s/data/scene.json", num);
|
|
|
+ sceneJson = fYunFileService.getFileContent(scenePlusExt.getYunFileBucket(), objectName);
|
|
|
+ redisUtil.set(key, sceneJson);
|
|
|
+ }
|
|
|
+ SceneInfoBean sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoBean.class);
|
|
|
+ sceneInfoVO.setScenePassword(null);
|
|
|
+ if(Objects.isNull(sceneInfoVO.getFloorPlanAngle())){
|
|
|
+ sceneInfoVO.setFloorPlanAngle(0f);
|
|
|
+ }
|
|
|
+ if(Objects.isNull(sceneInfoVO.getFloorPlanCompass())){
|
|
|
+ sceneInfoVO.setFloorPlanCompass(0f);
|
|
|
+ }
|
|
|
+ SceneEditControlsBean controls = sceneInfoVO.getControls();
|
|
|
+ if(Objects.isNull(controls.getShowShare())){
|
|
|
+ controls.setShowShare(CommonStatus.YES.code().intValue());
|
|
|
+ }
|
|
|
+ if(Objects.isNull(controls.getShowCapture())){
|
|
|
+ controls.setShowCapture(CommonStatus.YES.code().intValue());
|
|
|
+ }
|
|
|
+ if(Objects.isNull(controls.getShowBillboardTitle())){
|
|
|
+ controls.setShowBillboardTitle(CommonStatus.YES.code().intValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ //随心装特殊要求,由于随心装场景无法提供vision2.txt,故默认随心装场景关闭标尺功能
|
|
|
+ if(SceneFrom.SXZ.code().equals(scenePlusExt.getSceneFrom())){
|
|
|
+ controls.setShowRule(CommonStatus.NO.code().intValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ return sceneInfoVO;
|
|
|
+ }
|
|
|
|
|
|
private String genZipUrl4Kankan(String num){
|
|
|
String downloadUrl = null;
|
|
|
@@ -342,6 +385,8 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
|
|
|
FileUtil.del(zipDir);
|
|
|
String volumeName = zipDir.concat(num).concat(".zip");
|
|
|
FileUtil.mkParentDirs(volumeName);
|
|
|
+ //下载算法日志 https://4dkk.4dage.com/build_log/06TRwcBTiC/console.log
|
|
|
+ HttpUtil.downloadFile(ossHost4dkkOld.concat("/build_log/").concat(num).concat("/console.log"), dirPath.concat("/").concat(num).concat("/console.log"));
|
|
|
String cmd = "cd " + dirPath + " && zip -r " + volumeName + " " + num + " -s 500M";
|
|
|
log.info("压缩命令:{}", cmd);
|
|
|
CmdUtils.callLineSh(cmd, 200);
|
|
|
@@ -383,6 +428,7 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
|
|
|
params.put("downloadUrl", downloadUrl);
|
|
|
params.put("version", push.getVersion());
|
|
|
params.put("calcTime", DateExtUtil.format(scenePlusExt.getAlgorithmTime(), DateExtUtil.dateStyle8));
|
|
|
+ params.put("computeTime", scenePlusExt.getComputeTime());
|
|
|
String post = HttpUtil.post(push.getDestUrl(), params, 60 * 60 * 1000);
|
|
|
log.info("场景推送成功,接收端返回结果:{}", post);
|
|
|
push.setPushStatus(CommonSuccessStatus.SUCCESS.code());
|