Commit 8375bfa8 by xmh

1

1 parent 11be1afc
......@@ -32,8 +32,8 @@ public enum Dict {
captionType.put(4, "车牌号码");
captionType.put(5, "设备名称");
captionType.put(6, "设备编号");
captionType.put(7, "方向名称");
captionType.put(8, "方向编号");
captionType.put(7, "行驶方向");
captionType.put(8, "行驶方向编号");
captionType.put(9, "车辆类型");
captionType.put(10, "车身颜色");
captionType.put(11, "车辆品牌");
......@@ -42,5 +42,7 @@ public enum Dict {
captionType.put(14, "车道号");
captionType.put(15, "防伪码");
captionType.put(16, "自定义");
captionType.put(17, "违法代码");
captionType.put(18, "违法类型");
}
}
......@@ -193,7 +193,8 @@ public class Generator {
}
List<Context> contexts = caption.getContexts();
Pair<String, Integer> combine = combineCaptionContent(contexts);
String dateFormat = (caption.getMillisecond() != null && caption.getMillisecond()) ? caption.getDateFormat() + ":xxx" : caption.getDateFormat();
Pair<String, Integer> combine = combineCaptionContent(picType, contexts, dateFormat);
String content = combine.getKey();
Integer wrapCount = combine.getValue();
Element ele = XmlUtil.appendChild(captionsElement, "Caption" + (i + 1));
......@@ -207,9 +208,18 @@ public class Generator {
XmlUtil.appendChild(ele, "bgTransparency").setTextContent(caption.getBgTransparency().toString());
Element coordinateElement = XmlUtil.appendChild(ele, "Coordinate");
// 坐标需要根据positionType来搞
Integer positionType = caption.getPositionType();
String y = coordinate.getY();
if (positionType == 1) {
y = y + "+全景1高";
} else if (positionType == 0) {
y = y + "-80";
} else if (positionType == 3) {
y = y + "+全景1高-80";
}
XmlUtil.appendChild(coordinateElement, "left").setTextContent(coordinate.getX());
XmlUtil.appendChild(coordinateElement, "top").setTextContent(coordinate.getY());
XmlUtil.appendChild(coordinateElement, "width").setTextContent(coordinate.getName() + "宽");
XmlUtil.appendChild(coordinateElement, "top").setTextContent(y);
XmlUtil.appendChild(coordinateElement, "width").setTextContent("全景1宽");
int height = wrapCount == 0 ? 80 : caption.getFontSize() * wrapCount;
XmlUtil.appendChild(coordinateElement, "height").setTextContent(String.valueOf(height));
captionCount++;
......@@ -228,19 +238,49 @@ public class Generator {
return dataTypes.stream().map(x -> "数据类型=" + x).collect(Collectors.joining("+"));
}
private Pair<String, Integer> combineCaptionContent(List<Context> contexts) {
private Pair<String, Integer> combineCaptionContent(Integer picType, List<Context> contexts, String dateFormat) {
if (CollectionUtil.isEmpty(contexts)) {
return Pair.of(null, null);
}
String picTypeName = Dict.INSTANCE.picType.get(picType);
StringBuilder sb = new StringBuilder();
int wrapCount = 0;
for (Context context : contexts) {
sb.append(Dict.INSTANCE.captionType.get(context.getType())).append(":+").append(context.getContent());
Integer type = context.getType();
sb.append(Dict.INSTANCE.captionType.get(type)).append(": + ");
switch (type) {
case 1:
sb.append("(").append(picTypeName).append("时间:").append(dateFormat).append(")");
break;
case 9:
sb.append("(用户车辆类型1)");
break;
case 10:
sb.append("(用户车身颜色1)");
break;
case 11:
sb.append("(车辆子品牌)");
break;
case 15:
sb.append("(合成图1防伪码)");
break;
case 16:
sb.append(context.getContent());
break;
case 17:
sb.append("(违法类型代码)");
break;
default:
sb.append("(").append(Dict.INSTANCE.captionType.get(type)).append(")");
}
if (context.getWrap()) {
wrapCount++;
sb.append("+(换行分隔符)");
}
sb.append("+");
}
sb.setLength(sb.length() - 1);
return Pair.of(sb.toString(), wrapCount);
}
......@@ -274,7 +314,7 @@ public class Generator {
case 41:
case 51:
case 61:
x = pre.x + "+" + Dict.INSTANCE.picType.get(pre.getType()) + "宽";
x = pre.x + "+" + "全景1宽";
y = "80";
break;
case 12:
......@@ -283,43 +323,43 @@ public class Generator {
case 15:
case 16:
x = "0";
y = pre.y + "+" + Dict.INSTANCE.picType.get(pre.getType()) + "高";
y = pre.y + "+" + "全景1高";
break;
case 22:
case 23:
if (index == 1) {
x = Dict.INSTANCE.picType.get(pre.getType()) + "宽";
x = "全景1宽";
y = "80";
} else if (index == 2) {
x = "0";
y = "80" + "+" + Dict.INSTANCE.picType.get(coordinates[0].getType()) + "高";
y = "80" + "+" + "全景1高";
} else if (index == 3) {
x = Dict.INSTANCE.picType.get(coordinates[2].getType()) + "宽";
y = "80" + "+" + Dict.INSTANCE.picType.get(coordinates[1].getType()) + "高";
x = "全景1宽";
y = "80" + "+" + "全景1高";
} else if (index == 4) {
x = "0";
y = coordinates[2].y + "+" + Dict.INSTANCE.picType.get(coordinates[2].getType()) + "高";
y = coordinates[2].y + "+" + "全景1高";
} else if (index == 5) {
x = Dict.INSTANCE.picType.get(coordinates[4].getType()) + "宽";
y = coordinates[3].y + "+" + Dict.INSTANCE.picType.get(coordinates[3].getType()) + "高";
x = "全景1宽";
y = coordinates[3].y + "+" + "全景1高";
}
break;
case 32:
if (index == 1) {
x = Dict.INSTANCE.picType.get(coordinates[0].getType()) + "宽";
x = "全景1宽";
y = "80";
} else if (index == 2) {
x = coordinates[1].x + "+" + Dict.INSTANCE.picType.get(coordinates[1].getType()) + "宽";
x = "全景1宽" + "+" + "全景1宽";
y = "80";
} else if (index == 3) {
x = "0";
y = "80" + "+" + Dict.INSTANCE.picType.get(coordinates[0].getType()) + "高";
y = "80" + "+" + "全景1高";
} else if (index == 4) {
x = Dict.INSTANCE.picType.get(coordinates[3].getType()) + "宽";
y = "80" + "+" + Dict.INSTANCE.picType.get(coordinates[1].getType()) + "高";
x = "全景1宽";
y = "80" + "+" + "全景1高";
} else if (index == 5) {
x = Dict.INSTANCE.picType.get(coordinates[4].getType()) + "宽";
y = "80" + "+" + Dict.INSTANCE.picType.get(coordinates[2].getType()) + "高";
x = "全景1宽 + 全景1宽";
y = "80" + "+" + "全景1高";
}
break;
default:
......
spring.cloud.consul.discovery.metadata.version=0.0.1-SNAPSHOT
\ No newline at end of file
......@@ -27,8 +27,6 @@ spring:
# 服务注册标识,格式为:应用名称:服务器IP:端口
instance-id: ${spring.application.name}:${spring.cloud.consul.discovery.ip-address}:${server.port}
ip-address: 192.168.9.146
metadata:
version: 0.0.1-SNAPSHOT
datasource:
url: jdbc:h2:tcp://localhost:9092/F:\\myIDEAworkspace\\繁星\\storage-config\\h2\\storeConfig
username: root
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!