【修改报错,去除无效日志打印】
This commit is contained in:
parent
e997462d4d
commit
04b47b5e16
@ -36,13 +36,10 @@ public class LineGraphicDataRepository {
|
|||||||
private static final Map<Integer, Map<String, CoordinateConvertor>> lineCoordinateMain =
|
private static final Map<Integer, Map<String, CoordinateConvertor>> lineCoordinateMain =
|
||||||
new HashMap<>();
|
new HashMap<>();
|
||||||
|
|
||||||
/**
|
/** 线路-设备code-设备 */
|
||||||
* 线路-设备code-设备
|
private static final HashBasedTable<Short, String, MessageOrBuilder> line_code_table =
|
||||||
*/
|
HashBasedTable.create();
|
||||||
private static final HashBasedTable<Short, String, MessageOrBuilder> line_code_table = HashBasedTable.create();
|
/** 线路-设备。由于现在许多设备code都是"",使用line_code_table会覆盖,临时加此map,后续删除 */
|
||||||
/**
|
|
||||||
* 线路-设备。由于现在许多设备code都是"",使用line_code_table会覆盖,临时加此map,后续删除
|
|
||||||
*/
|
|
||||||
private static final HashMap<Short, List<MessageOrBuilder>> line_map = new HashMap<>();
|
private static final HashMap<Short, List<MessageOrBuilder>> line_map = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,28 +114,30 @@ public class LineGraphicDataRepository {
|
|||||||
return line_map.get(lineId).stream()
|
return line_map.get(lineId).stream()
|
||||||
.filter(builder -> cls.isAssignableFrom(builder.getClass()))
|
.filter(builder -> cls.isAssignableFrom(builder.getClass()))
|
||||||
.map(builder -> (T) builder);
|
.map(builder -> (T) builder);
|
||||||
// return line_code_table.row(lineId).values().stream()
|
// return line_code_table.row(lineId).values().stream()
|
||||||
// .filter(builder -> cls.isAssignableFrom(builder.getClass()))
|
// .filter(builder -> cls.isAssignableFrom(builder.getClass()))
|
||||||
// .map(builder -> (T) builder);
|
// .map(builder -> (T) builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fillLineCodeTable(Integer lineId, RtssGraphicStorage storage) {
|
private static void fillLineCodeTable(Integer lineId, RtssGraphicStorage storage) {
|
||||||
Short shortLineId = lineId.shortValue();
|
Short shortLineId = lineId.shortValue();
|
||||||
List<MessageOrBuilder> list = storage.getAllFields().entrySet().stream()
|
List<MessageOrBuilder> list =
|
||||||
.filter(entry -> entry.getKey().isRepeated())
|
storage.getAllFields().entrySet().stream()
|
||||||
.flatMap(entry -> ((List<MessageOrBuilder>) entry.getValue()).stream())
|
.filter(entry -> entry.getKey().isRepeated())
|
||||||
.collect(Collectors.toList());
|
.flatMap(entry -> ((List<MessageOrBuilder>) entry.getValue()).stream())
|
||||||
|
.collect(Collectors.toList());
|
||||||
line_map.put(shortLineId, list);
|
line_map.put(shortLineId, list);
|
||||||
// storage.getAllFields().forEach((fd, value) -> {
|
// storage.getAllFields().forEach((fd, value) -> {
|
||||||
// if (fd.isRepeated()) {
|
// if (fd.isRepeated()) {
|
||||||
// List<MessageOrBuilder> list = (List<MessageOrBuilder>) value;
|
// List<MessageOrBuilder> list = (List<MessageOrBuilder>) value;
|
||||||
// for (MessageOrBuilder builder : list) {
|
// for (MessageOrBuilder builder : list) {
|
||||||
// FieldDescriptor fieldDescriptor = builder.getDescriptorForType().findFieldByName("code");
|
// FieldDescriptor fieldDescriptor =
|
||||||
// String code = (String) builder.getField(fieldDescriptor);
|
// builder.getDescriptorForType().findFieldByName("code");
|
||||||
// line_code_table.put(shortLineId, code, builder);
|
// String code = (String) builder.getField(fieldDescriptor);
|
||||||
// }
|
// line_code_table.put(shortLineId, code, builder);
|
||||||
// }
|
// }
|
||||||
// });
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -404,9 +403,6 @@ public class LineGraphicDataRepository {
|
|||||||
if (sectionMap.containsKey(sid)) {
|
if (sectionMap.containsKey(sid)) {
|
||||||
DeviceInfoProto.Section.Builder sectionBuilder =
|
DeviceInfoProto.Section.Builder sectionBuilder =
|
||||||
(DeviceInfoProto.Section.Builder) sectionMap.get(sid);
|
(DeviceInfoProto.Section.Builder) sectionMap.get(sid);
|
||||||
if (sectionBuilder.getPhysicalSectionId().equals("118")) {
|
|
||||||
log.info("");
|
|
||||||
}
|
|
||||||
sectionBuilder.setCode(section.getCode());
|
sectionBuilder.setCode(section.getCode());
|
||||||
// 获取到物理区段信息
|
// 获取到物理区段信息
|
||||||
DeviceInfoProto.Section.Builder physicalSection =
|
DeviceInfoProto.Section.Builder physicalSection =
|
||||||
|
@ -10,22 +10,25 @@ import org.assertj.core.util.Lists;
|
|||||||
|
|
||||||
public class GenerateProtoBufUtil {
|
public class GenerateProtoBufUtil {
|
||||||
|
|
||||||
private final static String EXE_BIN_FILE = String.join(File.separator,
|
private static final String EXE_BIN_FILE =
|
||||||
System.getProperty("user.dir"), "xian-ncc-da-message",
|
String.join(
|
||||||
"protoc-23.1", "bin", "win64",
|
File.separator,
|
||||||
"protoc");
|
System.getProperty("user.dir"),
|
||||||
|
"xian-ncc-da-message",
|
||||||
|
"protoc-23.1",
|
||||||
|
"bin",
|
||||||
|
"win64",
|
||||||
|
"protoc");
|
||||||
private File protoFilePath;
|
private File protoFilePath;
|
||||||
private String outPath;
|
private String outPath;
|
||||||
private boolean pullMessage;
|
private boolean pullMessage;
|
||||||
// private String gitPullPath;
|
// private String gitPullPath;
|
||||||
|
|
||||||
public GenerateProtoBufUtil(String rootPath, boolean pullMessage) {
|
public GenerateProtoBufUtil(String rootPath, boolean pullMessage) {
|
||||||
this.pullMessage = pullMessage;
|
this.pullMessage = pullMessage;
|
||||||
String sourcePath = String.join(File.separator, rootPath,
|
String sourcePath = String.join(File.separator, rootPath, "xian-ncc-da-message", "protos");
|
||||||
"xian-ncc-da-message", "protos");
|
|
||||||
|
|
||||||
this.outPath = String.join(File.separator, rootPath,
|
this.outPath = String.join(File.separator, rootPath, "src", "main", "java");
|
||||||
"src", "main", "java");
|
|
||||||
this.protoFilePath = new File(sourcePath);
|
this.protoFilePath = new File(sourcePath);
|
||||||
if (!protoFilePath.exists() || !protoFilePath.isDirectory()) {
|
if (!protoFilePath.exists() || !protoFilePath.isDirectory()) {
|
||||||
throw new RuntimeException("proto不是目录或目录不存在");
|
throw new RuntimeException("proto不是目录或目录不存在");
|
||||||
@ -41,9 +44,14 @@ public class GenerateProtoBufUtil {
|
|||||||
this.PullTmmsMessage();
|
this.PullTmmsMessage();
|
||||||
}
|
}
|
||||||
for (File file : this.findFiles()) {
|
for (File file : this.findFiles()) {
|
||||||
String command = String.format("%s --proto_path=%s -I=%s --java_out=%s %s", EXE_BIN_FILE,
|
String command =
|
||||||
this.protoFilePath.getPath(), file.getParentFile().getAbsolutePath(), this.outPath,
|
String.format(
|
||||||
file.getName());
|
"%s --proto_path=%s -I=%s --java_out=%s %s",
|
||||||
|
EXE_BIN_FILE,
|
||||||
|
this.protoFilePath.getPath(),
|
||||||
|
file.getParentFile().getAbsolutePath(),
|
||||||
|
this.outPath,
|
||||||
|
file.getName());
|
||||||
this.genertateFile(command);
|
this.genertateFile(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,8 +82,8 @@ public class GenerateProtoBufUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void PullTmmsMessage() throws IOException {
|
private void PullTmmsMessage() throws IOException {
|
||||||
InputStream inputStream = Runtime.getRuntime()
|
InputStream inputStream =
|
||||||
.exec("git pull", null, protoFilePath).getInputStream();
|
Runtime.getRuntime().exec("git pull", null, protoFilePath).getInputStream();
|
||||||
byte[] ebs = new byte[512];
|
byte[] ebs = new byte[512];
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
int size;
|
int size;
|
||||||
@ -87,7 +95,7 @@ public class GenerateProtoBufUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
GenertateProtoBufUtil gu = new GenertateProtoBufUtil(System.getProperty("user.dir"), true);
|
GenerateProtoBufUtil gu = new GenerateProtoBufUtil(System.getProperty("user.dir"), true);
|
||||||
gu.execCommand();
|
gu.execCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit e521fa9d3372987b45a4d9bdb63544cf4e1f088f
|
Subproject commit edc9973662bc4f02198f72919de9408fa9ea9043
|
Loading…
Reference in New Issue
Block a user