Commit e3ca43c2dd47e4dbfdeab9515c8bd063e7d6093a
Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into
minhang
Showing
2 changed files
with
53 additions
and
27 deletions
Too many changes to show.
To preserve performance only 2 of 10 files are displayed.
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| ... | ... | @@ -57,7 +57,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 57 | 57 | } |
| 58 | 58 | if(times.length() != 0){ |
| 59 | 59 | String[] split = times.split("-"); |
| 60 | - sql += " and fcsj >= '"+split[0]+"' and fcsj <= '"+split[1]+"'"; | |
| 60 | + String[] split0 = split[0].split(":"); | |
| 61 | + String[] split1 = split[1].split(":"); | |
| 62 | + int time0 = Integer.valueOf(split0[0])*60 + Integer.valueOf(split0[1]); | |
| 63 | + int time1 = Integer.valueOf(split1[0])*60 + Integer.valueOf(split1[1]); | |
| 64 | + if(time1 > time0){ | |
| 65 | + sql += " and fcsj >= '"+split[0]+"' and fcsj <= '"+split[1]+"'"; | |
| 66 | + } else { | |
| 67 | + sql += " and (fcsj >= '"+split[0]+"' or fcsj <= '"+split[1]+"')"; | |
| 68 | + } | |
| 61 | 69 | } |
| 62 | 70 | if(company.length() != 0){ |
| 63 | 71 | sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; |
| ... | ... | @@ -65,6 +73,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 65 | 73 | if(normal){ |
| 66 | 74 | sql += " and bc_type != 'in' and bc_type != 'out'"; |
| 67 | 75 | } |
| 76 | + System.out.println(sql); | |
| 68 | 77 | |
| 69 | 78 | list = jdbcTemplate.query(sql, |
| 70 | 79 | new RowMapper<ScheduleRealInfo>(){ |
| ... | ... | @@ -1577,7 +1586,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1577 | 1586 | } |
| 1578 | 1587 | if(times.length() != 0){ |
| 1579 | 1588 | String[] split = times.split("-"); |
| 1580 | - sql += " and fcsj >= '"+split[0]+"' and fcsj <= '"+split[1]+"'"; | |
| 1589 | + String[] split0 = split[0].split(":"); | |
| 1590 | + String[] split1 = split[1].split(":"); | |
| 1591 | + int time0 = Integer.valueOf(split0[0])*60 + Integer.valueOf(split0[1]); | |
| 1592 | + int time1 = Integer.valueOf(split1[0])*60 + Integer.valueOf(split1[1]); | |
| 1593 | + if(time1 > time0){ | |
| 1594 | + sql += " and fcsj >= '"+split[0]+"' and fcsj <= '"+split[1]+"'"; | |
| 1595 | + } else { | |
| 1596 | + sql += " and (fcsj >= '"+split[0]+"' or fcsj <= '"+split[1]+"')"; | |
| 1597 | + } | |
| 1581 | 1598 | } |
| 1582 | 1599 | if(company.length() != 0){ |
| 1583 | 1600 | sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | ... | ... |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| ... | ... | @@ -236,6 +236,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 236 | 236 | |
| 237 | 237 | // 1.6、获取最大的发车数,用于输出数据的数量 |
| 238 | 238 | Long maxfcno = ttInfoDetailRepository.findMaxFcno(xlid, ttid); |
| 239 | + LOGGER.info("最大发车顺序号={}", maxfcno); | |
| 239 | 240 | if (maxfcno != null) { |
| 240 | 241 | // 2、读取ktr生成的excel数据,组织编辑用数据返回 |
| 241 | 242 | // 2-1、读取Excel文件 |
| ... | ... | @@ -263,39 +264,47 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 263 | 264 | double lc_ks = 0; // 空驶里程 |
| 264 | 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 | } | ... | ... |