Commit d21467d2ca6d5269cd30656ef1d51d7f0a364a4a

Authored by 王通
1 parent f6d110c7

1.百度地图key替换

2.区间子线路+线路文件、报站文件生成的完善,以及线调的处理变化
3.js打包兼容es6
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -517,7 +517,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ @@ -517,7 +517,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ
517 FTPClientUtils.deleteFileByPrefix(String.format("%s-", line.getLineCode()), url, port, username, password, String.format("%s/voice/", remotePath)); 517 FTPClientUtils.deleteFileByPrefix(String.format("%s-", line.getLineCode()), url, port, username, password, String.format("%s/voice/", remotePath));
518 for (LineRegion lineRegion : lineRegions) { 518 for (LineRegion lineRegion : lineRegions) {
519 voicePath = String.format("%s%s-%d.zip", linePath, lineId, lineRegion.getSeq()); 519 voicePath = String.format("%s%s-%d.zip", linePath, lineId, lineRegion.getSeq());
520 - textStr = String.format("%s\r\n%s", head, subLine2Ftp(lineRegion)); 520 + textStr = String.format("%s\r\n%s", head.replace(lineName, String.format("%s(%s)", lineName, "区间")), subLine2Ftp(lineRegion));
521 input = new ByteArrayInputStream(textStr.getBytes("gbk")); 521 input = new ByteArrayInputStream(textStr.getBytes("gbk"));
522 clientUtils.uploadFile(url, port, username, password, remotePath + "/voice/", String.format("%s-%d.txt", line.getLineCode(), lineRegion.getSeq()), input); 522 clientUtils.uploadFile(url, port, username, password, remotePath + "/voice/", String.format("%s-%d.txt", line.getLineCode(), lineRegion.getSeq()), input);
523 clientUtils.deleteFtpFile(url, port, username, password, remotePath + "/voice/", String.format("%s-%d.zip", line.getLineCode(), lineRegion.getSeq())); 523 clientUtils.deleteFtpFile(url, port, username, password, remotePath + "/voice/", String.format("%s-%d.zip", line.getLineCode(), lineRegion.getSeq()));
@@ -1159,7 +1159,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ @@ -1159,7 +1159,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ
1159 } 1159 }
1160 merge(lineId, "0", seq, seqs, languages); 1160 merge(lineId, "0", seq, seqs, languages);
1161 } 1161 }
1162 - zipAudio(String.format("%s%s/", linePath, "0"), voicePath); 1162 + //zipAudio(String.format("%s%s/", linePath, "0"), voicePath);
  1163 + zipAudio(linePath, lineId, "0");
1163 1164
1164 // 线路区间 1165 // 线路区间
1165 Map<LineRegion, List<SeqStationLevel>> region2map = new HashMap<>(); 1166 Map<LineRegion, List<SeqStationLevel>> region2map = new HashMap<>();
@@ -1203,7 +1204,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -1203,7 +1204,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1203 merge(lineId, subLineId, seq, map1, languages); 1204 merge(lineId, subLineId, seq, map1, languages);
1204 } 1205 }
1205 1206
1206 - 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));
  1208 + zipAudio(linePath, lineId, subLineId);
1207 } 1209 }
1208 } 1210 }
1209 1211
@@ -1222,31 +1224,39 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -1222,31 +1224,39 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1222 1224
1223 /** 1225 /**
1224 * 压缩音频到zip 1226 * 压缩音频到zip
1225 - * @param subLinePath 子线路文件夹  
1226 - * @param voicePath 语音报站文件压缩包路径 1227 + * @param linePath 线路文件夹
  1228 + * @param lineId
  1229 + * @param subLineId
1227 */ 1230 */
1228 - private void zipAudio(String subLinePath, String voicePath) throws Exception { 1231 + private void zipAudio(String linePath, String lineId, String subLineId) throws Exception {
  1232 + String s = "0".equals(subLineId) ? "" : String.format("-%s", subLineId);
  1233 + String subLinePath = String.format("%s%s/", linePath, subLineId), voicePath = String.format("%s%s%s.zip", linePath, lineId, s);
  1234 + String pack = String.format("%s%s\\", lineId, s);
1229 File file = new File(subLinePath); 1235 File file = new File(subLinePath);
1230 ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(voicePath)); 1236 ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(voicePath));
  1237 + ZipEntry zipEntry = new ZipEntry(pack);
  1238 + zos.putNextEntry(zipEntry);
  1239 + zos.closeEntry();
  1240 +
1231 for (File f : file.listFiles()) { 1241 for (File f : file.listFiles()) {
1232 if (f.isFile() && f.getName().endsWith(".mp3")) { 1242 if (f.isFile() && f.getName().endsWith(".mp3")) {
1233 - addFileToZip(zos, f); 1243 + addFileToZip(zos, f, pack);
1234 } 1244 }
1235 } 1245 }
1236 // Key打头音频 1246 // Key打头音频
1237 file = new File(commonPath); 1247 file = new File(commonPath);
1238 for (File f : file.listFiles()) { 1248 for (File f : file.listFiles()) {
1239 if (f.isFile() && f.getName().startsWith("Key-")) { 1249 if (f.isFile() && f.getName().startsWith("Key-")) {
1240 - addFileToZip(zos, f); 1250 + addFileToZip(zos, f, pack);
1241 } 1251 }
1242 } 1252 }
1243 zos.flush(); 1253 zos.flush();
1244 zos.close(); 1254 zos.close();
1245 } 1255 }
1246 1256
1247 - private static void addFileToZip(ZipOutputStream zos, File file) throws IOException { 1257 + private static void addFileToZip(ZipOutputStream zos, File file, String pack) throws IOException {
1248 FileInputStream fis = new FileInputStream(file); 1258 FileInputStream fis = new FileInputStream(file);
1249 - ZipEntry zipEntry = new ZipEntry(file.getName()); 1259 + ZipEntry zipEntry = new ZipEntry(String.format("%s%s", pack, file.getName()));
1250 zos.putNextEntry(zipEntry); 1260 zos.putNextEntry(zipEntry);
1251 1261
1252 byte[] bytes = new byte[4096]; 1262 byte[] bytes = new byte[4096];