|
@@ -43,14 +43,10 @@ import java.util.concurrent.TimeUnit;
|
|
|
public class TestServiceImpl implements TestService {
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@Autowired
|
|
|
ConfigConstant configConstant;
|
|
|
|
|
|
-// @Autowired
|
|
|
-// FileUtils fileUtils;
|
|
|
+
|
|
|
|
|
|
@Autowired
|
|
|
AliYunOssUtil aliyunOssUtil;
|
|
@@ -68,8 +64,6 @@ public class TestServiceImpl implements TestService {
|
|
|
RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
public Result batchReplaceSomeData(String isBatch) {
|
|
|
String basePath = "F:\\work\\四维-全景看看\\data\\";
|
|
@@ -103,6 +97,7 @@ public class TestServiceImpl implements TestService {
|
|
|
|
|
|
/**
|
|
|
* 2022-3-22 根据作品id获取场景码
|
|
|
+ *
|
|
|
* @param ids
|
|
|
* @return
|
|
|
*/
|
|
@@ -121,10 +116,10 @@ public class TestServiceImpl implements TestService {
|
|
|
|
|
|
// 转json 方便使用
|
|
|
JSONArray array = JSONArray.parseArray(JSON.toJSONString(sceneCodes));
|
|
|
- log.info("场景码数量:{}", sceneCodes.size() );
|
|
|
- log.info("场景码:{}", sceneCodes );
|
|
|
- log.info("场景码JSON:{}", array );
|
|
|
- log.info("书略图:{}", iconMap );
|
|
|
+ log.info("场景码数量:{}", sceneCodes.size());
|
|
|
+ log.info("场景码:{}", sceneCodes);
|
|
|
+ log.info("场景码JSON:{}", array);
|
|
|
+ log.info("书略图:{}", iconMap);
|
|
|
|
|
|
downloadThumb(iconMap);
|
|
|
|
|
@@ -133,10 +128,9 @@ public class TestServiceImpl implements TestService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 2022-10-21
|
|
|
+ *
|
|
|
* @param isAll
|
|
|
* @return
|
|
|
*/
|
|
@@ -161,14 +155,14 @@ public class TestServiceImpl implements TestService {
|
|
|
int i = 0;
|
|
|
for (FodderEntity entity : list) {
|
|
|
String tour = entity.getTour();
|
|
|
- if (StrUtil.isNotBlank(tour)){
|
|
|
+ if (StrUtil.isNotBlank(tour)) {
|
|
|
continue;
|
|
|
}
|
|
|
String sceneCode = entity.getSceneCode();
|
|
|
// if (tour.contains("%CURRENTXML%")){
|
|
|
// continue;
|
|
|
// }
|
|
|
- i ++ ;
|
|
|
+ i++;
|
|
|
String basePath = "%CURRENTXML%../" + sceneCode + "/vtour/panos/";
|
|
|
tour = tour.replaceAll("panos/", basePath);
|
|
|
entity.setTour(tour);
|
|
@@ -198,8 +192,8 @@ public class TestServiceImpl implements TestService {
|
|
|
@Override
|
|
|
public Result sh(TestShDto param) {
|
|
|
String sceneCode = param.getSceneCode();
|
|
|
- String cmd = StrUtil.format("bash /mnt/720yun_fd_manage_data/baseData/aws_upload.sh test-4dkankan /mnt/720yun_fd_manage_data/{} 720yun_fd_manage/{}", sceneCode, sceneCode );
|
|
|
- if ("1".equals(param.getType())){
|
|
|
+ String cmd = StrUtil.format("bash /mnt/720yun_fd_manage_data/baseData/aws_upload.sh test-4dkankan /mnt/720yun_fd_manage_data/{} 720yun_fd_manage/{}", sceneCode, sceneCode);
|
|
|
+ if ("1".equals(param.getType())) {
|
|
|
cmd = "sudo " + cmd;
|
|
|
}
|
|
|
|
|
@@ -223,8 +217,126 @@ public class TestServiceImpl implements TestService {
|
|
|
|
|
|
|
|
|
/**
|
|
|
+ * 2022-12-26
|
|
|
+ *
|
|
|
+ * @param isAll
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result updateSceneCode(String isAll) {
|
|
|
+
|
|
|
+ // 1. 获取作品表
|
|
|
+
|
|
|
+ List<WorkEntity> list = workService.findByStatus(1);
|
|
|
+ log.info("作品数量:{}", list.size());
|
|
|
+ int n = 0;
|
|
|
+ for (WorkEntity workEntity : list) {
|
|
|
+ n++;
|
|
|
+
|
|
|
+ // 只处理场景码包含中[] 符合的数据
|
|
|
+ String sceneCodes = workEntity.getSceneCodes();
|
|
|
+ if (StrUtil.isBlank(sceneCodes)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (sceneCodes.startsWith("[")) {
|
|
|
+ String id = workEntity.getId();
|
|
|
+ List<String> codes = downLoadSomeData(id);
|
|
|
+ log.info("更新完成第:{} 个, 作品码为:{}, 处理后的场景码为:{}", n, id, codes);
|
|
|
+ String join = StringUtils.join(codes, ",");
|
|
|
+
|
|
|
+ workEntity.setSceneCodes(join);
|
|
|
+ workService.update(workEntity);
|
|
|
+
|
|
|
+ if (!"1".equals(isAll)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 2022-12-26
|
|
|
+ * @param isAll
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result updateWorkType(String isAll) {
|
|
|
+ // 1. 获取作品表
|
|
|
+ List<WorkEntity> list = workService.findByStatus(1);
|
|
|
+ log.info("作品数量:{}", list.size());
|
|
|
+ int n = 0;
|
|
|
+ for (WorkEntity workEntity : list) {
|
|
|
+ n++;
|
|
|
+
|
|
|
+ // 只处理没有数据的
|
|
|
+ String type = workEntity.getType();
|
|
|
+ if (StrUtil.isNotBlank(type)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 场景码为空的不处理
|
|
|
+ String sceneCodes = workEntity.getSceneCodes();
|
|
|
+ if (StrUtil.isBlank(sceneCodes)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ String workType = getTypeBySceneCodes(sceneCodes);
|
|
|
+ workEntity.setType(workType);
|
|
|
+ workService.update(workEntity);
|
|
|
+ log.info("更新完成第:{} 个, 作品码为:{}, 处理后的场景码为:{}", n, workEntity.getId(), workType);
|
|
|
+
|
|
|
+ if (!"1".equals(isAll)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 2022-12-19
|
|
|
+ * 获取作品类型
|
|
|
+ * @param sceneCodes 场景码集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String getTypeBySceneCodes(String sceneCodes){
|
|
|
+ String type = "0"; // 默认值
|
|
|
+ if (StrUtil.isBlank(sceneCodes)){
|
|
|
+ return type;
|
|
|
+ }
|
|
|
+ List<String> list = StrUtil.splitTrim(sceneCodes, ",");
|
|
|
+ boolean isPano = false;
|
|
|
+ boolean is4dkk = false;
|
|
|
+ for (String s : list) {
|
|
|
+ if (s.startsWith("fd720_")){
|
|
|
+ type = "pano";
|
|
|
+ isPano = true;
|
|
|
+ } else {
|
|
|
+ type = "4dkk";
|
|
|
+ is4dkk = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isPano && is4dkk){ // 同时满足:mix:混合类型
|
|
|
+ type = "mix";
|
|
|
+ }
|
|
|
+ log.info("当前作品类型为:{}", type);
|
|
|
+ return type;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
* 2022-10-21
|
|
|
* 作品创建tour.xml
|
|
|
+ *
|
|
|
* @param isAll
|
|
|
*/
|
|
|
private void createWorkTour(String isAll) {
|
|
@@ -239,9 +351,9 @@ public class TestServiceImpl implements TestService {
|
|
|
String id = workEntity.getId();
|
|
|
List<String> sceneCodes = downLoadSomeData(id);
|
|
|
createTour(sceneCodes, id);
|
|
|
- n ++;
|
|
|
+ n++;
|
|
|
log.info("更新完成第:{} 个, 作品码为:{}", n, id);
|
|
|
- if (!"1".equals(isAll)){
|
|
|
+ if (!"1".equals(isAll)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -250,13 +362,13 @@ public class TestServiceImpl implements TestService {
|
|
|
|
|
|
/**
|
|
|
* oss 下载ossSomeData
|
|
|
- * 原因: 作品码里的场景数据有误的
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<String> downLoadSomeData(String id){
|
|
|
- String someData = configConstant.ossDomain + configConstant.ossBasePath + id +"/someData.json";
|
|
|
- String locSomeData = configConstant.serverBasePath + id +"/someData.json";
|
|
|
+ private List<String> downLoadSomeData(String id) {
|
|
|
+ String someData = configConstant.ossDomain + configConstant.ossBasePath + id + "/someData.json";
|
|
|
+ String locSomeData = configConstant.serverBasePath + id + "/someData.json";
|
|
|
try {
|
|
|
HttpUtil.downloadFile(someData, locSomeData);
|
|
|
} catch (Exception e) {
|
|
@@ -280,7 +392,7 @@ public class TestServiceImpl implements TestService {
|
|
|
|
|
|
String type = sub.getString("type");
|
|
|
// 过滤场景
|
|
|
- if ("pano".equals(type)){
|
|
|
+ if ("pano".equals(type)) {
|
|
|
String sceneCode = sub.getString("sceneCode");
|
|
|
list.add(sceneCode);
|
|
|
}
|
|
@@ -291,6 +403,7 @@ public class TestServiceImpl implements TestService {
|
|
|
|
|
|
/**
|
|
|
* 创建tour.xml并上传oss
|
|
|
+ *
|
|
|
* @param scenes
|
|
|
* @param id
|
|
|
*/
|
|
@@ -323,7 +436,7 @@ public class TestServiceImpl implements TestService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private String getBaseTour(){
|
|
|
+ private String getBaseTour() {
|
|
|
String baseTourPath = configConstant.serverBasePath + "baseData/tour.xml";
|
|
|
String s = FileUtil.readString(baseTourPath, "utf-8");
|
|
|
// 结束标签置空, 方便操作
|
|
@@ -334,17 +447,18 @@ public class TestServiceImpl implements TestService {
|
|
|
|
|
|
/**
|
|
|
* 过滤720场景
|
|
|
+ *
|
|
|
* @param sceneCodes
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<String> filterSceneCodesByPano(String sceneCodes){
|
|
|
- if (StrUtil.isBlank(sceneCodes)){
|
|
|
+ private List<String> filterSceneCodesByPano(String sceneCodes) {
|
|
|
+ if (StrUtil.isBlank(sceneCodes)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
String[] split = sceneCodes.split(",");
|
|
|
List<String> list = new ArrayList<>();
|
|
|
for (String s : split) {
|
|
|
- if (s.startsWith("fd720_")){
|
|
|
+ if (s.startsWith("fd720_")) {
|
|
|
list.add(s);
|
|
|
}
|
|
|
}
|
|
@@ -354,6 +468,7 @@ public class TestServiceImpl implements TestService {
|
|
|
/**
|
|
|
* 2022-10-21
|
|
|
* 更新素材表字段
|
|
|
+ *
|
|
|
* @param isAll
|
|
|
*/
|
|
|
private void updateFodderTour(String isAll) {
|
|
@@ -366,9 +481,9 @@ public class TestServiceImpl implements TestService {
|
|
|
int n = 0;
|
|
|
List<String> errTours = new ArrayList<>();
|
|
|
for (FodderEntity fodderEntity : list) {
|
|
|
- n ++;
|
|
|
+ n++;
|
|
|
String tour = fodderEntity.getTour();
|
|
|
- if (StrUtil.isNotBlank(tour)){
|
|
|
+ if (StrUtil.isNotBlank(tour)) {
|
|
|
continue;
|
|
|
}
|
|
|
String ossPath = fodderEntity.getOssPath();
|
|
@@ -380,7 +495,7 @@ public class TestServiceImpl implements TestService {
|
|
|
HttpUtil.downloadFile(tourPath, locPath);
|
|
|
String tourXmlScene = getTourXmlScene(sceneCode);
|
|
|
|
|
|
- if (!tourXmlScene.contains("CURRENTXML")){
|
|
|
+ if (!tourXmlScene.contains("CURRENTXML")) {
|
|
|
errTours.add(sceneCode);
|
|
|
}
|
|
|
|
|
@@ -398,18 +513,15 @@ public class TestServiceImpl implements TestService {
|
|
|
}
|
|
|
|
|
|
// isAll != 1 只更新一个
|
|
|
- if (!"1".equals(isAll)){
|
|
|
+ if (!"1".equals(isAll)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
log.warn("tour数据异常的数量:{}", errTours.size());
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -435,7 +547,7 @@ public class TestServiceImpl implements TestService {
|
|
|
}
|
|
|
|
|
|
// 下载初始场景图片
|
|
|
- private void downloadThumb(Map<String, String> iconMap){
|
|
|
+ private void downloadThumb(Map<String, String> iconMap) {
|
|
|
String basePath = "F:\\work\\项目-科学城(广州)信科集团-3D合作\\thumb";
|
|
|
for (Map.Entry<String, String> m : iconMap.entrySet()) {
|
|
|
String sceneCode = m.getKey();
|
|
@@ -449,14 +561,14 @@ public class TestServiceImpl implements TestService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void getHandleSceneCode(String str, Map iconMap, Set sceneCodes){
|
|
|
+ private void getHandleSceneCode(String str, Map iconMap, Set sceneCodes) {
|
|
|
JSONArray array = JSONArray.parseArray(str);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
|
|
|
for (Object o : array) {
|
|
|
JSONObject parse = JSON.parseObject(o.toString());
|
|
|
String type = parse.getString("type");
|
|
|
- if ("pano".equals(type)){
|
|
|
+ if ("pano".equals(type)) {
|
|
|
String sceneCode = parse.getString("sceneCode");
|
|
|
String icon = parse.getString("icon");
|
|
|
jsonArray.add(sceneCode);
|
|
@@ -473,15 +585,15 @@ public class TestServiceImpl implements TestService {
|
|
|
|
|
|
/**
|
|
|
* 读取replace.csv
|
|
|
- *
|
|
|
+ * <p>
|
|
|
* https://www.4dkankan.com/panorama/show.html?id=606&vr=fd720_7B6nNaWQO
|
|
|
- *
|
|
|
+ * <p>
|
|
|
* https://www.4dkankan.com/panorama/show.html?id=566&vr=fd720_1jKqSxWLe
|
|
|
- *
|
|
|
+ * <p>
|
|
|
* fd720_1AOhUJZoI -> fd720_A6yCltViq
|
|
|
*/
|
|
|
@Test
|
|
|
- public void readReplaceFile(){
|
|
|
+ public void readReplaceFile() {
|
|
|
String basePath = "F:\\work\\四维-全景看看\\data\\";
|
|
|
String replacePath = basePath + "replace.csv";
|
|
|
List<String> str = FileUtil.readLines(replacePath, "utf-8");
|
|
@@ -512,8 +624,7 @@ public class TestServiceImpl implements TestService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * @param workIds 590, 580, 582, 571, 583, 573, 584, 585, 586, 575, 587, 588, 577, 566, 589, 578, 579, 568, 606
|
|
|
+ * @param workIds 590, 580, 582, 571, 583, 573, 584, 585, 586, 575, 587, 588, 577, 566, 589, 578, 579, 568, 606
|
|
|
* @param basePath
|
|
|
*/
|
|
|
private void downloadSomeDataJson(Set<String> workIds, String basePath) {
|
|
@@ -524,31 +635,31 @@ public class TestServiceImpl implements TestService {
|
|
|
String url;
|
|
|
for (String workId : workIds) {
|
|
|
// oss下载someData.json
|
|
|
- url = baseUrl + workId + "/someData.json?m="+ System.currentTimeMillis();
|
|
|
+ url = baseUrl + workId + "/someData.json?m=" + System.currentTimeMillis();
|
|
|
HttpUtil.downloadFile(url, basePath + workId + "/someData.json");
|
|
|
log.info("下载someData完成: {}", workId);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void editSomeData(String basePath, String isBatch, List<ReplaceVo> list){
|
|
|
+ private void editSomeData(String basePath, String isBatch, List<ReplaceVo> list) {
|
|
|
File[] faFiles = new File(basePath).listFiles();
|
|
|
int i = 0;
|
|
|
for (File file : faFiles) {
|
|
|
String dirPath = file.getAbsolutePath();
|
|
|
String dirName = file.getName();
|
|
|
- if (FileUtil.isDirectory(dirPath)){
|
|
|
+ if (FileUtil.isDirectory(dirPath)) {
|
|
|
log.info("工作目录:{}", dirPath);
|
|
|
log.info("工作码: {}", dirName);
|
|
|
String outPath = dirPath + "/b/someData.json";
|
|
|
- this.writeFile(dirPath + "/someData.json",outPath, list, dirName);
|
|
|
+ this.writeFile(dirPath + "/someData.json", outPath, list, dirName);
|
|
|
|
|
|
log.info("替换第: {} 个, 场景码: {}", i, dirName);
|
|
|
}
|
|
|
i++;
|
|
|
|
|
|
- if (!"0".equals(isBatch)){
|
|
|
- if (i==1){
|
|
|
+ if (!"0".equals(isBatch)) {
|
|
|
+ if (i == 1) {
|
|
|
log.info("单个执行");
|
|
|
break;
|
|
|
}
|
|
@@ -559,9 +670,10 @@ public class TestServiceImpl implements TestService {
|
|
|
|
|
|
/**
|
|
|
* 写文件
|
|
|
+ *
|
|
|
* @param inPath 输入文件地址
|
|
|
*/
|
|
|
- private void writeFile(String inPath, String outPath, List<ReplaceVo> list, String workId){
|
|
|
+ private void writeFile(String inPath, String outPath, List<ReplaceVo> list, String workId) {
|
|
|
if (!FileUtil.isFile(inPath)) {
|
|
|
log.error("场景码输入文件不存在,请检查 : {}", inPath);
|
|
|
return;
|
|
@@ -570,7 +682,7 @@ public class TestServiceImpl implements TestService {
|
|
|
for (ReplaceVo vo : list) {
|
|
|
String oCode = vo.getOCode();
|
|
|
String oName = vo.getOName();
|
|
|
- if (s.contains(oCode) || s.contains(oName)){
|
|
|
+ if (s.contains(oCode) || s.contains(oName)) {
|
|
|
log.info("有替换内容, 旧场景码:{}, 新场景码:{}", oCode, vo.getNCode());
|
|
|
s = s.replaceAll(oCode, vo.getNCode());
|
|
|
s = s.replaceAll(oName, vo.getNName());
|
|
@@ -584,7 +696,7 @@ public class TestServiceImpl implements TestService {
|
|
|
ossUploadSomeData(outPath, workId);
|
|
|
}
|
|
|
|
|
|
- private void ossUploadSomeData(String srcPath, String workId){
|
|
|
+ private void ossUploadSomeData(String srcPath, String workId) {
|
|
|
log.info("oss准备上传: {}", srcPath);
|
|
|
String targetPath = configConstant.ossBasePath + workId + "/someData.json";
|
|
|
log.info("oss上传地址: {}", targetPath);
|