Commit 22a1793b50b0794a792fdd090bda73052a633535
1 parent
c8cc89c2
Update
Showing
1 changed file
with
34 additions
and
25 deletions
Too many changes to show.
To preserve performance only 1 of 2 files are displayed.
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| @@ -236,6 +236,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | @@ -236,6 +236,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | ||
| 236 | 236 | ||
| 237 | // 1.6、获取最大的发车数,用于输出数据的数量 | 237 | // 1.6、获取最大的发车数,用于输出数据的数量 |
| 238 | Long maxfcno = ttInfoDetailRepository.findMaxFcno(xlid, ttid); | 238 | Long maxfcno = ttInfoDetailRepository.findMaxFcno(xlid, ttid); |
| 239 | + LOGGER.info("最大发车顺序号={}", maxfcno); | ||
| 239 | if (maxfcno != null) { | 240 | if (maxfcno != null) { |
| 240 | // 2、读取ktr生成的excel数据,组织编辑用数据返回 | 241 | // 2、读取ktr生成的excel数据,组织编辑用数据返回 |
| 241 | // 2-1、读取Excel文件 | 242 | // 2-1、读取Excel文件 |
| @@ -263,39 +264,47 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | @@ -263,39 +264,47 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | ||
| 263 | double lc_ks = 0; // 空驶里程 | 264 | double lc_ks = 0; // 空驶里程 |
| 264 | double lc_yy = 0; // 营运里程 | 265 | double lc_yy = 0; // 营运里程 |
| 265 | 266 | ||
| 266 | - for (int c = 1; c <= maxfcno * 7; ) { | ||
| 267 | - String ttdid_str = sheet.getCell(c, r).getContents(); // 时刻表明细id | ||
| 268 | - String fcsj = sheet.getCell(c + 1, r).getContents(); // 发车时间 | ||
| 269 | - String jhlc = sheet.getCell(c + 2, r).getContents(); // 计划里程 | ||
| 270 | - String fzdname = sheet.getCell(c + 3, r).getContents(); // 发车站点名称 | ||
| 271 | - String bctype = sheet.getCell(c + 4, r).getContents(); // 班次类型 | ||
| 272 | - String xldir = sheet.getCell(c + 5, r).getContents(); // 线路上下行 | ||
| 273 | - String isfb = sheet.getCell(c + 6, r).getContents(); // 是否分班 | 267 | + for (int c = 1; c <= maxfcno; c++) { |
| 268 | + String content_str = sheet.getCell(c, r).getContents(); | ||
| 269 | + try { | ||
| 270 | + String[] content = StringUtils.isEmpty(content_str) ? null : content_str.split(","); // 总的内容 | ||
| 274 | 271 | ||
| 275 | - FcInfo fcInfo = new FcInfo(ttdid_str, bctype, fcsj, xldir, isfb); | 272 | + String ttdid_str = content == null ? "" : content[0]; // 时刻表明细id |
| 273 | + String fcsj = content == null ? "" : content[1]; // 发车时间 | ||
| 274 | + String jhlc = content == null ? "" : content[2]; // 计划里程 | ||
| 275 | + String fzdname = content == null ? "" : content[3]; // 发车站点名称 | ||
| 276 | + String bctype = content == null ? "" : content[4]; // 班次类型 | ||
| 277 | + String xldir = content == null ? "" : content[5]; // 线路上下行 | ||
| 278 | + String isfb = content == null ? "" : content[6]; // 是否分班 | ||
| 276 | 279 | ||
| 277 | - if (StringUtils.isNotEmpty(fzdname)) | ||
| 278 | - headarrays[(int)(c / 7) + 1] = fzdname; | ||
| 279 | - fcInfos.add(fcInfo); | 280 | + FcInfo fcInfo = new FcInfo(ttdid_str, bctype, fcsj, xldir, isfb); |
| 280 | 281 | ||
| 281 | - c += 7; | 282 | + if (StringUtils.isNotEmpty(fzdname)) |
| 283 | + headarrays[c + 1] = fzdname; | ||
| 284 | + fcInfos.add(fcInfo); | ||
| 282 | 285 | ||
| 283 | - // 计算班次里程 | ||
| 284 | - if (StringUtils.isNotEmpty(jhlc)) { | ||
| 285 | - if ("in".equals(bctype) || "out".equals(bctype)) { | ||
| 286 | - bc_ks += 1; | ||
| 287 | - lc_ks += Double.valueOf(jhlc); | ||
| 288 | 286 | ||
| 289 | - all_bc += 1; | ||
| 290 | - all_lc_ks += Double.valueOf(jhlc); | 287 | + // 计算班次里程 |
| 288 | + if (StringUtils.isNotEmpty(jhlc)) { | ||
| 289 | + if ("in".equals(bctype) || "out".equals(bctype)) { | ||
| 290 | + bc_ks += 1; | ||
| 291 | + lc_ks += Double.valueOf(jhlc); | ||
| 291 | 292 | ||
| 292 | - } else { | ||
| 293 | - bc_yy += 1; | ||
| 294 | - lc_yy += Double.valueOf(jhlc); | 293 | + all_bc += 1; |
| 294 | + all_lc_ks += Double.valueOf(jhlc); | ||
| 295 | + | ||
| 296 | + } else { | ||
| 297 | + bc_yy += 1; | ||
| 298 | + lc_yy += Double.valueOf(jhlc); | ||
| 295 | 299 | ||
| 296 | - all_bc += 1; | ||
| 297 | - all_lc_yy += Double.valueOf(jhlc); | 300 | + all_bc += 1; |
| 301 | + all_lc_yy += Double.valueOf(jhlc); | ||
| 302 | + } | ||
| 298 | } | 303 | } |
| 304 | + | ||
| 305 | + } catch (Exception exp) { | ||
| 306 | + LOGGER.info("{}行,{}数据有问题,数据={},异常message={}", r, c, content_str, exp); | ||
| 307 | + break; | ||
| 299 | } | 308 | } |
| 300 | 309 | ||
| 301 | } | 310 | } |