|
|
@@ -0,0 +1,123 @@
|
|
|
+package tool;
|
|
|
+
|
|
|
+import bogda.common.IOKit;
|
|
|
+import bogda.common.JsonAdapter;
|
|
|
+import bogda.common.model.Model;
|
|
|
+import bogda.common.model.ModelTrans;
|
|
|
+import bogda.common.model.Prop;
|
|
|
+
|
|
|
+import java.io.FileOutputStream;
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
+public class Pipe {
|
|
|
+
|
|
|
+ public static void main(String[] args) throws Exception {
|
|
|
+ new Pipe().build();
|
|
|
+ }
|
|
|
+
|
|
|
+ ArrayList<Node> roots = new ArrayList<>();
|
|
|
+
|
|
|
+ void build() throws Exception {
|
|
|
+ roots.add(liquid());
|
|
|
+ roots.add(air());
|
|
|
+ String json = ModelTrans.get().notMarkType().toJson(roots);
|
|
|
+ json = JsonAdapter.formatJson(json);
|
|
|
+ IOKit.writeContent(json, new FileOutputStream("d:/work_area/pipe.json"));
|
|
|
+ }
|
|
|
+
|
|
|
+ Node liquid() throws Exception {
|
|
|
+ String type = "liquid";
|
|
|
+ Node root = new Node("液体管道", type, type);
|
|
|
+
|
|
|
+ buildSys("water", "给排水系统",
|
|
|
+ new String[]{"生活给水", "生活热水给水", "直饮水给水", "中水给水", "其他公共给水(水景、喷灌、泳池等)", "污水排水", "雨水收集"},
|
|
|
+ root);
|
|
|
+
|
|
|
+ buildSys("ac", "空调系统",
|
|
|
+ new String[]{"冷冻水", "冷却水", "采暖热水", "采暖蒸汽", "制冷剂", "吸收剂", "乙二醇"},
|
|
|
+ root);
|
|
|
+
|
|
|
+ buildSys("fire", "消防系统",
|
|
|
+ new String[]{"消防给水", "液体灭火剂"},
|
|
|
+ root);
|
|
|
+
|
|
|
+ buildSys("sp", "特殊",
|
|
|
+ new String[]{"燃油", "液化天然气"},
|
|
|
+ root);
|
|
|
+
|
|
|
+ buildSys("liquid_other", "其他液体管道", new String[]{}, root);
|
|
|
+
|
|
|
+ return root;
|
|
|
+ }
|
|
|
+
|
|
|
+ void buildSys(String sys, String sysName, String[] names, Node root) {
|
|
|
+ Node sysNode = root.addSub(new Node(sysName, sys, root.type));
|
|
|
+ for (int i = 0; i < names.length; i++) {
|
|
|
+ sysNode.addSub(new Node(names[i], sys + "_" + (i + 1), root.type));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Node air() throws Exception {
|
|
|
+ String type = "air";
|
|
|
+ Node root = new Node("气体管道", type, type);
|
|
|
+
|
|
|
+ buildSys("pk", "普通空调系统用风管",
|
|
|
+ new String[]{"送风", "回风", "排风", "新风", "加压送风", "厨房排油烟"},
|
|
|
+ root);
|
|
|
+
|
|
|
+ buildSys("py", "防排烟系统用风管",
|
|
|
+ new String[]{"消防补风", "排烟"},
|
|
|
+ root);
|
|
|
+
|
|
|
+ buildSys("pf", "含酸碱排风系统用风管", new String[]{}, root);
|
|
|
+
|
|
|
+ buildSys("gas", "燃气系统送燃气", new String[]{}, root);
|
|
|
+
|
|
|
+ buildSys("gea", "气体灭火剂管", new String[]{}, root);
|
|
|
+
|
|
|
+ buildSys("ad", "人防风管", new String[]{}, root);
|
|
|
+
|
|
|
+ buildSys("air_other", "其他气体管道", new String[]{}, root);
|
|
|
+
|
|
|
+ return root;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Model(type = "node", ns = "test")
|
|
|
+ class Node {
|
|
|
+
|
|
|
+ @Prop
|
|
|
+ String name;
|
|
|
+
|
|
|
+ @Prop
|
|
|
+ String code;
|
|
|
+
|
|
|
+ @Prop
|
|
|
+ String type;
|
|
|
+
|
|
|
+ @Prop(name = "children")
|
|
|
+ ArrayList<Node> subs;
|
|
|
+
|
|
|
+ public Node() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public Node(String name, String code, String type) {
|
|
|
+ this.name = name;
|
|
|
+ this.code = code;
|
|
|
+ this.type = type;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Node addSub(Node sub) {
|
|
|
+ if (subs == null)
|
|
|
+ subs = new ArrayList<Node>();
|
|
|
+ subs.add(sub);
|
|
|
+ return sub;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void toJson(StringBuilder json) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|