Commit f9e8fc2c5633ce14db87993d52d797841b16addc

Authored by 王通
1 parent 37e95b0a

1.

@@ -191,6 +191,11 @@ @@ -191,6 +191,11 @@
191 <groupId>org.apache.xmlgraphics</groupId> 191 <groupId>org.apache.xmlgraphics</groupId>
192 <artifactId>batik-js</artifactId> 192 <artifactId>batik-js</artifactId>
193 </exclusion> 193 </exclusion>
  194 + <!-- 排除旧版本javassist,使用兼容Java 8+的版本 -->
  195 + <exclusion>
  196 + <groupId>javassist</groupId>
  197 + <artifactId>javassist</artifactId>
  198 + </exclusion>
194 </exclusions> 199 </exclusions>
195 </dependency> 200 </dependency>
196 <dependency> 201 <dependency>
@@ -393,6 +398,13 @@ @@ -393,6 +398,13 @@
393 <groupId>org.projectlombok</groupId> 398 <groupId>org.projectlombok</groupId>
394 <artifactId>lombok</artifactId> 399 <artifactId>lombok</artifactId>
395 </dependency> 400 </dependency>
  401 +
  402 + <!-- 更新javassist版本,兼容Java 8+ -->
  403 + <dependency>
  404 + <groupId>org.javassist</groupId>
  405 + <artifactId>javassist</artifactId>
  406 + <version>3.27.0-GA</version>
  407 + </dependency>
396 408
397 <!-- https://mvnrepository.com/artifact/pentaho/simple-jndi --> 409 <!-- https://mvnrepository.com/artifact/pentaho/simple-jndi -->
398 <dependency> 410 <dependency>
@@ -437,6 +449,28 @@ @@ -437,6 +449,28 @@
437 <version>4.3.2-1.5.5</version> 449 <version>4.3.2-1.5.5</version>
438 <classifier>${javacpp.platform}</classifier> 450 <classifier>${javacpp.platform}</classifier>
439 </dependency> 451 </dependency>
  452 +
  453 + <dependency>
  454 + <groupId>org.springframework.boot</groupId>
  455 + <artifactId>spring-boot-starter-test</artifactId>
  456 + <scope>test</scope>
  457 + <exclusions>
  458 + <exclusion>
  459 + <groupId>org.junit.jupiter</groupId>
  460 + <artifactId>*</artifactId>
  461 + </exclusion>
  462 + <exclusion>
  463 + <groupId>junit</groupId>
  464 + <artifactId>junit</artifactId>
  465 + </exclusion>
  466 + </exclusions>
  467 + </dependency>
  468 + <dependency>
  469 + <groupId>junit</groupId>
  470 + <artifactId>junit</artifactId>
  471 + <version>4.12</version>
  472 + <scope>test</scope>
  473 + </dependency>
440 </dependencies> 474 </dependencies>
441 475
442 <dependencyManagement> 476 <dependencyManagement>
src/main/java/com/bsth/common/Constants.java
@@ -38,6 +38,8 @@ public class Constants { @@ -38,6 +38,8 @@ public class Constants {
38 public static final String XD_REAL_GPS = "/gps/real/line"; 38 public static final String XD_REAL_GPS = "/gps/real/line";
39 //public static final String XD_TEMPS = "/pages/control/line/temps/**"; 39 //public static final String XD_TEMPS = "/pages/control/line/temps/**";
40 40
  41 + public static final String PASSENGER_PAGES = "/pages/passenger/**";
  42 +
41 //车载网关上行接口 43 //车载网关上行接口
42 public static final String UPSTREAM_URL = "/control/upstream"; 44 public static final String UPSTREAM_URL = "/control/upstream";
43 //rfid 上传入口 45 //rfid 上传入口
src/main/java/com/bsth/filter/BaseFilter.java
@@ -20,7 +20,7 @@ public abstract class BaseFilter implements Filter { @@ -20,7 +20,7 @@ public abstract class BaseFilter implements Filter {
20 Constants.ASSETS_URL, Constants.LOGIN_ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, 20 Constants.ASSETS_URL, Constants.LOGIN_ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, Constants.LOGIN_FAILURE,
21 Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, 21 Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL,
22 Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.VEHICLE_DATA_SYNC_URL, Constants.METRONIC_URL, 22 Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.VEHICLE_DATA_SYNC_URL, Constants.METRONIC_URL,
23 - Constants.FILE_AUTH, "/e10adc3949ba59abbe56e057f20f883e.html", "/8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92.html"}; 23 + Constants.FILE_AUTH, Constants.PASSENGER_PAGES, "/e10adc3949ba59abbe56e057f20f883e.html", "/8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92.html"};
24 24
25 @Override 25 @Override
26 public void destroy() { 26 public void destroy() {
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -1037,33 +1037,59 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -1037,33 +1037,59 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1037 } 1037 }
1038 } 1038 }
1039 1039
  1040 + /**
  1041 + * 组装子线路文件内容
  1042 + * @param lineRegion
  1043 + * @return
  1044 + */
1040 private String subLine2Ftp(LineRegion lineRegion) { 1045 private String subLine2Ftp(LineRegion lineRegion) {
1041 StringBuilder builder = new StringBuilder(); 1046 StringBuilder builder = new StringBuilder();
1042 int len = lineRegion.getStationRoutes().size(); 1047 int len = lineRegion.getStationRoutes().size();
1043 int idx = 1; 1048 int idx = 1;
  1049 + if (lineRegion.getDirection() == 1) {
  1050 + LsStationRoute first = lineRegion.getStationRoutes().get(0), last = lineRegion.getStationRoutes().get(len - 1);
  1051 + spliceRoute(builder, first, idx, false); idx++;
  1052 + spliceRoute(builder, last, idx, true); idx++;
  1053 + }
1044 for (int i = 0;i < len;i++) { 1054 for (int i = 0;i < len;i++) {
1045 LsStationRoute route = lineRegion.getStationRoutes().get(i); 1055 LsStationRoute route = lineRegion.getStationRoutes().get(i);
1046 - builder.append(route.getCenterPointWgs().getPosition().getCoordinate(0))  
1047 - .append("\t").append(route.getCenterPointWgs().getPosition().getCoordinate(1))  
1048 - .append("\t").append(i == len - 1 ? 2 : 1)  
1049 - .append("\t").append(idx).append("\t");  
1050 - for (int j = 0;j < 8 - route.getStationCode().length();j++) {  
1051 - builder.append("0");  
1052 - }  
1053 - builder.append(route.getStationCode())  
1054 - .append("\t").append((int) route.getDistances().doubleValue() * 1000)  
1055 - .append("\t0")  
1056 - .append("\t").append(route.getStationName())  
1057 - .append("\t").append(route.getStationNameEn())  
1058 - .append("\r\n"); 1056 + spliceRoute(builder, route, idx, i == len - 1);
1059 1057
1060 idx++; 1058 idx++;
1061 } 1059 }
  1060 + if (lineRegion.getDirection() == 0) {
  1061 + LsStationRoute first = lineRegion.getStationRoutes().get(0), last = lineRegion.getStationRoutes().get(len - 1);
  1062 + spliceRoute(builder, first, idx, false); idx++;
  1063 + spliceRoute(builder, last, idx, true);
  1064 + }
1062 1065
1063 return builder.toString(); 1066 return builder.toString();
1064 } 1067 }
1065 1068
1066 /** 1069 /**
  1070 + * 按站点路由进行组装
  1071 + * @param builder
  1072 + * @param route
  1073 + * @param idx
  1074 + * @param isEnd
  1075 + */
  1076 + private void spliceRoute(StringBuilder builder, LsStationRoute route, int idx, boolean isEnd){
  1077 + builder.append(route.getCenterPointWgs().getPosition().getCoordinate(0))
  1078 + .append("\t").append(route.getCenterPointWgs().getPosition().getCoordinate(1))
  1079 + .append("\t").append(isEnd ? 2 : 1)
  1080 + .append("\t").append(idx).append("\t");
  1081 + for (int j = 0;j < 8 - route.getStationCode().length();j++) {
  1082 + builder.append("0");
  1083 + }
  1084 + builder.append(route.getStationCode())
  1085 + .append("\t").append((int) route.getDistances().doubleValue() * 1000)
  1086 + .append("\t0")
  1087 + .append("\t").append(route.getStationName())
  1088 + .append("\t").append(route.getStationNameEn())
  1089 + .append("\r\n");
  1090 + }
  1091 +
  1092 + /**
1067 * tts合成及打包 1093 * tts合成及打包
1068 * @param objects 1094 * @param objects
1069 * @param line 1095 * @param line
@@ -1137,7 +1163,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -1137,7 +1163,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1137 zipAudio(String.format("%s%s/", linePath, "0"), voicePath); 1163 zipAudio(String.format("%s%s/", linePath, "0"), voicePath);
1138 1164
1139 // 线路区间 1165 // 线路区间
1140 - Map<String, List<SeqStationLevel>> region2map = new HashMap<>(); 1166 + Map<LineRegion, List<SeqStationLevel>> region2map = new HashMap<>();
1141 for (LineRegion lineRegion : lineRegions) { 1167 for (LineRegion lineRegion : lineRegions) {
1142 for (int i = 0;i < objects.size();i++) { 1168 for (int i = 0;i < objects.size();i++) {
1143 Object[] objArr = objects.get(i); 1169 Object[] objArr = objects.get(i);
@@ -1147,10 +1173,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -1147,10 +1173,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1147 for (int j = 0;j < lineRegion.getStationRoutes().size();j++) { 1173 for (int j = 0;j < lineRegion.getStationRoutes().size();j++) {
1148 LsStationRoute stationRoute = lineRegion.getStationRoutes().get(j); 1174 LsStationRoute stationRoute = lineRegion.getStationRoutes().get(j);
1149 if (stationCode.equals(stationRoute.getStationCode())) { 1175 if (stationCode.equals(stationRoute.getStationCode())) {
1150 - List<SeqStationLevel> map = region2map.get(lineRegion.getSeq().toString()); 1176 + List<SeqStationLevel> map = region2map.get(lineRegion);
1151 if (map == null) { 1177 if (map == null) {
1152 map = new ArrayList<>(); 1178 map = new ArrayList<>();
1153 - region2map.put(lineRegion.getSeq().toString(), map); 1179 + region2map.put(lineRegion, map);
1154 } 1180 }
1155 map.add(new SeqStationLevel(j + 1, i + 1, direction)); 1181 map.add(new SeqStationLevel(j + 1, i + 1, direction));
1156 break; 1182 break;
@@ -1159,11 +1185,25 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -1159,11 +1185,25 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1159 } 1185 }
1160 } 1186 }
1161 } 1187 }
1162 - for (Map.Entry<String, List<SeqStationLevel>> entry : region2map.entrySet()) {  
1163 - String subLineId = entry.getKey(); 1188 + for (Map.Entry<LineRegion, List<SeqStationLevel>> entry : region2map.entrySet()) {
  1189 + LineRegion lineRegion = entry.getKey();
  1190 + String subLineId = lineRegion.getSeq().toString();
1164 List<SeqStationLevel> map = entry.getValue(); 1191 List<SeqStationLevel> map = entry.getValue();
1165 seq = 1; 1192 seq = 1;
1166 - merge(lineId, subLineId, seq, map, languages); 1193 + if (lineRegion.getDirection() == 1) {
  1194 + List<SeqStationLevel> map1 = new ArrayList<>();
  1195 + map1.add(new SeqStationLevel(1, 1, 0));
  1196 + map1.add(new SeqStationLevel(2, 2, 0));
  1197 + seq = merge(lineId, subLineId, seq, map1, languages);
  1198 + }
  1199 + seq = merge(lineId, subLineId, seq, map, languages);
  1200 + if (lineRegion.getDirection() == 0) {
  1201 + List<SeqStationLevel> map1 = new ArrayList<>();
  1202 + map1.add(new SeqStationLevel(map.size() + 1, 1, 1));
  1203 + map1.add(new SeqStationLevel(map.size() + 2, 2, 1));
  1204 + merge(lineId, subLineId, seq, map1, languages);
  1205 + }
  1206 +
1167 zipAudio(String.format("%s%s/", linePath, subLineId), String.format("%s%s-%s.zip", linePath, lineId, subLineId)); 1207 zipAudio(String.format("%s%s/", linePath, subLineId), String.format("%s%s-%s.zip", linePath, lineId, subLineId));
1168 } 1208 }
1169 } 1209 }
src/main/java/com/bsth/util/IFlyUtils.java
@@ -55,9 +55,12 @@ public class IFlyUtils { @@ -55,9 +55,12 @@ public class IFlyUtils {
55 request.getBusiness().put("sfl", 1); 55 request.getBusiness().put("sfl", 1);
56 request.getBusiness().put("vcn", vcn); 56 request.getBusiness().put("vcn", vcn);
57 String charset = "GBK"; 57 String charset = "GBK";
58 - if (language.equals("en")) { 58 + if ("en".equals(language)) {
59 charset = "UTF-8"; 59 charset = "UTF-8";
60 } 60 }
  61 + if ("en".equals(language) || "sh".equals(language)) {
  62 + request.getBusiness().put("volume", 100);
  63 + }
61 request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes(charset))); 64 request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes(charset)));
62 request.getData().put("status", 2); 65 request.getData().put("status", 2);
63 websocketWork(wsUrl, request, new FileOutputStream(file)); 66 websocketWork(wsUrl, request, new FileOutputStream(file));