Commit 8375bfa8 by xmh

1

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