Commit b2d1f7ee10219a5fd497ef077f882c892c9e504a
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control
into pudong
Showing
21 changed files
with
1418 additions
and
135 deletions
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
| ... | ... | @@ -5,9 +5,13 @@ import com.bsth.controller.schedule.BController; |
| 5 | 5 | import com.bsth.entity.schedule.TTInfoDetail; |
| 6 | 6 | import com.bsth.service.schedule.TTInfoDetailService; |
| 7 | 7 | import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; |
| 8 | +import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData; | |
| 9 | +import com.bsth.service.schedule.utils.DataToolsFile; | |
| 8 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 11 | import org.springframework.web.bind.annotation.*; |
| 10 | 12 | |
| 13 | +import javax.servlet.http.HttpServletResponse; | |
| 14 | +import java.io.*; | |
| 11 | 15 | import java.util.HashMap; |
| 12 | 16 | import java.util.List; |
| 13 | 17 | import java.util.Map; |
| ... | ... | @@ -120,4 +124,32 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> { |
| 120 | 124 | public Map<String, Object> skbDetailMxSave(@RequestParam Map<String, Object> entities){ |
| 121 | 125 | return ttInfoDetailService.skbDetailMxSave(entities); |
| 122 | 126 | } |
| 127 | + | |
| 128 | + | |
| 129 | + @RequestMapping(value = "/exportDTDFile", method = RequestMethod.POST) | |
| 130 | + public void exportFile( | |
| 131 | + @RequestBody TTinfoDetailDynamicData.DTInfos dtInfos, | |
| 132 | + HttpServletResponse response) throws Exception { | |
| 133 | + DataToolsFile dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos); | |
| 134 | + // 流输出导出文件 | |
| 135 | + response.setHeader("content-type", "application/octet-stream"); | |
| 136 | + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName()); | |
| 137 | + response.setContentType("application/octet-stream"); | |
| 138 | + | |
| 139 | + OutputStream os = response.getOutputStream(); | |
| 140 | + BufferedOutputStream bos = new BufferedOutputStream(os); | |
| 141 | + | |
| 142 | + InputStream is = new FileInputStream(dataToolsFile.getFile()); | |
| 143 | + BufferedInputStream bis = new BufferedInputStream(is); | |
| 144 | + | |
| 145 | + int length = 0; | |
| 146 | + byte[] temp = new byte[1 * 1024 * 10]; | |
| 147 | + while ((length = bis.read(temp)) != -1) { | |
| 148 | + bos.write(temp, 0, length); | |
| 149 | + } | |
| 150 | + bos.flush(); | |
| 151 | + bis.close(); | |
| 152 | + bos.close(); | |
| 153 | + is.close(); | |
| 154 | + } | |
| 123 | 155 | } | ... | ... |
src/main/java/com/bsth/service/schedule/TTInfoDetailService.java
| ... | ... | @@ -2,7 +2,9 @@ package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.TTInfoDetail; |
| 4 | 4 | import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; |
| 5 | +import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData; | |
| 5 | 6 | import com.bsth.service.schedule.exception.ScheduleException; |
| 7 | +import com.bsth.service.schedule.utils.DataToolsFile; | |
| 6 | 8 | |
| 7 | 9 | import java.util.List; |
| 8 | 10 | import java.util.Map; |
| ... | ... | @@ -22,6 +24,14 @@ public interface TTInfoDetailService extends BService<TTInfoDetail, Long> { |
| 22 | 24 | TTInfoDetailForEdit.EditInfo getEditInfo(Integer xlid, Long ttid, Long maxfcno) throws ScheduleException; |
| 23 | 25 | |
| 24 | 26 | /** |
| 27 | + * 导出动态时刻表。 | |
| 28 | + * @param dtInfos | |
| 29 | + * @return | |
| 30 | + * @throws ScheduleException | |
| 31 | + */ | |
| 32 | + DataToolsFile exportDynamicTTinfo(TTinfoDetailDynamicData.DTInfos dtInfos) throws ScheduleException; | |
| 33 | + | |
| 34 | + /** | |
| 25 | 35 | * 获取时刻表最大发车顺序号 |
| 26 | 36 | * @param xlid 线路id |
| 27 | 37 | * @param ttinfoid 时刻表id | ... | ... |
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
| 1 | 1 | package com.bsth.service.schedule.datatools; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.Station; | |
| 4 | +import com.bsth.service.StationService; | |
| 3 | 5 | import com.bsth.service.schedule.exception.ScheduleException; |
| 4 | 6 | import com.bsth.service.schedule.utils.*; |
| 5 | 7 | import jxl.Sheet; |
| ... | ... | @@ -8,7 +10,13 @@ import jxl.write.Label; |
| 8 | 10 | import jxl.write.WritableSheet; |
| 9 | 11 | import jxl.write.WritableWorkbook; |
| 10 | 12 | import org.apache.commons.lang3.StringUtils; |
| 13 | +import org.apache.poi.ss.usermodel.Cell; | |
| 11 | 14 | import org.apache.poi.ss.usermodel.Row; |
| 15 | +import org.apache.poi.ss.util.CellRangeAddress; | |
| 16 | +import org.apache.poi.ss.util.WorkbookUtil; | |
| 17 | +import org.apache.poi.xssf.usermodel.XSSFRow; | |
| 18 | +import org.apache.poi.xssf.usermodel.XSSFSheet; | |
| 19 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
| 12 | 20 | import org.joda.time.DateTime; |
| 13 | 21 | import org.slf4j.Logger; |
| 14 | 22 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -17,20 +25,27 @@ import org.springframework.beans.factory.annotation.Qualifier; |
| 17 | 25 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 18 | 26 | import org.springframework.stereotype.Service; |
| 19 | 27 | |
| 28 | +import java.awt.*; | |
| 20 | 29 | import java.io.File; |
| 30 | +import java.io.FileOutputStream; | |
| 21 | 31 | import java.io.PrintWriter; |
| 22 | 32 | import java.io.StringWriter; |
| 23 | 33 | import java.util.*; |
| 34 | +import java.util.List; | |
| 24 | 35 | |
| 25 | 36 | /** |
| 26 | 37 | * Created by xu on 17/5/16. |
| 27 | 38 | */ |
| 28 | 39 | @EnableConfigurationProperties(DataToolsProperties.class) |
| 29 | 40 | @Service(value = "ttInfoDetail_dataTool") |
| 30 | -public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetailForEdit { | |
| 41 | +public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetailForEdit, TTinfoDetailDynamicData { | |
| 31 | 42 | /** 日志记录器 */ |
| 32 | 43 | private final static Logger LOGGER = LoggerFactory.getLogger(TTInfoDetailDataToolsImpl.class); |
| 33 | 44 | |
| 45 | + // TODO:之后改了 | |
| 46 | + @Autowired | |
| 47 | + private StationService stationService; | |
| 48 | + | |
| 34 | 49 | @Autowired |
| 35 | 50 | @Qualifier(value = "dataToolsServiceImpl") |
| 36 | 51 | private DataToolsService dataToolsService; |
| ... | ... | @@ -363,4 +378,141 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail |
| 363 | 378 | } |
| 364 | 379 | } |
| 365 | 380 | |
| 381 | + @Override | |
| 382 | + public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException { | |
| 383 | + try { | |
| 384 | + // 使用POI,创建xlsx文件 | |
| 385 | + XSSFWorkbook wb = new XSSFWorkbook(); | |
| 386 | + XSSFSheet sheet = wb.createSheet(WorkbookUtil.createSafeSheetName("时刻表信息")); | |
| 387 | + | |
| 388 | + //-------------------------------- 1、路牌班次数据 -------------------------------// | |
| 389 | + List<LpObj> lpObjList = dtInfos.getLpObjList(); | |
| 390 | + | |
| 391 | + // 构建第一行数据 | |
| 392 | + XSSFRow lpHeadRow = sheet.createRow((short) 0); | |
| 393 | + if (lpObjList.size() == 0) { | |
| 394 | + throw new RuntimeException("没有班次数据!"); | |
| 395 | + } | |
| 396 | + int groupCount = lpObjList.get(0).getGroupCount(); // 获取总圈数 | |
| 397 | + if (groupCount == 0) { | |
| 398 | + throw new RuntimeException("总圈数为0,有问题!"); | |
| 399 | + } | |
| 400 | + | |
| 401 | + // 构造表头 | |
| 402 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short)0, "路牌", new Color(0x96b9d7)); | |
| 403 | + Station station1 = stationService.findById(lpObjList.get(0).getStationRouteId1()); | |
| 404 | + Station station2 = stationService.findById(lpObjList.get(1).getStationRouteId2()); | |
| 405 | + for (int i = 0; i < groupCount; i++) { | |
| 406 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 1), | |
| 407 | + station1.getStationName(), new Color(0x96b9d7)); | |
| 408 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 2), | |
| 409 | + station2.getStationName(), new Color(0x96b9d7)); | |
| 410 | + } | |
| 411 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 1), | |
| 412 | + "路牌工时", new Color(0x96b9d7)); | |
| 413 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 2), | |
| 414 | + "营运班次数", new Color(0x96b9d7)); | |
| 415 | + | |
| 416 | + // 构建每个路牌的班次数据 | |
| 417 | + for (int i = 0; i < lpObjList.size(); i++) { | |
| 418 | + LpObj lpObj = lpObjList.get(i); | |
| 419 | + XSSFRow lpRow = sheet.createRow((short) (i + 1)); | |
| 420 | + PoiUtils.createStringXSSFCell(wb, lpRow, (short) 0, lpObj.getLpname()); | |
| 421 | + for (int j = 0; j < groupCount; j++) { | |
| 422 | + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 1)); | |
| 423 | + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 2)); | |
| 424 | + } | |
| 425 | + for (BcObj bcObj : lpObj.getBcObjList()) { | |
| 426 | + Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 1)); | |
| 427 | + cell.setCellValue(bcObj.getFcsj()); | |
| 428 | + } | |
| 429 | + // 路牌工时/班次数 | |
| 430 | + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 1), | |
| 431 | + lpObj.getZgs() / 60); | |
| 432 | + // 营运班次数 | |
| 433 | + PoiUtils.createIntegerXSSFCell(wb, lpRow, (short) (groupCount * 2 + 2), | |
| 434 | + lpObj.getZbc()); | |
| 435 | + } | |
| 436 | + | |
| 437 | + // 自适应单元格长宽 | |
| 438 | + sheet.autoSizeColumn(0); | |
| 439 | + for (int i = 0; i < groupCount; i++) { | |
| 440 | + sheet.autoSizeColumn(i * 2 + 1); | |
| 441 | + sheet.autoSizeColumn(i * 2 + 2); | |
| 442 | + } | |
| 443 | + sheet.autoSizeColumn(groupCount * 2 + 1); | |
| 444 | + sheet.autoSizeColumn(groupCount * 2 + 2); | |
| 445 | + | |
| 446 | + // 锁定行首,列首 | |
| 447 | + sheet.createFreezePane(1, 1); | |
| 448 | + | |
| 449 | + //-------------------------------- 2、统计数据 -------------------------------// | |
| 450 | + List<StatInfo> statInfos = dtInfos.getStatInfoList(); | |
| 451 | + | |
| 452 | + // 创建总的统计数据格式 | |
| 453 | + // 第一行 统计数据 | |
| 454 | + // 第二行 序号,统计项目(8个单元格合并),统计数值 | |
| 455 | + // 第三行开始数据,一共20行 | |
| 456 | + | |
| 457 | + int startrow = lpObjList.size() + 3; | |
| 458 | + for (int i = startrow; i <= startrow + 22; i++) { | |
| 459 | + XSSFRow xssfRow = sheet.createRow(i); | |
| 460 | + for (int j = 0; j < 10; j++) { | |
| 461 | + PoiUtils.createStringXSSFCell(wb, xssfRow, (short) j, ""); | |
| 462 | + | |
| 463 | + } | |
| 464 | + } | |
| 465 | + // 合并第一行 | |
| 466 | + sheet.addMergedRegion(new CellRangeAddress(startrow, startrow, 0, 9)); | |
| 467 | + sheet.getRow(startrow).getCell(0).setCellValue("统计数据"); | |
| 468 | + // 合并第二行 | |
| 469 | + sheet.getRow(startrow + 1).getCell(0).setCellValue("序号"); | |
| 470 | + sheet.getRow(startrow + 1).getCell(1).setCellValue("统计项目"); | |
| 471 | + sheet.getRow(startrow + 1).getCell(9).setCellValue("统计数值"); | |
| 472 | + sheet.addMergedRegion(new CellRangeAddress(startrow + 1, startrow + 1, 1, 8)); | |
| 473 | + // 处理后面具体统计行 | |
| 474 | + for (int row = startrow + 2; row <= startrow + 2 + statInfos.size(); row++) { | |
| 475 | + sheet.addMergedRegion(new CellRangeAddress(row, row, 1, 8)); | |
| 476 | + } | |
| 477 | + | |
| 478 | + for (int i = 0; i < statInfos.size(); i++) { | |
| 479 | + StatInfo statInfo = statInfos.get(i); | |
| 480 | + | |
| 481 | + // 1、统计序号 | |
| 482 | + PoiUtils.setIntegerStyleXSSFCellStyle(wb, sheet.getRow(startrow + 2 + i).getCell(0)); | |
| 483 | + sheet.getRow(startrow + 2 + i).getCell(0).setCellValue(i); | |
| 484 | + | |
| 485 | + // 2、统计项目 | |
| 486 | + sheet.getRow(startrow + 2 + i).getCell(1).setCellValue(statInfo.getStatItem()); | |
| 487 | + | |
| 488 | + // 3、统计数值 | |
| 489 | + PoiUtils.setDoubleStyleXSSFCellStyle(wb, sheet.getRow(startrow + 2 + i).getCell(9)); | |
| 490 | + sheet.getRow(startrow + 2 + i).getCell(9).setCellValue(statInfo.getStatValue()); | |
| 491 | + } | |
| 492 | + | |
| 493 | + // 最后内存写入文件 | |
| 494 | + String filepath = dataToolsProperties.getFileoutputDir() + | |
| 495 | + File.separator + | |
| 496 | + "动态时刻表-" + | |
| 497 | + new DateTime().toString("yyyyMMddHHmmss") + ".xlsx"; | |
| 498 | + FileOutputStream fileOut = new FileOutputStream(filepath); | |
| 499 | + wb.write(fileOut); | |
| 500 | + | |
| 501 | + DataToolsFile dataToolsFile = new DataToolsFile(); | |
| 502 | + dataToolsFile.setFileType(DataToolsFileType.XLSX); | |
| 503 | + dataToolsFile.setFile(new File(filepath)); | |
| 504 | + | |
| 505 | + return dataToolsFile; | |
| 506 | + | |
| 507 | + } catch (Exception exp) { | |
| 508 | + LOGGER.info("//---------------- 动态时刻表输出 failed... ----------------//"); | |
| 509 | + | |
| 510 | + StringWriter sw = new StringWriter(); | |
| 511 | + exp.printStackTrace(new PrintWriter(sw)); | |
| 512 | + LOGGER.info(sw.toString()); | |
| 513 | + | |
| 514 | + throw new ScheduleException(exp); | |
| 515 | + } | |
| 516 | + | |
| 517 | + } | |
| 366 | 518 | } | ... | ... |
src/main/java/com/bsth/service/schedule/datatools/TTinfoDetailDynamicData.java
0 → 100644
| 1 | +package com.bsth.service.schedule.datatools; | |
| 2 | + | |
| 3 | +import com.bsth.service.schedule.exception.ScheduleException; | |
| 4 | +import com.bsth.service.schedule.utils.DataToolsFile; | |
| 5 | +import com.fasterxml.jackson.annotation.JsonCreator; | |
| 6 | +import com.fasterxml.jackson.annotation.JsonValue; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 动态时刻表数据。 | |
| 12 | + */ | |
| 13 | +public interface TTinfoDetailDynamicData { | |
| 14 | + | |
| 15 | + //---------------------- 生成时刻表用对象(以下) ---------------------// | |
| 16 | + public static enum BcType { // 班次类型枚举 | |
| 17 | + IN("in"), // 进场 | |
| 18 | + OUT("out"), // 出场 | |
| 19 | + BD("bd"), // 早例保 | |
| 20 | + LC("lc"), // 晚例保 | |
| 21 | + NORMAL("normal"); // 正常 | |
| 22 | + private String flag; | |
| 23 | + | |
| 24 | + @JsonCreator | |
| 25 | + private BcType(String flag) { | |
| 26 | + this.flag = flag; | |
| 27 | + } | |
| 28 | + | |
| 29 | + @JsonValue | |
| 30 | + public String getFlag() { | |
| 31 | + return flag; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setFlag(String flag) { | |
| 35 | + this.flag = flag; | |
| 36 | + } | |
| 37 | + } | |
| 38 | + | |
| 39 | + public static class BcObj { // 班次对象 | |
| 40 | + /** 班次时间 */ | |
| 41 | + private Integer bcsj; | |
| 42 | + /** 停站时间 */ | |
| 43 | + private Integer ssj; | |
| 44 | + /** 吃饭时间 */ | |
| 45 | + private Integer eatsj; | |
| 46 | + | |
| 47 | + /** 停车场id */ | |
| 48 | + private Integer tccid; | |
| 49 | + /** 起点站id */ | |
| 50 | + private Integer qdzid; | |
| 51 | + /** 终点站id */ | |
| 52 | + private Integer zdzid; | |
| 53 | + | |
| 54 | + /** 是否上行 */ | |
| 55 | + private Boolean isUp; | |
| 56 | + | |
| 57 | + /** 班次类型 */ | |
| 58 | + private BcType bcType; | |
| 59 | + /** 发车时刻 */ | |
| 60 | + private String fcsj; | |
| 61 | + | |
| 62 | + /** 第几圈(从1开始) */ | |
| 63 | + private Integer groupNo; | |
| 64 | + /** 圈里第几个班次(1或者2) */ | |
| 65 | + private Integer groupBcNo; | |
| 66 | + | |
| 67 | + public Integer getBcsj() { | |
| 68 | + return bcsj; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public void setBcsj(Integer bcsj) { | |
| 72 | + this.bcsj = bcsj; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public Integer getSsj() { | |
| 76 | + return ssj; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public void setSsj(Integer ssj) { | |
| 80 | + this.ssj = ssj; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public Integer getEatsj() { | |
| 84 | + return eatsj; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setEatsj(Integer eatsj) { | |
| 88 | + this.eatsj = eatsj; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public Integer getTccid() { | |
| 92 | + return tccid; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public void setTccid(Integer tccid) { | |
| 96 | + this.tccid = tccid; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public Integer getQdzid() { | |
| 100 | + return qdzid; | |
| 101 | + } | |
| 102 | + | |
| 103 | + public void setQdzid(Integer qdzid) { | |
| 104 | + this.qdzid = qdzid; | |
| 105 | + } | |
| 106 | + | |
| 107 | + public Integer getZdzid() { | |
| 108 | + return zdzid; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public void setZdzid(Integer zdzid) { | |
| 112 | + this.zdzid = zdzid; | |
| 113 | + } | |
| 114 | + | |
| 115 | + public BcType getBcType() { | |
| 116 | + return bcType; | |
| 117 | + } | |
| 118 | + | |
| 119 | + public void setBcType(BcType bcType) { | |
| 120 | + this.bcType = bcType; | |
| 121 | + } | |
| 122 | + | |
| 123 | + public String getFcsj() { | |
| 124 | + return fcsj; | |
| 125 | + } | |
| 126 | + | |
| 127 | + public void setFcsj(String fcsj) { | |
| 128 | + this.fcsj = fcsj; | |
| 129 | + } | |
| 130 | + | |
| 131 | + public Boolean getIsUp() { | |
| 132 | + return isUp; | |
| 133 | + } | |
| 134 | + | |
| 135 | + public void setIsUp(Boolean isUp) { | |
| 136 | + this.isUp = isUp; | |
| 137 | + } | |
| 138 | + | |
| 139 | + public Integer getGroupNo() { | |
| 140 | + return groupNo; | |
| 141 | + } | |
| 142 | + | |
| 143 | + public void setGroupNo(Integer groupNo) { | |
| 144 | + this.groupNo = groupNo; | |
| 145 | + } | |
| 146 | + | |
| 147 | + public Integer getGroupBcNo() { | |
| 148 | + return groupBcNo; | |
| 149 | + } | |
| 150 | + | |
| 151 | + public void setGroupBcNo(Integer groupBcNo) { | |
| 152 | + this.groupBcNo = groupBcNo; | |
| 153 | + } | |
| 154 | + } | |
| 155 | + | |
| 156 | + public static class LpObj { // 路牌对象 | |
| 157 | + /** 路牌名字 */ | |
| 158 | + private String lpname; | |
| 159 | + /** 每圈的第一个班次是否上行 */ | |
| 160 | + private Boolean isUp; | |
| 161 | + | |
| 162 | + /** 第一个班次起点站路由id */ | |
| 163 | + private Integer stationRouteId1; | |
| 164 | + /** 第二个班次起点站路由id */ | |
| 165 | + private Integer stationRouteId2; | |
| 166 | + | |
| 167 | + /** 班次列表 */ | |
| 168 | + private List<BcObj> bcObjList; | |
| 169 | + /** 总圈数 */ | |
| 170 | + private Integer groupCount; | |
| 171 | + | |
| 172 | + /** 总工时 */ | |
| 173 | + private Double zgs; | |
| 174 | + /** 总班次 */ | |
| 175 | + private Integer zbc; | |
| 176 | + | |
| 177 | + | |
| 178 | + public String getLpname() { | |
| 179 | + return lpname; | |
| 180 | + } | |
| 181 | + | |
| 182 | + public void setLpname(String lpname) { | |
| 183 | + this.lpname = lpname; | |
| 184 | + } | |
| 185 | + | |
| 186 | + public Boolean getIsUp() { | |
| 187 | + return isUp; | |
| 188 | + } | |
| 189 | + | |
| 190 | + public void setIsUp(Boolean isUp) { | |
| 191 | + this.isUp = isUp; | |
| 192 | + } | |
| 193 | + | |
| 194 | + public List<BcObj> getBcObjList() { | |
| 195 | + return bcObjList; | |
| 196 | + } | |
| 197 | + | |
| 198 | + public void setBcObjList(List<BcObj> bcObjList) { | |
| 199 | + this.bcObjList = bcObjList; | |
| 200 | + } | |
| 201 | + | |
| 202 | + public Integer getGroupCount() { | |
| 203 | + return groupCount; | |
| 204 | + } | |
| 205 | + | |
| 206 | + public void setGroupCount(Integer groupCount) { | |
| 207 | + this.groupCount = groupCount; | |
| 208 | + } | |
| 209 | + | |
| 210 | + public Double getZgs() { | |
| 211 | + return zgs; | |
| 212 | + } | |
| 213 | + | |
| 214 | + public void setZgs(Double zgs) { | |
| 215 | + this.zgs = zgs; | |
| 216 | + } | |
| 217 | + | |
| 218 | + public Integer getZbc() { | |
| 219 | + return zbc; | |
| 220 | + } | |
| 221 | + | |
| 222 | + public void setZbc(Integer zbc) { | |
| 223 | + this.zbc = zbc; | |
| 224 | + } | |
| 225 | + | |
| 226 | + public Integer getStationRouteId1() { | |
| 227 | + return stationRouteId1; | |
| 228 | + } | |
| 229 | + | |
| 230 | + public void setStationRouteId1(Integer stationRouteId1) { | |
| 231 | + this.stationRouteId1 = stationRouteId1; | |
| 232 | + } | |
| 233 | + | |
| 234 | + public Integer getStationRouteId2() { | |
| 235 | + return stationRouteId2; | |
| 236 | + } | |
| 237 | + | |
| 238 | + public void setStationRouteId2(Integer stationRouteId2) { | |
| 239 | + this.stationRouteId2 = stationRouteId2; | |
| 240 | + } | |
| 241 | + } | |
| 242 | + | |
| 243 | + public static class StatInfo { // 统计数据对象 | |
| 244 | + /** 统计项目 */ | |
| 245 | + private String statItem; | |
| 246 | + /** 统计值 */ | |
| 247 | + private Double statValue; | |
| 248 | + | |
| 249 | + public String getStatItem() { | |
| 250 | + return statItem; | |
| 251 | + } | |
| 252 | + | |
| 253 | + public void setStatItem(String statItem) { | |
| 254 | + this.statItem = statItem; | |
| 255 | + } | |
| 256 | + | |
| 257 | + public Double getStatValue() { | |
| 258 | + return statValue; | |
| 259 | + } | |
| 260 | + | |
| 261 | + public void setStatValue(Double statValue) { | |
| 262 | + this.statValue = statValue; | |
| 263 | + } | |
| 264 | + } | |
| 265 | + | |
| 266 | + public static class DTInfos { // 所有数据信息 | |
| 267 | + /** 路牌班次数据列表 */ | |
| 268 | + private List<LpObj> lpObjList; | |
| 269 | + /** 统计数据列表 */ | |
| 270 | + private List<StatInfo> statInfoList; | |
| 271 | + | |
| 272 | + public List<LpObj> getLpObjList() { | |
| 273 | + return lpObjList; | |
| 274 | + } | |
| 275 | + | |
| 276 | + public void setLpObjList(List<LpObj> lpObjList) { | |
| 277 | + this.lpObjList = lpObjList; | |
| 278 | + } | |
| 279 | + | |
| 280 | + public List<StatInfo> getStatInfoList() { | |
| 281 | + return statInfoList; | |
| 282 | + } | |
| 283 | + | |
| 284 | + public void setStatInfoList(List<StatInfo> statInfoList) { | |
| 285 | + this.statInfoList = statInfoList; | |
| 286 | + } | |
| 287 | + } | |
| 288 | + | |
| 289 | + //---------------------- 生成时刻表用对象(以上) ---------------------// | |
| 290 | + | |
| 291 | + /** | |
| 292 | + * 导出动态时刻表数据。 | |
| 293 | + * @param dtInfos | |
| 294 | + * @return | |
| 295 | + * @throws ScheduleException | |
| 296 | + */ | |
| 297 | + public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException; | |
| 298 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| ... | ... | @@ -19,6 +19,7 @@ import com.bsth.service.StationRouteService; |
| 19 | 19 | import com.bsth.service.schedule.GuideboardInfoService; |
| 20 | 20 | import com.bsth.service.schedule.TTInfoDetailService; |
| 21 | 21 | import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; |
| 22 | +import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData; | |
| 22 | 23 | import com.bsth.service.schedule.exception.ScheduleException; |
| 23 | 24 | import com.bsth.service.schedule.utils.DataToolsFile; |
| 24 | 25 | import com.bsth.service.schedule.utils.DataToolsFileType; |
| ... | ... | @@ -86,6 +87,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 86 | 87 | private TTInfoDetailForEdit ttInfoDetailForEdit; |
| 87 | 88 | |
| 88 | 89 | @Autowired |
| 90 | + @Qualifier(value = "ttInfoDetail_dataTool") | |
| 91 | + private TTinfoDetailDynamicData tTinfoDetailDynamicData; | |
| 92 | + | |
| 93 | + @Autowired | |
| 89 | 94 | private JdbcTemplate jdbcTemplate; |
| 90 | 95 | |
| 91 | 96 | /** |
| ... | ... | @@ -134,6 +139,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 134 | 139 | return dataToolsService.exportData(params); |
| 135 | 140 | } |
| 136 | 141 | |
| 142 | + @Override | |
| 143 | + public DataToolsFile exportDynamicTTinfo(TTinfoDetailDynamicData.DTInfos dtInfos) throws ScheduleException { | |
| 144 | + return tTinfoDetailDynamicData.exportDynamicTTinfo(dtInfos); | |
| 145 | + } | |
| 137 | 146 | |
| 138 | 147 | @Override |
| 139 | 148 | public TTInfoDetailForEdit.EditInfo getEditInfo(Integer xlid, Long ttid, Long maxfcno) throws ScheduleException { | ... | ... |
src/main/java/com/bsth/service/schedule/utils/PoiUtils.java
| 1 | 1 | package com.bsth.service.schedule.utils; |
| 2 | 2 | |
| 3 | 3 | import org.apache.poi.hssf.usermodel.HSSFDateUtil; |
| 4 | -import org.apache.poi.ss.usermodel.Cell; | |
| 5 | -import org.apache.poi.xssf.usermodel.XSSFCell; | |
| 4 | +import org.apache.poi.ss.usermodel.*; | |
| 5 | +import org.apache.poi.ss.util.WorkbookUtil; | |
| 6 | +import org.apache.poi.xssf.usermodel.*; | |
| 6 | 7 | |
| 8 | +import java.awt.Color; | |
| 7 | 9 | import java.text.DecimalFormat; |
| 8 | 10 | import java.text.SimpleDateFormat; |
| 9 | 11 | import java.util.Date; |
| ... | ... | @@ -52,4 +54,152 @@ public class PoiUtils { |
| 52 | 54 | } |
| 53 | 55 | return cellValue; |
| 54 | 56 | } |
| 57 | + | |
| 58 | + public static XSSFCell createStringXSSFCell( | |
| 59 | + XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, String value, | |
| 60 | + Color backgroundColor) { | |
| 61 | + return createXSSFCell( | |
| 62 | + xssfWorkbook, xssfRow, column, | |
| 63 | + value, XSSFCell.CELL_TYPE_STRING, | |
| 64 | + HorizontalAlignment.CENTER, VerticalAlignment.CENTER, | |
| 65 | + BorderStyle.MEDIUM, new Color(0xdedede), | |
| 66 | + (short) 13, new Color(0x2765A7), "宋体", | |
| 67 | + backgroundColor, FillPatternType.SOLID_FOREGROUND | |
| 68 | + ); | |
| 69 | + } | |
| 70 | + | |
| 71 | + public static XSSFCell createStringXSSFCell( | |
| 72 | + XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, String value) { | |
| 73 | + return createXSSFCell( | |
| 74 | + xssfWorkbook, xssfRow, column, | |
| 75 | + value, XSSFCell.CELL_TYPE_STRING, | |
| 76 | + HorizontalAlignment.CENTER, VerticalAlignment.CENTER, | |
| 77 | + BorderStyle.MEDIUM, new Color(0xdedede), | |
| 78 | + (short) 13, new Color(0x2765A7), "宋体", | |
| 79 | + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND | |
| 80 | + ); | |
| 81 | + } | |
| 82 | + | |
| 83 | + public static XSSFCell createDoubleXSSFCell( | |
| 84 | + XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, Double value) { | |
| 85 | + return createXSSFCell( | |
| 86 | + xssfWorkbook, xssfRow, column, | |
| 87 | + value, XSSFCell.CELL_TYPE_NUMERIC, | |
| 88 | + HorizontalAlignment.CENTER, VerticalAlignment.CENTER, | |
| 89 | + BorderStyle.MEDIUM, new Color(0xdedede), | |
| 90 | + (short) 13, new Color(0x2765A7), "宋体", | |
| 91 | + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND | |
| 92 | + ); | |
| 93 | + } | |
| 94 | + | |
| 95 | + public static XSSFCell createIntegerXSSFCell( | |
| 96 | + XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, Integer value) { | |
| 97 | + return createXSSFCell( | |
| 98 | + xssfWorkbook, xssfRow, column, | |
| 99 | + value, XSSFCell.CELL_TYPE_NUMERIC, | |
| 100 | + HorizontalAlignment.CENTER, VerticalAlignment.CENTER, | |
| 101 | + BorderStyle.MEDIUM, new Color(0xdedede), | |
| 102 | + (short) 13, new Color(0x2765A7), "宋体", | |
| 103 | + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND | |
| 104 | + ); | |
| 105 | + } | |
| 106 | + | |
| 107 | + public static XSSFCell createBlankXSSFCell( | |
| 108 | + XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column) { | |
| 109 | + return createXSSFCell( | |
| 110 | + xssfWorkbook, xssfRow, column, | |
| 111 | + null, XSSFCell.CELL_TYPE_BLANK, | |
| 112 | + HorizontalAlignment.CENTER, VerticalAlignment.CENTER, | |
| 113 | + BorderStyle.MEDIUM, new Color(0xdedede), | |
| 114 | + (short) 13, new Color(0x2765A7), "宋体", | |
| 115 | + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND | |
| 116 | + ); | |
| 117 | + } | |
| 118 | + | |
| 119 | + public static XSSFCell setIntegerStyleXSSFCellStyle(XSSFWorkbook xssfWorkbook, XSSFCell xssfCell) { | |
| 120 | + CreationHelper creationHelper = xssfWorkbook.getCreationHelper(); | |
| 121 | + XSSFCellStyle xssfCellStyle = xssfCell.getCellStyle(); | |
| 122 | + xssfCellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("0")); | |
| 123 | + return xssfCell; | |
| 124 | + } | |
| 125 | + public static XSSFCell setDoubleStyleXSSFCellStyle(XSSFWorkbook xssfWorkbook, XSSFCell xssfCell) { | |
| 126 | + CreationHelper creationHelper = xssfWorkbook.getCreationHelper(); | |
| 127 | + XSSFCellStyle xssfCellStyle = xssfCell.getCellStyle(); | |
| 128 | + xssfCellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("0.00")); | |
| 129 | + return xssfCell; | |
| 130 | + } | |
| 131 | + | |
| 132 | + public static XSSFCell createXSSFCell( | |
| 133 | + XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, | |
| 134 | + Object value, int valueType, | |
| 135 | + HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, | |
| 136 | + BorderStyle borderStyle, Color borderColor, | |
| 137 | + short fontSize, Color fontColor, String fontName, | |
| 138 | + Color backgroudColor, FillPatternType fillPatternType) { | |
| 139 | + CreationHelper creationHelper = xssfWorkbook.getCreationHelper(); | |
| 140 | + | |
| 141 | + // 1、创建单元格对象 | |
| 142 | + XSSFCell cell = xssfRow.createCell(column); | |
| 143 | + | |
| 144 | + // 2、设定样式 | |
| 145 | + XSSFCellStyle cellStyle = xssfWorkbook.createCellStyle(); | |
| 146 | + | |
| 147 | + // 设定值 | |
| 148 | + if (valueType == XSSFCell.CELL_TYPE_STRING) { | |
| 149 | + cell.setCellValue(creationHelper.createRichTextString( | |
| 150 | + WorkbookUtil.createSafeSheetName(String.valueOf(value)))); | |
| 151 | + } else if (valueType == XSSFCell.CELL_TYPE_NUMERIC) { | |
| 152 | + if (value instanceof Date) { // 日期 | |
| 153 | + cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("yyyy-mm-dd")); | |
| 154 | + cell.setCellValue((Date) value); | |
| 155 | + } else if (value instanceof Double) { | |
| 156 | + cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("0.00")); | |
| 157 | + cell.setCellValue((Double) value); | |
| 158 | + } else if (value instanceof Integer) { | |
| 159 | + cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("0")); | |
| 160 | + cell.setCellValue(Double.valueOf(value.toString())); | |
| 161 | + } else { | |
| 162 | + throw new RuntimeException("只支持 Date Double Integer 单元格类型"); | |
| 163 | + } | |
| 164 | + } else if (valueType == XSSFCell.CELL_TYPE_BLANK) { | |
| 165 | + cell.setCellType(Cell.CELL_TYPE_BLANK); | |
| 166 | + } | |
| 167 | + | |
| 168 | + else { | |
| 169 | + throw new RuntimeException("暂时不支持字符串、日期、数字以为的类型"); | |
| 170 | + } | |
| 171 | + | |
| 172 | + // 对齐方式 | |
| 173 | + cellStyle.setAlignment(horizontalAlignment); | |
| 174 | + cellStyle.setVerticalAlignment(verticalAlignment); | |
| 175 | + | |
| 176 | + // 边框样式 | |
| 177 | + cellStyle.setBorderTop(borderStyle); | |
| 178 | + cellStyle.setTopBorderColor(new XSSFColor(borderColor)); | |
| 179 | + cellStyle.setBorderBottom(borderStyle); | |
| 180 | + cellStyle.setBottomBorderColor(new XSSFColor(borderColor)); | |
| 181 | + cellStyle.setBorderLeft(borderStyle); | |
| 182 | + cellStyle.setLeftBorderColor(new XSSFColor(borderColor)); | |
| 183 | + cellStyle.setBorderRight(borderStyle); | |
| 184 | + cellStyle.setRightBorderColor(new XSSFColor(borderColor)); | |
| 185 | + | |
| 186 | + // 字体颜色 | |
| 187 | + XSSFFont font = xssfWorkbook.createFont(); | |
| 188 | + font.setColor(new XSSFColor(fontColor)); | |
| 189 | + font.setFontHeightInPoints(fontSize); | |
| 190 | + font.setFontName(fontName); | |
| 191 | + cellStyle.setFont(font); | |
| 192 | + | |
| 193 | + | |
| 194 | + // 单元背景色 | |
| 195 | + cellStyle.setFillForegroundColor(new XSSFColor(backgroudColor)); | |
| 196 | + cellStyle.setFillPattern(fillPatternType); | |
| 197 | + | |
| 198 | + // TODO | |
| 199 | + | |
| 200 | + cell.setCellStyle(cellStyle); | |
| 201 | + return cell; | |
| 202 | + } | |
| 203 | + | |
| 55 | 204 | } |
| 205 | + | ... | ... |
src/main/resources/datatools/ktrs/ttinfodetailDataOutputMetaData.ktr
| ... | ... | @@ -91,8 +91,8 @@ |
| 91 | 91 | <notepads> |
| 92 | 92 | <notepad> |
| 93 | 93 | <note>TODO:如果groupby 加入bctype,
则以发车顺序号,班次类型分组的数据可能重复,
应为班次类型可能不一样(导入之后人为修改的,如正常班次改成区间),
因为导出时必须数据不重复,这里的解决方法,只使用发车顺序号分组,
以后建议,还是原来的方式分组,然后把更新时间晚的去除

以后改成去除重复纪录</note> |
| 94 | - <xloc>46</xloc> | |
| 95 | - <yloc>400</yloc> | |
| 94 | + <xloc>178</xloc> | |
| 95 | + <yloc>547</yloc> | |
| 96 | 96 | <width>406</width> |
| 97 | 97 | <heigth>122</heigth> |
| 98 | 98 | <fontname>YaHei Consolas Hybrid</fontname> |
| ... | ... | @@ -299,14 +299,14 @@ |
| 299 | 299 | <order> |
| 300 | 300 | <hop> <from>时刻表明细分组数据</from><to>过滤记录</to><enabled>Y</enabled> </hop> |
| 301 | 301 | <hop> <from>过滤记录</from><to>计算站点</to><enabled>Y</enabled> </hop> |
| 302 | - <hop> <from>计算站点</from><to>查找站点名</to><enabled>Y</enabled> </hop> | |
| 303 | - <hop> <from>查找站点名</from><to>计算反范式元数据</to><enabled>Y</enabled> </hop> | |
| 304 | - <hop> <from>查找站点名</from><to>计算excel输出字段</to><enabled>Y</enabled> </hop> | |
| 305 | 302 | <hop> <from>计算excel输出字段</from><to>字段选择</to><enabled>Y</enabled> </hop> |
| 306 | 303 | <hop> <from>字段选择</from><to>排序记录</to><enabled>Y</enabled> </hop> |
| 307 | 304 | <hop> <from>生成路牌字段</from><to>排序记录</to><enabled>Y</enabled> </hop> |
| 308 | 305 | <hop> <from>计算反范式元数据</from><to>ETL元数据注入</to><enabled>Y</enabled> </hop> |
| 309 | 306 | <hop> <from>排序记录</from><to>ETL元数据注入</to><enabled>Y</enabled> </hop> |
| 307 | + <hop> <from>计算站点</from><to>查找起点站</to><enabled>Y</enabled> </hop> | |
| 308 | + <hop> <from>查找起点站</from><to>计算反范式元数据</to><enabled>Y</enabled> </hop> | |
| 309 | + <hop> <from>查找起点站</from><to>计算excel输出字段</to><enabled>Y</enabled> </hop> | |
| 310 | 310 | </order> |
| 311 | 311 | <step> |
| 312 | 312 | <name>ETL元数据注入</name> |
| ... | ... | @@ -368,29 +368,6 @@ |
| 368 | 368 | </step> |
| 369 | 369 | |
| 370 | 370 | <step> |
| 371 | - <name>去除重复记录</name> | |
| 372 | - <type>Unique</type> | |
| 373 | - <description/> | |
| 374 | - <distribute>Y</distribute> | |
| 375 | - <custom_distribution/> | |
| 376 | - <copies>1</copies> | |
| 377 | - <partitioning> | |
| 378 | - <method>none</method> | |
| 379 | - <schema_name/> | |
| 380 | - </partitioning> | |
| 381 | - <count_rows>N</count_rows> | |
| 382 | - <count_field/> | |
| 383 | - <reject_duplicate_row>N</reject_duplicate_row> | |
| 384 | - <error_description/> | |
| 385 | - <fields> </fields> <cluster_schema/> | |
| 386 | - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | |
| 387 | - <xloc>842</xloc> | |
| 388 | - <yloc>592</yloc> | |
| 389 | - <draw>Y</draw> | |
| 390 | - </GUI> | |
| 391 | - </step> | |
| 392 | - | |
| 393 | - <step> | |
| 394 | 371 | <name>字段选择</name> |
| 395 | 372 | <type>SelectValues</type> |
| 396 | 373 | <description/> |
| ... | ... | @@ -468,7 +445,7 @@ |
| 468 | 445 | <schema_name/> |
| 469 | 446 | </partitioning> |
| 470 | 447 | <connection>bus_control_variable</connection> |
| 471 | - <sql>select 
fcno
, min(xl) xl 
, min(xl_dir) xl_dir
, min(qdz_code) qdz
, min(zdz_code) zdz
, min(bc_type) bc_type 
from bsth_c_s_ttinfo_detail
where ttinfo = ${ttinfoid}
group by fcno</sql> | |
| 448 | + <sql>select 
fcno
, min(xl) xl 
, min(xl_dir) xl_dir
, min(qdz_code) qdz
, min(zdz_code) zdz
, min(bc_type) bc_type 
, min(line_version) line_version
from bsth_c_s_ttinfo_detail
where ttinfo = ${ttinfoid}
group by fcno</sql> | |
| 472 | 449 | <limit>0</limit> |
| 473 | 450 | <lookup/> |
| 474 | 451 | <execute_each_row>N</execute_each_row> |
| ... | ... | @@ -477,61 +454,7 @@ |
| 477 | 454 | <cluster_schema/> |
| 478 | 455 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 479 | 456 | <xloc>56</xloc> |
| 480 | - <yloc>185</yloc> | |
| 481 | - <draw>Y</draw> | |
| 482 | - </GUI> | |
| 483 | - </step> | |
| 484 | - | |
| 485 | - <step> | |
| 486 | - <name>查找站点名</name> | |
| 487 | - <type>DBLookup</type> | |
| 488 | - <description/> | |
| 489 | - <distribute>N</distribute> | |
| 490 | - <custom_distribution/> | |
| 491 | - <copies>1</copies> | |
| 492 | - <partitioning> | |
| 493 | - <method>none</method> | |
| 494 | - <schema_name/> | |
| 495 | - </partitioning> | |
| 496 | - <connection>bus_control_variable</connection> | |
| 497 | - <cache>N</cache> | |
| 498 | - <cache_load_all>Y</cache_load_all> | |
| 499 | - <cache_size>0</cache_size> | |
| 500 | - <lookup> | |
| 501 | - <schema/> | |
| 502 | - <table>bsth_c_stationroute</table> | |
| 503 | - <orderby/> | |
| 504 | - <fail_on_multiple>N</fail_on_multiple> | |
| 505 | - <eat_row_on_failure>N</eat_row_on_failure> | |
| 506 | - <key> | |
| 507 | - <name>xl</name> | |
| 508 | - <field>line</field> | |
| 509 | - <condition>=</condition> | |
| 510 | - <name2/> | |
| 511 | - </key> | |
| 512 | - <key> | |
| 513 | - <name>xl_dir</name> | |
| 514 | - <field>directions</field> | |
| 515 | - <condition>=</condition> | |
| 516 | - <name2/> | |
| 517 | - </key> | |
| 518 | - <key> | |
| 519 | - <name>zd</name> | |
| 520 | - <field>station_code</field> | |
| 521 | - <condition>=</condition> | |
| 522 | - <name2/> | |
| 523 | - </key> | |
| 524 | - <value> | |
| 525 | - <name>station_name</name> | |
| 526 | - <rename>zdname</rename> | |
| 527 | - <default/> | |
| 528 | - <type>String</type> | |
| 529 | - </value> | |
| 530 | - </lookup> | |
| 531 | - <cluster_schema/> | |
| 532 | - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | |
| 533 | - <xloc>410</xloc> | |
| 534 | - <yloc>191</yloc> | |
| 457 | + <yloc>192</yloc> | |
| 535 | 458 | <draw>Y</draw> |
| 536 | 459 | </GUI> |
| 537 | 460 | </step> |
| ... | ... | @@ -697,13 +620,19 @@ |
| 697 | 620 | <optimizationLevel>9</optimizationLevel> |
| 698 | 621 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 699 | 622 | <jsScript_name>Script 1</jsScript_name> |
| 700 | - <jsScript_script>//Script here

var zd;

if (bc_type == 'in') {
 zd = qdz;
} else if (bc_type == 'out') {
 zd = zdz;
} else if (bc_type == 'normal') {
 zd = qdz;
} else {
 zd = qdz;
}
</jsScript_script> | |
| 701 | - </jsScript> </jsScripts> <fields> <field> <name>zd</name> | |
| 702 | - <rename>zd</rename> | |
| 623 | + <jsScript_script>//Script here

/*
var zd;

if (bc_type == 'in') {
 zd = qdz;
} else if (bc_type == 'out') {
 zd = zdz;
} else if (bc_type == 'normal') {
 zd = qdz;
} else {
 zd = qdz;
}
*/

// 站点标志
var smark = "B";
var destroy = 0;</jsScript_script> | |
| 624 | + </jsScript> </jsScripts> <fields> <field> <name>smark</name> | |
| 625 | + <rename>smark</rename> | |
| 703 | 626 | <type>String</type> |
| 704 | 627 | <length>-1</length> |
| 705 | 628 | <precision>-1</precision> |
| 706 | 629 | <replace>N</replace> |
| 630 | + </field> <field> <name>destroy</name> | |
| 631 | + <rename>destroy</rename> | |
| 632 | + <type>Number</type> | |
| 633 | + <length>16</length> | |
| 634 | + <precision>2</precision> | |
| 635 | + <replace>N</replace> | |
| 707 | 636 | </field> </fields> <cluster_schema/> |
| 708 | 637 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 709 | 638 | <xloc>300</xloc> |
| ... | ... | @@ -728,9 +657,14 @@ |
| 728 | 657 | <compare> |
| 729 | 658 | <condition> |
| 730 | 659 | <negated>N</negated> |
| 731 | - <leftvalue>bc_type</leftvalue> | |
| 732 | - <function>IS NOT NULL</function> | |
| 733 | - <rightvalue/> | |
| 660 | + <conditions> | |
| 661 | + <condition> | |
| 662 | + <negated>N</negated> | |
| 663 | + <leftvalue>bc_type</leftvalue> | |
| 664 | + <function>IS NOT NULL</function> | |
| 665 | + <rightvalue/> | |
| 666 | + </condition> | |
| 667 | + </conditions> | |
| 734 | 668 | </condition> |
| 735 | 669 | </compare> |
| 736 | 670 | <cluster_schema/> |
| ... | ... | @@ -741,6 +675,72 @@ |
| 741 | 675 | </GUI> |
| 742 | 676 | </step> |
| 743 | 677 | |
| 678 | + <step> | |
| 679 | + <name>查找起点站</name> | |
| 680 | + <type>DBLookup</type> | |
| 681 | + <description/> | |
| 682 | + <distribute>N</distribute> | |
| 683 | + <custom_distribution/> | |
| 684 | + <copies>1</copies> | |
| 685 | + <partitioning> | |
| 686 | + <method>none</method> | |
| 687 | + <schema_name/> | |
| 688 | + </partitioning> | |
| 689 | + <connection>bus_control_variable</connection> | |
| 690 | + <cache>N</cache> | |
| 691 | + <cache_load_all>Y</cache_load_all> | |
| 692 | + <cache_size>0</cache_size> | |
| 693 | + <lookup> | |
| 694 | + <schema/> | |
| 695 | + <table>bsth_c_ls_stationroute</table> | |
| 696 | + <orderby/> | |
| 697 | + <fail_on_multiple>N</fail_on_multiple> | |
| 698 | + <eat_row_on_failure>N</eat_row_on_failure> | |
| 699 | + <key> | |
| 700 | + <name>xl</name> | |
| 701 | + <field>line</field> | |
| 702 | + <condition>=</condition> | |
| 703 | + <name2/> | |
| 704 | + </key> | |
| 705 | + <key> | |
| 706 | + <name>xl_dir</name> | |
| 707 | + <field>directions</field> | |
| 708 | + <condition>=</condition> | |
| 709 | + <name2/> | |
| 710 | + </key> | |
| 711 | + <key> | |
| 712 | + <name>line_version</name> | |
| 713 | + <field>versions</field> | |
| 714 | + <condition>=</condition> | |
| 715 | + <name2/> | |
| 716 | + </key> | |
| 717 | + <key> | |
| 718 | + <name>smark</name> | |
| 719 | + <field>station_mark</field> | |
| 720 | + <condition>=</condition> | |
| 721 | + <name2/> | |
| 722 | + </key> | |
| 723 | + <key> | |
| 724 | + <name>destroy</name> | |
| 725 | + <field>destroy</field> | |
| 726 | + <condition>=</condition> | |
| 727 | + <name2/> | |
| 728 | + </key> | |
| 729 | + <value> | |
| 730 | + <name>station_name</name> | |
| 731 | + <rename>zdname</rename> | |
| 732 | + <default/> | |
| 733 | + <type>String</type> | |
| 734 | + </value> | |
| 735 | + </lookup> | |
| 736 | + <cluster_schema/> | |
| 737 | + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | |
| 738 | + <xloc>412</xloc> | |
| 739 | + <yloc>189</yloc> | |
| 740 | + <draw>Y</draw> | |
| 741 | + </GUI> | |
| 742 | + </step> | |
| 743 | + | |
| 744 | 744 | <step_error_handling> |
| 745 | 745 | </step_error_handling> |
| 746 | 746 | <slave-step-copy-partition-distribution> | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
| ... | ... | @@ -772,4 +772,23 @@ div[id*='PanoramaFlashWraperTANGRAM']{ |
| 772 | 772 | |
| 773 | 773 | .line_change_panel .uk-list>li{ |
| 774 | 774 | padding: 5px; |
| 775 | +} | |
| 776 | + | |
| 777 | +.instructions_tips{ | |
| 778 | + position: absolute; | |
| 779 | + z-index: 9999; | |
| 780 | + background: #fffdf0; | |
| 781 | + width: 635px; | |
| 782 | + left: 590px; | |
| 783 | + top: 10px; | |
| 784 | + font-size: 14px; | |
| 785 | + padding: 15px 15px 0; | |
| 786 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | |
| 787 | + color: #000000; | |
| 788 | + display: none; | |
| 789 | +} | |
| 790 | + | |
| 791 | +.instructions_tips .uk-close{ | |
| 792 | + position: absolute; | |
| 793 | + right: 20px; | |
| 775 | 794 | } |
| 776 | 795 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/js/map.js
| ... | ... | @@ -37,7 +37,7 @@ var gb_ct_map = function () { |
| 37 | 37 | |
| 38 | 38 | map = new BMap.Map($(gb_map_consts.mapContainer)[0], {enableMapClick: false}); |
| 39 | 39 | //中心点和缩放级别 |
| 40 | - map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 14); | |
| 40 | + map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 15); | |
| 41 | 41 | map.enableScrollWheelZoom(); |
| 42 | 42 | |
| 43 | 43 | var stCtrl = new BMap.PanoramaControl(); //构造全景控件 | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/js/submit.js
| ... | ... | @@ -3,6 +3,10 @@ |
| 3 | 3 | */ |
| 4 | 4 | var gb_data_submit = function () { |
| 5 | 5 | |
| 6 | + function confirmRejected() { | |
| 7 | + console.log('Rejected'); | |
| 8 | + } | |
| 9 | + | |
| 6 | 10 | /** |
| 7 | 11 | * 缓冲区编辑提交 |
| 8 | 12 | */ |
| ... | ... | @@ -38,7 +42,7 @@ var gb_data_submit = function () { |
| 38 | 42 | //退出编辑模式 |
| 39 | 43 | gb_ct_map.exitEditBufferStatus(rs.station); |
| 40 | 44 | }); |
| 41 | - }); | |
| 45 | + }, confirmRejected); | |
| 42 | 46 | return false; |
| 43 | 47 | }); |
| 44 | 48 | |
| ... | ... | @@ -57,7 +61,7 @@ var gb_data_submit = function () { |
| 57 | 61 | UIkit.notification("修改成功!", {status: 'success'}); |
| 58 | 62 | gb_station_route.update(rs.station); |
| 59 | 63 | }); |
| 60 | - }); | |
| 64 | + },confirmRejected); | |
| 61 | 65 | }); |
| 62 | 66 | |
| 63 | 67 | /** |
| ... | ... | @@ -86,7 +90,7 @@ var gb_data_submit = function () { |
| 86 | 90 | hide_run_text(); |
| 87 | 91 | UIkit.notification("修改成功!", {status: 'success'}); |
| 88 | 92 | }); |
| 89 | - }); | |
| 93 | + },confirmRejected); | |
| 90 | 94 | return false; |
| 91 | 95 | }); |
| 92 | 96 | |
| ... | ... | @@ -122,7 +126,7 @@ var gb_data_submit = function () { |
| 122 | 126 | $('.add_road_search_point_wrap').remove(); |
| 123 | 127 | gb_ct_map.exitEditRoadStatus(null, true); |
| 124 | 128 | }); |
| 125 | - }); | |
| 129 | + },confirmRejected); | |
| 126 | 130 | return false; |
| 127 | 131 | }); |
| 128 | 132 | |
| ... | ... | @@ -141,7 +145,6 @@ var gb_data_submit = function () { |
| 141 | 145 | } |
| 142 | 146 | data.gsectionVector = gsectionVector.substr(0, gsectionVector.length - 1); |
| 143 | 147 | |
| 144 | - console.log('data', data); | |
| 145 | 148 | UIkit.modal.confirm('确定保存编辑的【'+data.sectionName+'】?').then(function() { |
| 146 | 149 | show_run_text('正在保存...'); |
| 147 | 150 | |
| ... | ... | @@ -152,7 +155,7 @@ var gb_data_submit = function () { |
| 152 | 155 | |
| 153 | 156 | gb_ct_map.exitEditRoadStatus(rs.road); |
| 154 | 157 | }); |
| 155 | - }); | |
| 158 | + },confirmRejected); | |
| 156 | 159 | }); |
| 157 | 160 | |
| 158 | 161 | /** |
| ... | ... | @@ -172,7 +175,7 @@ var gb_data_submit = function () { |
| 172 | 175 | clearAll(); |
| 173 | 176 | startup(); |
| 174 | 177 | }); |
| 175 | - }); | |
| 178 | + },confirmRejected); | |
| 176 | 179 | }); |
| 177 | 180 | |
| 178 | 181 | var show_run_text = function (t) { |
| ... | ... | @@ -201,7 +204,7 @@ var gb_data_submit = function () { |
| 201 | 204 | hide_run_text(); |
| 202 | 205 | UIkit.notification("撤销成功!", {status: 'success'}); |
| 203 | 206 | }); |
| 204 | - }); | |
| 207 | + },confirmRejected); | |
| 205 | 208 | } |
| 206 | 209 | |
| 207 | 210 | /** |
| ... | ... | @@ -221,7 +224,7 @@ var gb_data_submit = function () { |
| 221 | 224 | hide_run_text(); |
| 222 | 225 | UIkit.notification("撤销成功!", {status: 'success'}); |
| 223 | 226 | }); |
| 224 | - }); | |
| 227 | + },confirmRejected); | |
| 225 | 228 | }; |
| 226 | 229 | |
| 227 | 230 | function getUpDown(){ | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/main.html
| ... | ... | @@ -20,6 +20,19 @@ |
| 20 | 20 | <div><span uk-spinner></span><span class="text">正在加载...</span></div> |
| 21 | 21 | </div> |
| 22 | 22 | <div class="ct_page" > |
| 23 | + <div class="instructions_tips uk-animation-slide-top-medium"> | |
| 24 | + <button type="button" uk-close></button> | |
| 25 | + <div> | |
| 26 | + <h4>说明</h4> | |
| 27 | + <ul class="uk-list"> | |
| 28 | + <li>1、所有的改道、缩线、并线等对走向调整都必须新建版本,以保留原走向版本。</li> | |
| 29 | + <li>2、只有在人工数据录入错误的情况下,才有理由对当前启用的版本进行走向编辑。</li> | |
| 30 | + <li>3、走向版本可以任意切换,但是必须维护好一个准确的“版本切换记录”。</li> | |
| 31 | + <hr> | |
| 32 | + <li>4、调整缓冲区、修改站点名称、修改路段名称 不算走向调整,不需要新建版本。</li> | |
| 33 | + </ul> | |
| 34 | + </div> | |
| 35 | + </div> | |
| 23 | 36 | <div id="map_wrap"></div> |
| 24 | 37 | <div class="main_left_panel_m_layer"></div> |
| 25 | 38 | <div class="main_left_panel"> |
| ... | ... | @@ -34,6 +47,8 @@ |
| 34 | 47 | <ul class="uk-list"></ul> |
| 35 | 48 | </div> |
| 36 | 49 | |
| 50 | + | |
| 51 | + | |
| 37 | 52 | <a uk-icon="icon: trash" class="remove_line_version_icon uk-animation-slide-right-small" title="删除线路版本" style="display: none" uk-tooltip></a> |
| 38 | 53 | <a uk-icon="icon: plus" class="add_line_version_icon" title="新增一个线路版本" uk-tooltip></a> |
| 39 | 54 | </div> |
| ... | ... | @@ -79,7 +94,7 @@ |
| 79 | 94 | <div class="main_rt_tools_panel"> |
| 80 | 95 | <!--<a style="color: red;" uk-icon="icon: unlock;ratio: .9" class="_icon" title="当前版本有变更未启用" uk-tooltip="pos:bottom"></a>--> |
| 81 | 96 | |
| 82 | - <a uk-icon="icon: bookmark;ratio: .9" class="_icon" title="变更日志,日后再说" uk-tooltip="pos:bottom"></a> | |
| 97 | + <a uk-icon="icon: bookmark;ratio: .9" class="_icon" title="走向版本变更记录" uk-tooltip="pos:bottom"></a> | |
| 83 | 98 | <a uk-icon="icon: expand;ratio: .9" class="_icon full_screen_icon"></a> |
| 84 | 99 | </div> |
| 85 | 100 | </div> |
| ... | ... | @@ -165,14 +180,16 @@ |
| 165 | 180 | //文件加载 |
| 166 | 181 | var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route' |
| 167 | 182 | , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () { |
| 168 | - startup(); | |
| 183 | + startup(function () { | |
| 184 | + $('.instructions_tips').show(); | |
| 185 | + }); | |
| 169 | 186 | |
| 170 | 187 | gb_change_line.init(); |
| 171 | 188 | }); |
| 172 | 189 | |
| 173 | 190 | var g_line_code; |
| 174 | 191 | var g_version; |
| 175 | - var startup = function () { | |
| 192 | + var startup = function (cb) { | |
| 176 | 193 | g_line_code = storage.getItem('geo_data_edit_line_code'); |
| 177 | 194 | |
| 178 | 195 | gb_main_ep = new EventProxy(); |
| ... | ... | @@ -195,6 +212,8 @@ |
| 195 | 212 | |
| 196 | 213 | $loadPanel.hide(); |
| 197 | 214 | gb_ct_search.init(); |
| 215 | + | |
| 216 | + cb && cb(); | |
| 198 | 217 | }); |
| 199 | 218 | }; |
| 200 | 219 | |
| ... | ... | @@ -233,6 +252,16 @@ |
| 233 | 252 | e.stopPropagation(); |
| 234 | 253 | return false; |
| 235 | 254 | }); |
| 255 | + | |
| 256 | + $(document).on('click', 'button.cancel', function (e) { | |
| 257 | + e.stopPropagation(); | |
| 258 | + return false; | |
| 259 | + }); | |
| 260 | + | |
| 261 | + //关闭说明 | |
| 262 | + $('.instructions_tips .uk-close').on('click', function () { | |
| 263 | + $('.instructions_tips').remove(); | |
| 264 | + }); | |
| 236 | 265 | </script> |
| 237 | 266 | |
| 238 | 267 | ... | ... |
src/main/resources/static/pages/base/timesmodel/gantt.html
| ... | ... | @@ -44,9 +44,12 @@ |
| 44 | 44 | <div class="btn-group btn-group-devided countbtn" data-toggle="buttons"> |
| 45 | 45 | <a class="btn btn-circle blue countAdd" href="javascript:;" data-pjax><i class="fa fa-database"></i> 统计数据</a> |
| 46 | 46 | </div> |
| 47 | - <div class="btn-group btn-group-devided checkbtn" data-toggle="buttons"> | |
| 48 | - <a class="btn btn-circle blue checkAdd" href="javascript:;" data-pjax><i class="fa fa-check"></i> 保存数据</a> | |
| 49 | - </div> | |
| 47 | + <!--<div class="btn-group btn-group-devided checkbtn" data-toggle="buttons">--> | |
| 48 | + <!--<a class="btn btn-circle blue checkAdd" href="javascript:;" data-pjax><i class="fa fa-check"></i> 保存数据</a>--> | |
| 49 | + <!--</div>--> | |
| 50 | + <div class="btn-group btn-group-devided exportbtn" data-toggle="buttons"> | |
| 51 | + <!--<a class="btn btn-circle blue exportAdd" href="javascript:;" data-pjax><i class="fa fa-file-excel-o"></i> 导出数据</a>--> | |
| 52 | + </div> | |
| 50 | 53 | <div class="btn-group checkbtn"> |
| 51 | 54 | <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown" aria-expanded="false"> |
| 52 | 55 | <i class="fa fa-cog"></i> | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/add-form-reload.js
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | $('.openHaveSkb').on('click',function() { |
| 8 | 8 | var skbId = $("#skbNameSelect").val(); |
| 9 | 9 | var argus = { |
| 10 | - baseRes:"0",carPark:"FFFFFF68",downInMileage:"0", | |
| 10 | + baseRes:"0",czarPark:"FFFFFF68",downInMileage:"0", | |
| 11 | 11 | downInTimer:"0",downMileage:"3.5",downOutMileage:"0", |
| 12 | 12 | downOutTimer:"0",downStopTime:"10",downTravelTime:"7", |
| 13 | 13 | down_s:"26922_26928",earlyDownTime:"7",earlyEndTime:"08:30", | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/add-form-wizard.js
| ... | ... | @@ -372,11 +372,22 @@ var SKBFormWizard = function() { |
| 372 | 372 | } |
| 373 | 373 | sjdArr[s].num = num; |
| 374 | 374 | } |
| 375 | - map.zgfbeforepcs = sjdArr[0].num;// 早高峰前配车数 | |
| 376 | - map.zgfpcs = sjdArr[2].num;// 早高峰配车数 | |
| 377 | - map.gfzjpcs = sjdArr[4].num;// 高峰之间配车数 | |
| 378 | - map.wgfpcs = sjdArr[2].num ;// 晚高峰配车数 | |
| 379 | - map.wgfafterpcs = sjdArr[1].num + sjdArr[3].num;// 晚高峰后配车数 | |
| 375 | + | |
| 376 | + // 注意:如果为0,设置成 10 17默认值 | |
| 377 | + map.zgfbeforepcs = sjdArr[0].num == 0 ? 10 : sjdArr[0].num;// 早高峰前配车数 | |
| 378 | + map.zgfpcs = sjdArr[2].num == 0 ? 17 : sjdArr[2].num;// 早高峰配车数 | |
| 379 | + map.gfzjpcs = sjdArr[4].num == 0 ? 10 : sjdArr[4].num;// 高峰之间配车数 | |
| 380 | + map.wgfpcs = sjdArr[2].num == 0 ? 17 : sjdArr[2].num ;// 晚高峰配车数 | |
| 381 | + map.wgfafterpcs = (sjdArr[1].num + sjdArr[3].num) == 0 ? 10 : sjdArr[1].num + sjdArr[3].num;// 晚高峰后配车数 | |
| 382 | + | |
| 383 | + // 注意:高峰 5 低谷 20 其他 10 | |
| 384 | + map.upStopTime = 10; | |
| 385 | + map.downStopTime = 10; | |
| 386 | + map.mixstopTime = 5; | |
| 387 | + map.maxstopTime = 20; | |
| 388 | + | |
| 389 | + //alert("dddd"); | |
| 390 | + | |
| 380 | 391 | // 返回参数详情模版. |
| 381 | 392 | return cb && cb ({'forminput':template(tempName,{map:map}),'datadisplay': template(tempName +'config',{map:null})}); |
| 382 | 393 | }); |
| ... | ... | @@ -640,13 +651,49 @@ var SKBFormWizard = function() { |
| 640 | 651 | |
| 641 | 652 | // 表单提交. |
| 642 | 653 | function submit(p,argus) { |
| 643 | - storage.setItem("Gantt_AgursData",JSON.stringify(argus)); | |
| 644 | - if(p!=null) { | |
| 645 | - storage.setItem('isDoDate',JSON.stringify({'rsD':p.rsD,'rsLP':p.rsLp})); | |
| 646 | - }else { | |
| 647 | - storage.setItem('isDoDate',''); | |
| 648 | - } | |
| 649 | - loadPage('gantt.html'); | |
| 654 | + var baseRes2 = $('#submit_argus_form input[name="baseRes"]:checked').val();// 获取参数方式值. | |
| 655 | + if (baseRes2 == 0) { | |
| 656 | + // TODO:客流暂时有问题,直接使用现有时刻表打开,日后有机会再改好 | |
| 657 | + var skbId2 = $("#skbNameSelect").val(); | |
| 658 | + var argus2 = { | |
| 659 | + baseRes:"0",carPark:"FFFFFF68",downInMileage:"0", | |
| 660 | + downInTimer:"0",downMileage:"3.5",downOutMileage:"0", | |
| 661 | + downOutTimer:"0",downStopTime:"10",downTravelTime:"7", | |
| 662 | + down_s:"26922_26928",earlyDownTime:"7",earlyEndTime:"08:30", | |
| 663 | + earlyStartTime:"06:31",earlyUpTime:"10",endStationEndTime:"22:30", | |
| 664 | + endStationFirstTime:"05:50",gfzjpcs:"7",istidc:1,kfsj:"",krl:"50", | |
| 665 | + lateDownTime:"7",lateEndTime:"18:30",lateStartTime:"16:31", | |
| 666 | + lateUpTime:"10",lb:"15",lineName:"801702_801702_1109路", | |
| 667 | + linePlayType:"0",maxstopTime:"20",mixstopTime:"8",qjDownTime:"", | |
| 668 | + qjUpTime:"",skbName:skbId2,skbmc:"2016.4.6双时刻表", | |
| 669 | + startStationEndTime:"23:00",startStationFirstTime:"06:15",tcc_id:45,troughDownTime:"7",troughUpTime:"10",upInMileage:"0", | |
| 670 | + upInTimer:"10",upMileage:"3.5",upOutMileage:"0",upOutTimer:"10",upStopTime:"10",upTravelTime:"10", | |
| 671 | + up_s:"26912_26921",wgfafterpcs:"5",wgfpcs:"10",workeDinner:"20",workeLunch:"20",xlmc:"1109路",zgfbeforepcs:"3",zgfpcs:"10",} | |
| 672 | + // 获取时刻表明细. | |
| 673 | + $get('/tidc/all',{'ttinfo.id_eq':parseInt(argus.skbName)},function(data) { | |
| 674 | + var p = formatData(data.data,argus2); | |
| 675 | + // TODO:添加parent | |
| 676 | + for (var ii = 0; ii < p.rsD.length; ii++) { | |
| 677 | + p.rsD[ii].parent = p.rsD[ii].lpNo;// 路牌名称 | |
| 678 | + } | |
| 679 | + | |
| 680 | + argus2.istidc = 1; | |
| 681 | + var storage = window.localStorage; | |
| 682 | + storage.setItem("Gantt_AgursData",JSON.stringify(argus2)); | |
| 683 | + storage.setItem('isDoDate',JSON.stringify({'rsD':p.rsD,'rsLP':p.rsLp})); | |
| 684 | + loadPage('gantt.html'); | |
| 685 | + }); | |
| 686 | + } else { | |
| 687 | + storage.setItem("Gantt_AgursData",JSON.stringify(argus)); | |
| 688 | + if(p!=null) { | |
| 689 | + storage.setItem('isDoDate',JSON.stringify({'rsD':p.rsD,'rsLP':p.rsLp})); | |
| 690 | + }else { | |
| 691 | + storage.setItem('isDoDate',''); | |
| 692 | + } | |
| 693 | + loadPage('gantt.html'); | |
| 694 | + } | |
| 695 | + | |
| 696 | + | |
| 650 | 697 | } |
| 651 | 698 | } |
| 652 | 699 | }); | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/gantt.js
| ... | ... | @@ -83,7 +83,9 @@ |
| 83 | 83 | // TODO:绘制gantt图表 |
| 84 | 84 | // TODO:var seDate = getksjssj(null,seMap.s); 关联参数必须设置 |
| 85 | 85 | // TODO:CSMap.maxCar 之后要设定一下的 |
| 86 | + $(".exportbtn").html("<a class=\"btn btn-circle blue exportAdd\" href=\"javascript:;\" data-pjax><i class=\"fa fa-file-excel-o\"></i> 导出数据</a>"); | |
| 86 | 87 | data = Main_v2.BXPplaceClassesTime03(_paramObj, CSMap.maxCar); |
| 88 | + Main_v2.exportDataConfig(data.aInternalLpObj); | |
| 87 | 89 | } |
| 88 | 90 | |
| 89 | 91 | }else { | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalBcObj.js
| ... | ... | @@ -51,7 +51,7 @@ var InternalBcObj = function( |
| 51 | 51 | //------------------- get/set 方法 -------------------// |
| 52 | 52 | |
| 53 | 53 | InternalBcObj.prototype.fnSetIsFirstBc = function(bFlag) { |
| 54 | - this._$_bIsFirstBc = true; | |
| 54 | + this._$_bIsFirstBc = bFlag; | |
| 55 | 55 | }; |
| 56 | 56 | InternalBcObj.prototype.fnIsFirstBc = function() { |
| 57 | 57 | return this._$_bIsFirstBc; | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalLpObj.js
| ... | ... | @@ -38,12 +38,11 @@ var InternalLpObj = function( |
| 38 | 38 | // 这里的间隔表示下一个路牌上的班次距离本路牌的班次发车时间间隔 |
| 39 | 39 | // 如果当前是最后一个路牌,表示第一个路牌的下一圈同方向班次距离本班次的间隔 |
| 40 | 40 | this._$_aVerticalIntervalTime = new Array(this._$_qCount); |
| 41 | - var i; | |
| 42 | 41 | for (i = 0; i < this._$_aVerticalIntervalTime.length; i++) { |
| 43 | 42 | this._$_aVerticalIntervalTime[i] = new Array(2); |
| 44 | 43 | } |
| 45 | 44 | |
| 46 | - // 班型的相关变量 | |
| 45 | + // 班型的相关变量 | |
| 47 | 46 | this._$_bx_isLb = false; // 是否连班 |
| 48 | 47 | this._$_bx_isfb = false; // 是否分班 |
| 49 | 48 | this._$_bx_isfb_5_2 = false; // 是否5休2分班 |
| ... | ... | @@ -74,6 +73,22 @@ InternalLpObj.prototype.getGroup = function(qIndex) { |
| 74 | 73 | }; |
| 75 | 74 | |
| 76 | 75 | /** |
| 76 | + * 获取路牌圈数。 | |
| 77 | + * @returns {*} | |
| 78 | + */ | |
| 79 | +InternalLpObj.prototype.fnGetGroupCount = function() { | |
| 80 | + return this._$_qCount; | |
| 81 | +}; | |
| 82 | + | |
| 83 | +/** | |
| 84 | + * 是否上行。 | |
| 85 | + * @returns boolean | |
| 86 | + */ | |
| 87 | +InternalLpObj.prototype.isUp = function() { | |
| 88 | + return this._$_isUp; | |
| 89 | +}; | |
| 90 | + | |
| 91 | +/** | |
| 77 | 92 | * 获取班次。 |
| 78 | 93 | * @param qIndex 第几圈 |
| 79 | 94 | * @param bcIndex 第几个班次 |
| ... | ... | @@ -847,8 +862,3 @@ InternalLpObj.prototype.calcuLpBx = function() { |
| 847 | 862 | }; |
| 848 | 863 | |
| 849 | 864 | |
| 850 | - | |
| 851 | - | |
| 852 | - | |
| 853 | - | |
| 854 | - | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
| ... | ... | @@ -1880,6 +1880,14 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 1880 | 1880 | |
| 1881 | 1881 | //------------- 其他方法 -------------// |
| 1882 | 1882 | /** |
| 1883 | + * 返回内部路牌数据列表。 | |
| 1884 | + * @returns {Array} | |
| 1885 | + */ | |
| 1886 | + fnGetLpArray: function() { | |
| 1887 | + return _internalLpArray; | |
| 1888 | + }, | |
| 1889 | + | |
| 1890 | + /** | |
| 1883 | 1891 | * 内部数据转化成显示用的班次数组。 |
| 1884 | 1892 | */ |
| 1885 | 1893 | fnToGanttBcArray: function() { |
| ... | ... | @@ -1937,4 +1945,5 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 1937 | 1945 | } |
| 1938 | 1946 | |
| 1939 | 1947 | }; |
| 1948 | + | |
| 1940 | 1949 | }; |
| 1941 | 1950 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
| ... | ... | @@ -131,6 +131,340 @@ var Main_v2 = function() { |
| 131 | 131 | {'type':'无工休', 'hoursV':5.43, 'minueV':'5:43', 'qcount': 0, 'avertime': 0} |
| 132 | 132 | ]; |
| 133 | 133 | |
| 134 | + var _funCalcuExportData_lpObjList = function(aInternalLpObj) { | |
| 135 | + // 构造路牌对象 | |
| 136 | + var aLpObj = []; | |
| 137 | + var i; | |
| 138 | + var j; | |
| 139 | + var z; | |
| 140 | + var oInternalLp; | |
| 141 | + var oInternalBc; | |
| 142 | + var oLp; | |
| 143 | + var iZbc; | |
| 144 | + var iZgs; | |
| 145 | + for (i = 0; i < aInternalLpObj.length; i++) { | |
| 146 | + oInternalLp = aInternalLpObj[i]; | |
| 147 | + iZbc = 0; | |
| 148 | + iZgs = 0; | |
| 149 | + oLp = { | |
| 150 | + "lpname": oInternalLp.getLpName(), // 路牌名字 | |
| 151 | + "isUp": oInternalLp.isUp(), // 每圈的第一个班次是否上行 | |
| 152 | + "bcObjList": [], // 班次列表 | |
| 153 | + "groupCount": oInternalLp.fnGetGroupCount(), // 总圈数 | |
| 154 | + "zgs": 0, // 总工时 | |
| 155 | + "zbc": 0, // 总班次 | |
| 156 | + "stationRouteId1": 0, // 第一个班次起点站路由id | |
| 157 | + "stationRouteId2": 0 // 第二个班次起点站路由id | |
| 158 | + }; | |
| 159 | + | |
| 160 | + // 将报到班次,进出场班次加到班次的时间上 | |
| 161 | + var iBcChainCount; | |
| 162 | + var oStartBc; | |
| 163 | + var oEndBc; | |
| 164 | + var oTempBc; | |
| 165 | + var aFcsj = []; | |
| 166 | + | |
| 167 | + iBcChainCount = oInternalLp.fnGetBcChainCount(); | |
| 168 | + if (iBcChainCount == 1) { // 单一车次链,连班班型 | |
| 169 | + oStartBc = oInternalLp.getBc( | |
| 170 | + oInternalLp.fnGetBcChainInfo(0)["s_q"], | |
| 171 | + oInternalLp.fnGetBcChainInfo(0)["s_b"] | |
| 172 | + ); | |
| 173 | + oTempBc = _factory.createBcObj( | |
| 174 | + oLp, "bd", true, 1, | |
| 175 | + oStartBc.getFcTimeObj(), | |
| 176 | + _paramObj | |
| 177 | + ); | |
| 178 | + aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 179 | + oTempBc = _factory.createBcObj( | |
| 180 | + oLp, "out", true, 1, | |
| 181 | + oStartBc.getFcTimeObj(), | |
| 182 | + _paramObj | |
| 183 | + ); | |
| 184 | + aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 185 | + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 186 | + oStartBc._$_fcsj_desc = aFcsj.join(""); | |
| 187 | + | |
| 188 | + aFcsj = []; | |
| 189 | + | |
| 190 | + oEndBc = oInternalLp.getBc( | |
| 191 | + oInternalLp.fnGetBcChainInfo(0)["e_q"], | |
| 192 | + oInternalLp.fnGetBcChainInfo(0)["e_b"] | |
| 193 | + ); | |
| 194 | + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 195 | + oTempBc = _factory.createBcObj( | |
| 196 | + oLp, "in", true, 1, | |
| 197 | + oEndBc.getArrTimeObj(), | |
| 198 | + _paramObj | |
| 199 | + ); | |
| 200 | + aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 201 | + oTempBc = _factory.createBcObj( | |
| 202 | + oLp, "lc", true, 1, | |
| 203 | + oEndBc.getArrTimeObj(), | |
| 204 | + _paramObj | |
| 205 | + ); | |
| 206 | + aFcsj.push("(离" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 207 | + oEndBc._$_fcsj_desc = aFcsj.join(""); | |
| 208 | + | |
| 209 | + } else if (iBcChainCount == 2) { // 两个车次链,分班班型 | |
| 210 | + oStartBc = oInternalLp.getBc( | |
| 211 | + oInternalLp.fnGetBcChainInfo(0)["s_q"], | |
| 212 | + oInternalLp.fnGetBcChainInfo(0)["s_b"] | |
| 213 | + ); | |
| 214 | + oTempBc = _factory.createBcObj( | |
| 215 | + oLp, "bd", true, 1, | |
| 216 | + oStartBc.getFcTimeObj(), | |
| 217 | + _paramObj | |
| 218 | + ); | |
| 219 | + aFcsj.push("(到" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 220 | + oTempBc = _factory.createBcObj( | |
| 221 | + oLp, "out", true, 1, | |
| 222 | + oStartBc.getFcTimeObj(), | |
| 223 | + _paramObj | |
| 224 | + ); | |
| 225 | + aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 226 | + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 227 | + oStartBc._$_fcsj_desc = aFcsj.join(""); | |
| 228 | + | |
| 229 | + aFcsj = []; | |
| 230 | + | |
| 231 | + oEndBc = oInternalLp.getBc( | |
| 232 | + oInternalLp.fnGetBcChainInfo(0)["e_q"], | |
| 233 | + oInternalLp.fnGetBcChainInfo(0)["e_b"] | |
| 234 | + ); | |
| 235 | + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 236 | + oTempBc = _factory.createBcObj( | |
| 237 | + oLp, "in", true, 1, | |
| 238 | + oEndBc.getArrTimeObj(), | |
| 239 | + _paramObj | |
| 240 | + ); | |
| 241 | + aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 242 | + oTempBc = _factory.createBcObj( | |
| 243 | + oLp, "lc", true, 1, | |
| 244 | + oEndBc.getArrTimeObj(), | |
| 245 | + _paramObj | |
| 246 | + ); | |
| 247 | + oEndBc._$_fcsj_desc = aFcsj.join(""); | |
| 248 | + | |
| 249 | + aFcsj = []; | |
| 250 | + | |
| 251 | + oStartBc = oInternalLp.getBc( | |
| 252 | + oInternalLp.fnGetBcChainInfo(1)["s_q"], | |
| 253 | + oInternalLp.fnGetBcChainInfo(1)["s_b"] | |
| 254 | + ); | |
| 255 | + oTempBc = _factory.createBcObj( | |
| 256 | + oLp, "out", true, 1, | |
| 257 | + oStartBc.getFcTimeObj(), | |
| 258 | + _paramObj | |
| 259 | + ); | |
| 260 | + aFcsj.push("(出" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 261 | + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 262 | + oStartBc._$_fcsj_desc = aFcsj.join(""); | |
| 263 | + | |
| 264 | + aFcsj = []; | |
| 265 | + | |
| 266 | + oEndBc = oInternalLp.getBc( | |
| 267 | + oInternalLp.fnGetBcChainInfo(1)["e_q"], | |
| 268 | + oInternalLp.fnGetBcChainInfo(1)["e_b"] | |
| 269 | + ); | |
| 270 | + aFcsj.push("(" + oStartBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 271 | + oTempBc = _factory.createBcObj( | |
| 272 | + oLp, "in", true, 1, | |
| 273 | + oEndBc.getArrTimeObj(), | |
| 274 | + _paramObj | |
| 275 | + ); | |
| 276 | + aFcsj.push("(进" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 277 | + oTempBc = _factory.createBcObj( | |
| 278 | + oLp, "lc", true, 1, | |
| 279 | + oEndBc.getArrTimeObj(), | |
| 280 | + _paramObj | |
| 281 | + ); | |
| 282 | + aFcsj.push("(离" + oTempBc.getFcTimeObj().format("HH:mm") + ")"); | |
| 283 | + oEndBc._$_fcsj_desc = aFcsj.join(""); | |
| 284 | + | |
| 285 | + } | |
| 286 | + | |
| 287 | + for (j = 0; j < oInternalLp.fnGetGroupCount(); j++) { | |
| 288 | + for (z = 0; z < 2; z++) { | |
| 289 | + oInternalBc = oInternalLp.getBc(j, z); | |
| 290 | + if (oInternalBc) { | |
| 291 | + if (oInternalBc.fnGetEatTime() > 0) { | |
| 292 | + oInternalBc._$_fcsj_desc = "(吃" + oInternalBc.getFcTimeObj().format("HH:mm") + ")"; | |
| 293 | + } | |
| 294 | + | |
| 295 | + oLp.bcObjList.push({ | |
| 296 | + "bcsj": oInternalBc.getBcTime(), // 班次时间 | |
| 297 | + "ssj": oInternalBc.getStopTime(), // 停站时间 | |
| 298 | + "eatsj": oInternalBc.fnGetEatTime(), // 吃饭时间 | |
| 299 | + | |
| 300 | + "tccid": oInternalBc._$_tccid, // 停车场id | |
| 301 | + "qdzid": oInternalBc._$_qdzid, // 起点站id | |
| 302 | + "zdzid": oInternalBc._$_zdzid, // 终点站id | |
| 303 | + | |
| 304 | + "isUp": oInternalBc._$_isUp, // 是否上行 | |
| 305 | + | |
| 306 | + "bcType": oInternalBc._$_bcType, // 班次类型 | |
| 307 | + "fcsj": oInternalBc._$_fcsj_desc || oInternalBc._$_fcsjObj.format("HH:mm"), // 发车时间描述 | |
| 308 | + | |
| 309 | + "groupNo": j, // 第几圈 | |
| 310 | + "groupBcNo": z // 圈里第几个班次 | |
| 311 | + | |
| 312 | + }); | |
| 313 | + | |
| 314 | + iZgs = iZgs + | |
| 315 | + oInternalBc.getBcTime() + // 班次时间 | |
| 316 | + oInternalBc.getStopTime() + // 停站时间 | |
| 317 | + oInternalBc.fnGetEatTime(); // 吃饭时间 | |
| 318 | + iZbc = iZbc + 1; | |
| 319 | + | |
| 320 | + // 设置圈站点路由id | |
| 321 | + if (oInternalBc.isUp() == oInternalLp.isUp()) { // 第一个班次 | |
| 322 | + if (oLp.stationRouteId1 == 0) { | |
| 323 | + oLp.stationRouteId1 = oInternalBc._$_qdzid; | |
| 324 | + } | |
| 325 | + } else { // 第二个班次 | |
| 326 | + if (oLp.stationRouteId2 == 0) { | |
| 327 | + oLp.stationRouteId2 = oInternalBc._$_qdzid; | |
| 328 | + } | |
| 329 | + } | |
| 330 | + | |
| 331 | + } | |
| 332 | + } | |
| 333 | + | |
| 334 | + } | |
| 335 | + | |
| 336 | + for (z = 0; z < oInternalLp.getOtherBcArray().length; z++) { | |
| 337 | + oInternalBc = oInternalLp.getOtherBcArray()[z]; | |
| 338 | + iZgs = iZgs + | |
| 339 | + oInternalBc.getBcTime() + // 班次时间 | |
| 340 | + oInternalBc.getStopTime(); // 停站时间 | |
| 341 | + if (oInternalBc._$_bcType != "bd" && | |
| 342 | + oInternalBc._$_bcType != "lc" && | |
| 343 | + oInternalBc._$_bcType != "cf") { | |
| 344 | + iZbc = iZbc + 1; | |
| 345 | + } | |
| 346 | + } | |
| 347 | + | |
| 348 | + oLp.zgs = iZgs; | |
| 349 | + oLp.zbc = iZbc; | |
| 350 | + aLpObj.push(oLp); | |
| 351 | + } | |
| 352 | + | |
| 353 | + return aLpObj; | |
| 354 | + }; | |
| 355 | + | |
| 356 | + var _funCalcuExportData_statInfoList = function(aInternalLpObj) { | |
| 357 | + var countBc = 0, // 总班次 | |
| 358 | + serviceBc = 0, // 营运班次 | |
| 359 | + jcbc = 0, // 进场总班次. | |
| 360 | + ccbc = 0, // 出场总班次. | |
| 361 | + cfbc = 0, // 吃饭总班次. | |
| 362 | + zwlbbc = 0, // 早晚例保总班次. | |
| 363 | + countGs = 0.0, // 总工时 | |
| 364 | + servicesj = 0, // 营运班次总时间 | |
| 365 | + jcsj = 0.0, // 进场总时间. | |
| 366 | + ccsj = 0.0, // 出场总时间. | |
| 367 | + cfsj = 0.0, // 吃饭总时间. | |
| 368 | + zwlbsj = 0.0, // 早晚例保总时间. | |
| 369 | + ksBc = 0, // 空驶班次 | |
| 370 | + serviceLc = 0.0, // 营运里程 | |
| 371 | + ksLc = 0.0, // 空驶里程 | |
| 372 | + avgTzjx = 0.0, // 平均停站间隙 | |
| 373 | + gfServiceBc = 0, // 高峰营运班次 | |
| 374 | + dgServiceBc = 0, // 低谷营运班次 | |
| 375 | + gfAvgTzjx = 0.0, // 高峰平均停站间隙 | |
| 376 | + dgAvgTzjx = 0.0; // 低谷平均停站间隙 | |
| 377 | + | |
| 378 | + var aAllBc = []; | |
| 379 | + var oLp; | |
| 380 | + var oBc; | |
| 381 | + var i; | |
| 382 | + var j; | |
| 383 | + | |
| 384 | + for (i = 0; i < aInternalLpObj.length; i++) { | |
| 385 | + oLp = aInternalLpObj[i]; | |
| 386 | + for (j = 0; j < oLp.getBcArray().length; j++) { | |
| 387 | + aAllBc.push(oLp.getBcArray()[j]); | |
| 388 | + } | |
| 389 | + for (j = 0; j < oLp.getOtherBcArray().length; j++) { | |
| 390 | + aAllBc.push(oLp.getOtherBcArray()[j]); | |
| 391 | + } | |
| 392 | + } | |
| 393 | + | |
| 394 | + for (i = 0; i < aAllBc.length; i++) { | |
| 395 | + oBc = aAllBc[i]; | |
| 396 | + | |
| 397 | + if (oBc.getBcTime() > 0) { | |
| 398 | + countBc = countBc + 1; | |
| 399 | + countGs = countGs + oBc.getStopTime() + oBc.getBcTime(); | |
| 400 | + if (_paramObj.isTroughBc(oBc.getFcTimeObj())) { | |
| 401 | + if (oBc._$_bcType == "normal") { | |
| 402 | + dgServiceBc = dgServiceBc + 1; | |
| 403 | + dgAvgTzjx = dgAvgTzjx + oBc.getStopTime(); | |
| 404 | + } | |
| 405 | + } else { | |
| 406 | + if (oBc._$_bcType == "normal") { | |
| 407 | + gfServiceBc = gfServiceBc + 1; | |
| 408 | + gfAvgTzjx = gfAvgTzjx + oBc.getStopTime(); | |
| 409 | + } | |
| 410 | + } | |
| 411 | + | |
| 412 | + if (oBc._$_bcType == "normal") { | |
| 413 | + serviceBc = serviceBc + 1; | |
| 414 | + serviceLc = serviceLc + oBc._$_bclc; | |
| 415 | + servicesj = servicesj + oBc.getBcTime(); | |
| 416 | + avgTzjx = avgTzjx + oBc.getStopTime(); | |
| 417 | + | |
| 418 | + if (oBc.fnGetEatTime() > 0) { | |
| 419 | + cfbc = cfbc + 1; | |
| 420 | + cfsj = cfsj + oBc.fnGetEatTime(); | |
| 421 | + } | |
| 422 | + } else if (oBc._$_bcType == "in") { | |
| 423 | + jcbc = jcbc + 1; | |
| 424 | + jcsj = jcsj + oBc.getBcTime(); | |
| 425 | + } else if (oBc._$_bcType == "out") { | |
| 426 | + ccbc = ccbc + 1; | |
| 427 | + ccsj = ccsj + oBc.getBcTime(); | |
| 428 | + } else if (oBc._$_bcType == "bd") { | |
| 429 | + zwlbbc = zwlbbc + 1; | |
| 430 | + zwlbsj = zwlbsj + oBc.getBcTime(); | |
| 431 | + } else if (oBc._$_bcType == "lc") { | |
| 432 | + zwlbbc = zwlbbc + 1; | |
| 433 | + zwlbsj = zwlbsj + oBc.getBcTime(); | |
| 434 | + } | |
| 435 | + } | |
| 436 | + } | |
| 437 | + | |
| 438 | + dgAvgTzjx = dgAvgTzjx / dgServiceBc; | |
| 439 | + gfAvgTzjx = gfAvgTzjx / gfServiceBc; | |
| 440 | + avgTzjx = avgTzjx / dgServiceBc; | |
| 441 | + | |
| 442 | + return [ | |
| 443 | + {'statItem': '总班次(包括进出场、吃饭时间、早晚例保、营运且班次时间大于零的班次)', 'statValue': countBc}, | |
| 444 | + {'statItem': '进场总班次(包括进场且班次时间大于零的班次)', 'statValue': jcbc}, | |
| 445 | + {'statItem': '出场总班次(包括进场且班次时间大于零的班次)', 'statValue': ccbc}, | |
| 446 | + {'statItem': '吃饭总班次(包括吃饭且班次时间大于零的班次)', 'statValue': cfbc}, | |
| 447 | + {'statItem': '早晚例保总班次(包括早晚例保且时间大于零的班次)', 'statValue': zwlbbc}, | |
| 448 | + {'statItem': '营运总班次(包括正常、区间、放大站且班次时间大于零班次)','statValue': serviceBc}, | |
| 449 | + {'statItem': '进场总时间(包括进场班次且班次时间大于零)', 'statValue': jcsj/60}, | |
| 450 | + {'statItem': '出场总时间(包括进场班次且班次时间大于零)', 'statValue': ccsj/60}, | |
| 451 | + {'statItem': '吃饭总时间(包括吃饭班次且班次时间大于零)', 'statValue': cfsj/60}, | |
| 452 | + {'statItem': '早晚例保总时间(包括早晚例保班次且时间大于零的)', 'statValue': zwlbsj/60}, | |
| 453 | + {'statItem': '营运班次总时间(包括正常、区间、放大站且班次时间大于零)', 'statValue': servicesj/60}, | |
| 454 | + {'statItem': '总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)', 'statValue': countGs/60}, | |
| 455 | + {'statItem': '空驶班次(包括直放班次)', 'statValue': ksBc}, | |
| 456 | + {'statItem': '营运里程(包括正常、区间、放大站里程)', 'statValue': serviceLc}, | |
| 457 | + {'statItem': '空驶里程(包括直放里程)', 'statValue': ksLc}, | |
| 458 | + {'statItem': '平均停站时间(营运班次停站时间总和/营运总班次)', 'statValue': avgTzjx}, | |
| 459 | + {'statItem': '高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)', 'statValue': gfServiceBc}, | |
| 460 | + {'statItem': '低谷营运班次(包括低谷时段的正常、区间、放大站班次)', 'statValue': dgServiceBc}, | |
| 461 | + {'statItem': '高峰平均停站间隙(高峰营运班次停站时间总和/高峰营运班次总和)', 'statValue': gfAvgTzjx}, | |
| 462 | + {'statItem': '低谷平均停站间隙(低谷营运班次停站时间总和/低谷营运班次总和)', 'statValue': dgAvgTzjx}, | |
| 463 | + {'statItem': '综合评估', 'statValue': 3} | |
| 464 | + ]; | |
| 465 | + | |
| 466 | + }; | |
| 467 | + | |
| 134 | 468 | return { |
| 135 | 469 | /** |
| 136 | 470 | * 工厂对象,创建不同的对象。 |
| ... | ... | @@ -196,12 +530,123 @@ var Main_v2 = function() { |
| 196 | 530 | schedule.fnCalcuOtherBc(); |
| 197 | 531 | |
| 198 | 532 | //-------------------- 输出ganut图上的班次,班型描述 ----------------------// |
| 199 | - var gBcData = schedule.fnToGanttBcArray(); | |
| 200 | 533 | // TODO:班型再议 |
| 201 | - return {'json':gBcData,'bxrcgs':null}; | |
| 534 | + return { | |
| 535 | + 'json':schedule.fnToGanttBcArray(),'bxrcgs':null, | |
| 536 | + 'aInternalLpObj': schedule.fnGetLpArray() | |
| 537 | + }; | |
| 538 | + | |
| 539 | + }, | |
| 540 | + /** | |
| 541 | + * 导出时刻表配置。 | |
| 542 | + * @param aInternalLpObj 内部路牌对象列表 | |
| 543 | + */ | |
| 544 | + exportDataConfig: function(aInternalLpObj) { | |
| 545 | + $('.exportAdd').on('click',function() { | |
| 546 | + var aInfos = { | |
| 547 | + "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表 | |
| 548 | + "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj) // 统计项目列表 | |
| 549 | + }; | |
| 550 | + | |
| 551 | + console.log(aInfos); | |
| 202 | 552 | |
| 553 | + $(".exportAdd").addClass("disabled"); | |
| 554 | + $(".exportAdd").html("<i class=\"fa fa-spinner\" aria-hidden=\"true\"></i>" + " 正在导出..."); | |
| 555 | + | |
| 556 | + // 提交 | |
| 557 | + $.ajax({ | |
| 558 | + type: 'POST', | |
| 559 | + url: "/tidc/exportDTDFile", | |
| 560 | + dataType: 'binary', | |
| 561 | + contentType: "application/json", | |
| 562 | + data: JSON.stringify(aInfos), | |
| 563 | + success: function(data){ | |
| 564 | + Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xls"); | |
| 565 | + | |
| 566 | + $(".exportAdd").removeClass("disabled"); | |
| 567 | + $(".exportAdd").html("<i class=\"fa fa-file-excel-o\"></i>" + " 导出数据"); | |
| 568 | + }, | |
| 569 | + error: function(xhr, type){ | |
| 570 | + alert('错误:TODO'); | |
| 571 | + | |
| 572 | + $(".exportAdd").removeClass("disabled"); | |
| 573 | + $(".exportAdd").html("<i class=\"fa fa-file-excel-o\"></i>" + " 导出数据"); | |
| 574 | + } | |
| 575 | + }); | |
| 576 | + | |
| 577 | + }); | |
| 578 | + }, | |
| 579 | + | |
| 580 | + downloadFile: function (data, mimeType, fileName) { | |
| 581 | + var success = false; | |
| 582 | + var blob = new Blob([data], { type: mimeType }); | |
| 583 | + try { | |
| 584 | + if (navigator.msSaveBlob) | |
| 585 | + navigator.msSaveBlob(blob, fileName); | |
| 586 | + else { | |
| 587 | + // Try using other saveBlob implementations, if available | |
| 588 | + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob; | |
| 589 | + if (saveBlob === undefined) throw "Not supported"; | |
| 590 | + saveBlob(blob, fileName); | |
| 591 | + } | |
| 592 | + success = true; | |
| 593 | + } catch (ex) { | |
| 594 | + console.log("saveBlob method failed with the following exception:"); | |
| 595 | + console.log(ex); | |
| 596 | + } | |
| 597 | + | |
| 598 | + if (!success) { | |
| 599 | + // Get the blob url creator | |
| 600 | + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL; | |
| 601 | + if (urlCreator) { | |
| 602 | + // Try to use a download link | |
| 603 | + var link = document.createElement('a'); | |
| 604 | + if ('download' in link) { | |
| 605 | + // Try to simulate a click | |
| 606 | + try { | |
| 607 | + // Prepare a blob URL | |
| 608 | + var url = urlCreator.createObjectURL(blob); | |
| 609 | + link.setAttribute('href', url); | |
| 610 | + | |
| 611 | + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+) | |
| 612 | + link.setAttribute("download", fileName); | |
| 613 | + | |
| 614 | + // Simulate clicking the download link | |
| 615 | + var event = document.createEvent('MouseEvents'); | |
| 616 | + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); | |
| 617 | + link.dispatchEvent(event); | |
| 618 | + success = true; | |
| 619 | + | |
| 620 | + } catch (ex) { | |
| 621 | + console.log("Download link method with simulated click failed with the following exception:"); | |
| 622 | + console.log(ex); | |
| 623 | + } | |
| 624 | + } | |
| 625 | + | |
| 626 | + if (!success) { | |
| 627 | + // Fallback to window.location method | |
| 628 | + try { | |
| 629 | + // Prepare a blob URL | |
| 630 | + // Use application/octet-stream when using window.location to force download | |
| 631 | + var url = urlCreator.createObjectURL(blob); | |
| 632 | + window.location = url; | |
| 633 | + console.log("Download link method with window.location succeeded"); | |
| 634 | + success = true; | |
| 635 | + } catch (ex) { | |
| 636 | + console.log("Download link method with window.location failed with the following exception:"); | |
| 637 | + console.log(ex); | |
| 638 | + } | |
| 639 | + } | |
| 640 | + } | |
| 641 | + } | |
| 642 | + | |
| 643 | + if (!success) { | |
| 644 | + // Fallback to window.open method | |
| 645 | + console.log("No methods worked for saving the arraybuffer, using last resort window.open"); | |
| 646 | + window.open("", '_blank', ''); | |
| 647 | + } | |
| 203 | 648 | } |
| 204 | 649 | |
| 205 | 650 | }; |
| 206 | 651 | |
| 207 | -}(); | |
| 208 | 652 | \ No newline at end of file |
| 653 | +}(); | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/main.js
| ... | ... | @@ -343,4 +343,48 @@ ScheduleApp.controller('ScheduleAppController', [ |
| 343 | 343 | DataStore.getData("cl"); |
| 344 | 344 | DataStore.getData("ry"); |
| 345 | 345 | } |
| 346 | -]); | |
| 347 | 346 | \ No newline at end of file |
| 347 | +]); | |
| 348 | + | |
| 349 | +// JQuery插件,使$ajax支持resposetype=arraybuffer,二进制输出,html5的特性 | |
| 350 | +// use this transport for "binary" data type | |
| 351 | +$.ajaxTransport("+binary", function(options, originalOptions, jqXHR){ | |
| 352 | + // check for conditions and support for blob / arraybuffer response type | |
| 353 | + if (window.FormData && ((options.dataType && (options.dataType == 'binary')) || (options.data && ((window.ArrayBuffer && options.data instanceof ArrayBuffer) || (window.Blob && options.data instanceof Blob))))) | |
| 354 | + { | |
| 355 | + return { | |
| 356 | + // create new XMLHttpRequest | |
| 357 | + send: function(headers, callback){ | |
| 358 | + // setup all variables | |
| 359 | + var xhr = new XMLHttpRequest(), | |
| 360 | + url = options.url, | |
| 361 | + type = options.type, | |
| 362 | + async = options.async || true, | |
| 363 | + // blob or arraybuffer. Default is blob | |
| 364 | + dataType = options.responseType || "blob", | |
| 365 | + data = options.data || null, | |
| 366 | + username = options.username || null, | |
| 367 | + password = options.password || null; | |
| 368 | + | |
| 369 | + xhr.addEventListener('load', function(){ | |
| 370 | + var data = {}; | |
| 371 | + data[options.dataType] = xhr.response; | |
| 372 | + // make callback and send data | |
| 373 | + callback(xhr.status, xhr.statusText, data, xhr.getAllResponseHeaders()); | |
| 374 | + }); | |
| 375 | + | |
| 376 | + xhr.open(type, url, async, username, password); | |
| 377 | + | |
| 378 | + // setup custom headers | |
| 379 | + for (var i in headers ) { | |
| 380 | + xhr.setRequestHeader(i, headers[i] ); | |
| 381 | + } | |
| 382 | + | |
| 383 | + xhr.responseType = dataType; | |
| 384 | + xhr.send(data); | |
| 385 | + }, | |
| 386 | + abort: function(){ | |
| 387 | + jqXHR.abort(); | |
| 388 | + } | |
| 389 | + }; | |
| 390 | + } | |
| 391 | +}); | |
| 348 | 392 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch/h_add_sub_task_other.html
| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | <script id="sub-task-other-form-temp" type="text/html"> |
| 11 | 11 | <input type="hidden" value="{{sch.id}}" name="schedule.id"> |
| 12 | 12 | <div class="uk-grid"> |
| 13 | - <div class="uk-width-1-1"> | |
| 13 | + <div class="uk-width-1-2"> | |
| 14 | 14 | <div class="uk-form-row"> |
| 15 | 15 | <label class="uk-form-label">班次类型</label> |
| 16 | 16 | <div class="uk-form-controls"> |
| ... | ... | @@ -23,6 +23,22 @@ |
| 23 | 23 | </div> |
| 24 | 24 | </div> |
| 25 | 25 | </div> |
| 26 | + | |
| 27 | + <div class="uk-width-1-2 inout_reason_wrap" style="display: none"> | |
| 28 | + <div class="uk-form-row"> | |
| 29 | + <label class="uk-form-label">进出场原因</label> | |
| 30 | + <div class="uk-form-controls"> | |
| 31 | + <select class="form-control" name="reason" required> | |
| 32 | + <option value="">请选择..</option> | |
| 33 | + <option>故障</option> | |
| 34 | + <option>肇事</option> | |
| 35 | + <option>纠纷</option> | |
| 36 | + <option>其他</option> | |
| 37 | + </select> | |
| 38 | + </div> | |
| 39 | + </div> | |
| 40 | + </div> | |
| 41 | + | |
| 26 | 42 | </div> |
| 27 | 43 | <div class="uk-grid"> |
| 28 | 44 | <div class="uk-width-1-2"> |
| ... | ... | @@ -167,6 +183,7 @@ |
| 167 | 183 | |
| 168 | 184 | //班次类型 |
| 169 | 185 | $('[name=type2]', f).on('change', function () { |
| 186 | + $('.inout_reason_wrap').hide(); | |
| 170 | 187 | var routes = stationRoutes[sch.xlDir] |
| 171 | 188 | , lastCode = routes[routes.length - 1].stationCode |
| 172 | 189 | , opts = '', park_opts = ''; |
| ... | ... | @@ -184,11 +201,15 @@ |
| 184 | 201 | qdz.html(park_opts).val(information.carPark); |
| 185 | 202 | zdz.html(opts); |
| 186 | 203 | mType.val('empty'); |
| 204 | + //进出场原因 | |
| 205 | + $('.inout_reason_wrap').show(); | |
| 187 | 206 | break; |
| 188 | 207 | case '2'://进场 |
| 189 | 208 | qdz.html(opts); |
| 190 | 209 | zdz.html(park_opts).val(information.carPark); |
| 191 | 210 | mType.val('empty'); |
| 211 | + //进出场原因 | |
| 212 | + $('.inout_reason_wrap').show(); | |
| 192 | 213 | break; |
| 193 | 214 | default: |
| 194 | 215 | qdz.html(opts); | ... | ... |