|
@@ -56,98 +56,98 @@ public class DevController {
|
|
@PostMapping("/test")
|
|
@PostMapping("/test")
|
|
public String test() {
|
|
public String test() {
|
|
|
|
|
|
-
|
|
|
|
- String path="/home/webrtc/creatJson/outputjson/";
|
|
|
|
-
|
|
|
|
- if (FileUtil.exist(path.replaceAll("outputjson",""))){
|
|
|
|
- String s = FileUtil.readString(path.replaceAll("outputjson","") + "points.json", "utf8");
|
|
|
|
- JSONArray points= JSON.parseArray(s);
|
|
|
|
- for (Object point : points) {
|
|
|
|
- JSONObject a = JSON.parseObject(JSONObject.toJSON(point).toString());
|
|
|
|
- BreakpointsEntity breakpointsEntity=new BreakpointsEntity();
|
|
|
|
- breakpointsEntity.setAppId("0000000001");
|
|
|
|
- PointPO po=new PointPO();
|
|
|
|
- po.setX(a.getJSONObject("position").getDoubleValue("x"));
|
|
|
|
- po.setY(a.getJSONObject("position").getDoubleValue("y"));
|
|
|
|
- po.setZ(a.getJSONObject("position").getDoubleValue("z"));
|
|
|
|
- breakpointsEntity.setPosition(po);
|
|
|
|
- breakpointsEntity.setBreakPointId(a.getString("id"));
|
|
|
|
- breakpointsService.save(breakpointsEntity);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- File[] ls = FileUtil.ls(path);
|
|
|
|
- for (File l : ls) {
|
|
|
|
- List<File> files = FileUtil.loopFiles(l);
|
|
|
|
- for (File file : files) {
|
|
|
|
- if (!file.getName().contains("_")){
|
|
|
|
- String s = FileUtil.readString(file, "utf8");
|
|
|
|
- JSONArray rotate= JSON.parseArray(s);
|
|
|
|
- List<RotateFrameEntity> rotateFrameEntityList = new ArrayList<>();
|
|
|
|
- for (int i = 0; i < rotate.size(); i++) {
|
|
|
|
- if (i!=360){
|
|
|
|
- DecimalFormat decimalFormat = new DecimalFormat("0000");
|
|
|
|
- String numFormat= decimalFormat .format(i);
|
|
|
|
- JSONObject a = JSON.parseObject(JSONObject.toJSON(rotate.get(i)).toString());
|
|
|
|
- RotateFrameEntity rotateFrameEntity=new RotateFrameEntity();
|
|
|
|
- rotateFrameEntity.setFrameIndex(a.getInteger("frame"));
|
|
|
|
- rotateFrameEntity.setFileName(l.getName()+"."+numFormat+".h264");
|
|
|
|
- rotateFrameEntity.setDirectory(l.getName());
|
|
|
|
- AnglePO anglePO=new AnglePO();
|
|
|
|
- anglePO.setPitch(a.getJSONObject("angle").getIntValue("pitch"));
|
|
|
|
- anglePO.setRoll(a.getJSONObject("angle").getIntValue("roll"));
|
|
|
|
- anglePO.setYaw(a.getJSONObject("angle").getIntValue("yaw"));
|
|
|
|
- rotateFrameEntity.setCameraAngle(anglePO);
|
|
|
|
- PointPO po=new PointPO();
|
|
|
|
- po.setX(a.getJSONObject("position").getDoubleValue("x"));
|
|
|
|
- po.setY(a.getJSONObject("position").getDoubleValue("y"));
|
|
|
|
- po.setZ(a.getJSONObject("position").getDoubleValue("z"));
|
|
|
|
- rotateFrameEntity.setCameraPosition(po);
|
|
|
|
- rotateFrameEntity.setBreakPointId(l.getName());
|
|
|
|
- rotateFrameEntity.setAppId("0000000001");
|
|
|
|
- rotateFrameEntityList.add(rotateFrameEntity);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- boolean b = rotateFrameService.saveBatch(rotateFrameEntityList);
|
|
|
|
- System.out.println("saverotateFrameEntityList-"+b );
|
|
|
|
-
|
|
|
|
- }else {
|
|
|
|
- String s = FileUtil.readString(file, "utf8");
|
|
|
|
- JSONArray moveFrame= JSON.parseArray(s);
|
|
|
|
- List<MoveFrameEntity> moveFrameEntityList=new ArrayList<>();
|
|
|
|
- for (int i = 0; i < moveFrame.size(); i++) {
|
|
|
|
- DecimalFormat decimalFormat = new DecimalFormat("0000");
|
|
|
|
- String numFormat= decimalFormat .format(i);
|
|
|
|
- JSONObject a = JSON.parseObject(JSONObject.toJSON(moveFrame.get(i)).toString());
|
|
|
|
- MoveFrameEntity moveFrameEntity=new MoveFrameEntity();
|
|
|
|
- AnglePO anglePO=new AnglePO();
|
|
|
|
- anglePO.setPitch(a.getJSONObject("angle").getIntValue("pitch"));
|
|
|
|
- anglePO.setRoll(a.getJSONObject("angle").getIntValue("roll"));
|
|
|
|
- anglePO.setYaw(a.getJSONObject("angle").getIntValue("yaw"));
|
|
|
|
- moveFrameEntity.setCameraAngle(anglePO);
|
|
|
|
- PointPO po=new PointPO();
|
|
|
|
- po.setX(a.getJSONObject("position").getDoubleValue("x"));
|
|
|
|
- po.setY(a.getJSONObject("position").getDoubleValue("y"));
|
|
|
|
- po.setZ(a.getJSONObject("position").getDoubleValue("z"));
|
|
|
|
- moveFrameEntity.setCameraPosition(po);
|
|
|
|
- String name = file.getName().replace(".json", "");
|
|
|
|
- String[] s1 = name.split("_");
|
|
|
|
- moveFrameEntity.setStartBreakPointId(Integer.parseInt(s1[0]));
|
|
|
|
- moveFrameEntity.setEndBreakPointId(Integer.parseInt(s1[1]));
|
|
|
|
- moveFrameEntity.setAngle(Integer.parseInt(s1[2]));
|
|
|
|
- moveFrameEntity.setFrameIndex(a.getInteger("frame"));
|
|
|
|
- moveFrameEntity.setDirectory(file.getName().replace(".json",""));
|
|
|
|
- System.out.println(JSON.toJSONString(moveFrameEntity));
|
|
|
|
- moveFrameEntity.setAppId("0000000001");
|
|
|
|
- moveFrameEntity.setFileName(file.getName().replace(".json","")+"."+numFormat+".h264");
|
|
|
|
- moveFrameEntityList.add(moveFrameEntity);
|
|
|
|
- }
|
|
|
|
- boolean b = moveFrameService.saveBatch(moveFrameEntityList);
|
|
|
|
- System.out.println("savemoveFrameEntityList-"+b );
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- System.out.println(FileUtil.isFile(l));
|
|
|
|
- }
|
|
|
|
|
|
+//
|
|
|
|
+// String path="/home/webrtc/creatJson/outputjson/";
|
|
|
|
+//
|
|
|
|
+// if (FileUtil.exist(path.replaceAll("outputjson",""))){
|
|
|
|
+// String s = FileUtil.readString(path.replaceAll("outputjson","") + "points.json", "utf8");
|
|
|
|
+// JSONArray points= JSON.parseArray(s);
|
|
|
|
+// for (Object point : points) {
|
|
|
|
+// JSONObject a = JSON.parseObject(JSONObject.toJSON(point).toString());
|
|
|
|
+// BreakpointsEntity breakpointsEntity=new BreakpointsEntity();
|
|
|
|
+// breakpointsEntity.setAppId("0000000001");
|
|
|
|
+// PointPO po=new PointPO();
|
|
|
|
+// po.setX(a.getJSONObject("position").getDoubleValue("x"));
|
|
|
|
+// po.setY(a.getJSONObject("position").getDoubleValue("y"));
|
|
|
|
+// po.setZ(a.getJSONObject("position").getDoubleValue("z"));
|
|
|
|
+// breakpointsEntity.setPosition(po);
|
|
|
|
+// breakpointsEntity.setBreakPointId(a.getString("id"));
|
|
|
|
+// breakpointsService.save(breakpointsEntity);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// File[] ls = FileUtil.ls(path);
|
|
|
|
+// for (File l : ls) {
|
|
|
|
+// List<File> files = FileUtil.loopFiles(l);
|
|
|
|
+// for (File file : files) {
|
|
|
|
+// if (!file.getName().contains("_")){
|
|
|
|
+// String s = FileUtil.readString(file, "utf8");
|
|
|
|
+// JSONArray rotate= JSON.parseArray(s);
|
|
|
|
+// List<RotateFrameEntity> rotateFrameEntityList = new ArrayList<>();
|
|
|
|
+// for (int i = 0; i < rotate.size(); i++) {
|
|
|
|
+// if (i!=360){
|
|
|
|
+// DecimalFormat decimalFormat = new DecimalFormat("0000");
|
|
|
|
+// String numFormat= decimalFormat .format(i);
|
|
|
|
+// JSONObject a = JSON.parseObject(JSONObject.toJSON(rotate.get(i)).toString());
|
|
|
|
+// RotateFrameEntity rotateFrameEntity=new RotateFrameEntity();
|
|
|
|
+// rotateFrameEntity.setFrameIndex(a.getInteger("frame"));
|
|
|
|
+// rotateFrameEntity.setFileName(l.getName()+"."+numFormat+".h264");
|
|
|
|
+// rotateFrameEntity.setDirectory(l.getName());
|
|
|
|
+// AnglePO anglePO=new AnglePO();
|
|
|
|
+// anglePO.setPitch(a.getJSONObject("angle").getIntValue("pitch"));
|
|
|
|
+// anglePO.setRoll(a.getJSONObject("angle").getIntValue("roll"));
|
|
|
|
+// anglePO.setYaw(a.getJSONObject("angle").getIntValue("yaw"));
|
|
|
|
+// rotateFrameEntity.setCameraAngle(anglePO);
|
|
|
|
+// PointPO po=new PointPO();
|
|
|
|
+// po.setX(a.getJSONObject("position").getDoubleValue("x"));
|
|
|
|
+// po.setY(a.getJSONObject("position").getDoubleValue("y"));
|
|
|
|
+// po.setZ(a.getJSONObject("position").getDoubleValue("z"));
|
|
|
|
+// rotateFrameEntity.setCameraPosition(po);
|
|
|
|
+// rotateFrameEntity.setBreakPointId(l.getName());
|
|
|
|
+// rotateFrameEntity.setAppId("0000000001");
|
|
|
|
+// rotateFrameEntityList.add(rotateFrameEntity);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// boolean b = rotateFrameService.saveBatch(rotateFrameEntityList);
|
|
|
|
+// System.out.println("saverotateFrameEntityList-"+b );
|
|
|
|
+//
|
|
|
|
+// }else {
|
|
|
|
+// String s = FileUtil.readString(file, "utf8");
|
|
|
|
+// JSONArray moveFrame= JSON.parseArray(s);
|
|
|
|
+// List<MoveFrameEntity> moveFrameEntityList=new ArrayList<>();
|
|
|
|
+// for (int i = 0; i < moveFrame.size(); i++) {
|
|
|
|
+// DecimalFormat decimalFormat = new DecimalFormat("0000");
|
|
|
|
+// String numFormat= decimalFormat .format(i);
|
|
|
|
+// JSONObject a = JSON.parseObject(JSONObject.toJSON(moveFrame.get(i)).toString());
|
|
|
|
+// MoveFrameEntity moveFrameEntity=new MoveFrameEntity();
|
|
|
|
+// AnglePO anglePO=new AnglePO();
|
|
|
|
+// anglePO.setPitch(a.getJSONObject("angle").getIntValue("pitch"));
|
|
|
|
+// anglePO.setRoll(a.getJSONObject("angle").getIntValue("roll"));
|
|
|
|
+// anglePO.setYaw(a.getJSONObject("angle").getIntValue("yaw"));
|
|
|
|
+// moveFrameEntity.setCameraAngle(anglePO);
|
|
|
|
+// PointPO po=new PointPO();
|
|
|
|
+// po.setX(a.getJSONObject("position").getDoubleValue("x"));
|
|
|
|
+// po.setY(a.getJSONObject("position").getDoubleValue("y"));
|
|
|
|
+// po.setZ(a.getJSONObject("position").getDoubleValue("z"));
|
|
|
|
+// moveFrameEntity.setCameraPosition(po);
|
|
|
|
+// String name = file.getName().replace(".json", "");
|
|
|
|
+// String[] s1 = name.split("_");
|
|
|
|
+// moveFrameEntity.setStartBreakPointId(Integer.parseInt(s1[0]));
|
|
|
|
+// moveFrameEntity.setEndBreakPointId(Integer.parseInt(s1[1]));
|
|
|
|
+// moveFrameEntity.setAngle(Integer.parseInt(s1[2]));
|
|
|
|
+// moveFrameEntity.setFrameIndex(a.getInteger("frame"));
|
|
|
|
+// moveFrameEntity.setDirectory(file.getName().replace(".json",""));
|
|
|
|
+// System.out.println(JSON.toJSONString(moveFrameEntity));
|
|
|
|
+// moveFrameEntity.setAppId("0000000001");
|
|
|
|
+// moveFrameEntity.setFileName(file.getName().replace(".json","")+"."+numFormat+".h264");
|
|
|
|
+// moveFrameEntityList.add(moveFrameEntity);
|
|
|
|
+// }
|
|
|
|
+// boolean b = moveFrameService.saveBatch(moveFrameEntityList);
|
|
|
|
+// System.out.println("savemoveFrameEntityList-"+b );
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// System.out.println(FileUtil.isFile(l));
|
|
|
|
+// }
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
}
|
|
}
|