|
@@ -22,24 +22,16 @@ import com.fdkankan.extend.service.IScenePlusService;
|
|
import com.fdkankan.extend.service.ITowerService;
|
|
import com.fdkankan.extend.service.ITowerService;
|
|
import com.fdkankan.extend.util.RsaCryptTools;
|
|
import com.fdkankan.extend.util.RsaCryptTools;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
|
+import com.fdkankan.model.constants.UploadFilePath;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
-import com.fdkankan.web.response.ResultData;
|
|
|
|
-import lombok.Data;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import netscape.javascript.JSObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-import com.fdkankan.model.constants.UploadFilePath;
|
|
|
|
|
|
|
|
-import javax.crypto.BadPaddingException;
|
|
|
|
-import javax.crypto.IllegalBlockSizeException;
|
|
|
|
-import javax.crypto.NoSuchPaddingException;
|
|
|
|
-import java.io.IOException;
|
|
|
|
-import java.security.InvalidKeyException;
|
|
|
|
-import java.security.NoSuchAlgorithmException;
|
|
|
|
-import java.security.spec.InvalidKeySpecException;
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -86,6 +78,7 @@ public class TowerServiceImpl implements ITowerService {
|
|
//校验场景名称是否正确
|
|
//校验场景名称是否正确
|
|
String sceneStr = fYunFileService.getFileContent(ossScenePoolFilePath);
|
|
String sceneStr = fYunFileService.getFileContent(ossScenePoolFilePath);
|
|
List<TowerSceneBean> towerSceneBeans = JSON.parseArray(sceneStr, TowerSceneBean.class);
|
|
List<TowerSceneBean> towerSceneBeans = JSON.parseArray(sceneStr, TowerSceneBean.class);
|
|
|
|
+
|
|
if(CollUtil.isEmpty(towerSceneBeans)){
|
|
if(CollUtil.isEmpty(towerSceneBeans)){
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
@@ -136,25 +129,60 @@ public class TowerServiceImpl implements ITowerService {
|
|
//下载vision.txt
|
|
//下载vision.txt
|
|
fYunFileService.downloadFile(ossImagesPath.concat("vision.txt"), imagesPath.concat("vision.txt"));
|
|
fYunFileService.downloadFile(ossImagesPath.concat("vision.txt"), imagesPath.concat("vision.txt"));
|
|
|
|
|
|
|
|
+ this.convertVisable(imagesPath.concat("vision.txt"));
|
|
|
|
+
|
|
//打包
|
|
//打包
|
|
ZipUtil.zip(sceneSourcePath, zipPath, true);
|
|
ZipUtil.zip(sceneSourcePath, zipPath, true);
|
|
|
|
|
|
log.info("结束下载,开始推送:{}", num);
|
|
log.info("结束下载,开始推送:{}", num);
|
|
|
|
|
|
try {
|
|
try {
|
|
-// this.dataPush(num, title, towerSceneBean.getSceneId(), towerSceneBean.getRoomId(), zipPath);
|
|
|
|
|
|
+ this.dataPush(num, title, towerSceneBean.getSceneId(), towerSceneBean.getRoomId(), zipPath);
|
|
}finally {
|
|
}finally {
|
|
-// FileUtil.del(scenePath);
|
|
|
|
-// FileUtil.del(sceneSourcePath);
|
|
|
|
|
|
+ FileUtil.del(scenePath);
|
|
}
|
|
}
|
|
|
|
|
|
-// FileUtil.del(scenePath);
|
|
|
|
- FileUtil.copy(zipPath, parentPath, true);
|
|
|
|
- FileUtil.del(scenePath);
|
|
|
|
-
|
|
|
|
return zipPath;
|
|
return zipPath;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void convertVisable(String visionPath){
|
|
|
|
+
|
|
|
|
+ String visionStr = FileUtil.readUtf8String(visionPath);
|
|
|
|
+ JSONObject visionObj = JSON.parseObject(visionStr);
|
|
|
|
+ JSONArray array = visionObj.getJSONArray("sweepLocations");
|
|
|
|
+ Map<Integer, String> uuidMap = new HashMap<>();
|
|
|
|
+ for(int i = 0; i < array.size(); i++){
|
|
|
|
+ JSONObject o = (JSONObject)array.get(i);
|
|
|
|
+ uuidMap.put(i, o.getString("uuid"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < array.size(); i++){
|
|
|
|
+ JSONObject o = (JSONObject)array.get(i);
|
|
|
|
+ JSONArray visibles = o.getJSONArray("visibles");
|
|
|
|
+ o.put("visibles", this.convertVisableHandler(visibles,uuidMap));
|
|
|
|
+
|
|
|
|
+ JSONArray visibles2 = o.getJSONArray("visibles2");
|
|
|
|
+ o.put("visibles2", this.convertVisableHandler(visibles2,uuidMap));
|
|
|
|
+
|
|
|
|
+ JSONArray visibles3 = o.getJSONArray("visibles3");
|
|
|
|
+ o.put("visibles3", this.convertVisableHandler(visibles3,uuidMap));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ FileUtil.writeUtf8String(JSON.toJSONString(visionObj), visionPath);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String[] convertVisableHandler(JSONArray visibles, Map<Integer, String> uuidMap){
|
|
|
|
+ int size = visibles.size();
|
|
|
|
+ String[] visibleArr = new String[size];
|
|
|
|
+ for(int j = 0; j < size; j++){
|
|
|
|
+ System.out.println(visibles.get(j));
|
|
|
|
+ int index = (Integer)visibles.get(j);
|
|
|
|
+ String uuid = uuidMap.get(index);
|
|
|
|
+ visibleArr[j] = uuid;
|
|
|
|
+ }
|
|
|
|
+ return visibleArr;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void packSceneData(Long companyId, List<String> nums) {
|
|
public void packSceneData(Long companyId, List<String> nums) {
|
|
|
|
|
|
@@ -238,6 +266,9 @@ public class TowerServiceImpl implements ITowerService {
|
|
params.put("manufact", manufact);
|
|
params.put("manufact", manufact);
|
|
params.put("encrypt", encrypt);
|
|
params.put("encrypt", encrypt);
|
|
params.put("upUserAcct", "xxx");
|
|
params.put("upUserAcct", "xxx");
|
|
|
|
+ log.info("private-key:{}", privateKey);
|
|
|
|
+ log.info("manufact:{}", manufact);
|
|
|
|
+ log.info("compose:{}", compose);
|
|
log.info("encrypt:{}", encrypt);
|
|
log.info("encrypt:{}", encrypt);
|
|
log.info("开始推送");
|
|
log.info("开始推送");
|
|
String post = HttpUtil.post(url, params);
|
|
String post = HttpUtil.post(url, params);
|
|
@@ -248,16 +279,47 @@ public class TowerServiceImpl implements ITowerService {
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
|
- params.put("stationCode", "410192010000001484");
|
|
|
|
- params.put("roomEntityID", "000102050000000003085104");
|
|
|
|
- params.put("file", FileUtil.file("D:\\test\\410192010000001484_000102050000000003085104.zip"));
|
|
|
|
- params.put("manufact", "3");
|
|
|
|
- params.put("upUserAcct", "111");
|
|
|
|
- params.put("encrypt", "oNFZonGRrum3hldhU9AcMwP0JsXoxZocaTSTgj1h1Ag9pJzro9us0udinPr058y9KcwSPtkO58TKVE4csnasTZT00jghJQqsk0ATiNzX8QZh+F1iH33j6I3NHZu3vzjAV4lVHSo23WcEMo4s9G5dxymagYl8FKd7ua0/CYNysrs=");
|
|
|
|
- String post = HttpUtil.post("http://120.52.136.13:2808/fileManager/uploadRsaFileZipView", params);
|
|
|
|
- JSONObject jsonObject = JSON.parseObject(post);
|
|
|
|
- System.out.println(jsonObject.toJSONString());
|
|
|
|
|
|
+// Map<String, Object> params = new HashMap<>();
|
|
|
|
+// params.put("stationCode", "410192010000001484");
|
|
|
|
+// params.put("roomEntityID", "000102050000000003085104");
|
|
|
|
+// params.put("file", FileUtil.file("D:\\test\\410192010000001484_000102050000000003085104.zip"));
|
|
|
|
+// params.put("manufact", "3");
|
|
|
|
+// params.put("upUserAcct", "111");
|
|
|
|
+// params.put("encrypt", "oNFZonGRrum3hldhU9AcMwP0JsXoxZocaTSTgj1h1Ag9pJzro9us0udinPr058y9KcwSPtkO58TKVE4csnasTZT00jghJQqsk0ATiNzX8QZh+F1iH33j6I3NHZu3vzjAV4lVHSo23WcEMo4s9G5dxymagYl8FKd7ua0/CYNysrs=");
|
|
|
|
+// String post = HttpUtil.post("http://120.52.136.13:2808/fileManager/uploadRsaFileZipView", params);
|
|
|
|
+// JSONObject jsonObject = JSON.parseObject(post);
|
|
|
|
+// System.out.println(jsonObject.toJSONString());
|
|
|
|
+
|
|
|
|
+// String sceneStr = fYunFileService.getFileContent(ossScenePoolFilePath);
|
|
|
|
+// String sceneStr = FileUtil.readUtf8String("D:\\四维时代\\中国铁塔\\郑州-天津.js");
|
|
|
|
+// List<TowerSceneBean> towerSceneBeans = JSON.parseArray(sceneStr, TowerSceneBean.class);
|
|
|
|
+// System.out.println(JSON.toJSONString(towerSceneBeans));
|
|
|
|
+
|
|
|
|
+ String visionStr = FileUtil.readUtf8String("C:\\Users\\dsx\\Desktop\\vision.txt");
|
|
|
|
+ JSONObject visionObj = JSON.parseObject(visionStr);
|
|
|
|
+ JSONArray array = visionObj.getJSONArray("sweepLocations");
|
|
|
|
+ Map<Integer, String> uuidMap = new HashMap<>();
|
|
|
|
+ for(int i = 0; i < array.size(); i++){
|
|
|
|
+ JSONObject o = (JSONObject)array.get(i);
|
|
|
|
+ uuidMap.put(i, o.getString("uuid"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < array.size(); i++){
|
|
|
|
+ JSONObject o = (JSONObject)array.get(i);
|
|
|
|
+ JSONArray visibles = o.getJSONArray("visibles");
|
|
|
|
+ int size = visibles.size();
|
|
|
|
+ String[] visibleArr = new String[size];
|
|
|
|
+ for(int j = 0; j < size; j++){
|
|
|
|
+ System.out.println(visibles.get(j));
|
|
|
|
+ int index = (Integer)visibles.get(j);
|
|
|
|
+ String uuid = uuidMap.get(index);
|
|
|
|
+ visibleArr[j] = uuid;
|
|
|
|
+ }
|
|
|
|
+ o.put("visibles", visibleArr);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ FileUtil.writeUtf8String(JSON.toJSONString(visionObj), "C:\\Users\\dsx\\Desktop\\vision2.txt");
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private void dataPushLog(String num, String title, String resultCode, String resultMsg){
|
|
private void dataPushLog(String num, String title, String resultCode, String resultMsg){
|
|
@@ -266,7 +328,7 @@ public class TowerServiceImpl implements ITowerService {
|
|
content = content.concat("-").concat(resultMsg);
|
|
content = content.concat("-").concat(resultMsg);
|
|
}
|
|
}
|
|
content = content.concat("\r\n");
|
|
content = content.concat("\r\n");
|
|
- FileUtil.writeUtf8String(content, parentPath.concat("download.log"));
|
|
|
|
|
|
+ FileUtil.appendUtf8String(content, parentPath.concat("download.log"));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|