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