Commit 8f6b2e0f302cba09e3a9488d62d7e0f51858ad43

Authored by 潘钊
2 parents 96edad4d d60fa05e

Merge branch 'minhang' into pudong

Showing 63 changed files with 4902 additions and 1585 deletions
src/main/java/com/bsth/controller/LineVersionsController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.Date;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import com.alibaba.fastjson.JSON;
  16 +import com.alibaba.fastjson.JSONObject;
  17 +import com.alibaba.fastjson.TypeReference;
  18 +import com.bsth.data.LineVersionsData;
  19 +import com.bsth.entity.Line;
  20 +import com.bsth.entity.LineVersions;
  21 +import com.bsth.entity.LsStationRoute;
  22 +import com.bsth.entity.StationRoute;
  23 +import com.bsth.repository.LineRepository;
  24 +import com.bsth.repository.LsStationRouteRepository;
  25 +import com.bsth.service.LineVersionsService;
  26 +
  27 +/**
  28 + *
  29 + * @ClassName: LineController(线路版本控制器)
  30 + *
  31 + * @Extends : BaseController
  32 + *
  33 + * @Description: TODO(线路版本版控制层)
  34 + *
  35 + * @Author bsth@lq
  36 + *
  37 + * @Version 公交调度系统BS版 0.1
  38 + *
  39 + */
  40 +@RestController
  41 +@RequestMapping("lineVersions")
  42 +public class LineVersionsController extends BaseController<LineVersions, Integer> {
  43 +
  44 + @Autowired
  45 + private LineVersionsService service;
  46 +
  47 + @Autowired
  48 + LineRepository lineRepository;
  49 + @Autowired
  50 + LsStationRouteRepository lsStationRouteRepository ;
  51 + /**
  52 + * 获取线路所有版本
  53 + *
  54 + */
  55 + @RequestMapping(value = "findByLineId", method = RequestMethod.GET)
  56 + public List<LineVersions> getLineCode(@RequestParam(defaultValue = "lineId") int lineId) {
  57 + return service.findByLineCode(lineId);
  58 + }
  59 +
  60 + /**
  61 + * 根据id查询线路版本信息
  62 + *
  63 + */
  64 + @RequestMapping(value = "findById", method = RequestMethod.GET)
  65 + public LineVersions findOne(@RequestParam(defaultValue = "id") int id) {
  66 + service.lineUpdate();
  67 + return service.findById(id);
  68 + }
  69 +
  70 + /**
  71 + * 根据id修改线路版本信息
  72 + *
  73 + */
  74 + @RequestMapping(value = "update", method = RequestMethod.POST)
  75 + public Map<String, Object> update(@RequestParam Map<String, Object> map) {
  76 + return service.update(map);
  77 + }
  78 +
  79 + @RequestMapping(value = "add", method = RequestMethod.POST)
  80 + public Map<String, Object> add(@RequestParam Map<String, Object> map) {
  81 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  82 +
  83 + LineVersions lineVersions = new LineVersions();
  84 + try {
  85 + Date startDate = simpleDateFormat.parse(map.get("startDate").toString());
  86 + Date endDate = simpleDateFormat.parse(map.get("endDate").toString());
  87 + Line line = lineRepository.findOne(Integer.valueOf(map.get("lineId").toString()));
  88 + lineVersions.setLine(line);
  89 + lineVersions.setLineCode(map.get("lineCode").toString());
  90 + lineVersions.setStartDate(new java.sql.Date(startDate.getTime()));
  91 + lineVersions.setEndDate(new java.sql.Date(endDate.getTime()));
  92 + lineVersions.setVersions(Integer.valueOf(map.get("versions").toString()));
  93 + lineVersions.setStatus(Integer.valueOf(map.get("status").toString()));
  94 + lineVersions.setRemark(map.get("remark").toString());
  95 + } catch (ParseException e) {
  96 + // TODO Auto-generated catch block
  97 + e.printStackTrace();
  98 + }
  99 + return service.save(lineVersions);
  100 + }
  101 +
  102 +}
src/main/java/com/bsth/controller/SectionController.java
@@ -74,6 +74,24 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; { @@ -74,6 +74,24 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; {
74 } 74 }
75 75
76 /** 76 /**
  77 + * @Description :TODO(编辑线路走向保存到线路历史表)
  78 + *
  79 + * @param map <sectionId:路段ID; sectionJSON:路段信息>
  80 + *
  81 + * @return Map<String, Object> <SUCCESS ; ERROR>
  82 + */
  83 + @RequestMapping(value="sectionCutSaveLineLS" , method = RequestMethod.POST)
  84 + public Map<String, Object> sectionCutSaveLineLS(@RequestParam Map<String, Object> map) {
  85 +
  86 + map.put("updateBy", "");
  87 +
  88 + map.put("createBy", "");
  89 +
  90 + return service.sectionCutSaveLineLS(map);
  91 +
  92 + }
  93 +
  94 + /**
77 * @Description :TODO(编辑线路走向) 95 * @Description :TODO(编辑线路走向)
78 * 96 *
79 * @param map <sectionId:路段ID; sectionJSON:路段信息> 97 * @param map <sectionId:路段ID; sectionJSON:路段信息>
src/main/java/com/bsth/data/LineVersionsData.java 0 → 100644
  1 +package com.bsth.data;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.List;
  5 +import java.util.Map;
  6 +
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.boot.CommandLineRunner;
  11 +import org.springframework.core.annotation.Order;
  12 +import org.springframework.stereotype.Component;
  13 +
  14 +import com.bsth.entity.LineVersions;
  15 +import com.bsth.service.LineVersionsService;
  16 +import com.bsth.service.StationRouteService;
  17 +
  18 +/**
  19 + * @ClassName: LineVersionsData
  20 + * @Description: TODO(线路版本数据管理)
  21 + */
  22 +@Component
  23 +@Order(20)
  24 +public class LineVersionsData implements CommandLineRunner {
  25 +
  26 + static Logger logger = LoggerFactory.getLogger(LineVersionsData.class);
  27 +
  28 +
  29 + @Autowired
  30 + LineVersionsService lineVersionsService;
  31 +
  32 + @Autowired
  33 + StationRouteService stationRouteService;
  34 +
  35 + @Override
  36 + public void run(String... arg0) throws Exception {
  37 +
  38 +
  39 + try {
  40 + List<LineVersions> list = lineVersionsService.lineUpdate();
  41 + for (LineVersions lineVersions : list) {
  42 + Integer lineId = lineVersions.getLine().getId();
  43 + // 更新线路文件
  44 + Map<String, Object> map = new HashMap<>();
  45 + map.put("lineId", lineId);
  46 + stationRouteService.usingSingle(map);
  47 + }
  48 + } catch (Exception e) {
  49 + // TODO Auto-generated catch block
  50 + e.printStackTrace();
  51 + }
  52 + }
  53 +}
src/main/java/com/bsth/data/utils/ListFilterUtils.java
1 -package com.bsth.data.utils;  
2 -  
3 -import org.apache.commons.lang3.StringUtils;  
4 -import org.slf4j.Logger;  
5 -import org.slf4j.LoggerFactory;  
6 -  
7 -import java.lang.reflect.Field;  
8 -import java.util.ArrayList;  
9 -import java.util.Collection;  
10 -import java.util.List;  
11 -import java.util.Map;  
12 -  
13 -/**  
14 - * 集合搜索过滤  
15 - * Created by panzhao on 2017/8/2.  
16 - */  
17 -public class ListFilterUtils {  
18 -  
19 - static Logger logger = LoggerFactory.getLogger(ListFilterUtils.class);  
20 -  
21 - public static List filter(Collection all, Map<String, Object> map, Class clazz) {  
22 - List rs = new ArrayList();  
23 - Field[] fields = clazz.getDeclaredFields();  
24 -  
25 - //参与过滤的字段  
26 - List<Field> fs = new ArrayList<>();  
27 - for (Field f : fields) {  
28 - f.setAccessible(true);  
29 - if (map.containsKey(f.getName()))  
30 - fs.add(f);  
31 - }  
32 -  
33 - //过滤数据  
34 - for (Object obj : all) {  
35 - if (fieldEquals(fs, obj, map))  
36 - rs.add(obj);  
37 - }  
38 - return rs;  
39 - }  
40 -  
41 - public static boolean fieldEquals(List<Field> fs, Object obj, Map<String, Object> map) {  
42 - try {  
43 - for (Field f : fs) {  
44 - if (StringUtils.isEmpty(map.get(f.getName()).toString()))  
45 - continue;  
46 -  
47 - if (f.get(obj) == null || f.get(obj).toString().indexOf(map.get(f.getName()).toString()) == -1)  
48 - return false;  
49 - }  
50 - } catch (Exception e) {  
51 - logger.error("", e);  
52 - return false;  
53 - }  
54 - return true;  
55 - }  
56 -} 1 +package com.bsth.data.utils;
  2 +
  3 +import org.apache.commons.lang3.StringUtils;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
  6 +
  7 +import java.lang.reflect.Field;
  8 +import java.util.ArrayList;
  9 +import java.util.Collection;
  10 +import java.util.List;
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * 集合搜索过滤
  15 + * Created by panzhao on 2017/8/2.
  16 + */
  17 +public class ListFilterUtils {
  18 +
  19 + static Logger logger = LoggerFactory.getLogger(ListFilterUtils.class);
  20 +
  21 + public static List filter(Collection all, Map<String, Object> map, Class clazz) {
  22 + List rs = new ArrayList();
  23 + Field[] fields = clazz.getDeclaredFields();
  24 +
  25 + //参与过滤的字段
  26 + List<Field> fs = new ArrayList<>();
  27 + for (Field f : fields) {
  28 + f.setAccessible(true);
  29 + if (map.containsKey(f.getName()))
  30 + fs.add(f);
  31 + }
  32 +
  33 + //过滤数据
  34 + for (Object obj : all) {
  35 + if (fieldEquals(fs, obj, map))
  36 + rs.add(obj);
  37 + }
  38 + return rs;
  39 + }
  40 +
  41 + public static boolean fieldEquals(List<Field> fs, Object obj, Map<String, Object> map) {
  42 + try {
  43 + for (Field f : fs) {
  44 + if (StringUtils.isEmpty(map.get(f.getName()).toString()))
  45 + continue;
  46 +
  47 + if (f.get(obj) == null || f.get(obj).toString().indexOf(map.get(f.getName()).toString()) == -1)
  48 + return false;
  49 + }
  50 + } catch (Exception e) {
  51 + logger.error("", e);
  52 + return false;
  53 + }
  54 + return true;
  55 + }
  56 +}
src/main/java/com/bsth/data/utils/ListPageQueryUtils.java
1 -package com.bsth.data.utils;  
2 -  
3 -import java.util.ArrayList;  
4 -import java.util.List;  
5 -  
6 -/**  
7 - * 集合分页工具  
8 - * Created by panzhao on 2017/8/2.  
9 - */  
10 -public class ListPageQueryUtils {  
11 -  
12 - public static List paging(List all, int page, int pageSize) {  
13 - List rs = new ArrayList(pageSize);  
14 -  
15 - int s = page * pageSize;  
16 - int e = (page + 1) * pageSize;  
17 -  
18 - int size = all.size();  
19 -  
20 - if (e > size)  
21 - e = size;  
22 -  
23 - if (s > size)  
24 - return rs;  
25 -  
26 - for (; s < e; s++) {  
27 - rs.add(all.get(s));  
28 - }  
29 - return rs;  
30 - }  
31 -} 1 +package com.bsth.data.utils;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +/**
  7 + * 集合分页工具
  8 + * Created by panzhao on 2017/8/2.
  9 + */
  10 +public class ListPageQueryUtils {
  11 +
  12 + public static List paging(List all, int page, int pageSize) {
  13 + List rs = new ArrayList(pageSize);
  14 +
  15 + int s = page * pageSize;
  16 + int e = (page + 1) * pageSize;
  17 +
  18 + int size = all.size();
  19 +
  20 + if (e > size)
  21 + e = size;
  22 +
  23 + if (s > size)
  24 + return rs;
  25 +
  26 + for (; s < e; s++) {
  27 + rs.add(all.get(s));
  28 + }
  29 + return rs;
  30 + }
  31 +}
src/main/java/com/bsth/entity/LineVersions.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Column;
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.GeneratedValue;
  8 +import javax.persistence.GenerationType;
  9 +import javax.persistence.Id;
  10 +import javax.persistence.ManyToOne;
  11 +import javax.persistence.Table;
  12 +
  13 +
  14 +/**
  15 + *
  16 + * @ClassName: LineVersions(线路版本实体类)
  17 + *
  18 + * @Description: TODO(线路版本)
  19 + *
  20 + * @Author bsth@lq
  21 + *
  22 + * @Version 公交调度系统BS版 0.1
  23 + *
  24 + */
  25 +
  26 +@Entity
  27 +@Table(name = "bsth_c_line_versions")
  28 +public class LineVersions{
  29 +
  30 + @Id
  31 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  32 + /** ID 主键(唯一标识符) int length(11) */
  33 + private Integer id;
  34 +
  35 + /** 线路ID int length(11) */
  36 + @ManyToOne
  37 + private Line line;
  38 +
  39 + /** 线路编码 varchar length(50) */
  40 + private String lineCode;
  41 +
  42 + /** 版本号 int length(11) */
  43 + private int versions;
  44 +
  45 + /** 启用日期 timestamp */
  46 + private Date startDate;
  47 +
  48 + /** 终止日期 timestamp */
  49 + private Date endDate;
  50 +
  51 + /** 创建日期 timestamp */
  52 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  53 + private Date createDate;
  54 +
  55 + /** 修改日期 timestamp */
  56 + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  57 + private Date updateDate;
  58 +
  59 + /** 备注 varchar length(50) */
  60 + private String remark;
  61 +
  62 + /** 版本状态 int length(11)
  63 + * 0(历史版本),1(当前版本),2(待更新版本)
  64 + */
  65 + private int status;
  66 +
  67 + public Integer getId() {
  68 + return id;
  69 + }
  70 +
  71 + public void setId(Integer id) {
  72 + this.id = id;
  73 + }
  74 +
  75 + public Line getLine() {
  76 + return line;
  77 + }
  78 +
  79 + public void setLine(Line line) {
  80 + this.line = line;
  81 + }
  82 +
  83 + public String getLineCode() {
  84 + return lineCode;
  85 + }
  86 +
  87 + public void setLineCode(String lineCode) {
  88 + this.lineCode = lineCode;
  89 + }
  90 +
  91 + public int getVersions() {
  92 + return versions;
  93 + }
  94 +
  95 + public void setVersions(int versions) {
  96 + this.versions = versions;
  97 + }
  98 +
  99 + public Date getStartDate() {
  100 + return startDate;
  101 + }
  102 +
  103 + public void setStartDate(Date startDate) {
  104 + this.startDate = startDate;
  105 + }
  106 +
  107 + public Date getEndDate() {
  108 + return endDate;
  109 + }
  110 +
  111 + public void setEndDate(Date endDate) {
  112 + this.endDate = endDate;
  113 + }
  114 +
  115 + public Date getCreateDate() {
  116 + return createDate;
  117 + }
  118 +
  119 + public void setCreateDate(Date createDate) {
  120 + this.createDate = createDate;
  121 + }
  122 +
  123 + public Date getUpdateDate() {
  124 + return updateDate;
  125 + }
  126 +
  127 + public void setUpdateDate(Date updateDate) {
  128 + this.updateDate = updateDate;
  129 + }
  130 +
  131 + public String getRemark() {
  132 + return remark;
  133 + }
  134 +
  135 + public void setRemark(String remark) {
  136 + this.remark = remark;
  137 + }
  138 +
  139 + public int getStatus() {
  140 + return status;
  141 + }
  142 +
  143 + public void setStatus(int status) {
  144 + this.status = status;
  145 + }
  146 +
  147 +}
0 \ No newline at end of file 148 \ No newline at end of file
src/main/java/com/bsth/entity/LsSectionRoute.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Column;
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.GeneratedValue;
  8 +import javax.persistence.GenerationType;
  9 +import javax.persistence.Id;
  10 +import javax.persistence.ManyToOne;
  11 +import javax.persistence.OneToOne;
  12 +import javax.persistence.Table;
  13 +
  14 +
  15 +/**
  16 + *
  17 + * @ClassName : SectionRoute(历史路段路由实体类)
  18 + *
  19 + * @Author : bsth@lq
  20 + *
  21 + * @Description : TODO(历史路段路由)
  22 + *
  23 + * @Version 公交调度系统BS版 0.1
  24 + *
  25 + */
  26 +
  27 +@Entity
  28 +@Table(name = "bsth_c_ls_sectionroute")
  29 +public class LsSectionRoute {
  30 +
  31 + @Id
  32 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  33 + private Integer id;
  34 +
  35 + // 路段路由序号
  36 + private Integer sectionrouteCode;
  37 +
  38 + // 线路编号
  39 + private String lineCode;
  40 +
  41 + // 路段编号
  42 + private String sectionCode;
  43 +
  44 + // 路段路由方向
  45 + private Integer directions;
  46 +
  47 + // 版本号
  48 + private Integer versions;
  49 +
  50 + // 是否撤销
  51 + private Integer destroy;
  52 +
  53 + /** 是否有路段限速数据 <0:分段;1:未分段>*/
  54 + private Integer isRoadeSpeed;
  55 +
  56 + // 描述
  57 + private String descriptions;
  58 +
  59 + // 创建人
  60 + private Integer createBy;
  61 +
  62 + // 修改人
  63 + private Integer updateBy;
  64 +
  65 + // 创建日期
  66 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  67 + private Date createDate;
  68 +
  69 + // 修改日期
  70 + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  71 + private Date updateDate;
  72 +
  73 + // 路段信息
  74 + @OneToOne
  75 + private Section section;
  76 +
  77 + // 线路信息
  78 + @ManyToOne
  79 + private Line line;
  80 +
  81 + public Integer getIsRoadeSpeed() {
  82 + return isRoadeSpeed;
  83 + }
  84 +
  85 + public void setIsRoadeSpeed(Integer isRoadeSpeed) {
  86 + this.isRoadeSpeed = isRoadeSpeed;
  87 + }
  88 +
  89 + public Integer getId() {
  90 + return id;
  91 + }
  92 +
  93 + public void setId(Integer id) {
  94 + this.id = id;
  95 + }
  96 +
  97 + public Integer getSectionrouteCode() {
  98 + return sectionrouteCode;
  99 + }
  100 +
  101 + public void setSectionrouteCode(Integer sectionrouteCode) {
  102 + this.sectionrouteCode = sectionrouteCode;
  103 + }
  104 +
  105 + public String getLineCode() {
  106 + return lineCode;
  107 + }
  108 +
  109 + public void setLineCode(String lineCode) {
  110 + this.lineCode = lineCode;
  111 + }
  112 +
  113 + public String getSectionCode() {
  114 + return sectionCode;
  115 + }
  116 +
  117 + public void setSectionCode(String sectionCode) {
  118 + this.sectionCode = sectionCode;
  119 + }
  120 +
  121 + public Integer getDirections() {
  122 + return directions;
  123 + }
  124 +
  125 + public void setDirections(Integer directions) {
  126 + this.directions = directions;
  127 + }
  128 +
  129 + public Integer getVersions() {
  130 + return versions;
  131 + }
  132 +
  133 + public void setVersions(Integer versions) {
  134 + this.versions = versions;
  135 + }
  136 +
  137 + public Integer getDestroy() {
  138 + return destroy;
  139 + }
  140 +
  141 + public void setDestroy(Integer destroy) {
  142 + this.destroy = destroy;
  143 + }
  144 +
  145 + public String getDescriptions() {
  146 + return descriptions;
  147 + }
  148 +
  149 + public void setDescriptions(String descriptions) {
  150 + this.descriptions = descriptions;
  151 + }
  152 +
  153 + public Integer getCreateBy() {
  154 + return createBy;
  155 + }
  156 +
  157 + public void setCreateBy(Integer createBy) {
  158 + this.createBy = createBy;
  159 + }
  160 +
  161 + public Integer getUpdateBy() {
  162 + return updateBy;
  163 + }
  164 +
  165 + public void setUpdateBy(Integer updateBy) {
  166 + this.updateBy = updateBy;
  167 + }
  168 +
  169 + public Date getCreateDate() {
  170 + return createDate;
  171 + }
  172 +
  173 + public void setCreateDate(Date createDate) {
  174 + this.createDate = createDate;
  175 + }
  176 +
  177 + public Date getUpdateDate() {
  178 + return updateDate;
  179 + }
  180 +
  181 + public void setUpdateDate(Date updateDate) {
  182 + this.updateDate = updateDate;
  183 + }
  184 +
  185 + public Section getSection() {
  186 + return section;
  187 + }
  188 +
  189 + public void setSection(Section section) {
  190 + this.section = section;
  191 + }
  192 +
  193 + public Line getLine() {
  194 + return line;
  195 + }
  196 +
  197 + public void setLine(Line line) {
  198 + this.line = line;
  199 + }
  200 +}
src/main/java/com/bsth/entity/LsStationRoute.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import javax.persistence.*;
  4 +import java.util.Date;
  5 +
  6 +/**
  7 + *
  8 + * @ClassName : StationRoute(历史站点路由实体类)
  9 + *
  10 + * @Author : bsth@lq
  11 + *
  12 + * @Description : TODO(历史站点路由)
  13 + *
  14 + * @Version 公交调度系统BS版 0.1
  15 + *
  16 + */
  17 +
  18 +@Entity
  19 +@Table(name = "bsth_c_ls_stationroute")
  20 +@NamedEntityGraphs({
  21 + @NamedEntityGraph(name = "ls_stationRoute_station", attributeNodes = {
  22 + @NamedAttributeNode("station"),
  23 + @NamedAttributeNode("line")
  24 + })
  25 +})
  26 +public class LsStationRoute {
  27 +
  28 + //站点路由ID
  29 + @Id
  30 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  31 + private Integer id;
  32 +
  33 + // 站点路由序号
  34 + private Integer stationRouteCode;
  35 +
  36 + // 站点编码
  37 + private String stationCode;
  38 +
  39 + // 站点名称
  40 + private String stationName;
  41 +
  42 + // 线路编码
  43 + private String lineCode;
  44 +
  45 + /**
  46 + * 站点类型
  47 + *
  48 + * ------ B:起点站
  49 + *
  50 + * ------ Z:中途站
  51 + *
  52 + * ------ E:终点站
  53 + *
  54 + * ------ T:停车场
  55 + *
  56 + */
  57 + private String stationMark;
  58 +
  59 + // 站点路由出站序号
  60 + private Integer outStationNmber;
  61 +
  62 + // 站点路由到站距离
  63 + private Double distances;
  64 +
  65 + // 站点路由到站时间
  66 + private Double toTime;
  67 +
  68 + // 首班时间
  69 + private String firstTime;
  70 +
  71 + // 末班时间
  72 + private String endTime;
  73 +
  74 + // 站点路由方向
  75 + private Integer directions;
  76 +
  77 + // 版本号
  78 + private Integer versions;
  79 +
  80 + // 是否撤销
  81 + private Integer destroy;
  82 +
  83 + // 描述
  84 + private String descriptions;
  85 +
  86 + // 创建人
  87 + private Integer createBy;
  88 +
  89 + // 修改人
  90 + private Integer updateBy;
  91 +
  92 + // 创建日期
  93 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  94 + private Date createDate;
  95 +
  96 + // 修改日期
  97 + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  98 + private Date updateDate;
  99 +
  100 + // 站点信息
  101 + @ManyToOne(fetch = FetchType.LAZY)
  102 + private Station station;
  103 +
  104 + // 线路信息
  105 + @ManyToOne
  106 + private Line line;
  107 +
  108 + public Integer getId() {
  109 + return id;
  110 + }
  111 +
  112 + public void setId(Integer id) {
  113 + this.id = id;
  114 + }
  115 +
  116 + public Integer getStationRouteCode() {
  117 + return stationRouteCode;
  118 + }
  119 +
  120 + public void setStationRouteCode(Integer stationRouteCode) {
  121 + this.stationRouteCode = stationRouteCode;
  122 + }
  123 +
  124 + public String getStationCode() {
  125 + return stationCode;
  126 + }
  127 +
  128 + public void setStationCode(String stationCode) {
  129 + this.stationCode = stationCode;
  130 + }
  131 +
  132 + public String getStationName() {
  133 + return stationName;
  134 + }
  135 +
  136 + public void setStationName(String stationName) {
  137 + this.stationName = stationName;
  138 + }
  139 +
  140 + public String getLineCode() {
  141 + return lineCode;
  142 + }
  143 +
  144 + public void setLineCode(String lineCode) {
  145 + this.lineCode = lineCode;
  146 + }
  147 +
  148 + public String getStationMark() {
  149 + return stationMark;
  150 + }
  151 +
  152 + public void setStationMark(String stationMark) {
  153 + this.stationMark = stationMark;
  154 + }
  155 +
  156 + public Integer getOutStationNmber() {
  157 + return outStationNmber;
  158 + }
  159 +
  160 + public void setOutStationNmber(Integer outStationNmber) {
  161 + this.outStationNmber = outStationNmber;
  162 + }
  163 +
  164 + public Double getDistances() {
  165 + return distances;
  166 + }
  167 +
  168 + public void setDistances(Double distances) {
  169 + this.distances = distances;
  170 + }
  171 +
  172 + public Double getToTime() {
  173 + return toTime;
  174 + }
  175 +
  176 + public void setToTime(Double toTime) {
  177 + this.toTime = toTime;
  178 + }
  179 +
  180 + public String getFirstTime() {
  181 + return firstTime;
  182 + }
  183 +
  184 + public void setFirstTime(String firstTime) {
  185 + this.firstTime = firstTime;
  186 + }
  187 +
  188 + public String getEndTime() {
  189 + return endTime;
  190 + }
  191 +
  192 + public void setEndTime(String endTime) {
  193 + this.endTime = endTime;
  194 + }
  195 +
  196 + public Integer getDirections() {
  197 + return directions;
  198 + }
  199 +
  200 + public void setDirections(Integer directions) {
  201 + this.directions = directions;
  202 + }
  203 +
  204 + public Integer getVersions() {
  205 + return versions;
  206 + }
  207 +
  208 + public void setVersions(Integer versions) {
  209 + this.versions = versions;
  210 + }
  211 +
  212 + public Integer getDestroy() {
  213 + return destroy;
  214 + }
  215 +
  216 + public void setDestroy(Integer destroy) {
  217 + this.destroy = destroy;
  218 + }
  219 +
  220 + public String getDescriptions() {
  221 + return descriptions;
  222 + }
  223 +
  224 + public void setDescriptions(String descriptions) {
  225 + this.descriptions = descriptions;
  226 + }
  227 +
  228 + public Integer getCreateBy() {
  229 + return createBy;
  230 + }
  231 +
  232 + public void setCreateBy(Integer createBy) {
  233 + this.createBy = createBy;
  234 + }
  235 +
  236 + public Integer getUpdateBy() {
  237 + return updateBy;
  238 + }
  239 +
  240 + public void setUpdateBy(Integer updateBy) {
  241 + this.updateBy = updateBy;
  242 + }
  243 +
  244 + public Date getCreateDate() {
  245 + return createDate;
  246 + }
  247 +
  248 + public void setCreateDate(Date createDate) {
  249 + this.createDate = createDate;
  250 + }
  251 +
  252 + public Date getUpdateDate() {
  253 + return updateDate;
  254 + }
  255 +
  256 + public void setUpdateDate(Date updateDate) {
  257 + this.updateDate = updateDate;
  258 + }
  259 +
  260 + public Station getStation() {
  261 + return station;
  262 + }
  263 +
  264 + public void setStation(Station station) {
  265 + this.station = station;
  266 + }
  267 +
  268 + public Line getLine() {
  269 + return line;
  270 + }
  271 +
  272 + public void setLine(Line line) {
  273 + this.line = line;
  274 + }
  275 +}
0 \ No newline at end of file 276 \ No newline at end of file
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
@@ -4,7 +4,6 @@ import com.bsth.entity.Line; @@ -4,7 +4,6 @@ import com.bsth.entity.Line;
4 import com.bsth.service.schedule.rules.rerun.RerunRule_input; 4 import com.bsth.service.schedule.rules.rerun.RerunRule_input;
5 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; 5 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
6 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; 6 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
7 -import org.apache.commons.lang3.StringUtils;  
8 7
9 import javax.persistence.*; 8 import javax.persistence.*;
10 import java.sql.PreparedStatement; 9 import java.sql.PreparedStatement;
@@ -181,28 +180,28 @@ public class SchedulePlanInfo extends BEntity { @@ -181,28 +180,28 @@ public class SchedulePlanInfo extends BEntity {
181 } 180 }
182 181
183 this.j = employeeConfigInfo.getJsy().getId(); 182 this.j = employeeConfigInfo.getJsy().getId();
184 -// this.jGh = employeeConfigInfo.getJsy().getJobCode();  
185 - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {  
186 - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");  
187 - if (jsy_temp.length > 1) {  
188 - this.jGh = jsy_temp[1];  
189 - } else {  
190 - this.jGh = jsy_temp[0];  
191 - }  
192 - } 183 + this.jGh = employeeConfigInfo.getJsy().getJobCodeori();
  184 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {
  185 +// String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");
  186 +// if (jsy_temp.length > 1) {
  187 +// this.jGh = jsy_temp[1];
  188 +// } else {
  189 +// this.jGh = jsy_temp[0];
  190 +// }
  191 +// }
193 this.jName = employeeConfigInfo.getJsy().getPersonnelName(); 192 this.jName = employeeConfigInfo.getJsy().getPersonnelName();
194 // 关联的售票员 193 // 关联的售票员
195 if (employeeConfigInfo.getSpy() != null) { 194 if (employeeConfigInfo.getSpy() != null) {
196 this.s = employeeConfigInfo.getSpy().getId(); 195 this.s = employeeConfigInfo.getSpy().getId();
197 -// this.sGh = employeeConfigInfo.getSpy().getJobCode();  
198 - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {  
199 - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");  
200 - if (spy_temp.length > 1) {  
201 - this.sGh = spy_temp[1];  
202 - } else {  
203 - this.sGh = spy_temp[0];  
204 - }  
205 - } 196 + this.sGh = employeeConfigInfo.getSpy().getJobCodeori();
  197 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {
  198 +// String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");
  199 +// if (spy_temp.length > 1) {
  200 +// this.sGh = spy_temp[1];
  201 +// } else {
  202 +// this.sGh = spy_temp[0];
  203 +// }
  204 +// }
206 205
207 this.sName = employeeConfigInfo.getSpy().getPersonnelName(); 206 this.sName = employeeConfigInfo.getSpy().getPersonnelName();
208 } 207 }
@@ -230,28 +229,28 @@ public class SchedulePlanInfo extends BEntity { @@ -230,28 +229,28 @@ public class SchedulePlanInfo extends BEntity {
230 } 229 }
231 230
232 this.j = employeeConfigInfo.getJsy().getId(); 231 this.j = employeeConfigInfo.getJsy().getId();
233 -// this.jGh = employeeConfigInfo.getJsy().getJobCode();  
234 - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {  
235 - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");  
236 - if (jsy_temp.length > 1) {  
237 - this.jGh = jsy_temp[1];  
238 - } else {  
239 - this.jGh = jsy_temp[0];  
240 - }  
241 - } 232 + this.jGh = employeeConfigInfo.getJsy().getJobCodeori();
  233 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {
  234 +// String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");
  235 +// if (jsy_temp.length > 1) {
  236 +// this.jGh = jsy_temp[1];
  237 +// } else {
  238 +// this.jGh = jsy_temp[0];
  239 +// }
  240 +// }
242 this.jName = employeeConfigInfo.getJsy().getPersonnelName(); 241 this.jName = employeeConfigInfo.getJsy().getPersonnelName();
243 // 关联的售票员 242 // 关联的售票员
244 if (employeeConfigInfo.getSpy() != null) { 243 if (employeeConfigInfo.getSpy() != null) {
245 this.s = employeeConfigInfo.getSpy().getId(); 244 this.s = employeeConfigInfo.getSpy().getId();
246 -// this.sGh = employeeConfigInfo.getSpy().getJobCode();  
247 - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {  
248 - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");  
249 - if (spy_temp.length > 1) {  
250 - this.sGh = spy_temp[1];  
251 - } else {  
252 - this.sGh = spy_temp[0];  
253 - }  
254 - } 245 + this.sGh = employeeConfigInfo.getSpy().getJobCodeori();
  246 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {
  247 +// String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");
  248 +// if (spy_temp.length > 1) {
  249 +// this.sGh = spy_temp[1];
  250 +// } else {
  251 +// this.sGh = spy_temp[0];
  252 +// }
  253 +// }
255 254
256 this.sName = employeeConfigInfo.getSpy().getPersonnelName(); 255 this.sName = employeeConfigInfo.getSpy().getPersonnelName();
257 } 256 }
@@ -316,28 +315,28 @@ public class SchedulePlanInfo extends BEntity { @@ -316,28 +315,28 @@ public class SchedulePlanInfo extends BEntity {
316 } 315 }
317 316
318 this.j = employeeConfigInfo.getJsy().getId(); 317 this.j = employeeConfigInfo.getJsy().getId();
319 -// this.jGh = employeeConfigInfo.getJsy().getJobCode();  
320 - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {  
321 - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");  
322 - if (jsy_temp.length > 1) {  
323 - this.jGh = jsy_temp[1];  
324 - } else {  
325 - this.jGh = jsy_temp[0];  
326 - }  
327 - } 318 + this.jGh = employeeConfigInfo.getJsy().getJobCodeori();
  319 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {
  320 +// String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");
  321 +// if (jsy_temp.length > 1) {
  322 +// this.jGh = jsy_temp[1];
  323 +// } else {
  324 +// this.jGh = jsy_temp[0];
  325 +// }
  326 +// }
328 this.jName = employeeConfigInfo.getJsy().getPersonnelName(); 327 this.jName = employeeConfigInfo.getJsy().getPersonnelName();
329 // 关联的售票员 328 // 关联的售票员
330 if (employeeConfigInfo.getSpy() != null) { 329 if (employeeConfigInfo.getSpy() != null) {
331 this.s = employeeConfigInfo.getSpy().getId(); 330 this.s = employeeConfigInfo.getSpy().getId();
332 -// this.sGh = employeeConfigInfo.getSpy().getJobCode();  
333 - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {  
334 - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");  
335 - if (spy_temp.length > 1) {  
336 - this.sGh = spy_temp[1];  
337 - } else {  
338 - this.sGh = spy_temp[0];  
339 - }  
340 - } 331 + this.sGh = employeeConfigInfo.getSpy().getJobCodeori();
  332 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {
  333 +// String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");
  334 +// if (spy_temp.length > 1) {
  335 +// this.sGh = spy_temp[1];
  336 +// } else {
  337 +// this.sGh = spy_temp[0];
  338 +// }
  339 +// }
341 340
342 this.sName = employeeConfigInfo.getSpy().getPersonnelName(); 341 this.sName = employeeConfigInfo.getSpy().getPersonnelName();
343 } 342 }
src/main/java/com/bsth/repository/LineVersionsRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.Date;
  4 +import java.util.List;
  5 +
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
  8 +import org.springframework.stereotype.Repository;
  9 +import org.springframework.transaction.annotation.Transactional;
  10 +
  11 +import com.bsth.entity.Line;
  12 +import com.bsth.entity.LineVersions;
  13 +
  14 +/**
  15 + *
  16 + * @Interface: LineVersionsRepository(线路Repository数据持久层接口)
  17 + *
  18 + * @Extends : BaseRepository
  19 + *
  20 + * @Description: TODO(线路版本Repository数据持久层接口)
  21 + *
  22 + * @Author bsth@lq
  23 + *
  24 + * @Version 公交调度系统BS版 0.1
  25 + *
  26 + */
  27 +@Repository
  28 +public interface LineVersionsRepository extends BaseRepository<LineVersions, Integer> {
  29 +
  30 + /**
  31 + * 获取线路所有版本
  32 + */
  33 + @Query(value = " SELECT lv FROM LineVersions lv where lv.line.id = ?1")
  34 + public List<LineVersions> findBylineCode(int lineId);
  35 +
  36 + @Transactional
  37 + @Modifying
  38 + @Query(value = "UPDATE LineVersions lv set lv.line=?2, lv.lineCode=?3, lv.startDate=?4, lv.endDate=?5, "
  39 + + "lv.versions=?6, lv.status=?7, lv.remark=?8 where lv.id=?1")
  40 + public int update(Integer id, Line line, String lineCode, Date startDate, Date endDate, Integer versions, Integer status,
  41 + String remark);
  42 +
  43 + /**
  44 + * 查询待更新线路的线路版本
  45 + */
  46 + @Query(value = "SELECT lv FROM LineVersions lv where lv.status = 2 and lv.startDate<sysdate() and lv.endDate > sysdate()")
  47 + public List<LineVersions> findupdated();
  48 +
  49 + /**
  50 + * 更改为历史版本
  51 + */
  52 + @Modifying
  53 + @Query(value = "UPDATE LineVersions lv set lv.status=0 where lv.line.id=?1 and lv.lineCode=?2 and lv.status=1")
  54 + public void updateOdlVersions(Integer lineId, String lineCode);
  55 +
  56 + /**
  57 + * 更改为当前版本
  58 + */
  59 + @Modifying
  60 + @Query(value = "UPDATE LineVersions lv set lv.status=1 where lv.line.id=?1 and lv.lineCode=?2 and lv.versions=?3")
  61 + public void updateNewVersions(Integer lineId, String lineCode, Integer versions);
  62 +
  63 +}
src/main/java/com/bsth/repository/LsSectionRouteRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import com.bsth.entity.LsSectionRoute;
  10 +
  11 +/**
  12 + *
  13 + * @Interface: SectionRouteRepository(路段路由Repository数据持久层接口)
  14 + *
  15 + * @Extends : BaseRepository
  16 + *
  17 + * @Description: TODO(路段路由Repository数据持久层接口)
  18 + *
  19 + * @Author bsth@lq
  20 + *
  21 + * @Version 公交调度系统BS版 0.1
  22 + *
  23 + */
  24 +
  25 +@Repository
  26 +public interface LsSectionRouteRepository extends BaseRepository<LsSectionRoute, Integer> {
  27 +
  28 + /**
  29 + * 查询待更新线路的路段路由
  30 + */
  31 + @Query(value = "SELECT sr FROM LsSectionRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3")
  32 + public List<LsSectionRoute> findupdated(Integer lineId,String lineCode,Integer versions);
  33 +
  34 + /**
  35 + * 更新路线前删除线路版本下历史原有路段路由
  36 + */
  37 + @Modifying
  38 + @Query(value="DELETE from bsth_c_ls_sectionroute where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true)
  39 + public void batchDelete(Integer line, Integer dir, Integer versions);
  40 +}
src/main/java/com/bsth/repository/LsStationRouteRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.EntityGraph;
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
  8 +import org.springframework.stereotype.Repository;
  9 +
  10 +import com.bsth.entity.LsStationRoute;
  11 +
  12 +/**
  13 + *
  14 + * @Interface: StationRouteRepository(站点路由Repository数据持久层接口)
  15 + *
  16 + * @Extends : BaseRepository
  17 + *
  18 + * @Description: TODO(站点路由Repository数据持久层接口)
  19 + *
  20 + * @Author bsth@lq
  21 + *
  22 + * @Version 公交调度系统BS版 0.1
  23 + *
  24 + */
  25 +
  26 +@Repository
  27 +public interface LsStationRouteRepository extends BaseRepository<LsStationRoute, Integer> {
  28 +
  29 + /**
  30 + * 查询待更新线路的站点路由
  31 + */
  32 + @EntityGraph(value = "ls_stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
  33 + @Query(value = "SELECT DISTINCT sr FROM LsStationRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3")
  34 + List<LsStationRoute> findupdated(Integer lineId, String lineCode, Integer versions);
  35 +
  36 + /**
  37 + * 更新路线前删除线路版本号历史原有站点路由
  38 + *
  39 + * @param line
  40 + * @param dir
  41 + */
  42 + @Modifying
  43 + @Query(value="DELETE from bsth_c_ls_stationroute where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true)
  44 + public void batchDelete(Integer line,Integer dir, Integer versions);
  45 +}
src/main/java/com/bsth/repository/SectionRouteRepository.java
@@ -192,4 +192,14 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -192,4 +192,14 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
192 @Modifying 192 @Modifying
193 @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) 193 @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true)
194 public void sectionRouteDir(Integer line); 194 public void sectionRouteDir(Integer line);
  195 +
  196 + // 更具线路批量撤销
  197 + @Modifying
  198 + @Query(value="UPDATE SectionRoute sr set sr.destroy = 1 where sr.line.id = ?1 and sr.lineCode = ?2")
  199 + public void batchUpdate(Integer lineId, String lineCode);
  200 +
  201 + // 批量删除
  202 + @Modifying
  203 + @Query(value="delete from SectionRoute sr where sr.line.id = ?1 and sr.lineCode = ?2")
  204 + public void batchDelete(Integer lineId, String lineCode);
195 } 205 }
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -313,7 +313,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -313,7 +313,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
313 public void stationRouteIsDestroyUpdBatch(Integer ids); 313 public void stationRouteIsDestroyUpdBatch(Integer ids);
314 314
315 /** 315 /**
316 - * 更新路线前撤销线路原有站点 316 + *
317 * 317 *
318 * @param line 318 * @param line
319 * @param dir 319 * @param dir
@@ -321,4 +321,14 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -321,4 +321,14 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
321 @Modifying 321 @Modifying
322 @Query(value="insert into (select * from bsth_c_stationroute_cache where line = ?1 and directions = ?2) bsth_c_stationroute", nativeQuery=true) 322 @Query(value="insert into (select * from bsth_c_stationroute_cache where line = ?1 and directions = ?2) bsth_c_stationroute", nativeQuery=true)
323 public void stationRouteUpdate(Integer line,Integer dir); 323 public void stationRouteUpdate(Integer line,Integer dir);
  324 +
  325 + // 更具线路批量撤销
  326 + @Modifying
  327 + @Query(value="UPDATE StationRoute sr set sr.destroy = 1 where sr.line.id = ?1 and sr.lineCode = ?2")
  328 + void batchUpdate(Integer lineId, String lineCode);
  329 +
  330 + // 批量删除
  331 + @Modifying
  332 + @Query(value="delete from StationRoute sr where sr.line.id = ?1 and sr.lineCode = ?2")
  333 + void batchDelete(Integer lineId, String lineCode);
324 } 334 }
src/main/java/com/bsth/service/LineVersionsService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.LineVersions;
  7 +
  8 +/**
  9 + *
  10 + * @Interface: LineVersionsService(线路版本service业务层实现接口)
  11 + *
  12 + * @extends : BaseService
  13 + *
  14 + * @Description: TODO(线路版本service业务层实现接口)
  15 + *
  16 + * @Author bsth@lq
  17 + *
  18 + * @Version 公交调度系统BS版 0.1
  19 + *
  20 + */
  21 +public interface LineVersionsService extends BaseService<LineVersions, Integer> {
  22 +
  23 + /**
  24 + * 获取线路版本
  25 + *
  26 + */
  27 + List<LineVersions> findByLineCode(int lineId);
  28 +
  29 + Map<String, Object> update(Map<String, Object> map);
  30 +
  31 + List<LineVersions> findupdated();
  32 +
  33 + List<LineVersions> lineUpdate();
  34 +
  35 +}
src/main/java/com/bsth/service/SectionRouteService.java
@@ -62,5 +62,7 @@ public interface SectionRouteService extends BaseService&lt;SectionRoute, Integer&gt; @@ -62,5 +62,7 @@ public interface SectionRouteService extends BaseService&lt;SectionRoute, Integer&gt;
62 List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map); 62 List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map);
63 63
64 Map<String, Object> quoteSection(Map<String, Object> map); 64 Map<String, Object> quoteSection(Map<String, Object> map);
  65 +
  66 + void batchUpdate(Integer lineId, String lineCode);
65 67
66 } 68 }
src/main/java/com/bsth/service/SectionService.java
@@ -35,4 +35,6 @@ public interface SectionService extends BaseService&lt;Section, Integer&gt; { @@ -35,4 +35,6 @@ public interface SectionService extends BaseService&lt;Section, Integer&gt; {
35 Map<String, Object> sectionCut(Map<String, Object> map); 35 Map<String, Object> sectionCut(Map<String, Object> map);
36 36
37 Map<String, Object> sectionCacheUpdate(Map<String, Object> map); 37 Map<String, Object> sectionCacheUpdate(Map<String, Object> map);
  38 +
  39 + Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map);
38 } 40 }
src/main/java/com/bsth/service/StationRouteService.java
@@ -112,5 +112,7 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt; @@ -112,5 +112,7 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt;
112 * @return 112 * @return
113 */ 113 */
114 Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp); 114 Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp);
  115 +
  116 + void batchUpdate(Integer lineId, String lineCode);
115 117
116 } 118 }
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
@@ -958,6 +958,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -958,6 +958,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
958 if(tsSet.contains(schedule2.getId()) || schedule2.getBcType().toString().equals("in") || schedule2.getBcType().toString().equals("out")){ 958 if(tsSet.contains(schedule2.getId()) || schedule2.getBcType().toString().equals("in") || schedule2.getBcType().toString().equals("out")){
959 fcsj2 = schedule1.getZdsjT(); 959 fcsj2 = schedule1.getZdsjT();
960 } 960 }
  961 + if(fcsj2 < fcsj1)
  962 + fcsj2 += 1440l;
961 if(sfqr == 1 && time1 > fcsj1){ 963 if(sfqr == 1 && time1 > fcsj1){
962 jhyysj += fcsj2 - time1; 964 jhyysj += fcsj2 - time1;
963 }else if(sfqr == 1 && time2 < fcsj2){ 965 }else if(sfqr == 1 && time2 < fcsj2){
@@ -966,7 +968,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -966,7 +968,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
966 jhyysj += fcsj2 - fcsj1; 968 jhyysj += fcsj2 - fcsj1;
967 } 969 }
968 if(jhyysj < 0){ 970 if(jhyysj < 0){
969 - System.out.println(fcsj2 + " - " + fcsj1); 971 + System.out.println(fcsj2 + " - " + fcsj1 + " = " + (fcsj2 - fcsj1));
970 } 972 }
971 jhyysj1 += fcsj2 - fcsj1; 973 jhyysj1 += fcsj2 - fcsj1;
972 } 974 }
@@ -1010,7 +1012,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1010,7 +1012,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1010 List<ChildTaskPlan> cTasks = cMap.get(schedule.getId()); 1012 List<ChildTaskPlan> cTasks = cMap.get(schedule.getId());
1011 for(ChildTaskPlan childTaskPlan : cTasks){ 1013 for(ChildTaskPlan childTaskPlan : cTasks){
1012 Map<String, Object> temp = new HashMap<String, Object>(); 1014 Map<String, Object> temp = new HashMap<String, Object>();
1013 - if(childTaskPlan.getMileageType().equals("empty") || childTaskPlan.isDestroy()){ 1015 + if(!childTaskPlan.getMileageType().equals("service") || childTaskPlan.isDestroy()
  1016 + || !childTaskPlan.getType1().equals("正常") || childTaskPlan.getCcId() != null){
1014 temp.put("lc", null); 1017 temp.put("lc", null);
1015 temp.put("fcsj", null); 1018 temp.put("fcsj", null);
1016 temp.put("zdsj", null); 1019 temp.put("zdsj", null);
@@ -1071,6 +1074,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1071,6 +1074,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1071 } else if(i == keyList.size() - 1){ 1074 } else if(i == keyList.size() - 1){
1072 fcsj2 = Long.valueOf(m2.get("zdsj").toString()); 1075 fcsj2 = Long.valueOf(m2.get("zdsj").toString());
1073 } 1076 }
  1077 + if(fcsj2 < fcsj1){
  1078 + fcsj2 += 1440l;
  1079 + }
1074 if(sfqr == 1 && time1 > fcsj1){ 1080 if(sfqr == 1 && time1 > fcsj1){
1075 sjyysj += fcsj2 - time1; 1081 sjyysj += fcsj2 - time1;
1076 }else if(sfqr == 1 && time2 < fcsj2){ 1082 }else if(sfqr == 1 && time2 < fcsj2){
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import java.sql.PreparedStatement;
  4 +import java.sql.SQLException;
  5 +import java.text.ParseException;
  6 +import java.text.SimpleDateFormat;
  7 +import java.util.Date;
  8 +import java.util.HashMap;
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +import org.drools.core.time.impl.PseudoClockScheduler;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  15 +import org.springframework.jdbc.core.JdbcTemplate;
  16 +import org.springframework.stereotype.Service;
  17 +import org.springframework.transaction.annotation.Transactional;
  18 +
  19 +import com.alibaba.fastjson.JSON;
  20 +import com.alibaba.fastjson.JSONArray;
  21 +import com.bsth.common.ResponseCode;
  22 +import com.bsth.entity.Line;
  23 +import com.bsth.entity.LineVersions;
  24 +import com.bsth.entity.LsSectionRoute;
  25 +import com.bsth.entity.LsStationRoute;
  26 +import com.bsth.entity.SectionRoute;
  27 +import com.bsth.entity.StationRoute;
  28 +import com.bsth.repository.LineRepository;
  29 +import com.bsth.repository.LineVersionsRepository;
  30 +import com.bsth.repository.LsSectionRouteRepository;
  31 +import com.bsth.repository.LsStationRouteRepository;
  32 +import com.bsth.service.LineVersionsService;
  33 +import com.bsth.service.SectionRouteService;
  34 +import com.bsth.service.StationRouteService;
  35 +
  36 +/**
  37 + *
  38 + * @ClassName: LineVersionsServiceImpl(线路service业务层实现类)
  39 + *
  40 + * @Extends : BaseService
  41 + *
  42 + * @Description: TODO(线路service业务层)
  43 + *
  44 + * @Author bsth@lq
  45 + *
  46 + * @Version 公交调度系统BS版 0.1
  47 + *
  48 + */
  49 +
  50 +@Service
  51 +public class LineVersionsServiceImpl extends BaseServiceImpl<LineVersions, Integer> implements LineVersionsService{
  52 +
  53 + @Autowired
  54 + private LineVersionsRepository repository;
  55 +
  56 + @Autowired
  57 + LineRepository lineRepository;
  58 +
  59 + @Autowired
  60 + SectionRouteService sectionRouteService;
  61 +
  62 + @Autowired
  63 + StationRouteService stationRouteService;
  64 +
  65 + @Autowired
  66 + com.bsth.repository.SectionRouteRepository sectionRouteRepository ;
  67 +
  68 + @Autowired
  69 + com.bsth.repository.StationRouteRepository stationRouteRepository ;
  70 +
  71 + @Autowired
  72 + LsSectionRouteRepository lsSectionRouteRepository ;
  73 +
  74 + @Autowired
  75 + LsStationRouteRepository lsStationRouteRepository ;
  76 +
  77 + @Override
  78 + public List<LineVersions> findByLineCode(int lineId) {
  79 + return repository.findBylineCode(lineId);
  80 + }
  81 +
  82 + @Override
  83 + public Map<String, Object> update(Map<String, Object> map) {
  84 + Map<String, Object> resultMap = new HashMap<>();
  85 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  86 + try {
  87 + Date startDate = simpleDateFormat.parse(map.get("startDate").toString());
  88 + Date endDate = simpleDateFormat.parse(map.get("endDate").toString());
  89 + Integer id = Integer.valueOf(map.get("Id").toString());
  90 + Integer lineid = Integer.valueOf(map.get("lineId").toString());
  91 + String lineCode = map.get("lineCode").toString();
  92 + Integer versions = Integer.valueOf(map.get("versions").toString());
  93 + Integer status = Integer.valueOf(map.get("status").toString());
  94 + String remark = map.get("remark").toString();
  95 +
  96 + Line line = lineRepository.findOne(lineid);
  97 +
  98 + int statu = repository.update(id,line,lineCode,new java.sql.Date(startDate.getTime()),
  99 + new java.sql.Date(endDate.getTime()),versions,status,remark);
  100 + if (statu==1) {
  101 + resultMap.put("status", ResponseCode.SUCCESS);
  102 + } else {
  103 + resultMap.put("status", ResponseCode.ERROR);
  104 + }
  105 + } catch (ParseException e) {
  106 + // TODO Auto-generated catch block
  107 + e.printStackTrace();
  108 + resultMap.put("status", ResponseCode.ERROR);
  109 + return resultMap;
  110 + }
  111 + return resultMap;
  112 + }
  113 +
  114 + @Override
  115 + public List<LineVersions> findupdated() {
  116 + return repository.findupdated();
  117 + }
  118 +
  119 + @Autowired
  120 + JdbcTemplate jdbcTemplate;
  121 +
  122 + // 线路更新
  123 + @Transactional
  124 + @Override
  125 + public List<LineVersions> lineUpdate() {
  126 + List<LineVersions> list = findupdated();
  127 + for (LineVersions lineVersions : list) {
  128 + Integer lineId = lineVersions.getLine().getId();
  129 + String lineCode = lineVersions.getLineCode();
  130 + Integer versions = lineVersions.getVersions();
  131 + // 需要更新线路的路由
  132 + List<LsSectionRoute> lsSectionRoutes = lsSectionRouteRepository.findupdated(lineId, lineCode, versions);
  133 + List<LsStationRoute> lsStationRoutes = lsStationRouteRepository.findupdated(lineId, lineCode, versions);
  134 + if (lsSectionRoutes.size() != 0 && lsStationRoutes.size() != 0) {
  135 + // 更新
  136 + final List<SectionRoute> sectionRoutes = JSONArray.parseArray(JSON.toJSONString(lsSectionRoutes), SectionRoute.class);
  137 + final List<StationRoute> stationRoutes = JSONArray.parseArray(JSON.toJSONString(lsStationRoutes), StationRoute.class);
  138 + //sectionRouteService.batchUpdate(lineId, lineCode);
  139 + //sectionRouteRepository.batchDelete(lineId, lineCode);
  140 +
  141 + jdbcTemplate.update("delete from bsth_c_stationroute where line = ? and line_code = ?", lineId, lineCode);
  142 +
  143 + String stationSql ="insert into bsth_c_stationroute(id,line,station,station_name,station_route_code,"
  144 + + "line_code,station_code,station_mark,out_station_nmber,directions,distances,"
  145 + + "to_time,first_time,end_time,descriptions,destroy,versions,create_by,create_date,"
  146 + + "update_by,update_date) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  147 + jdbcTemplate.batchUpdate(stationSql, new BatchPreparedStatementSetter() {
  148 +
  149 + @Override
  150 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  151 + StationRoute sRoute = stationRoutes.get(i);
  152 + sRoute.getStationRouteCode();
  153 + ps.setInt(1, sRoute.getId());
  154 + ps.setInt(2, sRoute.getLine().getId());
  155 + ps.setInt(3, sRoute.getStation().getId());
  156 + ps.setString(4, sRoute.getStationName());
  157 + ps.setInt(5, sRoute.getStationRouteCode());
  158 + ps.setString(6, sRoute.getLineCode());
  159 + ps.setString(7, sRoute.getStationCode());
  160 + ps.setString(8, sRoute.getStationMark());
  161 + ps.setInt(9, sRoute.getOutStationNmber()==null ? 0:sRoute.getOutStationNmber());
  162 + ps.setInt(10, sRoute.getDirections());
  163 + ps.setDouble(11, sRoute.getDistances());
  164 + ps.setDouble(12, sRoute.getToTime());
  165 + ps.setString(13, sRoute.getFirstTime()==null ? "":sRoute.getFirstTime());
  166 + ps.setString(14, sRoute.getEndTime()==null ? "":sRoute.getEndTime());
  167 + ps.setString(15, sRoute.getDescriptions()==null ? "":sRoute.getDescriptions());
  168 + ps.setInt(16, sRoute.getDestroy());
  169 + ps.setInt(17, sRoute.getVersions());
  170 + ps.setInt(18, sRoute.getCreateBy()==null ? 0:sRoute.getCreateBy());
  171 + ps.setDate(19, new java.sql.Date(sRoute.getCreateDate().getTime()));
  172 + ps.setInt(20, sRoute.getUpdateBy()==null ? 0:sRoute.getUpdateBy());
  173 + ps.setDate(21, new java.sql.Date(sRoute.getUpdateDate().getTime()));
  174 + }
  175 +
  176 + @Override
  177 + public int getBatchSize() {
  178 + // TODO Auto-generated method stub
  179 + return stationRoutes.size();
  180 + }
  181 + } );
  182 + jdbcTemplate.update("delete from bsth_c_sectionroute where line = ? and line_code = ?", lineId, lineCode);
  183 +
  184 + String sectionSql ="insert into bsth_c_sectionroute(id,line_code,section_code,sectionroute_code,"
  185 + + "directions,line,section,descriptions,create_by,create_date,update_by,update_date,versions,"
  186 + + "destroy,is_roade_speed) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  187 + jdbcTemplate.batchUpdate(sectionSql, new BatchPreparedStatementSetter() {
  188 +
  189 + @Override
  190 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  191 + SectionRoute sRoute = sectionRoutes.get(i);
  192 + ps.setInt(1, sRoute.getId());
  193 + ps.setString(2, sRoute.getLineCode());
  194 + ps.setString(3, sRoute.getSectionCode());
  195 + ps.setInt(4, sRoute.getSectionrouteCode());
  196 + ps.setInt(5, sRoute.getDirections());
  197 + ps.setInt(6, sRoute.getLine().getId());
  198 + ps.setInt(7, sRoute.getSection().getId());
  199 + ps.setString(8, sRoute.getDescriptions()==null ? "":sRoute.getDescriptions());
  200 + ps.setInt(9, sRoute.getCreateBy()==null ? 0:sRoute.getCreateBy());
  201 + ps.setDate(10, new java.sql.Date(sRoute.getCreateDate().getTime()));
  202 + ps.setInt(11, sRoute.getUpdateBy()==null ? 0:sRoute.getUpdateBy());
  203 + ps.setDate(12, new java.sql.Date(sRoute.getUpdateDate().getTime()));
  204 + ps.setInt(13, sRoute.getVersions());
  205 + ps.setInt(14, sRoute.getDestroy());
  206 + ps.setInt(15, sRoute.getIsRoadeSpeed()==null ? 0:sRoute.getIsRoadeSpeed());
  207 + }
  208 +
  209 + @Override
  210 + public int getBatchSize() {
  211 + // TODO Auto-generated method stub
  212 + return sectionRoutes.size();
  213 + }
  214 + } );
  215 + /*for (SectionRoute sectionRoute : sectionRoutes) {
  216 + sectionRouteService.save(sectionRoute);
  217 + }*/
  218 +// sectionRouteService.bulkSave(sectionRoutes);
  219 + //List<StationRoute> stationRoutes = JSONArray.parseArray(JSON.toJSONString(lsStationRoutes), StationRoute.class);
  220 +// stationRouteService.batchUpdate(lineId, lineCode);
  221 +
  222 + //stationRouteRepository.batchDelete(lineId, lineCode);
  223 + /*for (StationRoute stationRoute : stationRoutes) {
  224 + stationRouteService.save(stationRoute);
  225 + }*/
  226 +// stationRouteService.bulkSave(stationRoutes);
  227 + // 更新线路版本
  228 + repository.updateOdlVersions(lineId, lineCode);
  229 + repository.updateNewVersions(lineId,lineCode,versions);
  230 + }
  231 + }
  232 + return list;
  233 + }
  234 +
  235 +}
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
@@ -385,4 +385,10 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ @@ -385,4 +385,10 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
385 } 385 }
386 return resultMap; 386 return resultMap;
387 } 387 }
  388 +
  389 + // 更具线路批量撤销
  390 + @Override
  391 + public void batchUpdate(Integer lineId, String lineCode) {
  392 + repository.batchUpdate(lineId,lineCode);
  393 + }
388 } 394 }
389 \ No newline at end of file 395 \ No newline at end of file
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
@@ -17,12 +17,18 @@ import com.alibaba.fastjson.JSONArray; @@ -17,12 +17,18 @@ import com.alibaba.fastjson.JSONArray;
17 import com.alibaba.fastjson.JSONObject; 17 import com.alibaba.fastjson.JSONObject;
18 import com.bsth.common.ResponseCode; 18 import com.bsth.common.ResponseCode;
19 import com.bsth.entity.Line; 19 import com.bsth.entity.Line;
  20 +import com.bsth.entity.LineVersions;
  21 +import com.bsth.entity.LsSectionRoute;
  22 +import com.bsth.entity.LsStationRoute;
20 import com.bsth.entity.Section; 23 import com.bsth.entity.Section;
21 import com.bsth.entity.SectionRoute; 24 import com.bsth.entity.SectionRoute;
22 import com.bsth.entity.SectionRouteCache; 25 import com.bsth.entity.SectionRouteCache;
23 import com.bsth.entity.StationRoute; 26 import com.bsth.entity.StationRoute;
24 import com.bsth.entity.StationRouteCache; 27 import com.bsth.entity.StationRouteCache;
25 import com.bsth.repository.LineRepository; 28 import com.bsth.repository.LineRepository;
  29 +import com.bsth.repository.LineVersionsRepository;
  30 +import com.bsth.repository.LsSectionRouteRepository;
  31 +import com.bsth.repository.LsStationRouteRepository;
26 import com.bsth.repository.SectionRepository; 32 import com.bsth.repository.SectionRepository;
27 import com.bsth.repository.SectionRouteCacheRepository; 33 import com.bsth.repository.SectionRouteCacheRepository;
28 import com.bsth.repository.SectionRouteRepository; 34 import com.bsth.repository.SectionRouteRepository;
@@ -62,15 +68,24 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -62,15 +68,24 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
62 LineRepository lineRepository; 68 LineRepository lineRepository;
63 69
64 @Autowired 70 @Autowired
  71 + LineVersionsRepository lineVersionsRepository;
  72 +
  73 + @Autowired
65 SectionRouteRepository routeRepository; 74 SectionRouteRepository routeRepository;
66 75
67 @Autowired 76 @Autowired
  77 + LsSectionRouteRepository lsRouteRepository;
  78 +
  79 + @Autowired
68 SectionRouteCacheRepository routeCacheRepository; 80 SectionRouteCacheRepository routeCacheRepository;
69 81
70 @Autowired 82 @Autowired
71 StationRouteRepository stationRouteRepository; 83 StationRouteRepository stationRouteRepository;
72 84
73 @Autowired 85 @Autowired
  86 + LsStationRouteRepository lsStationRouteRepository;
  87 +
  88 + @Autowired
74 StationRouteCacheRepository stationRouteCacheRepository; 89 StationRouteCacheRepository stationRouteCacheRepository;
75 90
76 /** 91 /**
@@ -88,119 +103,12 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -88,119 +103,12 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
88 // 路段点List 103 // 路段点List
89 List<Point> bPointsList = new ArrayList<>(); 104 List<Point> bPointsList = new ArrayList<>();
90 // 截取路段点List 105 // 截取路段点List
91 - List<Point> bPointsCutList = new ArrayList<>(); 106 +// List<Point> bPointsCutList = new ArrayList<>();
92 // 截取后的路段 107 // 截取后的路段
93 List<Map<String, String>> sectionArrayList = new ArrayList<>(); 108 List<Map<String, String>> sectionArrayList = new ArrayList<>();
94 String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString(); 109 String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString();
95 String bsectionVectorCutList = map.get("cutSectionList").equals("") ? "" :map.get("cutSectionList").toString(); 110 String bsectionVectorCutList = map.get("cutSectionList").equals("") ? "" :map.get("cutSectionList").toString();
96 - if(!bsectionVector.equals("")) {  
97 - // 转换成JSON数组  
98 - JSONArray sectionsArray = JSONArray.parseArray(bsectionVector);  
99 - // 遍历  
100 - for(int s = 0 ;s<sectionsArray.size();s++) {  
101 - String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();  
102 - String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();  
103 - bPointsList.add(new Point(Double.parseDouble(pointsLngStr), Double.parseDouble(pointsLatStr)));  
104 - }  
105 - }  
106 - if(!bsectionVectorCutList.equals("")) {  
107 - // 转换成JSON数组  
108 - JSONArray sectionsArrayList = JSONArray.parseArray(bsectionVectorCutList);  
109 - // 截取路段在总路段中的下表  
110 - int firstTemp = 0;  
111 - int lastTemp = 0;  
112 - // 每个截取的路段去总路段中获取  
113 - for (int i = 0; i < sectionsArrayList.size(); i++) {  
114 - // 切点列表  
115 - JSONObject sectionsArray = sectionsArrayList.getJSONObject(i);  
116 - String sectionName = sectionsArray.get("name").toString();  
117 - JSONArray sectionPoints = sectionsArray.getJSONArray("section");  
118 - // 用两个坐标点去截取总路段  
119 - if (i == 0) {  
120 - for(int s = 0 ;s<sectionPoints.size();s++) {  
121 - String bpointsLngStr = sectionPoints.getJSONObject(s).get("lng").toString();  
122 - String bpointsLatStr = sectionPoints.getJSONObject(s).get("lat").toString();  
123 - Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr));  
124 - double distance = 0;  
125 - // 寻找最近点  
126 - for (int index = firstTemp; index < bPointsList.size(); index++) {  
127 - if (index == firstTemp) {  
128 - distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index));  
129 - } else {  
130 - double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index));  
131 - if(distance > distanceTemp) {  
132 - distance = distanceTemp;  
133 - lastTemp = index;  
134 - }  
135 - }  
136 - }  
137 - if (s == 0) {  
138 - // 第一个点作为路段的起点  
139 - firstTemp = lastTemp;  
140 - }  
141 - // 用切点替换最近点  
142 - if(lastTemp == firstTemp) {  
143 - bPointsList.add(++lastTemp, bPointcut);  
144 - } else {  
145 - bPointsList.set(lastTemp, bPointcut);  
146 - }  
147 - }  
148 - } else {  
149 - String bpointsLngStr = sectionPoints.getJSONObject(1).get("lng").toString();  
150 - String bpointsLatStr = sectionPoints.getJSONObject(1).get("lat").toString();  
151 - Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr));  
152 - double distance = 0;  
153 - // 寻找最近点  
154 - for (int index = firstTemp; index < bPointsList.size(); index++) {  
155 - if (index == firstTemp) {  
156 - distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index));  
157 - } else {  
158 - double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index));  
159 - if(distance > distanceTemp) {  
160 - distance = distanceTemp;  
161 - lastTemp = index;  
162 - }  
163 - }  
164 - }  
165 - // 用切点替换最近点  
166 - if(lastTemp == firstTemp) {  
167 - bPointsList.add(++lastTemp, bPointcut);  
168 - } else {  
169 - bPointsList.set(lastTemp, bPointcut);  
170 - }  
171 - }  
172 - // 切路段  
173 - if (sectionName != "" && sectionName != null ) {  
174 - // 原始线状图形坐标集合  
175 - String sectionsBpoints = "";  
176 - // WGS线状图形坐标集合  
177 - String sectionsWJPpoints = "";  
178 - for (int j = firstTemp; j <= lastTemp; j++) {  
179 - Point point = bPointsList.get(j);  
180 - String pointsLngStr = String.valueOf(point.getLon());  
181 - String pointsLatStr = String.valueOf(point.getLat());  
182 - /** to WGS坐标 */  
183 - Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);  
184 - String WGSLngStr = String.valueOf(resultPoint.getLng());  
185 - String WGSLatStr = String.valueOf(resultPoint.getLat());  
186 - if(j == firstTemp) {  
187 - sectionsBpoints = pointsLngStr + " " + pointsLatStr;  
188 - sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;  
189 - }else {  
190 - sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;  
191 - sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;  
192 - }  
193 - }  
194 - Map<String, String> sectionCutMap = new HashMap<String, String>();  
195 - sectionCutMap.put("sectionName", sectionName);  
196 - sectionCutMap.put("sectionsBpoints", sectionsBpoints);  
197 - sectionCutMap.put("sectionsWJPpoints", sectionsWJPpoints);  
198 - sectionArrayList.add(sectionCutMap);  
199 - }  
200 - // 上一个路段的终点作为下一个路段的起点  
201 - firstTemp = lastTemp;  
202 - }  
203 - } 111 + sectionListCut(bPointsList, sectionArrayList, bsectionVector, bsectionVectorCutList);
204 112
205 // 原坐标类型 113 // 原坐标类型
206 String dbType = map.get("sectiondbType").equals("") ? "" : map.get("sectiondbType").toString(); 114 String dbType = map.get("sectiondbType").equals("") ? "" : map.get("sectiondbType").toString();
@@ -217,7 +125,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -217,7 +125,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
217 // 路段长度 125 // 路段长度
218 Double sectionDistance = 0.0; 126 Double sectionDistance = 0.0;
219 // 路段路由Id 127 // 路段路由Id
220 - Integer sectionRouteId = map.get("sectionrouteId").equals("") ? null : Integer.valueOf(map.get("sectionrouteId").toString()); 128 +// Integer sectionRouteId = map.get("sectionrouteId").equals("") ? null : Integer.valueOf(map.get("sectionrouteId").toString());
221 // 线路编码 129 // 线路编码
222 String lineCode =map.get("sectionrouteLineCode").equals("") ? "" : map.get("sectionrouteLineCode").toString(); 130 String lineCode =map.get("sectionrouteLineCode").equals("") ? "" : map.get("sectionrouteLineCode").toString();
223 // 路段时长 131 // 路段时长
@@ -227,7 +135,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -227,7 +135,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
227 // 限速 135 // 限速
228 Double speedLimit = map.get("sectionSpeedLimet").equals("") ? null : Double.valueOf(map.get("sectionSpeedLimet").toString()); 136 Double speedLimit = map.get("sectionSpeedLimet").equals("") ? null : Double.valueOf(map.get("sectionSpeedLimet").toString());
229 // 版本 137 // 版本
230 - Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); 138 + Integer versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
231 139
232 Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); 140 Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
233 String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); 141 String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString();
@@ -243,8 +151,8 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -243,8 +151,8 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
243 String middleNode=""; 151 String middleNode="";
244 String sectionType=""; 152 String sectionType="";
245 String csectionVector=""; 153 String csectionVector="";
246 - // 撤销原有路段  
247 - routeRepository.sectionRouteUpdDestroy(Integer.parseInt(lineCode),directions); 154 + // 撤销原有路段路由
  155 + routeRepository.sectionRouteUpdDestroy(sectionRouteLine,directions);
248 // 路段保存 156 // 路段保存
249 for (int i = 0; i < sectionArrayList.size(); i++) { 157 for (int i = 0; i < sectionArrayList.size(); i++) {
250 long sectionMaxId = GetUIDAndCode.getSectionId(); 158 long sectionMaxId = GetUIDAndCode.getSectionId();
@@ -263,7 +171,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -263,7 +171,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
263 String bsectionVectorS = null; 171 String bsectionVectorS = null;
264 if(!sectionsBpoints.equals("")) 172 if(!sectionsBpoints.equals(""))
265 bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; 173 bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
266 - repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, sectionId); 174 + repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, sectionId);
267 SectionRoute route = new SectionRoute(); 175 SectionRoute route = new SectionRoute();
268 Line line = lineRepository.findOne(sectionRouteLine); 176 Line line = lineRepository.findOne(sectionRouteLine);
269 Section section = repository.findOne(sectionId); 177 Section section = repository.findOne(sectionId);
@@ -271,7 +179,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -271,7 +179,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
271 route.setLineCode(lineCode); 179 route.setLineCode(lineCode);
272 route.setSectionCode(sectionCode); 180 route.setSectionCode(sectionCode);
273 route.setDirections(directions); 181 route.setDirections(directions);
274 - route.setVersions(version); 182 + route.setVersions(versions);
275 route.setDestroy(destroy); 183 route.setDestroy(destroy);
276 route.setDescriptions(descriptions); 184 route.setDescriptions(descriptions);
277 route.setCreateBy(createBy); 185 route.setCreateBy(createBy);
@@ -282,9 +190,9 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -282,9 +190,9 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
282 routeRepository.save(route); 190 routeRepository.save(route);
283 } 191 }
284 // 删除缓存路段 192 // 删除缓存路段
285 - routeCacheRepository.sectionRouteCacheDel(Integer.parseInt(lineCode),directions);  
286 - // 撤销原有站点  
287 - stationRouteRepository.stationRouteUpdDestroy(Integer.parseInt(lineCode),directions); 193 + routeCacheRepository.sectionRouteCacheDel(sectionRouteLine,directions);
  194 + // 撤销原有站点路由
  195 + stationRouteRepository.stationRouteUpdDestroy(sectionRouteLine,directions);
288 // 站点保存 196 // 站点保存
289 List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(lineCode,directions); 197 List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(lineCode,directions);
290 for(int i=0; i < stationRouteList.size(); i++) { 198 for(int i=0; i < stationRouteList.size(); i++) {
@@ -305,7 +213,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -305,7 +213,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
305 stationRoute.setEndTime(stationRouteCache.getEndTime()); 213 stationRoute.setEndTime(stationRouteCache.getEndTime());
306 stationRoute.setDescriptions(stationRouteCache.getDescriptions()); 214 stationRoute.setDescriptions(stationRouteCache.getDescriptions());
307 stationRoute.setDestroy(stationRouteCache.getDestroy()); 215 stationRoute.setDestroy(stationRouteCache.getDestroy());
308 - stationRoute.setVersions(stationRouteCache.getVersions()); 216 + stationRoute.setVersions(versions);
309 stationRoute.setCreateBy(stationRouteCache.getCreateBy()); 217 stationRoute.setCreateBy(stationRouteCache.getCreateBy());
310 stationRoute.setCreateDate(stationRouteCache.getCreateDate()); 218 stationRoute.setCreateDate(stationRouteCache.getCreateDate());
311 stationRoute.setUpdateBy(stationRouteCache.getCreateBy()); 219 stationRoute.setUpdateBy(stationRouteCache.getCreateBy());
@@ -313,7 +221,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -313,7 +221,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
313 stationRouteRepository.save(stationRoute); 221 stationRouteRepository.save(stationRoute);
314 } 222 }
315 // 删除缓存站点 223 // 删除缓存站点
316 - stationRouteCacheRepository.stationRouteCacheDel(Integer.parseInt(lineCode),directions); 224 + stationRouteCacheRepository.stationRouteCacheDel(sectionRouteLine,directions);
317 225
318 resultMap.put("status", ResponseCode.SUCCESS); 226 resultMap.put("status", ResponseCode.SUCCESS);
319 } catch (Exception e) { 227 } catch (Exception e) {
@@ -324,6 +232,251 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -324,6 +232,251 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
324 } 232 }
325 233
326 /** 234 /**
  235 + * @Description :TODO(编辑线路走向保存到线路历史表)
  236 + *
  237 + * @param map <sectionId:路段ID; sectionJSON:路段信息>
  238 + *
  239 + * @return Map<String, Object> <SUCCESS ; ERROR>
  240 + */
  241 + @Override
  242 + @Transactional
  243 + public Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map) {
  244 + Map<String, Object> resultMap = new HashMap<String, Object>();
  245 + try {
  246 + // 路段点List
  247 + List<Point> bPointsList = new ArrayList<>();
  248 + // 截取后的路段
  249 + List<Map<String, String>> sectionArrayList = new ArrayList<>();
  250 + String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString();
  251 + String bsectionVectorCutList = map.get("cutSectionList").equals("") ? "" :map.get("cutSectionList").toString();
  252 + sectionListCut(bPointsList, sectionArrayList, bsectionVector, bsectionVectorCutList);
  253 +
  254 + // 原坐标类型
  255 + String dbType = map.get("sectiondbType").equals("") ? "" : map.get("sectiondbType").toString();
  256 + // 说明
  257 + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
  258 + // 是否撤销
  259 + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
  260 + // 方向
  261 + Integer directions = map.get("sectionrouteDirections").equals("") ? null : Integer.parseInt(map.get("sectionrouteDirections").toString());
  262 + // 线路ID
  263 + Integer sectionRouteLine = map.get("sectionrouteLine").equals("") ? null : Integer.parseInt(map.get("sectionrouteLine").toString());
  264 + // 道路编码
  265 + String roadCoding = map.get("sectionRoadCoding").equals("") ? "" : map.get("sectionRoadCoding").toString();
  266 + // 路段长度
  267 + Double sectionDistance = 0.0;
  268 + // 线路编码
  269 + String lineCode =map.get("sectionrouteLineCode").equals("") ? "" : map.get("sectionrouteLineCode").toString();
  270 + // 路段时长
  271 + Double sectionTime = 0.0;
  272 + // 路段路由
  273 + Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
  274 + // 限速
  275 + Double speedLimit = map.get("sectionSpeedLimet").equals("") ? null : Double.valueOf(map.get("sectionSpeedLimet").toString());
  276 + // 版本
  277 + Integer versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
  278 +
  279 + Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
  280 + Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString());
  281 + Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString());
  282 + String crosesRoad="";
  283 + String endNode="";
  284 + String startNode="";
  285 + String middleNode="";
  286 + String sectionType="";
  287 + String csectionVector="";
  288 + // 删除原有历史版本路段路由
  289 + lsRouteRepository.batchDelete(sectionRouteLine,directions,versions);
  290 + // 路段保存
  291 + for (int i = 0; i < sectionArrayList.size(); i++) {
  292 + long sectionMaxId = GetUIDAndCode.getSectionId();
  293 + // 路段编码
  294 + String sectionCode = String.valueOf(sectionMaxId);
  295 + // 路段ID
  296 + int sectionId = (int)sectionMaxId;
  297 + String sectionName = sectionArrayList.get(i).get("sectionName").toString();
  298 + String sectionsBpoints = sectionArrayList.get(i).get("sectionsBpoints").toString();
  299 + String sectionsWJPpoints = sectionArrayList.get(i).get("sectionsWJPpoints").toString();
  300 + // WGS坐标点集合
  301 + String gsectionVector = null;
  302 + if(!sectionsWJPpoints.equals(""))
  303 + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
  304 + // 原坐标点集合
  305 + String bsectionVectorS = null;
  306 + if(!sectionsBpoints.equals(""))
  307 + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
  308 + repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, 1, sectionId);
  309 + LsSectionRoute route = new LsSectionRoute();
  310 + Line line = lineRepository.findOne(sectionRouteLine);
  311 + Section section = repository.findOne(sectionId);
  312 + route.setSectionrouteCode(sectionrouteCode+i*100);
  313 + route.setLineCode(lineCode);
  314 + route.setSectionCode(sectionCode);
  315 + route.setDirections(directions);
  316 + route.setVersions(versions);
  317 + route.setDestroy(destroy);
  318 + route.setDescriptions(descriptions);
  319 + route.setCreateBy(createBy);
  320 + route.setUpdateBy(updateBy);
  321 + route.setLine(line);
  322 + route.setSection(section);
  323 + route.setIsRoadeSpeed(isRoadeSpeed);
  324 + lsRouteRepository.save(route);
  325 + }
  326 + // 删除缓存路段
  327 + routeCacheRepository.sectionRouteCacheDel(sectionRouteLine,directions);
  328 + // 删除原有历史表站点路由
  329 + lsStationRouteRepository.batchDelete(sectionRouteLine,directions,versions);
  330 + // 站点保存
  331 + List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(lineCode,directions);
  332 + for(int i=0; i < stationRouteList.size(); i++) {
  333 + StationRouteCache stationRouteCache = stationRouteList.get(i);
  334 + LsStationRoute stationRoute = new LsStationRoute();
  335 + stationRoute.setLine(stationRouteCache.getLine());
  336 + stationRoute.setStation(stationRouteCache.getStation());
  337 + stationRoute.setStationName(stationRouteCache.getStationName());
  338 + stationRoute.setStationRouteCode(stationRouteCache.getStationRouteCode());
  339 + stationRoute.setLineCode(stationRouteCache.getLineCode());
  340 + stationRoute.setStationCode(stationRouteCache.getStationCode());
  341 + stationRoute.setStationMark(stationRouteCache.getStationMark());
  342 + stationRoute.setOutStationNmber(stationRouteCache.getOutStationNmber());
  343 + stationRoute.setDirections(stationRouteCache.getDirections());
  344 + stationRoute.setDistances(stationRouteCache.getDistances());
  345 + stationRoute.setToTime(stationRouteCache.getToTime());
  346 + stationRoute.setFirstTime(stationRouteCache.getFirstTime());
  347 + stationRoute.setEndTime(stationRouteCache.getEndTime());
  348 + stationRoute.setDescriptions(stationRouteCache.getDescriptions());
  349 + stationRoute.setDestroy(stationRouteCache.getDestroy());
  350 + stationRoute.setVersions(versions);
  351 + stationRoute.setCreateBy(stationRouteCache.getCreateBy());
  352 + stationRoute.setCreateDate(stationRouteCache.getCreateDate());
  353 + stationRoute.setUpdateBy(stationRouteCache.getCreateBy());
  354 + stationRoute.setUpdateDate(stationRouteCache.getUpdateDate());
  355 + lsStationRouteRepository.save(stationRoute);
  356 + }
  357 + // 删除缓存站点
  358 + stationRouteCacheRepository.stationRouteCacheDel(sectionRouteLine,directions);
  359 + resultMap.put("status", ResponseCode.SUCCESS);
  360 + } catch (Exception e) {
  361 + resultMap.put("status", ResponseCode.ERROR);
  362 + logger.error("save erro.", e);
  363 + }
  364 + return resultMap;
  365 + }
  366 +
  367 + private void sectionListCut(List<Point> bPointsList, List<Map<String, String>> sectionArrayList,
  368 + String bsectionVector, String bsectionVectorCutList) {
  369 + if(!bsectionVector.equals("")) {
  370 + // 转换成JSON数组
  371 + JSONArray sectionsArray = JSONArray.parseArray(bsectionVector);
  372 + // 遍历
  373 + for(int s = 0 ;s<sectionsArray.size();s++) {
  374 + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
  375 + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
  376 + bPointsList.add(new Point(Double.parseDouble(pointsLngStr), Double.parseDouble(pointsLatStr)));
  377 + }
  378 + }
  379 + if(!bsectionVectorCutList.equals("")) {
  380 + // 转换成JSON数组
  381 + JSONArray sectionsArrayList = JSONArray.parseArray(bsectionVectorCutList);
  382 + // 截取路段在总路段中的下表
  383 + int firstTemp = 0;
  384 + int lastTemp = 0;
  385 + // 每个截取的路段去总路段中获取
  386 + for (int i = 0; i < sectionsArrayList.size(); i++) {
  387 + // 切点列表
  388 + JSONObject sectionsArray = sectionsArrayList.getJSONObject(i);
  389 + String sectionName = sectionsArray.get("name").toString();
  390 + JSONArray sectionPoints = sectionsArray.getJSONArray("section");
  391 + // 用两个坐标点去截取总路段
  392 + if (i == 0) {
  393 + for(int s = 0 ;s<sectionPoints.size();s++) {
  394 + String bpointsLngStr = sectionPoints.getJSONObject(s).get("lng").toString();
  395 + String bpointsLatStr = sectionPoints.getJSONObject(s).get("lat").toString();
  396 + Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr));
  397 + double distance = 0;
  398 + // 寻找最近点
  399 + for (int index = firstTemp; index < bPointsList.size(); index++) {
  400 + if (index == firstTemp) {
  401 + distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
  402 + } else {
  403 + double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
  404 + if(distance > distanceTemp) {
  405 + distance = distanceTemp;
  406 + lastTemp = index;
  407 + }
  408 + }
  409 + }
  410 + if (s == 0) {
  411 + // 第一个点作为路段的起点
  412 + firstTemp = lastTemp;
  413 + }
  414 + // 用切点替换最近点
  415 + if(lastTemp == firstTemp) {
  416 + bPointsList.add(++lastTemp, bPointcut);
  417 + } else {
  418 + bPointsList.set(lastTemp, bPointcut);
  419 + }
  420 + }
  421 + } else {
  422 + String bpointsLngStr = sectionPoints.getJSONObject(1).get("lng").toString();
  423 + String bpointsLatStr = sectionPoints.getJSONObject(1).get("lat").toString();
  424 + Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr));
  425 + double distance = 0;
  426 + // 寻找最近点
  427 + for (int index = firstTemp; index < bPointsList.size(); index++) {
  428 + if (index == firstTemp) {
  429 + distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
  430 + } else {
  431 + double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
  432 + if(distance > distanceTemp) {
  433 + distance = distanceTemp;
  434 + lastTemp = index;
  435 + }
  436 + }
  437 + }
  438 + // 用切点替换最近点
  439 + if(lastTemp == firstTemp) {
  440 + bPointsList.add(++lastTemp, bPointcut);
  441 + } else {
  442 + bPointsList.set(lastTemp, bPointcut);
  443 + }
  444 + }
  445 + // 切路段
  446 + if (sectionName != "" && sectionName != null ) {
  447 + // 原始线状图形坐标集合
  448 + String sectionsBpoints = "";
  449 + // WGS线状图形坐标集合
  450 + String sectionsWJPpoints = "";
  451 + for (int j = firstTemp; j <= lastTemp; j++) {
  452 + Point point = bPointsList.get(j);
  453 + String pointsLngStr = String.valueOf(point.getLon());
  454 + String pointsLatStr = String.valueOf(point.getLat());
  455 + /** to WGS坐标 */
  456 + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
  457 + String WGSLngStr = String.valueOf(resultPoint.getLng());
  458 + String WGSLatStr = String.valueOf(resultPoint.getLat());
  459 + if(j == firstTemp) {
  460 + sectionsBpoints = pointsLngStr + " " + pointsLatStr;
  461 + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
  462 + }else {
  463 + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
  464 + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
  465 + }
  466 + }
  467 + Map<String, String> sectionCutMap = new HashMap<String, String>();
  468 + sectionCutMap.put("sectionName", sectionName);
  469 + sectionCutMap.put("sectionsBpoints", sectionsBpoints);
  470 + sectionCutMap.put("sectionsWJPpoints", sectionsWJPpoints);
  471 + sectionArrayList.add(sectionCutMap);
  472 + }
  473 + // 上一个路段的终点作为下一个路段的起点
  474 + firstTemp = lastTemp;
  475 + }
  476 + }
  477 + }
  478 +
  479 + /**
327 * @Description :TODO(编辑线路走向) 480 * @Description :TODO(编辑线路走向)
328 * 481 *
329 * @param map <sectionId:路段ID; sectionJSON:路段信息> 482 * @param map <sectionId:路段ID; sectionJSON:路段信息>
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -84,7 +84,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -84,7 +84,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
84 List<String> title = new ArrayList<String>(); 84 List<String> title = new ArrayList<String>();
85 title.add("线路ID"); 85 title.add("线路ID");
86 title.add("方向"); 86 title.add("方向");
87 - title.add("站点ID"); 87 + title.add("站点编码");
88 title.add("站点顺序号"); 88 title.add("站点顺序号");
89 title.add("站点备注"); 89 title.add("站点备注");
90 title.add("站点名称"); 90 title.add("站点名称");
@@ -1268,4 +1268,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -1268,4 +1268,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1268 } 1268 }
1269 return rs; 1269 return rs;
1270 } 1270 }
  1271 +
  1272 + // 更具线路批量撤销
  1273 + @Override
  1274 + public void batchUpdate(Integer lineId, String lineCode) {
  1275 + repository.batchUpdate(lineId,lineCode);
  1276 + }
1271 } 1277 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -60,6 +60,9 @@ import com.bsth.service.schedule.SchedulePlanInfoService; @@ -60,6 +60,9 @@ import com.bsth.service.schedule.SchedulePlanInfoService;
60 import com.bsth.service.sys.DutyEmployeeService; 60 import com.bsth.service.sys.DutyEmployeeService;
61 import com.bsth.util.*; 61 import com.bsth.util.*;
62 import com.bsth.websocket.handler.SendUtils; 62 import com.bsth.websocket.handler.SendUtils;
  63 +import com.github.stuxuhai.jpinyin.PinyinException;
  64 +import com.github.stuxuhai.jpinyin.PinyinFormat;
  65 +import com.github.stuxuhai.jpinyin.PinyinHelper;
63 import com.google.common.base.Splitter; 66 import com.google.common.base.Splitter;
64 import com.google.common.collect.Lists; 67 import com.google.common.collect.Lists;
65 import org.apache.commons.lang3.StringEscapeUtils; 68 import org.apache.commons.lang3.StringEscapeUtils;
@@ -2464,6 +2467,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2464,6 +2467,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2464 Map<String, Object> map = new HashMap<String, Object>(); 2467 Map<String, Object> map = new HashMap<String, Object>();
2465 if(list.size()>0){ 2468 if(list.size()>0){
2466 map.put("xlName", list.get(0).getXlName()); 2469 map.put("xlName", list.get(0).getXlName());
  2470 + try {
  2471 + map.put("xlNamePy", PinyinHelper.convertToPinyinString(list.get(0).getXlName(), "" , PinyinFormat.WITHOUT_TONE));
  2472 + } catch (PinyinException e) {
  2473 + // TODO Auto-generated catch block
  2474 + e.printStackTrace();
  2475 + }
2467 double jhyygl=culateService.culateJhgl(list);//计划营运公里 2476 double jhyygl=culateService.culateJhgl(list);//计划营运公里
2468 double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) 2477 double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里)
2469 map.put("jhlc", jhyygl); 2478 map.put("jhlc", jhyygl);
@@ -2480,8 +2489,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2480,8 +2489,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2480 map.put("sjzgl", Arith.add(zyygl, zksgl)); 2489 map.put("sjzgl", Arith.add(zyygl, zksgl));
2481 map.put("sjgl",zyygl); 2490 map.put("sjgl",zyygl);
2482 map.put("sjksgl", zksgl); 2491 map.put("sjksgl", zksgl);
2483 -  
2484 - map.put("ssgl", culateService.culateLbgl(list)); 2492 + double ssgl= culateService.culateLbgl(list);
  2493 + map.put("ssgl", ssgl);
  2494 +
  2495 + //计划+临加-少驶=实驶
  2496 + double jl=Arith.add(jhyygl, ljgl);
  2497 + if(Arith.sub(jl, ssgl)==sjyygl){
  2498 + map.put("zt", 0);
  2499 + }else{
  2500 + map.put("zt", 1);
  2501 + }
  2502 +
2485 map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); 2503 map.put("ssgl_lz", culateService.culateCJLC(list, "路阻"));
2486 map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); 2504 map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢"));
2487 map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); 2505 map.put("ssgl_gz", culateService.culateCJLC(list, "故障"));
@@ -2568,7 +2586,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2568,7 +2586,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2568 } 2586 }
2569 } 2587 }
2570 } 2588 }
2571 - 2589 +
  2590 + Collections.sort(lMap,new AccountXlbm());
2572 Map<String, Object> map = new HashMap<String, Object>(); 2591 Map<String, Object> map = new HashMap<String, Object>();
2573 map.put("xlName", "合计"); 2592 map.put("xlName", "合计");
2574 double jhyygl=culateService.culateJhgl(list);//计划营运公里 2593 double jhyygl=culateService.culateJhgl(list);//计划营运公里
@@ -2587,7 +2606,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2587,7 +2606,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2587 map.put("sjzgl", Arith.add(zyygl, zksgl)); 2606 map.put("sjzgl", Arith.add(zyygl, zksgl));
2588 map.put("sjgl",zyygl); 2607 map.put("sjgl",zyygl);
2589 map.put("sjksgl", zksgl); 2608 map.put("sjksgl", zksgl);
2590 - map.put("ssgl", culateService.culateLbgl(list)); 2609 +
  2610 + double ssgl= culateService.culateLbgl(list);
  2611 + map.put("ssgl", ssgl);
  2612 + //计划+临加-少驶=实驶
  2613 + double jl=Arith.add(jhyygl, ljgl);
  2614 + if(Arith.sub(jl, ssgl)==sjyygl){
  2615 + map.put("zt", 0);
  2616 + }else{
  2617 + map.put("zt", 1);
  2618 + }
2591 map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); 2619 map.put("ssgl_lz", culateService.culateCJLC(list, "路阻"));
2592 map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); 2620 map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢"));
2593 map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); 2621 map.put("ssgl_gz", culateService.culateCJLC(list, "故障"));
@@ -4942,3 +4970,14 @@ class AccountMap2 implements Comparator&lt;Map&lt;String, Object&gt;&gt;{ @@ -4942,3 +4970,14 @@ class AccountMap2 implements Comparator&lt;Map&lt;String, Object&gt;&gt;{
4942 return o2.get("clZbh").toString().compareTo(o1.get("clZbh").toString()); 4970 return o2.get("clZbh").toString().compareTo(o1.get("clZbh").toString());
4943 } 4971 }
4944 } 4972 }
  4973 +
  4974 +class AccountXlbm implements Comparator<Map<String, Object>>{
  4975 + @Override
  4976 + public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  4977 + // TODO Auto-generated method stub
  4978 +// PinyinHelper.convertToPinyinString(ppy.getName(),
  4979 +// "" , PinyinFormat.WITHOUT_TONE)
  4980 + return o1.get("xlNamePy").toString().compareTo(
  4981 + o2.get("xlNamePy").toString());
  4982 + }
  4983 +}
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
@@ -882,7 +882,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -882,7 +882,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
882 else if(isInOut(sch)) 882 else if(isInOut(sch))
883 continue; 883 continue;
884 //主任务烂班 884 //主任务烂班
885 - else if(sch.getStatus() == -1){ 885 + else if(sch.getStatus() == -1 && !sch.isCcService()){
886 if(sch.getAdjustExps().equals(item) || 886 if(sch.getAdjustExps().equals(item) ||
887 (StringUtils.isEmpty(sch.getAdjustExps()) && item.equals("其他"))){ 887 (StringUtils.isEmpty(sch.getAdjustExps()) && item.equals("其他"))){
888 sum = Arith.add(sum, sch.getJhlcOrig()); 888 sum = Arith.add(sum, sch.getJhlcOrig());
src/main/resources/static/pages/base/line/editRoute.html
1 <!-- 手动添加站点 --> 1 <!-- 手动添加站点 -->
2 -<div class="modal fade" id="edit_route_mobal" tabindex="-1" role="basic" aria-hidden="true">  
3 - 2 +<div class="modal fade" id="edit_route_mobal" tabindex="-1" role="basic"
  3 + aria-hidden="true">
  4 +
4 <div class="modal-dialog"> 5 <div class="modal-dialog">
5 - 6 +
6 <div class="modal-content"> 7 <div class="modal-content">
7 - 8 +
8 <div class="modal-header"> 9 <div class="modal-header">
9 - <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> 10 + <button type="button" class="close" data-dismiss="modal"
  11 + aria-hidden="true"></button>
10 <h4 class="modal-title">生成路线(站点和路段)</h4> 12 <h4 class="modal-title">生成路线(站点和路段)</h4>
11 </div> 13 </div>
12 - 14 +
13 <div class="modal-body"> 15 <div class="modal-body">
14 -  
15 - <form class="form-horizontal" role="form" id="save_route_template_form" action="" method="">  
16 -  
17 - <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> 16 +
  17 + <form class="form-horizontal" role="form"
  18 + id="save_route_template_form" action="" method="">
  19 +
  20 + <div class="alert alert-danger display-hide">
  21 + <button class="close" data-close="alert"></button>
18 您的输入有误,请检查下面的输入项 22 您的输入有误,请检查下面的输入项
19 </div> 23 </div>
20 - 24 +
21 <!-- 站点名称 --> 25 <!-- 站点名称 -->
22 <div class="form-body"> 26 <div class="form-body">
23 - 27 +
24 <div class="form-group"> 28 <div class="form-group">
25 - <label class="control-label col-md-2">  
26 - <span class="required"> * </span> 坐标:  
27 - </label> 29 + <label class="control-label col-md-2"> <span
  30 + class="required"> * </span> 坐标:
  31 + </label>
28 <div class="col-md-10"> 32 <div class="col-md-10">
29 - <textarea class="form-control" rows="12" name="points" id="pointInput" placeholder="坐标点"></textarea> 33 + <textarea class="form-control" rows="12" name="points"
  34 + id="pointInput" placeholder="坐标点"></textarea>
30 </div> 35 </div>
31 - </div> 36 + </div>
32 </div> 37 </div>
33 <div class="form-group"> 38 <div class="form-group">
34 <label class="col-md-3 control-label">选择方向:</label> 39 <label class="col-md-3 control-label">选择方向:</label>
35 <div class="col-md-9"> 40 <div class="col-md-9">
36 <div class="icheck-list"> 41 <div class="icheck-list">
37 - <label>  
38 - <input type="radio" class="icheck" name="dirCheck" value='0' checked> 上行  
39 - </label>  
40 - <label>  
41 - <input type="radio" class="icheck" name="dirCheck" value='1' > 下行 42 + <label> <input type="radio" class="icheck"
  43 + name="dirCheck" value='0' checked> 上行
  44 + </label> <label> <input type="radio" class="icheck"
  45 + name="dirCheck" value='1'> 下行
42 </label> 46 </label>
43 </div> 47 </div>
44 </div> 48 </div>
45 </div> 49 </div>
46 - <div class="form-group">  
47 - <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">  
48 - <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 坐标生成路线规划说明: </span></h5>  
49 - <p>  
50 - <span class="help-block" style="color:#1bbc9b;">  
51 - &nbsp;请在文本域中按顺序依次输坐标点(如果是站点,请将在坐标后面用【Tab】键隔开后加(站点名/stop);没有(站点名/stop)默认是路段点),每输入完一个坐标时请按回车键【Enter】换行.  
52 - 例如:<br>  
53 - 121.715623 31.224058 042408.000<br>  
54 - 121.715623 31.224065 042409.000 Stop<br>  
55 - 121.715623 31.224065 042410.000<br>  
56 - </span>  
57 - </p>  
58 - </div>  
59 - </div> 50 + <div class="form-group">
  51 + <div class="alert alert-info font-blue-chambray"
  52 + style="background-color: #2C3E50">
  53 + <h5 class="block">
  54 + <span class="help-block" style="color: #1bbc9b;"> *
  55 + 坐标生成路线规划说明: </span>
  56 + </h5>
  57 + <p>
  58 + <span class="help-block" style="color: #1bbc9b;">
  59 + &nbsp;请在文本域中按顺序依次输坐标点,每行中的数据之间用【Tab】键隔开(如果是站点,请将在坐标后面加 stop;没有
  60 + stop默认是路段点),每输入完一个坐标时请按回车键【Enter】换行. 例如:<!-- <br> 121.715623
  61 + 31.224058 042408.000<br> 121.715623 31.224065 042409.000
  62 + Stop<br> 121.715623 31.224065 042410.000<br> -->
  63 + <br>121.511870 31.180638 043703.000
  64 + <br>121.511870 31.180643 043705.000
  65 + <br>121.511870 31.180648 043706.000 Stop
  66 + <br>121.511872 31.180653 043707.000
  67 + <br>121.511873 31.180658 043708.000
  68 + </span>
  69 + </p>
  70 + </div>
  71 + </div>
60 </form> 72 </form>
61 </div> 73 </div>
62 <div class="modal-footer"> 74 <div class="modal-footer">
63 - <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button> 75 + <button type="button" class="btn default" data-dismiss="modal"
  76 + id="addMobalHiden">取消</button>
64 <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button> 77 <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button>
65 </div> 78 </div>
66 </div> 79 </div>
@@ -139,20 +152,21 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m @@ -139,20 +152,21 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
139 var directionData = $("input[name='dirCheck']:checked").val(); 152 var directionData = $("input[name='dirCheck']:checked").val();
140 editRoute.setLineDir(directionData); 153 editRoute.setLineDir(directionData);
141 // 弹出正在加载层 154 // 弹出正在加载层
142 - var i = layer.load(0,{offset:['200px', '280px']}); 155 + var i = layer.load(2);
143 // 表单序列化 156 // 表单序列化
144 var paramsForm = form.serializeJSON(); 157 var paramsForm = form.serializeJSON();
145 // 切割坐标点 158 // 切割坐标点
146 var array = paramsForm.points.split('\r\n'); 159 var array = paramsForm.points.split('\r\n');
147 // 把坐标点转换为站点或路段 160 // 把坐标点转换为站点或路段
148 var arrayFormat = inputStationValueFormat(array); 161 var arrayFormat = inputStationValueFormat(array);
149 - var stationList = arrayFormat.stationList; 162 + var stationList = arrayFormat.stationList;
150 var sectionListTemp = arrayFormat.sectionList; 163 var sectionListTemp = arrayFormat.sectionList;
151 var sectionList = []; 164 var sectionList = [];
152 // 隔30个取一个点(相当于30s) 165 // 隔30个取一个点(相当于30s)
153 for(var i = 0; i*30 < sectionListTemp.length; i++) { 166 for(var i = 0; i*30 < sectionListTemp.length; i++) {
154 sectionList[i] = sectionListTemp[i*30]; 167 sectionList[i] = sectionListTemp[i*30];
155 } 168 }
  169 + sectionList[sectionList.length] = sectionListTemp[sectionListTemp.length-1];
156 170
157 var sectionListFinal = []; 171 var sectionListFinal = [];
158 sectionListFinal.push({sectionName : lineNameV, points : sectionList}); 172 sectionListFinal.push({sectionName : lineNameV, points : sectionList});
@@ -227,7 +241,7 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m @@ -227,7 +241,7 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
227 } 241 }
228 for(var i = 0 ;i<sectionList.length;i++) { 242 for(var i = 0 ;i<sectionList.length;i++) {
229 if(sectionList[i] == "" || typeof(sectionList[i]) == "undefined" || sectionList[i] == null) { 243 if(sectionList[i] == "" || typeof(sectionList[i]) == "undefined" || sectionList[i] == null) {
230 - sectionList.splice(i,1); 244 + sectionList.splice(i,1);//删除数组中下表i-i+1之间的值
231 i= i-1; 245 i= i-1;
232 } 246 }
233 247
src/main/resources/static/pages/base/line/js/line-add-form.js
@@ -94,13 +94,13 @@ $(function(){ @@ -94,13 +94,13 @@ $(function(){
94 // 需要验证的表单元素 94 // 需要验证的表单元素
95 rules : { 95 rules : {
96 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. 96 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度.
97 - 'lineCode' : {required : true,maxlength: 6,digits:true ,remote:{type: 'GET',  
98 - url: '/line/lineCodeVerification',  
99 - data:{'lineCode':function(){ return $("#lineCodeInput").val();}},  
100 - dataFilter: function (data,type) {  
101 - return data; //要返回data 否则会影响到后续验证 并且阻碍提交【即使验证通过】,也不会提交  
102 - },  
103 - delay: 2000}},// 线路编码 必填项、最大长度. 97 + 'lineCode' : {required : true,maxlength: 6,digits:true ,
  98 + remote:{type: 'GET',
  99 + url: '/line/lineCodeVerification',
  100 + cache:false,
  101 + async:false,
  102 + data:{'lineCode':function(){ return $("#lineCodeInput").val();}}
  103 + }},// 线路编码 必填项、最大长度.
104 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. 104 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度.
105 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. 105 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度.
106 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. 106 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度.
src/main/resources/static/pages/base/line/js/line-list-map.js
@@ -120,7 +120,6 @@ var WorldsBMapLine = function () { @@ -120,7 +120,6 @@ var WorldsBMapLine = function () {
120 var index = parseInt(arguments.callee.count) - 1; 120 var index = parseInt(arguments.callee.count) - 1;
121 121
122 if (index >= len-1) { 122 if (index >= len-1) {
123 -  
124 callback && callback(points); 123 callback && callback(points);
125 124
126 return; 125 return;
src/main/resources/static/pages/base/line/js/line-list-table.js
@@ -347,27 +347,14 @@ @@ -347,27 +347,14 @@
347 return ; 347 return ;
348 }else { 348 }else {
349 id = arrChk.data('id'); 349 id = arrChk.data('id');
350 - /*$('#uploadRoute').on('click', function() {  
351 - EditRoute.setLineId(id);  
352 - EditRoute.setLineDir(direction);  
353 - $.get('editRoute.html', function(m){  
354 - $(pjaxContainer).append(m);  
355 - $('#edit_route_mobal').trigger('editRouteMobal.show',[TransGPS,EditRoute,WorldsBMapLine,DrawingManagerObj,GetAjaxData,PublicFunctions]);  
356 - });  
357 - // 更新section_table 和缓存中的一切过的点数  
358 - WorldsBMapLine.initCutSectionPoint();  
359 - WorldsBMapLine.setPointIndex(0);  
360 - });*/  
361 - // 设置路线的线路id  
362 - //var a = EditRoute.setLineId(id);  
363 - // 显示地图  
364 - /*var param = {};  
365 - var list = [1,2,3];  
366 - param.id = id;  
367 - param.list = list;  
368 -  
369 - $get('/pages/base/line/map.html',param);*/  
370 - window.location.href = "/pages/base/line/map.html?no="+id; 350 + $.get('/lineVersions/findByLineId',{'lineId':id},function(lineVersions){
  351 + if(lineVersions != null && lineVersions != "") {
  352 + window.location.href = "/pages/base/line/map.html?no="+id;
  353 + } else {
  354 + layer.msg('此线路没有线路版本,请先到线路版本信息页面添加改线路版本!');
  355 + return ;
  356 + }
  357 + });
371 } 358 }
372 }); 359 });
373 360
src/main/resources/static/pages/base/line/list.html
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 <a href="javascript:;" data-action="1" id="editRoute" class="tool-action"> <i class="fa fa-level-up"></i>上传GPS生成路线</a> 41 <a href="javascript:;" data-action="1" id="editRoute" class="tool-action"> <i class="fa fa-level-up"></i>上传GPS生成路线</a>
42 </li> 42 </li>
43 <li> 43 <li>
44 - <a href="javascript:;" data-action="2" id="exportStation" class="tool-action"> <i class="fa fa-level-up"></i>导出线路站点Excel</a> 44 + <a href="javascript:;" data-action="2" id="exportStation" class="tool-action"> <i class="fa fa-level-down"></i>导出线路站点Excel</a>
45 </li> 45 </li>
46 <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印 46 <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印
47 </a></li> 47 </a></li>
src/main/resources/static/pages/base/line/map.html
1 -< <link href="/pages/base/line/css/bmap_base.css" rel="stylesheet" type="text/css" /> 1 +<
  2 +<link href="/pages/base/line/css/bmap_base.css" rel="stylesheet"
  3 + type="text/css" />
2 <div class="portlet-body"> 4 <div class="portlet-body">
3 <!-- 地图 --> 5 <!-- 地图 -->
4 - <div id="bmap_basic" class="bmaps"></div> 6 + <div id="bmap_basic" class="bmaps"></div>
5 <!-- 右边显示栏 --> 7 <!-- 右边显示栏 -->
6 <div class="cut-section" id="scrllmouseEvent_div"> 8 <div class="cut-section" id="scrllmouseEvent_div">
7 - <div class="portlet-title" >  
8 - <div class="caption" >  
9 - 途径站点 9 + <div class="portlet-title">
  10 + <div class="caption">途径站点</div>
  11 + </div>
  12 + <div class="portlet-body">
  13 + <div class="table-toolbar" style="text-align: center;" id="upload">
  14 + <button class="btn btn-circle blue" id="uploadRoute">
  15 + <i class="fa fa-plus"></i> 生成路线
  16 + </button>
10 </div> 17 </div>
11 - </div>  
12 - <div class="portlet-body">  
13 - <div class="table-toolbar" style="text-align:center;" id="upload">  
14 - <button class="btn btn-circle blue" id="uploadRoute" ><i class="fa fa-plus"></i> 生成路线 </button>  
15 - </div>  
16 - <div class="portlet-body hidden" id="upload_show">  
17 - <div class="defeat-scroll" style="height: auto;max-height:600px;overflow-y:auto; border-left: 10px;">  
18 - <table class="table table-bordered table-hover table-checkable " id="section_table" style="color:#B7B7B7;"> 18 + <div class="portlet-body hidden" id="upload_show">
  19 + <div class="defeat-scroll"
  20 + style="height: auto; max-height: 600px; overflow-y: auto; border-left: 10px;">
  21 + <table class="table table-bordered table-hover table-checkable "
  22 + id="section_table" style="color: #B7B7B7;">
19 <thead> 23 <thead>
20 <tr role="row" class="heading"> 24 <tr role="row" class="heading">
21 - <th >截取路段</th> 25 + <th>截取路段</th>
22 </tr> 26 </tr>
23 </thead> 27 </thead>
24 <tbody></tbody> 28 <tbody></tbody>
25 </table> 29 </table>
26 </div> 30 </div>
27 - <div class="table-toolbar" style="text-align:center;">  
28 - <button class="btn btn-circle blue" id="cutSection">提交路段</button>  
29 - <button class="btn btn-circle blue" id="Undo">撤销切点</button>  
30 - </div>  
31 - </div> 31 + <div class="table-toolbar" style="text-align: center;">
  32 + <button class="btn btn-circle blue" id="cutSection">提交选项</button>
  33 + <button class="btn btn-circle blue" id="Undo">撤销切点</button>
  34 + </div>
  35 + </div>
32 </div> 36 </div>
33 </div> 37 </div>
34 </div> 38 </div>
@@ -45,8 +49,9 @@ @@ -45,8 +49,9 @@
45 </tr> 49 </tr>
46 {{/if}} 50 {{/if}}
47 </script> 51 </script>
48 -<!--上传GPS坐标生成路线监听事件 -->  
49 -<<script type="text/javascript"> 52 +<!--上传GPS坐标生成路线监听事件 -->
  53 +<
  54 +<script type="text/javascript">
50 $(function(){ 55 $(function(){
51 // 关闭左侧栏 56 // 关闭左侧栏
52 if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} 57 if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
@@ -111,7 +116,16 @@ $(function(){ @@ -111,7 +116,16 @@ $(function(){
111 // 提交截取事件 116 // 提交截取事件
112 $('#cutSection').on('click', function() { 117 $('#cutSection').on('click', function() {
113 if(WorldsBMapLine.getPointIndex() > 0) { 118 if(WorldsBMapLine.getPointIndex() > 0) {
114 - layer.confirm('提交会把原有的站点和路段覆盖,您确定要提交吗?', { 119 + var sectionList = WorldsBMapLine.getSectionList();
  120 + var data = {};
  121 + var section = EditSectionObj.getEitdSection();
  122 + var josnSectionList = JSON.stringify(sectionList);
  123 + section.cutSectionList = josnSectionList;
  124 + $.get('submit_select.html', function(m){
  125 + $(pjaxContainer).append(m);
  126 + $('#submit_select_mobal').trigger('submitSelectMobal.show',[section,EditRoute]);
  127 + });
  128 + /* layer.confirm('提交会把原有的站点和路段覆盖,您确定要提交吗?', {
115 btn: ['提交','取消'] //按钮 129 btn: ['提交','取消'] //按钮
116 }, function(){ 130 }, function(){
117 var sectionList = WorldsBMapLine.getSectionList(); 131 var sectionList = WorldsBMapLine.getSectionList();
@@ -131,7 +145,7 @@ $(function(){ @@ -131,7 +145,7 @@ $(function(){
131 layer.msg('提交失败...'); 145 layer.msg('提交失败...');
132 } 146 }
133 }); 147 });
134 - }); 148 + }); */
135 } else { 149 } else {
136 layer.msg("请先截取路段!!!"); 150 layer.msg("请先截取路段!!!");
137 } 151 }
@@ -170,11 +184,11 @@ $(function(){ @@ -170,11 +184,11 @@ $(function(){
170 }).on('mouseleave',function() { 184 }).on('mouseleave',function() {
171 $('.defeat-scroll').css('overflow','hidden'); 185 $('.defeat-scroll').css('overflow','hidden');
172 }); 186 });
173 -}); 187 +});
174 </script> 188 </script>
175 <!--编辑路线类 --> 189 <!--编辑路线类 -->
176 <script src="/pages/base/line/js/editRoute.js"></script> 190 <script src="/pages/base/line/js/editRoute.js"></script>
177 - <!--坐标转换类 --> 191 +<!--坐标转换类 -->
178 <script src="/pages/base/line/js/transGPS.js"></script> 192 <script src="/pages/base/line/js/transGPS.js"></script>
179 <!-- 地图类 --> 193 <!-- 地图类 -->
180 <script src="/pages/base/line/js/line-list-map.js"></script> 194 <script src="/pages/base/line/js/line-list-map.js"></script>
src/main/resources/static/pages/base/line/submit_select.html 0 → 100644
  1 +<!-- 提交选项 -->
  2 +<div class="modal fade" id="submit_select_mobal" tabindex="-1"
  3 + role="basic" aria-hidden="true">
  4 + <div class="modal-dialog">
  5 + <div class="modal-content">
  6 + <div class="modal-header">
  7 + <button type="button" class="close" data-dismiss="modal"
  8 + aria-hidden="true"></button>
  9 + <h4 class="modal-title">
  10 + 提交选项
  11 + </h4>
  12 + </div>
  13 + <div class="modal-body">
  14 + <form class="form-horizontal" action="/" method="post"
  15 + id="formBootbox" role="form">
  16 +
  17 + <div class="form-group">
  18 + <label class="col-md-3 control-label">选择版本:</label>
  19 + <div class="col-md-9">
  20 + <select class="form-control" name="lineVersions" id="lineVersions" style="width: 370px;"></select>
  21 + </div>
  22 + </div>
  23 + </form>
  24 + </div>
  25 + <div class="modal-footer">
  26 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  27 + <button type="button" class="btn btn-primary"
  28 + id="submitSelectnextButton">提交</button>
  29 + </div>
  30 + </div>
  31 + </div>
  32 +</div>
  33 +<script type="text/javascript">
  34 + $('#submit_select_mobal').on('submitSelectMobal.show',function(e,section) {
  35 + // 加载显示mobal
  36 + $('#submit_select_mobal').modal({
  37 + show : true,
  38 + backdrop : 'static',
  39 + keyboard : false
  40 + });
  41 + // 给版本号下拉框赋值
  42 + $.get('/lineVersions/findByLineId',{'lineId':section.sectionrouteLine},function(lineVersions){
  43 + var options = "";
  44 + $.each(lineVersions, function () {
  45 + var startDate;
  46 + if(this.startDate != "" && this.startDate != null){
  47 + startDate = moment(this.startDate).format('YYYY-MM-DD HH:mm:ss');
  48 + } else {
  49 + startDate = "无";
  50 + }
  51 + if(this.status==1){
  52 + //当前版本为默认
  53 + options += '<option value="'+this.versions+','+this.status+','+startDate+'" > 版本'+this.versions+' 启用时间:'+startDate+' 当前版本</option>';
  54 + } else if(this.status==2){
  55 + options += '<option value="'+this.versions+','+this.status+','+startDate+'" selected = "selected"> 版本'+this.versions+' 启用时间:'+startDate+' 待更新版本</option>';
  56 + }
  57 + });
  58 + $('#lineVersions').html(options);
  59 + });
  60 +
  61 + // 获取表单元素
  62 + var form = $('#formBootbox');
  63 + // 下一步点击事件
  64 + $('#submitSelectnextButton').on('click', function() {
  65 + // 表单提交
  66 + form.submit();
  67 + });
  68 + // 表单验证
  69 + form.validate({
  70 + // 表单序列化
  71 + submitHandler : function(f) {
  72 + var lineVersions = $('#lineVersions').val();
  73 + var line = lineVersions.split(",");
  74 + // 即时更新
  75 + if(line[1] == 1) {
  76 + section.versions = line[0];
  77 + // 隐藏选项mobal
  78 + $('#submit_select_mobal').modal('hide');
  79 + layer.confirm('提交马上会把原有的站点和路段覆盖,您确定要提交吗?', {
  80 + btn: ['提交','取消'] //按钮
  81 + }, function(){
  82 + $.post('/section/sectionCut', section, function(resuntDate){
  83 + if(resuntDate.status=='SUCCESS') {
  84 + // 弹出添加成功提示消息
  85 + layer.msg('提交成功,跳转到线路详情页面!');
  86 + window.location.href = "/pages/base/stationroute/list.html?no="+section.sectionrouteLine+","+section.sectionrouteDirections;
  87 + }else {
  88 + // 弹出添加失败提示消息
  89 + layer.msg('提交失败...');
  90 + }
  91 + });
  92 + });
  93 + // 定时更新
  94 + } else if(line[1] == 2) {
  95 + section.versions = line[0];
  96 + // 隐藏选项mobal
  97 + $('#submit_select_mobal').modal('hide');
  98 + layer.confirm('提交后线路将在'+line[2]+'时间以后启用您提交的版本:'+line[0], {
  99 + btn: ['提交','取消'] //按钮
  100 + }, function(rs){
  101 + $.post('/section/sectionCutSaveLineLS', section, function(resuntDate){
  102 + if(resuntDate.status=='SUCCESS') {
  103 + // 关闭提示弹出层
  104 + layer.close(rs);
  105 + // 弹出添加成功提示消息
  106 + layer.msg('提交成功!');
  107 + // 返回线路list页面
  108 + loadPage('/pages/base/line/list.html');
  109 +// window.location.href = "/pages/base/stationroute/list.html?no="+section.sectionrouteLine+","+section.sectionrouteDirections;
  110 + }else {
  111 + // 弹出添加失败提示消息
  112 + layer.msg('提交失败...');
  113 + }
  114 + });
  115 + });
  116 + }
  117 + }
  118 + });
  119 + });
  120 +</script>
0 \ No newline at end of file 121 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/add.html 0 → 100644
  1 +<!-- 片段标题 START -->
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>修改添加信息</h1>
  5 + </div>
  6 +</div>
  7 +<!-- 片段标题 END -->
  8 +
  9 +<!-- 线路信息导航栏组件 START -->
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  13 + <li><a href="/pages/base/line/list.html" data-pjax>线路信息</a> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">修改添加信息</span></li>
  15 +</ul>
  16 +<!-- 线路信息导航栏组件 END -->
  17 +
  18 +<!-- 信息容器组件 START -->
  19 +<div class="portlet light bordered">
  20 +
  21 + <!-- 信息容器组件标题 START -->
  22 + <div class="portlet-title">
  23 + <div class="caption">
  24 + <i class="icon-equalizer font-red-sunglo"></i>
  25 + <span class="caption-subject font-red-sunglo bold uppercase">添加线路信息</span>
  26 + </div>
  27 + </div>
  28 + <!-- 信息容器组件标题 END -->
  29 +
  30 + <!-- 表单容器组件 START -->
  31 + <div class="portlet-body form" id="lineEditForm">
  32 +
  33 + <!-- START FORM -->
  34 + <form action="/lineVersions" class="form-horizontal" id="lineVersions_add_form" >
  35 +
  36 + <!-- 错误提示信息组件 START -->
  37 + <div class="alert alert-danger display-hide">
  38 + <button class="close" data-close="alert"></button>
  39 + 您的输入有误,请检查下面的输入项
  40 + </div>
  41 + <!-- 错误提示信息组件 END -->
  42 +
  43 + <!-- 表单内容 START -->
  44 + <div class="form-body">
  45 + <input type="hidden" name="lineId" id="lineIdInput" />
  46 + <input type="hidden" name="lineCode" id="lineCodeInput" />
  47 +
  48 + <!-- 表单分组组件 form-group START -->
  49 + <div class="form-group">
  50 + <label class="control-label col-md-5">
  51 + <span class="required"> * </span>线路名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  52 + </label>
  53 + <div class="col-md-4">
  54 + <select name="line" class="form-control" style="width:100%" id="lineSelect"></select>
  55 + </div>
  56 + </div>
  57 + <!-- 表单分组组件 form-group END -->
  58 +
  59 + <!-- 表单分组组件 form-group START -->
  60 + <div class="form-group">
  61 + <label class="control-label col-md-5">
  62 + <span class="required"> * </span>启用时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  63 + </label>
  64 + <div class="col-md-4">
  65 + <input type="text" class="form-control" name="startDate" id="startDateInput" />
  66 + </div>
  67 + </div>
  68 + <!-- 表单分组组件 form-group END -->
  69 +
  70 + <!-- 表单分组组件 form-group START -->
  71 + <div class="form-group">
  72 + <label class="control-label col-md-5">
  73 + <span class="required"> * </span>终止时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  74 + </label>
  75 + <div class="col-md-4">
  76 + <input type="text" class="form-control" name="endDate" id="endDateInput" />
  77 + </div>
  78 + </div>
  79 + <!-- 表单分组组件 form-group END -->
  80 +
  81 + <!-- 表单分组组件 form-group START -->
  82 + <div class="form-group">
  83 + <label class="control-label col-md-5">
  84 + <span class="required"> * </span>线路版本&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  85 + </label>
  86 + <div class="col-md-4">
  87 + <input type="text" class="form-control" name="versions" id="versionsInput" placeholder="线路版本" />
  88 + </div>
  89 + </div>
  90 + <!-- 表单分组组件 form-group END -->
  91 +
  92 + <div class="form-group">
  93 + <label class="control-label col-md-5">
  94 + <span class="required"> * </span>线路版本状态&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  95 + </label>
  96 + <div class="col-md-4">
  97 + <select name="status" class="form-control" id="statusInput">
  98 + <option value="">请选择...</option>
  99 + <option value="1">当前版本</option>
  100 + <option value="2">待更新版本</option>
  101 + <option value="0">历史版本</option>
  102 + </select>
  103 + </div>
  104 + </div>
  105 +
  106 + <!-- 表单分组组件 form-group START -->
  107 + <div class="form-group">
  108 + <label class="control-label col-md-5"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  109 + <div class="col-md-4">
  110 + <textarea class="form-control" rows="3" name="remark" id="remarkTextarea" placeholder="请填写更换版本原因,方便排班人员操作!"></textarea>
  111 + </div>
  112 + </div>
  113 + <!-- 表单分组组件 form-group END -->
  114 + </div>
  115 +
  116 + <!-- 表单按钮组件 START -->
  117 + <div class="form-actions">
  118 + <div class="row">
  119 + <div class="col-md-offset-5 col-md-7">
  120 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  121 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  122 + </div>
  123 + </div>
  124 + </div>
  125 + <!-- 表单按钮组件 END -->
  126 + </form>
  127 + <!-- END FORM-->
  128 + </div>
  129 + <!-- 表单组件 END -->
  130 +</div>
  131 +<!-- 信息容器组件 END -->
  132 +
  133 +<!-- 线路信息添加片段JS模块 -->
  134 +<script src="/pages/base/lineversions/js/lineversions-add-from.js"></script>
0 \ No newline at end of file 135 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/edit.html 0 → 100644
  1 +<!-- 片段标题 START -->
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>修改线路信息</h1>
  5 + </div>
  6 +</div>
  7 +<!-- 片段标题 END -->
  8 +
  9 +<!-- 线路信息导航栏组件 START -->
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  13 + <li><a href="/pages/base/line/list.html" data-pjax>线路信息</a> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">修改线路信息</span></li>
  15 +</ul>
  16 +<!-- 线路信息导航栏组件 END -->
  17 +
  18 +<!-- 信息容器组件 START -->
  19 +<div class="portlet light bordered">
  20 +
  21 + <!-- 信息容器组件标题 START -->
  22 + <div class="portlet-title">
  23 + <div class="caption">
  24 + <i class="icon-equalizer font-red-sunglo"></i>
  25 + <span class="caption-subject font-red-sunglo bold uppercase">修改线路信息</span>
  26 + </div>
  27 + </div>
  28 + <!-- 信息容器组件标题 END -->
  29 +
  30 + <!-- 表单容器组件 START -->
  31 + <div class="portlet-body form" id="lineEditForm">
  32 +
  33 + <!-- START FORM -->
  34 + <form action="/lineVersions" class="form-horizontal" id="lineVersions_edit_form" >
  35 +
  36 + <!-- 错误提示信息组件 START -->
  37 + <div class="alert alert-danger display-hide">
  38 + <button class="close" data-close="alert"></button>
  39 + 您的输入有误,请检查下面的输入项
  40 + </div>
  41 + <!-- 错误提示信息组件 END -->
  42 +
  43 + <!-- 表单内容 START -->
  44 + <div class="form-body">
  45 + <input type="hidden" name="lineId" id="lineIdInput" />
  46 + <input type="hidden" name="lineCode" id="lineCodeInput" />
  47 +
  48 + <!-- 表单分组组件 form-group START -->
  49 + <div class="form-group">
  50 + <label class="control-label col-md-5">
  51 + <span class="required"> * </span>线路版本Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  52 + </label>
  53 + <div class="col-md-4">
  54 + <input type="text" class="form-control" name="Id" id="IdInput" readonly="readonly" />
  55 + </div>
  56 + </div>
  57 + <!-- 表单分组组件 form-group END -->
  58 +
  59 + <!-- 表单分组组件 form-group START -->
  60 + <div class="form-group">
  61 + <label class="control-label col-md-5">
  62 + <span class="required"> * </span>线路名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  63 + </label>
  64 + <div class="col-md-4">
  65 + <select name="line" class="form-control" style="width:100%" id="lineSelect"></select>
  66 + </div>
  67 + </div>
  68 + <!-- 表单分组组件 form-group END -->
  69 +
  70 + <!-- 表单分组组件 form-group START -->
  71 + <div class="form-group">
  72 + <label class="control-label col-md-5">
  73 + <span class="required"> * </span>启用时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  74 + </label>
  75 + <div class="col-md-4">
  76 + <input type="text" class="form-control" name="startDate" id="startDateInput" />
  77 + </div>
  78 + </div>
  79 + <!-- 表单分组组件 form-group END -->
  80 +
  81 + <!-- 表单分组组件 form-group START -->
  82 + <div class="form-group">
  83 + <label class="control-label col-md-5">
  84 + <span class="required"> * </span>终止时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  85 + </label>
  86 + <div class="col-md-4">
  87 + <input type="text" class="form-control" name="endDate" id="endDateInput" />
  88 + </div>
  89 + </div>
  90 + <!-- 表单分组组件 form-group END -->
  91 +
  92 + <!-- 表单分组组件 form-group START -->
  93 + <div class="form-group">
  94 + <label class="control-label col-md-5">
  95 + <span class="required"> * </span>线路版本&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  96 + </label>
  97 + <div class="col-md-4">
  98 + <input type="text" class="form-control" name="versions" id="versionsInput" placeholder="线路版本" />
  99 + </div>
  100 + </div>
  101 + <!-- 表单分组组件 form-group END -->
  102 +
  103 + <div class="form-group">
  104 + <label class="control-label col-md-5">
  105 + <span class="required"> * </span>线路版本状态&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  106 + </label>
  107 + <div class="col-md-4">
  108 + <select name="status" class="form-control" id="statusInput">
  109 + <option value="">请选择...</option>
  110 + <option value="1">当前版本</option>
  111 + <option value="2">待更新版本</option>
  112 + <option value="0">历史版本</option>
  113 + </select>
  114 + </div>
  115 + </div>
  116 +
  117 + <!-- 表单分组组件 form-group START -->
  118 + <div class="form-group">
  119 + <label class="control-label col-md-5"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  120 + <div class="col-md-4">
  121 + <textarea class="form-control" rows="3" name="remark" id="remarkTextarea" placeholder="请填写更换版本原因,方便排班人员操作!"></textarea>
  122 + </div>
  123 + </div>
  124 + <!-- 表单分组组件 form-group END -->
  125 + </div>
  126 +
  127 + <!-- 表单按钮组件 START -->
  128 + <div class="form-actions">
  129 + <div class="row">
  130 + <div class="col-md-offset-5 col-md-7">
  131 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  132 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  133 + </div>
  134 + </div>
  135 + </div>
  136 + <!-- 表单按钮组件 END -->
  137 + </form>
  138 + <!-- END FORM-->
  139 + </div>
  140 + <!-- 表单组件 END -->
  141 +</div>
  142 +<!-- 信息容器组件 END -->
  143 +
  144 +<!-- 线路信息修改片段JS模块 -->
  145 +<script src="/pages/base/lineversions/js/lineversions-edit-from.js"></script>
0 \ No newline at end of file 146 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/js/lineversions-add-from.js 0 → 100644
  1 +// 线路版本添加js
  2 +(function(){
  3 + //获取参数ID
  4 + var id = $.url().param('no');
  5 +
  6 + $("#startDateInput").datetimepicker({
  7 + format : 'YYYY-MM-DD HH:mm:ss',
  8 + locale : 'zh-cn'
  9 + });
  10 +
  11 + $("#endDateInput").datetimepicker({
  12 + format : 'YYYY-MM-DD HH:mm:ss',
  13 + locale : 'zh-cn'
  14 + });
  15 + // 初始化线路名称select
  16 + lineAllInfo();
  17 +
  18 + function getComp (cb) {
  19 + $.get('/user/companyData',null,function(rs) {
  20 + var params = {};
  21 + if(rs.length>0) {
  22 + var compA = new Array();
  23 + for(var c = 0 ; c<rs.length;c++) {
  24 + var comC = rs[c].companyCode;
  25 + var child = rs[c].children;
  26 + if(child.length>0) {
  27 + for(var d = 0 ;d< child.length;d++) {
  28 + compA.push(comC + '_' + child[d].code);
  29 + }
  30 + }else {
  31 + compA.push(comC);
  32 + }
  33 + }
  34 + params.cgsbm_in = compA.toString();
  35 + }
  36 + return cb && cb(params);
  37 + });
  38 + }
  39 +
  40 + // 填充公司下拉框选择值
  41 + function lineAllInfo(){
  42 + getComp(function(params) {
  43 + $get('/line/all', params, function(array){
  44 + // get请求获取公司
  45 + $get('/business/all', {upCode_eq: '88'}, function(compD){
  46 + var len_ = array.length,paramsD = new Array();
  47 + if(len_>0) {
  48 + $.each(array, function(i, g){
  49 + if(g.name!='' || g.name != null) {
  50 + paramsD.push({'id':g.id + '_' + g.lineCode,
  51 + 'text':g.name + gsdmTogsName(compD,g.company)});
  52 + }
  53 + });
  54 + if($('span').hasClass('select2-selection'))
  55 + $('span .select2-selection').remove();
  56 + initPinYinSelect2($('#lineSelect'),paramsD,function(selector) {
  57 + selector.select2("val", splitxlName(window.localStorage.xlName_AgursData));
  58 + });
  59 + }
  60 + });
  61 + });
  62 + });
  63 + }
  64 +
  65 + // 监听线路名称下拉框值改变事件.
  66 + $('#lineSelect').on("change", function (e) {
  67 + var lineSelectValue = $('#lineSelect').val();// 获取线路名称值.
  68 + if(lineSelectValue=='' || lineSelectValue==null) {
  69 + $('#lineCodeInput').val('');// 设值线路编码.
  70 + $('#lineIdInput').val('');// 设值线路ID.
  71 + }else {
  72 + var lineSelectValueArray = lineSelectValue.split('_');// 切割线路名称值.
  73 + $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
  74 + $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID.
  75 + }
  76 + });
  77 +
  78 + function gsdmTogsName(gsD,code) {
  79 + var rsStr = '';
  80 + for(var s = 0 ; s < gsD.length; s++) {
  81 + if(gsD[s].businessCode == code) {
  82 + rsStr = rsStr + '(' + gsD[s].businessName.replace('公司','') + ')';
  83 + break;
  84 + }
  85 + }
  86 + return rsStr;
  87 + }
  88 +
  89 + // 切割线路名称值.获取线路ID及编码.
  90 + function splitxlName(str) {
  91 + var rsStr = '';
  92 + if(str) {
  93 + var strArray = str.split('_');
  94 + rsStr = strArray[0];
  95 + }
  96 + return rsStr;
  97 + }
  98 +
  99 + // 定义表单
  100 + var form = $('#lineVersions_add_form');
  101 + // 定义表单异常
  102 + var error = $('.alert-danger',form);
  103 + // 表单验证
  104 + form.validate({
  105 + // 错误提示元素span对象
  106 + errorElement : 'span',
  107 + // 错误提示元素class名称
  108 + errorClass : 'help-block help-block-error',
  109 + // 验证错误获取焦点
  110 + focusInvalid : true,
  111 + // 需要验证的表单元素
  112 + rules : {
  113 + 'line' : {required : true,maxlength: 30},// 线路名称 必填项、最大长度.
  114 + 'startDate' : {required : true},// 启用时间 不为空.
  115 + 'endDate' : {required : true},// 结束时间.
  116 + 'versions' : {required : true, digits : true, maxlength: 10},// 版本号 必填项、数字、最大长度10.
  117 + 'status' : {required : true, digits : true, maxlength: 10},// 版本状态 必填项、数字、最大长度10.
  118 + },
  119 +
  120 + /**
  121 + * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
  122 + *
  123 + * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
  124 + */
  125 + invalidHandler : function(event, validator) {
  126 + // 显示表单未通过提示信息
  127 + error.show();
  128 + // 把提示信息放到指定的位置。
  129 + App.scrollTo(error, -200);
  130 + },
  131 +
  132 + /**
  133 + * 类型:Callback。
  134 + *
  135 + * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
  136 + */
  137 + highlight : function(element) {
  138 + // 添加errorClass("has-error")到表单元素
  139 + $(element).closest('.form-group').addClass('has-error');
  140 + },
  141 +
  142 + /**
  143 + * 类型:Callback。
  144 + *
  145 + * 默认:移除errorClass("has-error")。与highlight操作相反
  146 + */
  147 + unhighlight : function(element) {
  148 + // 移除errorClass("has-error")
  149 + $(element).closest('.form-group').removeClass('has-error');
  150 + },
  151 +
  152 + /**
  153 + * 类型:String,Callback。
  154 + *
  155 + * 如果指定它,当验证通过时显示一个消息。
  156 + *
  157 + * 如果是String类型的,则添加该样式到标签中;
  158 + *
  159 + * 如果是一个回调函数,则将标签作为其唯一的参数。
  160 + */
  161 + success : function(label) {
  162 + // 当验证通过时,移除errorClass("has-error")
  163 + label.closest('.form-group').removeClass('has-error');
  164 +
  165 + },
  166 + /**
  167 + * 类型:Callback。
  168 + *
  169 + * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
  170 + */
  171 + submitHandler : function(f) {
  172 + // 隐藏错误提示
  173 + error.hide();
  174 + // 表单序列化
  175 + var params = form.serializeJSON();
  176 + submit();
  177 + // 提交
  178 + function submit() {
  179 + // 添加数据
  180 + $post('/lineVersions/add', params, function(result) {
  181 + // 如果返回结果不为空
  182 + if(result){
  183 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  184 + if(result.status=='SUCCESS') {
  185 + // 弹出添加成功提示消息
  186 + layer.msg('添加成功...');
  187 + } else if(result.status=='ERROR') {
  188 + // 弹出添加失败提示消息
  189 + layer.msg('添加失败...');
  190 + }
  191 + }
  192 + // 返回list.html页面
  193 + loadPage('list.html');
  194 + });
  195 + }
  196 + }
  197 + });
  198 +})();
0 \ No newline at end of file 199 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/js/lineversions-edit-from.js 0 → 100644
  1 +// 线路版本修改js
  2 +(function(){
  3 + //获取参数ID
  4 + var id = $.url().param('no');
  5 +
  6 + $("#startDateInput").datetimepicker({
  7 + format : 'YYYY-MM-DD HH:mm:ss',
  8 + locale : 'zh-cn'
  9 + });
  10 +
  11 + $("#endDateInput").datetimepicker({
  12 + format : 'YYYY-MM-DD HH:mm:ss',
  13 + locale : 'zh-cn'
  14 + });
  15 + // 初始化线路名称select
  16 + lineAllInfo();
  17 +
  18 + function getComp (cb) {
  19 + $.get('/user/companyData',null,function(rs) {
  20 + var params = {};
  21 + if(rs.length>0) {
  22 + var compA = new Array();
  23 + for(var c = 0 ; c<rs.length;c++) {
  24 + var comC = rs[c].companyCode;
  25 + var child = rs[c].children;
  26 + if(child.length>0) {
  27 + for(var d = 0 ;d< child.length;d++) {
  28 + compA.push(comC + '_' + child[d].code);
  29 + }
  30 + }else {
  31 + compA.push(comC);
  32 + }
  33 + }
  34 + params.cgsbm_in = compA.toString();
  35 + }
  36 + return cb && cb(params);
  37 + });
  38 + }
  39 +
  40 + // 填充公司下拉框选择值
  41 + function lineAllInfo(){
  42 + getComp(function(params) {
  43 + $get('/line/all', params, function(array){
  44 + // get请求获取公司
  45 + $get('/business/all', {upCode_eq: '88'}, function(compD){
  46 + var len_ = array.length,paramsD = new Array();
  47 + if(len_>0) {
  48 + $.each(array, function(i, g){
  49 + if(g.name!='' || g.name != null) {
  50 + paramsD.push({'id':g.id + '_' + g.lineCode,
  51 + 'text':g.name + gsdmTogsName(compD,g.company)});
  52 + }
  53 + });
  54 + if($('span').hasClass('select2-selection'))
  55 + $('span .select2-selection').remove();
  56 + initPinYinSelect2($('#lineSelect'),paramsD,function(selector) {
  57 + selector.select2("val", splitxlName(window.localStorage.xlName_AgursData));
  58 + });
  59 + }
  60 + });
  61 + });
  62 + });
  63 + }
  64 +
  65 + // 监听线路名称下拉框值改变事件.
  66 + $('#lineSelect').on("change", function (e) {
  67 + var lineSelectValue = $('#lineSelect').val();// 获取线路名称值.
  68 + if(lineSelectValue=='' || lineSelectValue==null) {
  69 + $('#lineCodeInput').val('');// 设值线路编码.
  70 + $('#lineIdInput').val('');// 设值线路ID.
  71 + }else {
  72 + var lineSelectValueArray = lineSelectValue.split('_');// 切割线路名称值.
  73 + $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
  74 + $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID.
  75 + }
  76 + });
  77 +
  78 + // 如果参数ID不为空
  79 + if(id) {
  80 + setTimeout(function(){
  81 + /** 根据ID查询详细信息 */
  82 + $get('/lineVersions/findById',{'id':id}, function(result){
  83 + // 如果不为空
  84 + if(result) {
  85 + $("#IdInput").val(result.id);
  86 + $("#lineIdInput").val(result.line);
  87 + $("#lineCodeInput").val(result.lineCode);
  88 + $("#lineSelect").val();
  89 + $("#lineSelect").val(result.line.id+"_"+result.lineCode).trigger("change");
  90 + $("#startDateInput").val(moment(result.startDate).format('YYYY-MM-DD HH:mm:ss'));
  91 + $("#endDateInput").val(moment(result.endDate).format('YYYY-MM-DD HH:mm:ss'));
  92 + $("#versionsInput").val(result.versions);
  93 + $("#statusInput").val(result.status);
  94 + $("#remarkTextarea").val(result.remark);
  95 + }
  96 +
  97 + });
  98 + }, 500);
  99 +
  100 + } else {
  101 + // 缺少ID
  102 + layer.confirm('【ID缺失,请点击返回,重新进行修改操作】', {btn : [ '返回' ],icon: 3, title:'提示'}, function(index){
  103 + // 关闭弹出层
  104 + layer.close(index);
  105 + // 跳转到list页面
  106 + loadPage('list.html');
  107 + });
  108 + }
  109 +
  110 + function gsdmTogsName(gsD,code) {
  111 + var rsStr = '';
  112 + for(var s = 0 ; s < gsD.length; s++) {
  113 + if(gsD[s].businessCode == code) {
  114 + rsStr = rsStr + '(' + gsD[s].businessName.replace('公司','') + ')';
  115 + break;
  116 + }
  117 + }
  118 + return rsStr;
  119 + }
  120 +
  121 + // 切割线路名称值.获取线路ID及编码.
  122 + function splitxlName(str) {
  123 + var rsStr = '';
  124 + if(str) {
  125 + var strArray = str.split('_');
  126 + rsStr = strArray[0];
  127 + }
  128 + return rsStr;
  129 + }
  130 +
  131 + // 定义表单
  132 + var form = $('#lineVersions_edit_form');
  133 + // 定义表单异常
  134 + var error = $('.alert-danger',form);
  135 + // 表单验证
  136 + form.validate({
  137 + // 错误提示元素span对象
  138 + errorElement : 'span',
  139 + // 错误提示元素class名称
  140 + errorClass : 'help-block help-block-error',
  141 + // 验证错误获取焦点
  142 + focusInvalid : true,
  143 + // 需要验证的表单元素
  144 + rules : {
  145 + 'line' : {required : true,maxlength: 30},// 线路名称 必填项、最大长度.
  146 + 'startDate' : {required : true},// 启用时间 不为空.
  147 + 'endDate' : {required : true},// 结束时间.
  148 + 'versions' : {required : true, digits : true, maxlength: 10},// 版本号 必填项、数字、最大长度10.
  149 + 'status' : {required : true, digits : true, maxlength: 10},// 版本状态 必填项、数字、最大长度10.
  150 + },
  151 +
  152 + /**
  153 + * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
  154 + *
  155 + * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
  156 + */
  157 + invalidHandler : function(event, validator) {
  158 + // 显示表单未通过提示信息
  159 + error.show();
  160 + // 把提示信息放到指定的位置。
  161 + App.scrollTo(error, -200);
  162 + },
  163 +
  164 + /**
  165 + * 类型:Callback。
  166 + *
  167 + * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
  168 + */
  169 + highlight : function(element) {
  170 + // 添加errorClass("has-error")到表单元素
  171 + $(element).closest('.form-group').addClass('has-error');
  172 + },
  173 +
  174 + /**
  175 + * 类型:Callback。
  176 + *
  177 + * 默认:移除errorClass("has-error")。与highlight操作相反
  178 + */
  179 + unhighlight : function(element) {
  180 + // 移除errorClass("has-error")
  181 + $(element).closest('.form-group').removeClass('has-error');
  182 + },
  183 +
  184 + /**
  185 + * 类型:String,Callback。
  186 + *
  187 + * 如果指定它,当验证通过时显示一个消息。
  188 + *
  189 + * 如果是String类型的,则添加该样式到标签中;
  190 + *
  191 + * 如果是一个回调函数,则将标签作为其唯一的参数。
  192 + */
  193 + success : function(label) {
  194 + // 当验证通过时,移除errorClass("has-error")
  195 + label.closest('.form-group').removeClass('has-error');
  196 +
  197 + },
  198 + /**
  199 + * 类型:Callback。
  200 + *
  201 + * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
  202 + */
  203 + submitHandler : function(f) {
  204 + // 隐藏错误提示
  205 + error.hide();
  206 + // 表单序列化
  207 + var params = form.serializeJSON();
  208 + submit();
  209 + // 提交
  210 + function submit() {
  211 + // 添加数据
  212 + $post('/lineVersions/update', params, function(result) {
  213 + // 如果返回结果不为空
  214 + if(result){
  215 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  216 + if(result.status=='SUCCESS') {
  217 + // 弹出添加成功提示消息
  218 + layer.msg('修改成功...');
  219 + } else if(result.status=='ERROR') {
  220 + // 弹出添加失败提示消息
  221 + layer.msg('修改失败...');
  222 + }
  223 + }
  224 + // 返回list.html页面
  225 + loadPage('list.html');
  226 + });
  227 + }
  228 + }
  229 + });
  230 +})();
0 \ No newline at end of file 231 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/js/lineversions-list-table.js 0 → 100644
  1 +/**
  2 + *
  3 + * @JSName : lineversions-list-table.js(线路版本信息list.html页面js)
  4 + * @Description : TOOD(线路信息list.html页面js)
  5 + */
  6 +
  7 +(function(){
  8 + // 关闭左侧栏
  9 + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
  10 + // 定义 page : 当前页;initPag ; icheckOptions:选择框
  11 + var page = 0,
  12 + initPag,
  13 + icheckOptions = {checkboxClass: 'icheckbox_flat-blue',increaseArea: '20%'},
  14 + storage = window.localStorage;
  15 + if(storage.xlName_AgursData!=null && storage.xlName_AgursData !='') {
  16 + $('.tipso-animation').children().remove();
  17 + // 延迟加载
  18 + setTimeout(function(){
  19 + $('.tipso-animation').tipso({
  20 + speed : 400,
  21 + background : '#0ed0e8',
  22 + color : '#ffffff',
  23 + position :'bottom',
  24 + width : 400,
  25 + delay : 100,
  26 + animationIn : 'fadeInDownBig',
  27 + animationOut : 'fadeOut',
  28 + offsetX : -50,
  29 + offsetY : -195,
  30 + content :'您可以通过点击重置按钮来清除对线路名称的记忆哦!',
  31 +
  32 + });
  33 + $('.tipso-animation').tipso('show');
  34 + setTimeout(function(){$('.tipso-animation').tipso('hide');},4000);
  35 + },200);
  36 + }
  37 + initCompanySelect2(function(array) {
  38 + // 公司下拉options属性值
  39 + var options = '<option value="">请选择...</option>';
  40 + // 遍历array
  41 + $.each(array, function(i,d){
  42 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  43 + });
  44 + // 初始化公司下拉框并监听值改变事件.
  45 + $('#companySelect').html(options).on('change', setBrancheCompanySelectOptions);
  46 + // 初始化分公司下拉框.
  47 + setBrancheCompanySelectOptions();
  48 + initLineSelect2(array);
  49 + /** 表格数据分页加载 @param:<null:搜索参数;true:是否重新分页> */
  50 + loadTableDate({'line.name_like':splitxlName(storage.xlName_AgursData)},true);
  51 + });
  52 +
  53 + function initLineSelect2(compD) {
  54 + getComp(function(rs) {
  55 + var params = {};
  56 + if(rs.length>0) {
  57 + var compA = new Array();
  58 + for(var c = 0 ; c<rs.length;c++) {
  59 + var comC = rs[c].companyCode;
  60 + var child = rs[c].children;
  61 + if(child.length>0) {
  62 + for(var d = 0 ;d< child.length;d++) {
  63 + compA.push(comC + '_' + child[d].code);
  64 + }
  65 + }else {
  66 + compA.push(comC);
  67 + }
  68 + }
  69 + params.cgsbm_in = compA.toString();
  70 + }
  71 + // 填充线路拉框选择值
  72 + $get('/line/all', params, function(array){
  73 + var len_ = array.length,paramsD = new Array();
  74 + if(len_>0) {
  75 + $.each(array, function(i, g){
  76 + if(g.name!='' || g.name != null) {
  77 + paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name + gsdmTogsName(compD,g.company)});
  78 + }
  79 + });
  80 + if($('span').hasClass('select2-selection'))
  81 + $('span .select2-selection').remove();
  82 + initPinYinSelect2($('#lineSelect'),paramsD,function(selector) {
  83 + selector.select2("val", storage.xlName_AgursData);
  84 + });
  85 + }
  86 + });
  87 + });
  88 + }
  89 +
  90 + function gsdmTogsName(gsD,code) {
  91 + var rsStr = '';
  92 + for(var s = 0 ; s < gsD.length; s++) {
  93 + if(gsD[s].businessCode == code) {
  94 + rsStr = rsStr + '(' + gsD[s].businessName.replace('公司','') + ')';
  95 + break;
  96 + }
  97 + }
  98 + return rsStr;
  99 + }
  100 +
  101 + function initCompanySelect2(cb) {
  102 + // get请求获取公司
  103 + $get('/business/all', {upCode_eq: '88'}, function(gs_d){
  104 + return cb && cb(gs_d);
  105 + });
  106 + }
  107 + function getComp(cb) {
  108 + $.get('/user/companyData',null,function(rs) {
  109 + return cb && cb(rs);
  110 + });
  111 + }
  112 + function getParams() {
  113 + // cells 集合返回表格中所有(列)单元格的一个数组
  114 + var cells = $('tr.filter')[0].cells;
  115 + // 搜索参数集合
  116 + var params = {};
  117 + // 搜索字段名称
  118 + var name;
  119 + // 遍历cells数组
  120 + $.each(cells, function(i, cell){
  121 + // 获取第i列的input或者select集合
  122 + var items = $('input,select', cell);
  123 + // 遍历items集合
  124 + for(var j = 0, item; item = items[j++];){
  125 + // 获取字段名称
  126 + name = $(item).attr('name');
  127 + if(name){
  128 + // 赋取相对应的值
  129 + params[name] = $(item).val();
  130 + }
  131 + }
  132 + });
  133 + return params;
  134 + }
  135 +
  136 + /** 表格数据分页加载事件 @param:<param : 查询参数;isPon : 是否重新分页> */
  137 + function loadTableDate(param,isPon){
  138 + // 搜索参数
  139 + var params = {};
  140 + if(param) {
  141 + params = param;
  142 + }
  143 + // 排序(按方向与序号)
  144 + params['order'] = 'lineCode,versions';
  145 + // 排序方向.
  146 + params['direction'] = 'ASC,ASC';
  147 + // 记录当前页数
  148 + params['page'] = page;
  149 + // 弹出正在加载层
  150 + var i = layer.load(2);
  151 + // 异步请求获取表格数据
  152 + $.get('/lineVersions',params,function(result){
  153 + // 添加序号
  154 + result.content.page = page;
  155 + // 把数据填充到模版中
  156 + $.each(result.content, function(){
  157 + this.startDateStr=moment(this.startDate).format('YYYY-MM-DD HH:mm:ss');
  158 + this.endDateStr=moment(this.endDate).format('YYYY-MM-DD HH:mm:ss');
  159 + })
  160 +
  161 + var tbodyHtml = template('lineversions_list_temp',{list:result.content});
  162 + $('#datatable_lineversions tbody').html(tbodyHtml);
  163 + // 是重新分页且返回数据长度大于0
  164 + if(isPon && result.content.length > 0){
  165 + // 重新分页
  166 + initPag = true;
  167 + // 分页栏
  168 + showPagination(result);
  169 + }
  170 + // 关闭弹出加载层
  171 + layer.close(i);
  172 + });
  173 + }
  174 +
  175 +
  176 + function toDate(timestamp){
  177 + var date = new Date(parseInt(timestamp).toLocaleString());
  178 + return date;
  179 + }
  180 +
  181 + /** 复选框组件 */
  182 + function iCheckChange(){
  183 + // 获取当前的父节点tr
  184 + var tr = $(this).parents('tr');
  185 + // 判断当前是否选中
  186 + if(this.checked) {
  187 + // 选中,则增添父节点tr的样式
  188 + tr.addClass('row-active');
  189 + }else {
  190 + // 未选中,则删除父节点tr的样式
  191 + tr.removeClass('row-active');
  192 + }
  193 + }
  194 +
  195 + /** 分页栏组件 */
  196 + function showPagination(data){
  197 + // 分页组件
  198 + $('#pagination').jqPaginator({
  199 + // 总页数
  200 + totalPages: data.totalPages,
  201 + // 中间显示页数
  202 + visiblePages: 6,
  203 + // 当前页
  204 + currentPage: page + 1,
  205 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  206 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  207 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  208 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  209 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  210 + onPageChange: function (num, type) {
  211 + if(initPag){
  212 + initPag = false;
  213 + return;
  214 + }
  215 + var pData = getParams();
  216 + pData['line.name_like'] = splitxlName(pData['line.name_like']);
  217 + page = num - 1;
  218 + loadTableDate(pData, false);
  219 + }
  220 + });
  221 + }
  222 + /** 填充分公司下拉框选择值 */
  223 + function setBrancheCompanySelectOptions(){
  224 + // 获取公司下拉框选择值
  225 + var businessCode = $('#companySelect').val();
  226 + // 分公司下拉框options属性值
  227 + var options = '<option value="">请选择...</option>';
  228 + // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码
  229 + if(businessCode == null || businessCode ==''){
  230 + // 填充分公司下拉框options
  231 + $('#brancheCompanySelect').html(options);
  232 + } else {
  233 + /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */
  234 + $get('/business/all', {upCode_eq: businessCode}, function(array){
  235 + // 遍历array
  236 + $.each(array, function(i,d){
  237 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  238 + // 填充分公司下拉框options
  239 + $('#brancheCompanySelect').html(options);
  240 + });
  241 + });
  242 + }
  243 + }
  244 +
  245 + /** 重置按钮事件 */
  246 + $('tr.filter .filter-cancel').on('click',function() {
  247 + // 清空搜索框值
  248 + $('tr.filter input,select').val('').change();
  249 + $('.tipso-animation').tipso('hide');
  250 + storage.setItem('xlName_AgursData','');
  251 + /** 表格数据分页加载 @param:<null:搜索参数;true:是否重新分页> */
  252 + loadTableDate(null,true);
  253 + });
  254 +
  255 + function splitxlName(str) {
  256 + var rsStr = '';
  257 + if(str) {
  258 + var strArray = str.split('_');
  259 + rsStr = strArray[0];
  260 + }
  261 + return rsStr;
  262 + }
  263 +
  264 + /** 搜索按钮事件 */
  265 + $('tr.filter .filter-submit').on('click',function(){
  266 + var params = getParams();
  267 + if(params['line.name_like']!='' && params['line.name_like'] != null) {
  268 + storage.setItem('xlName_AgursData',params['line.name_like']);
  269 + }
  270 + params['line.name_like'] = splitxlName(params['line.name_like']);
  271 + page = 0;
  272 + /** 表格数据分页加载 @param:<params:搜索参数;true:是否重新分页> */
  273 + loadTableDate(params,true);
  274 + });
  275 +
  276 +})();
0 \ No newline at end of file 277 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/list.html 0 → 100644
  1 +<!-- 片段标题 START -->
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>线路版本信息</h1>
  5 + </div>
  6 +</div>
  7 +<!-- 片段标题 END -->
  8 +
  9 +<!-- 线路信息导航栏组件 START -->
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  13 + <li><span class="active">线路版本信息</span></li>
  14 +</ul>
  15 +<!-- 线路信息导航栏组件 END -->
  16 +
  17 +<div class="row">
  18 + <div class="col-md-12">
  19 + <div class="portlet light porttlet-fit bordered">
  20 + <div class="portlet-title">
  21 + <div class="tipso-animation">
  22 + </div>
  23 + <div class="caption">
  24 + <i class="fa fa-info-circle font-dark"></i>
  25 + <span class="caption-subject font-dark sbold uppercase">线路版本信息</span>
  26 + </div>
  27 + <div class="actions">
  28 + <div class="btn-group btn-group-devided" data-toggle="buttons">
  29 + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加线路版本</a>
  30 + </div>
  31 + </div>
  32 + </div>
  33 + <div class="portlet-body">
  34 + <div class="table-container" style="margin-top: 10px">
  35 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_lineversions">
  36 + <thead>
  37 + <tr role="row" class="heading">
  38 + <th width="4%">序号</th>
  39 + <th width="5%">线路编码</th>
  40 + <th width="8%">线路名称</th>
  41 + <th width="8%">所属公司</th>
  42 + <th width="9%">所属分公司</th>
  43 + <th width="8%">启用时间</th>
  44 + <th width="8%">终止时间</th>
  45 + <th width="6%">版本号</th>
  46 + <th width="6%">版本状态</th>
  47 + <th width="6%">描述</th>
  48 + <th width="12%">操作</th>
  49 + </tr>
  50 + <tr role="row" class="filter">
  51 + <td>#</td>
  52 + <td>
  53 + <input type="text" class="form-control form-filter input-sm" name="lineCode_eq">
  54 + </td>
  55 + <td>
  56 + <select name="line.name_like" class="form-control" style="width:100%" id="lineSelect"></select>
  57 + <!-- <input type="text" class="form-control form-filter input-sm" name="name_like"> -->
  58 + </td>
  59 + <td>
  60 + <!-- 公司这里没使用字典表,暂时查的公司表 -->
  61 + <select name="line.company_eq" class="form-control" id="companySelect"></select>
  62 + </td>
  63 + <!-- 闵行没有下属公司,这里暂时注释掉 -->
  64 + <td>
  65 + <select name="line.brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select>
  66 + </td>
  67 + <td>
  68 +<!-- <input type="text" class="form-control form-filter input-sm" name="shanghaiLinecode_eq"> -->
  69 + </td>
  70 + <td>
  71 +<!-- <input type="text" class="form-control form-filter input-sm" name="shanghaiLinecode_eq"> -->
  72 + </td>
  73 + <td>
  74 + <input type="text" class="form-control form-filter input-sm" name="versions_eq">
  75 +
  76 + </td>
  77 + <td>
  78 + <select name="status_eq" class="form-control" id="statusSelect">
  79 + <option value="">请选择...</option>
  80 + <option value="1">当前版本</option>
  81 + <option value="2">待更新版本</option>
  82 + <option value="0">历史版本</option>
  83 + </select>
  84 + </td>
  85 + <td></td>
  86 + <td>
  87 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
  88 + <i class="fa fa-search"></i> 搜索
  89 + </button>
  90 +
  91 + <button class="btn btn-sm red btn-outline filter-cancel" id="notification-trigger">
  92 + <i class="fa fa-times"></i> 重置
  93 + </button>
  94 + </td>
  95 + </tr>
  96 + </thead>
  97 + <tbody></tbody>
  98 + </table>
  99 + <div style="text-align: right;">
  100 + <ul id="pagination" class="pagination"></ul>
  101 + </div>
  102 + </div>
  103 + </div>
  104 + </div>
  105 + </div>
  106 +</div>
  107 +
  108 +<script type="text/html" id="lineversions_list_temp">
  109 + {{each list as obj i }}
  110 + <tr>
  111 + <td style="vertical-align: middle;">
  112 + {{(list.page*10)+(i+1)}}
  113 + </td>
  114 + <td>
  115 + {{obj.lineCode}}
  116 + </td>
  117 + <td>
  118 + {{obj.line.name}}
  119 + </td>
  120 + <td>
  121 + {{if obj.line.company == '55'}}
  122 + 上南公司
  123 + {{else if obj.line.company == '22'}}
  124 + 金高公司
  125 + {{else if obj.line.company == '05'}}
  126 + 杨高公司
  127 + {{else if obj.line.company == '26'}}
  128 + 南汇公司
  129 + {{else if obj.line.company == '77'}}
  130 + 闵行公司
  131 + {{/if}}
  132 + </td>
  133 + <td>
  134 + {{if obj.line.company == '55'}}
  135 +
  136 + {{if obj.line.brancheCompany == '1'}}
  137 + 上南二分公司
  138 + {{else if obj.line.brancheCompany == '2'}}
  139 + 上南三分公司
  140 + {{else if obj.line.brancheCompany == '3'}}
  141 + 上南六分公司
  142 + {{else if obj.line.brancheCompany == '4'}}
  143 + 上南一分公司
  144 + {{/if}}
  145 +
  146 + {{else if obj.company == '22'}}
  147 +
  148 + {{if obj.line.brancheCompany == '1'}}
  149 + 四分公司
  150 + {{else if obj.line.brancheCompany == '2'}}
  151 + 二分公司
  152 + {{else if obj.line.brancheCompany == '3'}}
  153 + 三分公司
  154 + {{else if obj.line.brancheCompany == '5'}}
  155 + 一分公司
  156 + {{/if}}
  157 +
  158 + {{else if obj.line.company == '05'}}
  159 +
  160 + {{if obj.line.brancheCompany == '1'}}
  161 + 川沙分公司
  162 + {{else if obj.line.brancheCompany == '2'}}
  163 + 金桥分公司
  164 + {{else if obj.line.brancheCompany == '3'}}
  165 + 芦潮港分公司
  166 + {{else if obj.line.brancheCompany == '5'}}
  167 + 杨高分公司
  168 + {{else if obj.line.brancheCompany == '6'}}
  169 + 周浦分公司
  170 + {{/if}}
  171 +
  172 + {{else if obj.line.company == '26'}}
  173 +
  174 + {{if obj.line.brancheCompany == '1'}}
  175 + 南汇一分
  176 + {{else if obj.line.brancheCompany == '2'}}
  177 + 南汇二分
  178 + {{else if obj.line.brancheCompany == '3'}}
  179 + 南汇三分
  180 + {{else if obj.line.brancheCompany == '4'}}
  181 + 南汇维修公司
  182 + {{else if obj.line.brancheCompany == '5'}}
  183 + 南汇公司
  184 + {{/if}}
  185 +
  186 + {{/if}}
  187 + </td>
  188 + <td>
  189 + {{obj.startDateStr}}
  190 + </td>
  191 + <td>
  192 + {{obj.endDateStr}}
  193 + </td>
  194 + <td>
  195 + {{obj.versions}}
  196 + </td>
  197 + <td>
  198 + {{if obj.status == '0'}}
  199 + 历史版本
  200 + {{else if obj.status == '1'}}
  201 + 当前版本
  202 + {{else if obj.status == '2'}}
  203 + 待更新版本
  204 + {{/if}}
  205 + </td>
  206 + <td>
  207 + {{obj.remark}}
  208 + </td>
  209 + <td>
  210 + <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a>
  211 + </td>
  212 + </tr>
  213 + {{/each}}
  214 + {{if list.length == 0}}
  215 + <tr>
  216 + <td colspan=13><h6 class="muted">没有找到相关数据</h6></td>
  217 + </tr>
  218 + {{/if}}
  219 +</script>
  220 +<!-- 线路信息片段JS模块 -->
  221 +<script src="/pages/base/lineversions/js/lineversions-list-table.js"></script>
0 \ No newline at end of file 222 \ No newline at end of file
src/main/resources/static/pages/base/section/add.html
@@ -245,7 +245,7 @@ @@ -245,7 +245,7 @@
245 <div class="form-group"> 245 <div class="form-group">
246 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;:</label> 246 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;:</label>
247 <div class="col-md-6"> 247 <div class="col-md-6">
248 - <input type="text" class="form-control" name="versions" value='1' Readonly> 248 + <input type="text" class="form-control" name="versions" id="versionsInput" Readonly>
249 </div> 249 </div>
250 </div> 250 </div>
251 </div> 251 </div>
src/main/resources/static/pages/base/section/js/add-form-events.js
@@ -6,13 +6,22 @@ $(function(){ @@ -6,13 +6,22 @@ $(function(){
6 // 监听线路名称下拉框值改变事件. 6 // 监听线路名称下拉框值改变事件.
7 $('#lineSelect').on("change", function (e) { 7 $('#lineSelect').on("change", function (e) {
8 var lineSelectValue = $('#lineSelect').val();// 获取线路名称值. 8 var lineSelectValue = $('#lineSelect').val();// 获取线路名称值.
9 - if(lineSelectValue=='') { 9 + if(lineSelectValue=='' || lineSelectValue==null) {
10 $('#lineCodeInput').val('');// 设值线路编码. 10 $('#lineCodeInput').val('');// 设值线路编码.
11 $('#lineIdInput').val('');// 设值线路ID. 11 $('#lineIdInput').val('');// 设值线路ID.
12 }else { 12 }else {
  13 + debugger
13 var lineSelectValueArray = lineSelectValue.split('_');// 切割线路名称值. 14 var lineSelectValueArray = lineSelectValue.split('_');// 切割线路名称值.
14 $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码. 15 $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
15 $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID. 16 $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID.
  17 + // 版本号赋值
  18 + $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[0]},function(lineVersions){
  19 + $.each(lineVersions,function(){
  20 + if (this.status == 1) {
  21 + $('#versionsInput').val(this.versions);
  22 + }
  23 + })
  24 + });
16 // 获取该线路下的路段路由. 25 // 获取该线路下的路段路由.
17 PublicFunctions.getSectionRouteInfo(lineSelectValueArray[0],function(array) { 26 PublicFunctions.getSectionRouteInfo(lineSelectValueArray[0],function(array) {
18 // 定义路段路由长度、渲染拼音检索下拉框格式数据. 27 // 定义路段路由长度、渲染拼音检索下拉框格式数据.
src/main/resources/static/pages/base/section/js/add-form-reload.js
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
27 // 线路下拉框初始化. 27 // 线路下拉框初始化.
28 PublicFunctions.getLineAllInfo(function(array,compD) { 28 PublicFunctions.getLineAllInfo(function(array,compD) {
29 var len_ = array.length,paramsD = new Array(); 29 var len_ = array.length,paramsD = new Array();
  30 +// paramsD.push({'id':'','text':'请选择...'});
30 if(len_>0) { 31 if(len_>0) {
31 $.each(array, function(i, g){ 32 $.each(array, function(i, g){
32 if(g.name!='' || g.name != null) { 33 if(g.name!='' || g.name != null) {
src/main/resources/static/pages/base/section/js/section-positions-function.js
@@ -33,7 +33,7 @@ var PositionsPublicFunctions = function () { @@ -33,7 +33,7 @@ var PositionsPublicFunctions = function () {
33 $('#speedLimitInput').val(Section.sectionSpeedLimit);// 道路限速 33 $('#speedLimitInput').val(Section.sectionSpeedLimit);// 道路限速
34 $('#sectionDistanceInput').val(Section.sectionDistance);// 路段长度 34 $('#sectionDistanceInput').val(Section.sectionDistance);// 路段长度
35 $('#sectionTimeInput').val(Section.sectionTime);// 路段长度 35 $('#sectionTimeInput').val(Section.sectionTime);// 路段长度
36 - $('#versionsInput').val(Section.sectionVersion);// 版本号 36 + $('#versionsInput').val(Section.sectionRouteVersions);// 版本号
37 $('#destroySelect').val(Section.sectionRouteDestroy);// 是否撤销 37 $('#destroySelect').val(Section.sectionRouteDestroy);// 是否撤销
38 $('#descriptionsTextarea').val(Section.sectionRouteDescriptions);// 描述/说明 38 $('#descriptionsTextarea').val(Section.sectionRouteDescriptions);// 描述/说明
39 $('#isRoadeSpeedInput').val(Section.isRoadeSpeed);// 是否有路段限速数据 <0:分段;1:未分段> 39 $('#isRoadeSpeedInput').val(Section.isRoadeSpeed);// 是否有路段限速数据 <0:分段;1:未分段>
src/main/resources/static/pages/base/station/add.html
@@ -288,7 +288,7 @@ @@ -288,7 +288,7 @@
288 <div class="form-group"> 288 <div class="form-group">
289 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label> 289 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
290 <div class="col-md-6"> 290 <div class="col-md-6">
291 - <input type="text" class="form-control" name="versions" value='1' Readonly> 291 + <input type="text" class="form-control" name="versions" id="versionsInput" Readonly>
292 </div> 292 </div>
293 </div> 293 </div>
294 </div> 294 </div>
src/main/resources/static/pages/base/station/edit.html
@@ -184,7 +184,7 @@ @@ -184,7 +184,7 @@
184 <div class="form-group"> 184 <div class="form-group">
185 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label> 185 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
186 <div class="col-md-6"> 186 <div class="col-md-6">
187 - <input type="text" class="form-control" name="versions" value='1' Readonly> 187 + <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
188 </div> 188 </div>
189 </div> 189 </div>
190 </div> 190 </div>
@@ -253,7 +253,7 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu @@ -253,7 +253,7 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu
253 'stationMark' : {required : true},// 站点类型 必填项 253 'stationMark' : {required : true},// 站点类型 必填项
254 'bJwpoints' : {required : true},// 经纬度坐标点 必填项 254 'bJwpoints' : {required : true},// 经纬度坐标点 必填项
255 'shapesType' : {required : true},// 几何图形类型 必填项 255 'shapesType' : {required : true},// 几何图形类型 必填项
256 - 'radius' : {required : true},// 圆形半径 必填项 256 + 'radius' : {required : true, number : true,},// 圆形半径 必填项
257 'destroy' : {required : true},// 是否撤销 必填项 257 'destroy' : {required : true},// 是否撤销 必填项
258 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。 258 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
259 'distances' : {number : true},// 到站距离 // 到站距离 259 'distances' : {number : true},// 到站距离 // 到站距离
src/main/resources/static/pages/base/station/js/add-form-events.js
@@ -14,7 +14,7 @@ $(function(){ @@ -14,7 +14,7 @@ $(function(){
14 // 监听线路名称值改变事件. 14 // 监听线路名称值改变事件.
15 $('#lineSelect').on("change", function (e) { 15 $('#lineSelect').on("change", function (e) {
16 var lineSelectValue = $(this).val(); 16 var lineSelectValue = $(this).val();
17 - if(lineSelectValue=='' && lineSelectValue ==null) { 17 + if(lineSelectValue=='' || lineSelectValue ==null) {
18 $('#lineCodeInput').val(''); 18 $('#lineCodeInput').val('');
19 $('#lineIdInput').val(''); 19 $('#lineIdInput').val('');
20 }else { 20 }else {
@@ -23,6 +23,14 @@ $(function(){ @@ -23,6 +23,14 @@ $(function(){
23 $('#lineIdInput').val(lineSelectValueArray[0]); 23 $('#lineIdInput').val(lineSelectValueArray[0]);
24 $('#lineCodeInput').val(lineSelectValueArray[1]); 24 $('#lineCodeInput').val(lineSelectValueArray[1]);
25 var params = {'lineCode_eq':lineSelectValueArray[1],'destroy_eq':0,'directions_eq':dir}; 25 var params = {'lineCode_eq':lineSelectValueArray[1],'destroy_eq':0,'directions_eq':dir};
  26 + // 版本号赋值
  27 + $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[0]},function(lineVersions){
  28 + $.each(lineVersions,function(){
  29 + if (this.status == 1) {
  30 + $('#versionsInput').val(this.versions);
  31 + }
  32 + })
  33 + });
26 initSelect(params); 34 initSelect(params);
27 } 35 }
28 }); 36 });
@@ -58,8 +66,8 @@ $(function(){ @@ -58,8 +66,8 @@ $(function(){
58 PublicFunctions.getStationRouteInfo(p,function(array) { 66 PublicFunctions.getStationRouteInfo(p,function(array) {
59 // 定义路段路由长度、渲染拼音检索下拉框格式数据. 67 // 定义路段路由长度、渲染拼音检索下拉框格式数据.
60 var len_ = array.length,paramsD = new Array(); 68 var len_ = array.length,paramsD = new Array();
  69 +// paramsD.push({'id':'','text':'请选择...'});
61 if(len_>0) { 70 if(len_>0) {
62 - paramsD.push({'id':'','text':'请选择...'});  
63 // 遍历. 71 // 遍历.
64 $.each(array, function(i, g){ 72 $.each(array, function(i, g){
65 // 判断. 73 // 判断.
src/main/resources/static/pages/base/station/js/add-form-reload.js
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
25 $('#destroySelect').val('0'); 25 $('#destroySelect').val('0');
26 PublicFunctions.getLineAllInfo(function(array,compD) { 26 PublicFunctions.getLineAllInfo(function(array,compD) {
27 var len_ = array.length,paramsD = new Array(); 27 var len_ = array.length,paramsD = new Array();
  28 +// paramsD.push({'id':'','text':'请选择...'});
28 if(len_>0) { 29 if(len_>0) {
29 $.each(array, function(i, g){ 30 $.each(array, function(i, g){
30 if(g.name!='' || g.name != null) { 31 if(g.name!='' || g.name != null) {
src/main/resources/static/pages/base/station/js/add-form-wizard.js
@@ -36,7 +36,7 @@ var FormWizard = function() { @@ -36,7 +36,7 @@ var FormWizard = function() {
36 'directions' : {required : true,},// 站点方向 必填项 36 'directions' : {required : true,},// 站点方向 必填项
37 'bJwpoints' : {required : true,},// 经纬度坐标点 必填项 37 'bJwpoints' : {required : true,},// 经纬度坐标点 必填项
38 'shapesType' : {required : true,},// 范围图形类型 必填项 38 'shapesType' : {required : true,},// 范围图形类型 必填项
39 - 'radius': {required : true,},// 圆形半径 39 + 'radius': {required : true, number : true,},// 圆形半径
40 'destroy' : {required : true,},// 是否撤销 必填项. 40 'destroy' : {required : true,},// 是否撤销 必填项.
41 'toTime' : {number : true,},// 路段时长 必须输入合法的数字(负数,小数)。 41 'toTime' : {number : true,},// 路段时长 必须输入合法的数字(负数,小数)。
42 'distances' : {number : true,},// 路段时长 必须输入合法的数字(负数,小数)。 42 'distances' : {number : true,},// 路段时长 必须输入合法的数字(负数,小数)。
src/main/resources/static/pages/base/station/js/station-list-edit.js
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 'stationRouteCode' : {isStart : true},// 站点序号 54 'stationRouteCode' : {isStart : true},// 站点序号
55 'bJwpoints' : {required : true},// 经纬度坐标点 必填项 55 'bJwpoints' : {required : true},// 经纬度坐标点 必填项
56 'shapesType' : {required : true},// 几何图形类型 必填项 56 'shapesType' : {required : true},// 几何图形类型 必填项
57 - 'radius' : {required : true},// 圆形半径 必填项 57 + 'radius' : {required : true, number : true,},// 圆形半径 必填项
58 'destroy' : {required : true},// 是否撤销 必填项 58 'destroy' : {required : true},// 是否撤销 必填项
59 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。 59 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
60 'distances' : {number : true},// 到站距离 // 到站距离 60 'distances' : {number : true},// 到站距离 // 到站距离
src/main/resources/static/pages/base/station/js/station-positions-function.js
@@ -150,6 +150,8 @@ var PositionsPublicFunctions = function () { @@ -150,6 +150,8 @@ var PositionsPublicFunctions = function () {
150 $('#toTimeInput').val(stationObj.stationRouteToTime); 150 $('#toTimeInput').val(stationObj.stationRouteToTime);
151 // 到站距离 151 // 到站距离
152 $('#distancesInput').val(stationObj.stationRouteDistances); 152 $('#distancesInput').val(stationObj.stationRouteDistances);
  153 + // 版本号
  154 + $('#versionsInput').val(stationObj.stationRouteVersions);
153 // 描述/说明 155 // 描述/说明
154 $('#descriptionsTextarea').val(stationObj.stationRouteDescriptions); 156 $('#descriptionsTextarea').val(stationObj.stationRouteDescriptions);
155 }, 157 },
@@ -194,6 +196,8 @@ var PositionsPublicFunctions = function () { @@ -194,6 +196,8 @@ var PositionsPublicFunctions = function () {
194 $('#toTimeInput').val(stationObj.stationRouteToTime); 196 $('#toTimeInput').val(stationObj.stationRouteToTime);
195 // 到站距离 197 // 到站距离
196 $('#distancesInput').val(stationObj.stationRouteDistances); 198 $('#distancesInput').val(stationObj.stationRouteDistances);
  199 + // 版本号
  200 + $('#versionsInput').val(stationObj.stationRouteVersions);
197 // 描述/说明 201 // 描述/说明
198 $('#descriptionsTextarea').val(stationObj.stationRouteDescriptions); 202 $('#descriptionsTextarea').val(stationObj.stationRouteDescriptions);
199 }, 203 },
src/main/resources/static/pages/base/station/list_edit.html
@@ -241,7 +241,7 @@ @@ -241,7 +241,7 @@
241 <label class="control-label col-md-5"><span class="required"> </span> 版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 241 <label class="control-label col-md-5"><span class="required"> </span> 版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
242 </label> 242 </label>
243 <div class="col-md-4"> 243 <div class="col-md-4">
244 - <input type="text" class="form-control" name="versions" > 244 + <input type="text" class="form-control" name="versions" id="versionsInput" Readonly>
245 </div> 245 </div>
246 </div> 246 </div>
247 </div> 247 </div>
src/main/resources/static/pages/base/stationroute/add.html
@@ -173,7 +173,7 @@ @@ -173,7 +173,7 @@
173 <div class="form-group"> 173 <div class="form-group">
174 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label> 174 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
175 <div class="col-md-6"> 175 <div class="col-md-6">
176 - <input type="text" class="form-control" name="versions" value='1' Readonly> 176 + <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
177 </div> 177 </div>
178 </div> 178 </div>
179 </div> 179 </div>
@@ -236,6 +236,15 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao @@ -236,6 +236,15 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao
236 $('#radiusInput').val(Station.radius); 236 $('#radiusInput').val(Station.radius);
237 // 是否撤销 237 // 是否撤销
238 $('#destroySelect').val(0); 238 $('#destroySelect').val(0);
  239 + // 版本号
  240 + $.get('/lineVersions/findByLineId',{'lineId':Line.id},function(lineVersions){
  241 + $.each(lineVersions,function(){
  242 + if (this.status == 1) {
  243 + $('#versionsInput').val(this.versions);
  244 + }
  245 + })
  246 + });
  247 +
239 var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir}; 248 var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir};
240 initSelect(initzdlyP); 249 initSelect(initzdlyP);
241 }); 250 });
src/main/resources/static/pages/base/stationroute/edit.html
@@ -171,7 +171,7 @@ @@ -171,7 +171,7 @@
171 <div class="form-group"> 171 <div class="form-group">
172 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label> 172 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
173 <div class="col-md-6"> 173 <div class="col-md-6">
174 - <input type="text" class="form-control" name="versions" value='1' Readonly> 174 + <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
175 </div> 175 </div>
176 </div> 176 </div>
177 </div> 177 </div>
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
@@ -277,7 +277,6 @@ var PublicFunctions = function () { @@ -277,7 +277,6 @@ var PublicFunctions = function () {
277 277
278 /** @param directionV_ :方向 */ 278 /** @param directionV_ :方向 */
279 stationRevoke : function(directionV_) { 279 stationRevoke : function(directionV_) {
280 - debugger  
281 // 获取树选中节点对象 280 // 获取树选中节点对象
282 var obj = PublicFunctions.getCurrSelNode(directionV_); 281 var obj = PublicFunctions.getCurrSelNode(directionV_);
283 // 是否选中,选中节点是否为站点 282 // 是否选中,选中节点是否为站点
@@ -377,6 +376,8 @@ var PublicFunctions = function () { @@ -377,6 +376,8 @@ var PublicFunctions = function () {
377 $('#toTimeInput').val(editStationParmas.stationRouteToTime); 376 $('#toTimeInput').val(editStationParmas.stationRouteToTime);
378 // 到站距离 377 // 到站距离
379 $('#distancesInput').val(editStationParmas.stationRouteDistances); 378 $('#distancesInput').val(editStationParmas.stationRouteDistances);
  379 + // 线路版本号
  380 + $('#versionsInput').val(editStationParmas.stationRouteVersions);
380 // 描述/说明 381 // 描述/说明
381 $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions); 382 $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions);
382 }, 383 },
src/main/resources/static/pages/base/timesmodel/gantt.html
@@ -121,7 +121,7 @@ @@ -121,7 +121,7 @@
121 <script src="/pages/base/timesmodel/js/base-fun.js"></script> 121 <script src="/pages/base/timesmodel/js/base-fun.js"></script>
122 <script src="/pages/base/timesmodel/js/v2/ParameterObj.js"></script> 122 <script src="/pages/base/timesmodel/js/v2/ParameterObj.js"></script>
123 <script src="/pages/base/timesmodel/js/v2/core/InternalBcObj.js"></script> 123 <script src="/pages/base/timesmodel/js/v2/core/InternalBcObj.js"></script>
124 -<script src="/pages/base/timesmodel/js/v2/core/InternalGroupBcObj.js"></script> 124 +<script src="/pages/base/timesmodel/js/v2/core/InternalGroupObj.js"></script>
125 <script src="/pages/base/timesmodel/js/v2/core/InternalLpObj.js"></script> 125 <script src="/pages/base/timesmodel/js/v2/core/InternalLpObj.js"></script>
126 <script src="/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js"></script> 126 <script src="/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js"></script>
127 <script src="/pages/base/timesmodel/js/v2/main_v2.js"></script> 127 <script src="/pages/base/timesmodel/js/v2/main_v2.js"></script>
src/main/resources/static/pages/base/timesmodel/js/base-fun.js
@@ -797,44 +797,44 @@ var BaseFun = function() { @@ -797,44 +797,44 @@ var BaseFun = function() {
797 var temp = []; 797 var temp = [];
798 temp.push(allLMapBc[0]); 798 temp.push(allLMapBc[0]);
799 console.log(temp); 799 console.log(temp);
800 - return {'json':temp,'bxrcgs':null}; 800 + //return {'json':temp,'bxrcgs':null};
801 801
802 - //// 第二步 纵向调整  
803 - //baseF.evenStartDepartSpace(allLMapBc , dataMap);  
804 - ////return {'json':allLMapBc,'bxrcgs':null};  
805 - //  
806 - //// 第三步 剔除首末班车以外的班次,并确认首末班车.  
807 - //var markArray = baseF.markFirstAndLastBusAlsoDietNotInRangeBc(allLMapBc , dataMap);  
808 - ////return {'json':markArray,'bxrcgs':null};  
809 - //// 第四步 横向调整  
810 - //baseF.resizeByPitStopTime(cara , markArray , dataMap); 802 + // 第二步 纵向调整
  803 + baseF.evenStartDepartSpace(allLMapBc , dataMap);
  804 + //return {'json':allLMapBc,'bxrcgs':null};
  805 +
  806 + // 第三步 剔除首末班车以外的班次,并确认首末班车.
  807 + var markArray = baseF.markFirstAndLastBusAlsoDietNotInRangeBc(allLMapBc , dataMap);
  808 + //return {'json':markArray,'bxrcgs':null};
  809 + // 第四步 横向调整
  810 + baseF.resizeByPitStopTime(cara , markArray , dataMap);
  811 + //return {'json':markArray,'bxrcgs':null};
  812 + /**
  813 + * 第五步 把班型合理的分配到各个路牌上.
  814 + *
  815 + * 切割班型/人次/配车数 字符串 为 数组对象.
  816 + *
  817 + * 把班型分配到对应的具体路牌上.
  818 + */
  819 + // 切割班型/人次/配车数 字符串 为 数组对象.
  820 + var list = baseF.getBxRcListCollection(map.bxrc);
  821 + // 把班型分配到对应的具体路牌上.
  822 + baseF.bxAlloTotLp(list,cara);
811 ////return {'json':markArray,'bxrcgs':null}; 823 ////return {'json':markArray,'bxrcgs':null};
812 - ///**  
813 - // * 第五步 把班型合理的分配到各个路牌上.  
814 - // *  
815 - // * 切割班型/人次/配车数 字符串 为 数组对象.  
816 - // *  
817 - // * 把班型分配到对应的具体路牌上.  
818 - // */  
819 - //// 切割班型/人次/配车数 字符串 为 数组对象.  
820 - //var list = baseF.getBxRcListCollection(map.bxrc);  
821 - //// 把班型分配到对应的具体路牌上.  
822 - //baseF.bxAlloTotLp(list,cara);  
823 - //////return {'json':markArray,'bxrcgs':null};  
824 - ////  
825 - ////  
826 - //// 第六步 抽车来满足工时.  
827 - //var tempA = baseF.abstractCar(list , markArray , cara , saa , dataMap , map);  
828 - ////return {'json':tempA,'bxrcgs':null};  
829 - //// 第七步 确定吃饭时间.  
830 - //if (map.cfdd) { // NEW,没有选择吃饭地点,不设定吃饭班次  
831 - // baseF.markeEatTime(list , tempA , cara , saa , dataMap ,map);  
832 - //}  
833 - //baseF.resizeByPitStopTime(cara , tempA , dataMap);  
834 - //baseF.updfcno01(tempA,0);  
835 - ////return {'json':tempA,'bxrcgs':null};  
836 - //// 确定进出场、早晚例保时间.并返回班次数组集合  
837 - //return {'json':baseF.addInOutFieldBc(cara,tempA,dataMap,saa,map),'bxrcgs':null}; 824 + //
  825 + //
  826 + // 第六步 抽车来满足工时.
  827 + var tempA = baseF.abstractCar(list , markArray , cara , saa , dataMap , map);
  828 + //return {'json':tempA,'bxrcgs':null};
  829 + // 第七步 确定吃饭时间.
  830 + if (map.cfdd) { // NEW,没有选择吃饭地点,不设定吃饭班次
  831 + baseF.markeEatTime(list , tempA , cara , saa , dataMap ,map);
  832 + }
  833 + baseF.resizeByPitStopTime(cara , tempA , dataMap);
  834 + baseF.updfcno01(tempA,0);
  835 + //return {'json':tempA,'bxrcgs':null};
  836 + // 确定进出场、早晚例保时间.并返回班次数组集合
  837 + return {'json':baseF.addInOutFieldBc(cara,tempA,dataMap,saa,map),'bxrcgs':null};
838 }, 838 },
839 839
840 markeEatTime : function(list , markArray , cara , saa , dataMap ,map) { 840 markeEatTime : function(list , markArray , cara , saa , dataMap ,map) {
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalBcObj.js
1 /** 1 /**
2 * 内部班次对象。 2 * 内部班次对象。
3 - * @constructor 3 + * @param lpObj 内部路牌对象
  4 + * @param groupObj 内部圈对象
  5 + * @param otherParamObj 其他参数对象
  6 + * @constructor InternalBcObj
4 */ 7 */
5 var InternalBcObj = function( 8 var InternalBcObj = function(
6 - bcType, // 班次类型(normal,in,out等)  
7 - isUp, // boolean是否上下行  
8 - lp, // 路牌标识符  
9 - fcno, // 发车顺序号  
10 - fcTimeObj, // 发车时间对象  
11 - bclc, // 班次里程  
12 - bcsj, // 班次历时  
13 - arrtime, // 到达时间对象  
14 - stoptime, // 停站时间  
15 - tccid, // 停车场id  
16 - ttinfoid, // 时刻表id  
17 - xl, // 线路id  
18 - qdzid, // 起点站id  
19 - zdzid // 终点站id 9 + lpObj, // InternalLpObj路牌对象
  10 + otherParamObj // 班次其他参数对象
20 ) { 11 ) {
  12 + // 简单验证
  13 + if (!lpObj) {
  14 + throw "new InternalBcObj 路牌对象为空";
  15 + }
  16 + if (!otherParamObj) {
  17 + throw "new InternalBcObj 其他参数对象为空"
  18 + }
  19 +
  20 + // 内部重要属性
  21 + this._$$_internal_lp_obj = lpObj; // 班次所属的路牌对象(横轴)
  22 + // 之后会设定
  23 + this._$$_internal_group_obj; // 班次所属的圈对象(纵轴)
  24 +
21 // 属性重新复制一遍,加前缀 _$_ 表示内部属性,不要直接访问k 25 // 属性重新复制一遍,加前缀 _$_ 表示内部属性,不要直接访问k
22 // 外部函数使用 prototype 方式 26 // 外部函数使用 prototype 方式
23 - this._$_bcType = bcType;  
24 - this._$_isUp = isUp;  
25 - this._$_lp = lp;  
26 - this._$_fcno = fcno;  
27 - this._$_fcsjObj = moment(fcTimeObj);  
28 - this._$_bclc = bclc;  
29 - this._$_bcsj = bcsj;  
30 - this._$_arrtime = arrtime;  
31 - this._$_stoptime = stoptime;  
32 - this._$_tccid = tccid;  
33 - this._$_ttinfoid = ttinfoid;  
34 - this._$_xlid = xl;  
35 - this._$_qdzid = qdzid;  
36 - this._$_zdzid = zdzid; 27 + this._$_bcType = otherParamObj.bcType; // 班次类型(normal,in,out等)
  28 + this._$_isUp = otherParamObj.isUp; // boolean是否上下行
  29 + this._$_fcno = otherParamObj.fcno; // 发车顺序号
  30 + this._$_fcsjObj = moment(otherParamObj.fcTimeObj); // 发车时间对象
  31 + this._$_bclc = otherParamObj.bclc; // 班次里程
  32 + this._$_bcsj = otherParamObj.bcsj; // 班次历时
  33 + this._$_arrtime = otherParamObj.arrtime; // 到达时间对象
  34 + this._$_stoptime = otherParamObj.stoptime; // 停站时间
  35 + this._$_tccid = otherParamObj.tccid; // 停车场id
  36 + this._$_ttinfoid = otherParamObj.ttinfoid; // 时刻表id
  37 + this._$_xlid = otherParamObj.xl; // 线路id
  38 + this._$_qdzid = otherParamObj.qdzid; // 起点站id
  39 + this._$_zdzid = otherParamObj.zdzid; // 终点站id
37 40
38 }; 41 };
39 42
  43 +//------------------- get/set 方法 -------------------//
  44 +
  45 +/**
  46 + * 设置路牌对象。
  47 + * @param lpObj InternalLpObj路牌对象
  48 + */
  49 +InternalBcObj.prototype.setLp = function(lpObj) {
  50 + this._$$_internal_lp_obj = lpObj;
  51 +};
40 /** 52 /**
41 - * 设置路牌标号。  
42 - * @param lpNo 53 + * 设置圈对象。
  54 + * @param groupObj
43 */ 55 */
44 -InternalBcObj.prototype.setLp = function(lpNo) {  
45 - this._$_lp = lpNo; 56 +InternalBcObj.prototype.setGroup = function(groupObj) {
  57 + this._$$_internal_group_obj = groupObj;
46 }; 58 };
47 59
48 /** 60 /**
@@ -80,16 +92,19 @@ InternalBcObj.prototype.getBcTime = function() { @@ -80,16 +92,19 @@ InternalBcObj.prototype.getBcTime = function() {
80 InternalBcObj.prototype.getStopTime = function() { 92 InternalBcObj.prototype.getStopTime = function() {
81 return this._$_stoptime; 93 return this._$_stoptime;
82 }; 94 };
  95 +
  96 +//---------------------- 其他方法 -------------------------//
  97 +
83 /** 98 /**
84 * 转换成显示用班次对象。 99 * 转换成显示用班次对象。
85 * @returns {{}} 100 * @returns {{}}
86 */ 101 */
87 InternalBcObj.prototype.toGanttBcObj = function() { 102 InternalBcObj.prototype.toGanttBcObj = function() {
88 var _bcObj = { 103 var _bcObj = {
89 - parent: this._$_lp,  
90 - lpNo: this._$_lp, 104 + parent: this._$$_internal_lp_obj.getLpNo(),
  105 + lpNo: this._$$_internal_lp_obj.getLpNo(),
91 lp: null, 106 lp: null,
92 - lpName: this._$_lp, 107 + lpName: this._$$_internal_lp_obj.getLpName(),
93 lpType: '普通路牌', 108 lpType: '普通路牌',
94 bcType: this._$_bcType, 109 bcType: this._$_bcType,
95 fcno: this._$_fcno, 110 fcno: this._$_fcno,
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalGroupBcObj.js renamed to src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalGroupObj.js
@@ -4,11 +4,15 @@ @@ -4,11 +4,15 @@
4 * 一定是从第1圈开始,第0圈表示中标线的第一个班次,是下行班次,则第0圈的上行班次就是空的。 4 * 一定是从第1圈开始,第0圈表示中标线的第一个班次,是下行班次,则第0圈的上行班次就是空的。
5 * @constructor 5 * @constructor
6 */ 6 */
7 -var InternalGroupBcObj = function( 7 +var InternalGroupObj = function(
  8 + lpObj, // 所属 InternalLpObj 路牌对象
8 isUp, // 是否上行,就是圈以上行开始,还是下行开始 9 isUp, // 是否上行,就是圈以上行开始,还是下行开始
9 bc1, // 第一班次 10 bc1, // 第一班次
10 bc2 // 第二个班次 11 bc2 // 第二个班次
11 ) { 12 ) {
  13 + // 所属内部路牌对象
  14 + this._$$_internal_lp_obj = lpObj;
  15 +
12 this._$_isUp = isUp; 16 this._$_isUp = isUp;
13 17
14 this._$_internalBcArray = []; 18 this._$_internalBcArray = [];
@@ -16,26 +20,39 @@ var InternalGroupBcObj = function( @@ -16,26 +20,39 @@ var InternalGroupBcObj = function(
16 this._$_internalBcArray.push(bc2); 20 this._$_internalBcArray.push(bc2);
17 }; 21 };
18 22
19 -InternalGroupBcObj.prototype.getBc1 = function() { 23 +//------------------------ get/set 方法 ------------------------//
  24 +
  25 +InternalGroupObj.prototype.getBc1 = function() {
20 return this._$_internalBcArray[0]; 26 return this._$_internalBcArray[0];
21 }; 27 };
22 -InternalGroupBcObj.prototype.getBc2 = function() { 28 +InternalGroupObj.prototype.getBc2 = function() {
23 return this._$_internalBcArray[1]; 29 return this._$_internalBcArray[1];
24 }; 30 };
25 31
26 -InternalGroupBcObj.prototype.setBc1 = function(bc) { 32 +InternalGroupObj.prototype.setBc1 = function(bc) {
27 this._$_internalBcArray[0] = bc; 33 this._$_internalBcArray[0] = bc;
28 }; 34 };
29 -InternalGroupBcObj.prototype.setBc2 = function(bc) { 35 +InternalGroupObj.prototype.removeBc1 = function() {
  36 + this._$_internalBcArray[0] = undefined;
  37 +};
  38 +InternalGroupObj.prototype.setBc2 = function(bc) {
30 this._$_internalBcArray[1] = bc; 39 this._$_internalBcArray[1] = bc;
31 }; 40 };
32 -InternalGroupBcObj.prototype.setLp = function(lp) { 41 +InternalGroupObj.prototype.removeBc2 = function() {
  42 + this._$_internalBcArray[1] = undefined;
  43 +};
  44 +InternalGroupObj.prototype.setLp = function(lpObj) {
  45 + this._$$_internal_lp_obj = lpObj; // InternalLpObj 对象
  46 +
33 var bc1 = this._$_internalBcArray[0]; 47 var bc1 = this._$_internalBcArray[0];
34 var bc2 = this._$_internalBcArray[1]; 48 var bc2 = this._$_internalBcArray[1];
35 if (bc1) { 49 if (bc1) {
36 - bc1.setLp(lp); 50 + bc1.setLp(lpObj);
37 } 51 }
38 if (bc2) { 52 if (bc2) {
39 - bc2.setLp(lp); 53 + bc2.setLp(lpObj);
40 } 54 }
41 -};  
42 \ No newline at end of file 55 \ No newline at end of file
  56 +};
  57 +
  58 +
  59 +
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalLpObj.js
1 -/**  
2 - * 内部路牌对象。  
3 - * @constructor  
4 - */  
5 -var InternalLpObj = function(  
6 - lp, // 路牌编号  
7 - qCount, // 总共多少圈  
8 - isUp // 圈是以上行开始还是下行开始  
9 -) {  
10 - this._$_lp = lp;  
11 - this._$_isUp = isUp;  
12 -  
13 - // 距离上一个路牌的最小发车间隔时间  
14 - // 用于纵向添加班次的时候使用  
15 - // 默认第一个路牌为0  
16 - this._$_minVerticalIntervalTime = 0;  
17 -  
18 - // 路牌的圈数,注意每个路牌的圈数都是一致的,  
19 - // 但并不是每一圈都有值  
20 - // 第1圈从上标线开始  
21 - // 第0圈表示中标线的第一个班次组成的半圈  
22 - // 有多少圈根据最终迭代的结果来看  
23 - this._$_qCount = qCount;  
24 - // 保存的是 InternalGroupBcObj 对象  
25 - this._$_groupBcArray = new Array(qCount);  
26 -  
27 - var i;  
28 - for (i = 0; i < this._$_qCount; i++) {  
29 - this._$_groupBcArray[i] = new InternalGroupBcObj(  
30 - this._$_isUp, undefined, undefined);  
31 - }  
32 -  
33 - // 班型的相关变量  
34 - this._$_bx_isLb = false; // 是否连班  
35 - this._$_bx_isfb = false; // 是否分班  
36 - this._$_bx_isfb_5_2 = false; // 是否5休2分班  
37 -  
38 - // TODO:  
39 -  
40 -};  
41 -  
42 -InternalLpObj.prototype.setBxFb5_2 = function(fb) {  
43 - this._$_bx_isfb_5_2 = fb;  
44 -};  
45 -InternalLpObj.prototype.isBxFb5_2 = function() {  
46 - return this._$_bx_isfb_5_2;  
47 -};  
48 -InternalLpObj.prototype.setBxLb = function(lb) {  
49 - this._$_bx_isLb = lb;  
50 -};  
51 -InternalLpObj.prototype.isBxLb = function() {  
52 - return this._$_bx_isLb;  
53 -};  
54 -  
55 -InternalLpObj.prototype.setBxFb = function(fb) {  
56 - this._$_bx_isfb = fb;  
57 -};  
58 -InternalLpObj.prototype.isBxFb = function() {  
59 - return this._$_bx_isfb;  
60 -};  
61 -  
62 -/**  
63 - * 设置纵向最小发车间隔时间。  
64 - * @param v  
65 - */  
66 -InternalLpObj.prototype.setVerticalMinIntervalTime = function(v) {  
67 - // 第一个路牌,都为0  
68 - this._$_minVerticalIntervalTime = v;  
69 -};  
70 -/**  
71 - * 获取纵向最小发车间隔时间。  
72 - * @returns {number|*}  
73 - */  
74 -InternalLpObj.prototype.getVerticalMinIntervalTime = function() {  
75 - return this._$_minVerticalIntervalTime;  
76 -};  
77 -  
78 -/**  
79 - * 返回总共班次数。  
80 - */  
81 -InternalLpObj.prototype.getBcCount = function() {  
82 - var i;  
83 - var group;  
84 - var bccount = 0;  
85 - for (i = 0; i < this._$_groupBcArray.length; i++) {  
86 - group = this._$_groupBcArray[i];  
87 - if (group) {  
88 - if (group.getBc1()) {  
89 - bccount += 1;  
90 - }  
91 - if (group.getBc2()) {  
92 - bccount += 1;  
93 - }  
94 - }  
95 - }  
96 -  
97 - return bccount;  
98 -};  
99 -  
100 -/**  
101 - * 获取最小(最早)班次对象。  
102 - * @return [{圈index},{班次index}]  
103 - */  
104 -InternalLpObj.prototype.getMinBcObjPosition = function() {  
105 - var i;  
106 - var bIndex = [];  
107 - for (i = 0; i < this._$_groupBcArray.length; i++) {  
108 - if (this._$_groupBcArray[i].getBc1()) {  
109 - bIndex.push(i);  
110 - bIndex.push(0);  
111 - break;  
112 - }  
113 - if (this._$_groupBcArray[i].getBc2()) {  
114 - bIndex.push(i);  
115 - bIndex.push(1);  
116 - break;  
117 - }  
118 - }  
119 - return bIndex;  
120 -};  
121 -  
122 -// TODO  
123 -  
124 -/**  
125 - *  
126 - *  
127 - */  
128 -InternalLpObj.prototype.calcuLpBx = function() {  
129 -  
130 -};  
131 -  
132 -/**  
133 - * 返回班次列表,过滤空的班次,将所有存在的班次连成连续的对象数组返回。  
134 - * @returns arrays (InternalBcObj)  
135 - */  
136 -InternalLpObj.prototype.getBcArray = function() {  
137 - var bcArray = [];  
138 - var i;  
139 - var group;  
140 - for (i = 0; i < this._$_groupBcArray.length; i++) {  
141 - group = this._$_groupBcArray[i];  
142 - if (group) {  
143 - group.getBc1() ? bcArray.push(group.getBc1()) : "";  
144 - group.getBc2() ? bcArray.push(group.getBc2()) : "";  
145 - }  
146 - }  
147 -  
148 - return bcArray;  
149 -};  
150 -  
151 -/**  
152 - * 从指定开始时间到结束时间创建不间断班次(连班),并初始化路牌  
153 - * 注意,之前有班次会删除后再创建。  
154 - * @param startTime 开始时间  
155 - * @param endTime 结束时间  
156 - * @param isUp 第一个班次是上行还是下行  
157 - * @param fromQ 从第几圈开始加入  
158 - * @param paramObj 参数对象  
159 - * @param factory 工厂对象  
160 - */  
161 -InternalLpObj.prototype.initDataFromTimeToTime = function(  
162 - startTime,  
163 - endTime,  
164 - isUp,  
165 - fromQ,  
166 - paramObj,  
167 - factory) {  
168 -  
169 - var bcData = []; // 班次数组  
170 - var bcObj;  
171 - var kssj = startTime;  
172 - var fcno = 1; // 发车顺序号  
173 - var bcCount = 1; // 班次数  
174 - do {  
175 - bcObj = factory.createBcObj(  
176 - "normal", isUp, this._$_lp, fcno, kssj, paramObj);  
177 - bcData.push(bcObj);  
178 -  
179 - kssj = paramObj.addMinute(kssj, bcObj.getBcTime() + bcObj.getStopTime());  
180 - fcno ++;  
181 - bcCount ++;  
182 - isUp = !isUp;  
183 - } while(kssj.isBefore(endTime));  
184 - bcCount--;  
185 -  
186 - if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(endTime)) {  
187 - // 如果最后一个班次的到达时间超过结束时间,也要去除  
188 - bcData.splice(bcCount - 1, 1);  
189 - }  
190 -  
191 - this.initDataFromLbBcArray(bcData, fromQ);  
192 -  
193 -};  
194 -  
195 -/**  
196 - * 使用连班的班次数组初始化路牌。  
197 - * @param bcArray 连班班次数组  
198 - * @param fromQ 从第几圈开始加入  
199 - */  
200 -InternalLpObj.prototype.initDataFromLbBcArray = function(  
201 - bcArray,  
202 - fromQ  
203 -) {  
204 - // 第一班次是上行还是下行  
205 - var isUp = bcArray[0].isUp();  
206 -  
207 - if (bcArray.length > 0 && fromQ < this._$_qCount) {  
208 - // 构造圈数  
209 - if (isUp != this._$_isUp) {  
210 - // 如果方向不一致,意味着第一个班次是半圈  
211 - // 加半圈,并加在bc2上  
212 - this._$_groupBcArray[fromQ] =  
213 - new InternalGroupBcObj(  
214 - this._$_isUp,  
215 - undefined,  
216 - bcArray.slice(0, 1)[0]  
217 - );  
218 - bcArray.splice(0, 1);  
219 - fromQ ++;  
220 - }  
221 -  
222 - var qCount1 = Math.floor(bcArray.length / 2); // 需要添加多少圈  
223 - var qCount2 = bcArray.length % 2; // 最后是否有半圈  
224 -  
225 - while (fromQ < this._$_qCount) {  
226 - if (qCount1 > 0) {  
227 - this._$_groupBcArray[fromQ] =  
228 - new InternalGroupBcObj(  
229 - this._$_isUp,  
230 - bcArray.slice(0, 1)[0],  
231 - bcArray.slice(1, 2)[0]  
232 - );  
233 - bcArray.splice(0, 2);  
234 - qCount1 --;  
235 - } else if (qCount2 > 0) {  
236 - // 加半圈,并加在bc1上  
237 - this._$_groupBcArray[fromQ] =  
238 - new InternalGroupBcObj(  
239 - this._$_isUp,  
240 - bcArray.slice(0, 1)[0],  
241 - undefined  
242 - );  
243 - } else {  
244 - break;  
245 - }  
246 -  
247 - fromQ ++;  
248 - }  
249 - }  
250 -};  
251 -  
252 -/**  
253 - * 获取班次。  
254 - * @param qIndex 第几圈  
255 - * @param bcIndex 第几个班次  
256 - */  
257 -InternalLpObj.prototype.getBc = function(qIndex, bcIndex) {  
258 - var group = this._$_groupBcArray[qIndex];  
259 - var bc;  
260 - if (bcIndex == 0) {  
261 - bc = group.getBc1();  
262 - } else if (bcIndex == 1) {  
263 - bc = group.getBc2();  
264 - }  
265 - return bc;  
266 -};  
267 -  
268 -/**  
269 - * 再具体位置设置班次。  
270 - * @param qIndex 第几圈  
271 - * @param bcIndex 第几个班次  
272 - * @param bc 班次对象  
273 - */  
274 -InternalLpObj.prototype.setBc = function(qIndex, bcIndex, bc) {  
275 - var group = this._$_groupBcArray[qIndex];  
276 - if (bcIndex == 0) {  
277 - group.setBc1(bc);  
278 - } else if (bcIndex == 1) {  
279 - group.setBc2(bc);  
280 - }  
281 -};  
282 -  
283 -/**  
284 - * 设置班次的路牌编号。  
285 - * @param lpNo  
286 - */  
287 -InternalLpObj.prototype.setLp = function(lpNo) {  
288 - var i;  
289 - var group;  
290 - for (i = 0; i < this._$_groupBcArray.length; i++) {  
291 - group = this._$_groupBcArray[i];  
292 - if (group) {  
293 - group.setLp(lpNo);  
294 - }  
295 - }  
296 -};  
297 -  
298 -/**  
299 - * 使用指定时间匹配返回离之最近的第几圈第几个班次,  
300 - * 使用时间差的绝度值,比较,取最小的  
301 - * 如果有两个一样的时间差,取比fctime大的时间  
302 - * @param fctime 比较用时间  
303 - * @param groupArray 圈数组  
304 - * @returns [{第几圈},{第几个班次}]  
305 - */  
306 -InternalLpObj.prototype.getgetQBcIndexWithFcTimeFromGroupArray = function(  
307 - fctime, groupArray  
308 -) {  
309 - var i;  
310 - var timediff; // 时间差取绝对值  
311 - var qIndex;  
312 - var bcIndex;  
313 -  
314 - var group;  
315 - var bc1time;  
316 - var bc2time;  
317 -  
318 - var tempdiff;  
319 - for (i = 0; i < this._$_qCount; i++) {  
320 - group = groupArray[i];  
321 - if (group) {  
322 - if (group.getBc1()) {  
323 - bc1time = group.getBc1().getFcTimeObj();  
324 - tempdiff = Math.abs(bc1time.diff(fctime));  
325 -  
326 - if (!timediff) {  
327 - timediff = Math.abs(tempdiff);  
328 - qIndex = i;  
329 - bcIndex = 0;  
330 - } else {  
331 - if (tempdiff < timediff) {  
332 - timediff = tempdiff;  
333 - qIndex = i;  
334 - bcIndex = 0;  
335 - } if (Math.abs(tempdiff) == timediff) {  
336 - if (bc1time.isBefore(fctime)) {  
337 - timediff = tempdiff;  
338 - qIndex = i;  
339 - bcIndex = 0;  
340 - }  
341 -  
342 - }  
343 - }  
344 - }  
345 -  
346 - if (group.getBc2()) {  
347 - bc2time = group.getBc2().getFcTimeObj();  
348 - tempdiff = Math.abs(bc2time.diff(fctime));  
349 -  
350 - if (!timediff) {  
351 - timediff = Math.abs(tempdiff);  
352 - qIndex = i;  
353 - bcIndex = 1;  
354 - } else {  
355 - if (tempdiff < timediff) {  
356 - timediff = tempdiff;  
357 - qIndex = i;  
358 - bcIndex = 1;  
359 - } if (Math.abs(tempdiff) == timediff) {  
360 - if (bc2time.isBefore(fctime)) {  
361 - timediff = tempdiff;  
362 - qIndex = i;  
363 - bcIndex = 1;  
364 - }  
365 -  
366 - }  
367 - }  
368 - }  
369 - }  
370 - }  
371 -  
372 - var rst = [];  
373 - rst.push(qIndex);  
374 - rst.push(bcIndex);  
375 -  
376 - return rst;  
377 -};  
378 -  
379 -/**  
380 - * 使用指定时间匹配返回离之最近的第几圈第几个班次,  
381 - * 使用时间差的绝度值,比较,取最小的  
382 - * 如果有两个一样的时间差,取比fctime大的时间  
383 - * @param fctime 比较用时间  
384 - * @returns [{第几圈},{第几个班次}]  
385 - */  
386 -InternalLpObj.prototype.getQBcIndexWithFcTime = function(  
387 - fctime  
388 -) {  
389 - return this.getgetQBcIndexWithFcTimeFromGroupArray(fctime, this._$_groupBcArray);  
390 -};  
391 - 1 +/**
  2 + * 内部路牌对象。
  3 + * @constructor
  4 + */
  5 +var InternalLpObj = function(
  6 + orilpObj, // 原始路牌对象
  7 + qCount, // 总共多少圈
  8 + isUp // 圈是以上行开始还是下行开始
  9 +) {
  10 + // TODO:原始路牌对象(这个路牌是对接外部gantt图像,以后有机会改了)
  11 + this._$$_orign_lp_obj = orilpObj;
  12 +
  13 + this._$_isUp = isUp;
  14 +
  15 + // 距离上一个路牌的最小发车间隔时间
  16 + // 用于纵向添加班次的时候使用
  17 + // 默认第一个路牌为0
  18 + this._$_minVerticalIntervalTime = 0;
  19 +
  20 + // 路牌的圈数,注意每个路牌的圈数都是一致的,
  21 + // 但并不是每一圈都有值
  22 + // 第1圈从上标线开始
  23 + // 第0圈表示中标线的第一个班次组成的半圈
  24 + // 有多少圈根据最终迭代的结果来看
  25 + this._$_qCount = qCount;
  26 + // 保存的是 InternalGroupBcObj 对象
  27 + this._$_groupBcArray = new Array(qCount);
  28 +
  29 + var i;
  30 + for (i = 0; i < this._$_qCount; i++) {
  31 + this._$_groupBcArray[i] = new InternalGroupObj(
  32 + this, this._$_isUp, undefined, undefined);
  33 + }
  34 +
  35 + // 班型的相关变量
  36 + this._$_bx_isLb = false; // 是否连班
  37 + this._$_bx_isfb = false; // 是否分班
  38 + this._$_bx_isfb_5_2 = false; // 是否5休2分班
  39 + this._$_bx_desc; // 班型描述(默认为路牌编号)
  40 +
  41 + // TODO:
  42 +
  43 +};
  44 +
  45 +//------------------- get/set 方法 -------------------//
  46 +
  47 +/**
  48 + * 获取圈
  49 + * @param qIndex 圈index
  50 + */
  51 +InternalLpObj.prototype.getGroup = function(qIndex) {
  52 + return this._$_groupBcArray[qIndex];
  53 +};
  54 +
  55 +/**
  56 + * 获取班次。
  57 + * @param qIndex 第几圈
  58 + * @param bcIndex 第几个班次
  59 + */
  60 +InternalLpObj.prototype.getBc = function(qIndex, bcIndex) {
  61 + var group = this._$_groupBcArray[qIndex];
  62 + var bc;
  63 + if (bcIndex == 0) {
  64 + bc = group.getBc1();
  65 + } else if (bcIndex == 1) {
  66 + bc = group.getBc2();
  67 + }
  68 + return bc;
  69 +};
  70 +
  71 +/**
  72 + * 在具体位置设置班次。
  73 + * @param qIndex 第几圈
  74 + * @param bcIndex 第几个班次
  75 + * @param bc 班次对象
  76 + */
  77 +InternalLpObj.prototype.setBc = function(qIndex, bcIndex, bc) {
  78 + var group = this._$_groupBcArray[qIndex];
  79 + if (bcIndex == 0) {
  80 + group.setBc1(bc);
  81 + bc.setGroup(group);
  82 + } else if (bcIndex == 1) {
  83 + group.setBc2(bc);
  84 + bc.setGroup(group);
  85 + }
  86 +};
  87 +
  88 +/**
  89 + * 设置原始路牌对象。
  90 + * @param lpObj 原始路牌对象
  91 + */
  92 +InternalLpObj.prototype.setLp = function(lpObj) {
  93 + this._$$_orign_lp_obj = lpObj;
  94 + var i;
  95 + var group;
  96 + for (i = 0; i < this._$_groupBcArray.length; i++) {
  97 + group = this._$_groupBcArray[i];
  98 + if (group) {
  99 + group.setLp(this); // 圈和班次保存都是 InternalLpObj 对象
  100 + }
  101 + }
  102 +};
  103 +
  104 +InternalLpObj.prototype.getLpNo = function() {
  105 + return this._$$_orign_lp_obj.lpNo;
  106 +};
  107 +InternalLpObj.prototype.getLpName = function() {
  108 + return this._$$_orign_lp_obj.lpName;
  109 +};
  110 +InternalLpObj.prototype.setBxFb5_2 = function(fb) {
  111 + this._$_bx_isfb_5_2 = fb;
  112 +};
  113 +InternalLpObj.prototype.isBxFb5_2 = function() {
  114 + return this._$_bx_isfb_5_2;
  115 +};
  116 +InternalLpObj.prototype.setBxLb = function(lb) {
  117 + this._$_bx_isLb = lb;
  118 +};
  119 +InternalLpObj.prototype.isBxLb = function() {
  120 + return this._$_bx_isLb;
  121 +};
  122 +
  123 +InternalLpObj.prototype.setBxFb = function(fb) {
  124 + this._$_bx_isfb = fb;
  125 +};
  126 +InternalLpObj.prototype.isBxFb = function() {
  127 + return this._$_bx_isfb;
  128 +};
  129 +
  130 +/**
  131 + * 设置路牌的班型描述(最终是设置班次的路牌名字)。
  132 + * @param desc 描述
  133 + */
  134 +InternalLpObj.prototype.setBxDesc = function(desc) {
  135 + // 最终原始路牌的名字
  136 + this._$$_orign_lp_obj.lpName = desc + "_" + this._$$_orign_lp_obj.lpNo;
  137 + // 内部对象的班型描述
  138 + this._$_bx_desc = desc;
  139 +};
  140 +/**
  141 + * 获取版型描述
  142 + * @returns string
  143 + */
  144 +InternalLpObj.prototype.getBxDesc = function() {
  145 + return this._$_bx_desc;
  146 +};
  147 +
  148 +/**
  149 + * 设置纵向最小发车间隔时间。
  150 + * @param v
  151 + */
  152 +InternalLpObj.prototype.setVerticalMinIntervalTime = function(v) {
  153 + // 第一个路牌,都为0
  154 + this._$_minVerticalIntervalTime = v;
  155 +};
  156 +/**
  157 + * 获取纵向最小发车间隔时间。
  158 + * @returns {number|*}
  159 + */
  160 +InternalLpObj.prototype.getVerticalMinIntervalTime = function() {
  161 + return this._$_minVerticalIntervalTime;
  162 +};
  163 +
  164 +//-------------------- 班次操作方法(查询,统计,删除) -----------------------//
  165 +
  166 +/**
  167 + * 返回总共班次数。
  168 + */
  169 +InternalLpObj.prototype.getBcCount = function() {
  170 + var i;
  171 + var group;
  172 + var bccount = 0;
  173 + for (i = 0; i < this._$_groupBcArray.length; i++) {
  174 + group = this._$_groupBcArray[i];
  175 + if (group) {
  176 + if (group.getBc1()) {
  177 + bccount += 1;
  178 + }
  179 + if (group.getBc2()) {
  180 + bccount += 1;
  181 + }
  182 + }
  183 + }
  184 +
  185 + return bccount;
  186 +};
  187 +
  188 +/**
  189 + * 返回班次列表,过滤空的班次,将所有存在的班次连成连续的对象数组返回。
  190 + * @returns arrays (InternalBcObj)
  191 + */
  192 +InternalLpObj.prototype.getBcArray = function() {
  193 + var bcArray = [];
  194 + var i;
  195 + var group;
  196 + for (i = 0; i < this._$_groupBcArray.length; i++) {
  197 + group = this._$_groupBcArray[i];
  198 + if (group) {
  199 + group.getBc1() ? bcArray.push(group.getBc1()) : "";
  200 + group.getBc2() ? bcArray.push(group.getBc2()) : "";
  201 + }
  202 + }
  203 +
  204 + return bcArray;
  205 +};
  206 +
  207 +/**
  208 + * 获取最小(最早)班次对象。
  209 + * @returns [{圈index},{班次index}]
  210 + */
  211 +InternalLpObj.prototype.getMinBcObjPosition = function() {
  212 + var i;
  213 + var bIndex = [];
  214 + for (i = 0; i < this._$_groupBcArray.length; i++) {
  215 + if (this._$_groupBcArray[i].getBc1()) {
  216 + bIndex.push(i);
  217 + bIndex.push(0);
  218 + break;
  219 + }
  220 + if (this._$_groupBcArray[i].getBc2()) {
  221 + bIndex.push(i);
  222 + bIndex.push(1);
  223 + break;
  224 + }
  225 + }
  226 + return bIndex;
  227 +};
  228 +
  229 +/**
  230 + * 获取最大(最晚)班次对象。
  231 + * @returns [{圈index},{班次index}]
  232 + */
  233 +InternalLpObj.prototype.getMaxBcObjPosition = function() {
  234 + var i;
  235 + var bIndex = [];
  236 + for (i = this._$_groupBcArray.length - 1; i >= 0; i--) {
  237 + if (this._$_groupBcArray[i].getBc2()) {
  238 + bIndex.push(i);
  239 + bIndex.push(1);
  240 + break;
  241 + }
  242 + if (this._$_groupBcArray[i].getBc1()) {
  243 + bIndex.push(i);
  244 + bIndex.push(0);
  245 + break;
  246 + }
  247 + }
  248 + return bIndex;
  249 +};
  250 +
  251 +/**
  252 + * 在具体位置移除班次。
  253 + * @param qIndex 第几圈
  254 + * @param bcIndex 第几个班次
  255 + */
  256 +InternalLpObj.prototype.removeBc = function(qIndex, bcIndex) {
  257 + var group = this._$_groupBcArray[qIndex];
  258 + if (bcIndex == 0) {
  259 + group.removeBc1();
  260 + } else if (bcIndex == 1) {
  261 + group.removeBc2();
  262 + }
  263 +};
  264 +
  265 +/**
  266 + * 使用指定时间匹配返回离之最近的第几圈第几个班次,
  267 + * 使用时间差的绝度值,比较,取最小的
  268 + * 如果有两个一样的时间差,取比fctime大的时间
  269 + * @param fctime 比较用时间
  270 + * @param groupArray 圈数组
  271 + * @returns [{第几圈},{第几个班次}]
  272 + */
  273 +InternalLpObj.prototype.getgetQBcIndexWithFcTimeFromGroupArray = function(
  274 + fctime, groupArray
  275 +) {
  276 + var i;
  277 + var timediff; // 时间差取绝对值
  278 + var qIndex;
  279 + var bcIndex;
  280 +
  281 + var group;
  282 + var bc1time;
  283 + var bc2time;
  284 +
  285 + var tempdiff;
  286 + for (i = 0; i < this._$_qCount; i++) {
  287 + group = groupArray[i];
  288 + if (group) {
  289 + if (group.getBc1()) {
  290 + bc1time = group.getBc1().getFcTimeObj();
  291 + tempdiff = Math.abs(bc1time.diff(fctime));
  292 +
  293 + if (!timediff) {
  294 + timediff = Math.abs(tempdiff);
  295 + qIndex = i;
  296 + bcIndex = 0;
  297 + } else {
  298 + if (tempdiff < timediff) {
  299 + timediff = tempdiff;
  300 + qIndex = i;
  301 + bcIndex = 0;
  302 + } if (Math.abs(tempdiff) == timediff) {
  303 + if (bc1time.isBefore(fctime)) {
  304 + timediff = tempdiff;
  305 + qIndex = i;
  306 + bcIndex = 0;
  307 + }
  308 +
  309 + }
  310 + }
  311 + }
  312 +
  313 + if (group.getBc2()) {
  314 + bc2time = group.getBc2().getFcTimeObj();
  315 + tempdiff = Math.abs(bc2time.diff(fctime));
  316 +
  317 + if (!timediff) {
  318 + timediff = Math.abs(tempdiff);
  319 + qIndex = i;
  320 + bcIndex = 1;
  321 + } else {
  322 + if (tempdiff < timediff) {
  323 + timediff = tempdiff;
  324 + qIndex = i;
  325 + bcIndex = 1;
  326 + } if (Math.abs(tempdiff) == timediff) {
  327 + if (bc2time.isBefore(fctime)) {
  328 + timediff = tempdiff;
  329 + qIndex = i;
  330 + bcIndex = 1;
  331 + }
  332 +
  333 + }
  334 + }
  335 + }
  336 + }
  337 + }
  338 +
  339 + var rst = [];
  340 + rst.push(qIndex);
  341 + rst.push(bcIndex);
  342 +
  343 + return rst;
  344 +};
  345 +
  346 +/**
  347 + * 使用指定时间匹配返回离之最近的第几圈第几个班次,
  348 + * 使用时间差的绝度值,比较,取最小的
  349 + * 如果有两个一样的时间差,取比fctime大的时间
  350 + * @param fctime 比较用时间
  351 + * @returns [{第几圈},{第几个班次}]
  352 + */
  353 +InternalLpObj.prototype.getQBcIndexWithFcTime = function(
  354 + fctime
  355 +) {
  356 + return this.getgetQBcIndexWithFcTimeFromGroupArray(fctime, this._$_groupBcArray);
  357 +};
  358 +
  359 +//---------------------- 内部数据初始化方法(不同于构造函数)---------------------//
  360 +
  361 +/**
  362 + * 从指定开始时间到结束时间创建不间断班次(连班),并初始化路牌
  363 + * 注意,之前有班次会删除后再创建。
  364 + * @param startTime 开始时间
  365 + * @param endTime 结束时间
  366 + * @param isUp 第一个班次是上行还是下行
  367 + * @param fromQ 从第几圈开始加入
  368 + * @param paramObj 参数对象
  369 + * @param factory 工厂对象
  370 + */
  371 +InternalLpObj.prototype.initDataFromTimeToTime = function(
  372 + startTime,
  373 + endTime,
  374 + isUp,
  375 + fromQ,
  376 + paramObj,
  377 + factory) {
  378 +
  379 + var bcData = []; // 班次数组
  380 + var bcObj;
  381 + var kssj = startTime;
  382 + var fcno = 1; // 发车顺序号
  383 + var bcCount = 1; // 班次数
  384 + do {
  385 + bcObj = factory.createBcObj(
  386 + this, "normal", isUp, fcno, kssj, paramObj); // this就是所属路牌对象
  387 + bcData.push(bcObj);
  388 +
  389 + kssj = paramObj.addMinute(kssj, bcObj.getBcTime() + bcObj.getStopTime());
  390 + fcno ++;
  391 + bcCount ++;
  392 + isUp = !isUp;
  393 + } while(kssj.isBefore(endTime));
  394 + bcCount--;
  395 +
  396 + if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(endTime)) {
  397 + // 如果最后一个班次的到达时间超过结束时间,也要去除
  398 + bcData.splice(bcCount - 1, 1);
  399 + }
  400 +
  401 + this._initDataFromLbBcArray(bcData, fromQ);
  402 +
  403 +};
  404 +
  405 +/**
  406 + * 使用连班的班次数组初始化路牌(相应的圈会被覆盖)。
  407 + * @param bcArray 连班班次数组
  408 + * @param fromQ 从第几圈开始加入
  409 + */
  410 +InternalLpObj.prototype._initDataFromLbBcArray = function(
  411 + bcArray,
  412 + fromQ
  413 +) {
  414 + var _bc1Obj;
  415 + var _bc2Obj;
  416 + var _qObj;
  417 +
  418 + // 第一班次是上行还是下行
  419 + var isUp = bcArray[0].isUp();
  420 +
  421 + if (bcArray.length > 0 && fromQ < this._$_qCount) {
  422 + // 构造圈数
  423 + if (isUp != this._$_isUp) {
  424 + // 如果方向不一致,意味着第一个班次是半圈
  425 + // 加半圈,并加在bc2上
  426 + _bc2Obj = bcArray.slice(0, 1)[0];
  427 + _qObj = new InternalGroupObj(
  428 + this,
  429 + this._$_isUp,
  430 + undefined,
  431 + _bc2Obj
  432 + );
  433 + _bc2Obj.setGroup(_qObj);
  434 + this._$_groupBcArray[fromQ] = _qObj;
  435 +
  436 + bcArray.splice(0, 1);
  437 + fromQ ++;
  438 + }
  439 +
  440 + var qCount1 = Math.floor(bcArray.length / 2); // 需要添加多少圈
  441 + var qCount2 = bcArray.length % 2; // 最后是否有半圈
  442 +
  443 + while (fromQ < this._$_qCount) {
  444 + if (qCount1 > 0) {
  445 + _bc1Obj = bcArray.slice(0, 1)[0];
  446 + _bc2Obj = bcArray.slice(1, 2)[0];
  447 + _qObj = new InternalGroupObj(
  448 + this,
  449 + this._$_isUp,
  450 + _bc1Obj,
  451 + _bc2Obj
  452 + );
  453 + _bc1Obj.setGroup(_qObj);
  454 + _bc2Obj.setGroup(_qObj);
  455 + this._$_groupBcArray[fromQ] = _qObj;
  456 +
  457 + bcArray.splice(0, 2);
  458 + qCount1 --;
  459 + } else if (qCount2 > 0) {
  460 + // 加半圈,并加在bc1上
  461 + _bc1Obj = bcArray.slice(0, 1)[0];
  462 + _qObj = new InternalGroupObj(
  463 + this,
  464 + this._$_isUp,
  465 + _bc1Obj,
  466 + undefined
  467 + );
  468 + _bc1Obj.setGroup(_qObj);
  469 + this._$_groupBcArray[fromQ] = _qObj;
  470 + } else {
  471 + break;
  472 + }
  473 +
  474 + fromQ ++;
  475 + }
  476 + }
  477 +};
  478 +
  479 +//-------------------------- 其他方法 ----------------------------//
  480 +
  481 +
  482 +// TODO
  483 +
  484 +/**
  485 + *
  486 + *
  487 + */
  488 +InternalLpObj.prototype.calcuLpBx = function() {
  489 +
  490 +};
  491 +
  492 +
  493 +
  494 +
  495 +
  496 +
  497 +
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
1 -/**  
2 - * 内部行车计划对象。  
3 - * @constructor  
4 - */  
5 -var InternalScheduleObj = function(paramObj, lpArray, factory) {  
6 - // 参数对象  
7 - var _paramObj = paramObj;  
8 - // 外部的路牌数组  
9 - var _lpArray = lpArray;  
10 - // 工厂对象  
11 - var _factory = factory;  
12 -  
13 - //------------------ 初始化方法1,以及计算关联的内部变量 -----------------//  
14 - var _qIsUp; // 每一圈是上行开始还是下行开始  
15 - var _qCount = 0; // 总的圈数  
16 - var _internalLpArray = []; // 内部对象数组  
17 -  
18 - var _initFun1 = function() { // 初始化方法1  
19 - // 确定_qIsUp,哪个方向的首班车晚就用哪个  
20 - _qIsUp = _paramObj.getUpFirstDTimeObj().isBefore(  
21 - _paramObj.getDownFirstDTimeObj()) ? false : true;  
22 - // 上标线开始时间,就是方向的首班车时间  
23 - var st = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();  
24 - // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向  
25 - var et;  
26 - var et_IsUp;  
27 - if (_paramObj.getUpLastDtimeObj().isBefore(  
28 - _paramObj.getDownLastDTimeObj())) {  
29 - et = _paramObj.getDownLastDTimeObj();  
30 - et_IsUp = false;  
31 - } else {  
32 - et = _paramObj.getUpLastDtimeObj();  
33 - et_IsUp = true;  
34 - }  
35 -  
36 - // 以开始时间,结束时间,构造上标线用连班班次  
37 - var bcData = []; // 班次数组  
38 - var bcObj;  
39 - var isUp = _qIsUp; // 方向  
40 - var kssj = st;  
41 - var fcno = 1; // 发车顺序号  
42 - var bcCount = 1; // 班次数  
43 - do {  
44 - bcObj = _factory.createBcObj(  
45 - "normal", isUp, _lpArray[0].lpNo, fcno, kssj, paramObj);  
46 - bcData.push(bcObj);  
47 -  
48 - kssj = paramObj.addMinute(kssj, bcObj.getBcTime() + bcObj.getStopTime());  
49 - fcno ++;  
50 - bcCount ++;  
51 - isUp = !isUp;  
52 - } while(kssj.isBefore(et));  
53 - bcCount--; // 因为先做do,所以总的班次要减1  
54 - if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(et)) {  
55 - // 如果最后一个班次的到达时间超过结束时间,也要去除  
56 - bcData.splice(bcCount - 1, 1);  
57 - bcCount--;  
58 - }  
59 - var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈  
60 - var _qCount_p2 = bcCount % 2; // 余下的1个班次也算一圈  
61 -  
62 - // 利用连班数组计算圈数  
63 - _qCount = 1; // 前面加1圈,补中标线的班次  
64 - _qCount += _qCount_p1;  
65 - _qCount += _qCount_p2;  
66 -  
67 - // 计算最后是不是还要补一圈  
68 - if (_qCount > 1) { // 总的圈数就1圈,没必要加了(其实是不可能的,除非参数里问题)  
69 - if (_qCount_p2 == 0) { // 没有余下班次,整数圈数  
70 - // 最后一个班次的方向一定和开始的方向相反,如:上-下,上-下,上-下,一共三圈,最后一个班次为下行  
71 - // 判定最后一个班次的方向和上标线判定结束时间的班次方向是否一致  
72 - if (!_qIsUp == et_IsUp) {  
73 - // 一致不用加圈数  
74 - } else {  
75 - // 不一致需要加圈补最后一个结束时间班次  
76 - _qCount ++;  
77 - }  
78 - } else {  
79 - // 有余下的圈数,最后要不补的班次不管上行,下行都在这一圈里  
80 - // 不需要在补圈数了  
81 - }  
82 - }  
83 -  
84 - // 创建内部的路牌数组,并把之前的连班路牌添加进上标线路牌中  
85 - var i;  
86 - for (i = 0; i < _lpArray.length; i++) {  
87 - _internalLpArray.push(  
88 - new InternalLpObj(_lpArray[i].lpNo, _qCount, _qIsUp));  
89 - }  
90 - _internalLpArray[0].initDataFromLbBcArray(bcData, 1); // 上标线从第1圈开始放班次  
91 -  
92 - console.log("//---------------- 行车计划,初始化方法1 start ----------------//");  
93 - console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") +  
94 - "上行末班车时间:" + _paramObj.getUpLastDtimeObj().format("HH:mm"));  
95 - console.log("下行首班车时间:" + _paramObj.getDownFirstDTimeObj().format("HH:mm") +  
96 - "下行末班车时间:" + _paramObj.getDownLastDTimeObj().format("HH:mm"));  
97 - console.log("总共计算的圈数:" + _qCount);  
98 - console.log("圈的方向isUP:" + _qIsUp);  
99 - console.log("//---------------- 行车计划,初始化方法1 end ----------------//");  
100 -  
101 - };  
102 -  
103 - //------------------ 初始化方法2,以及计算关联的内部变量 ----------------//  
104 - var _zgfQIndex; // 早高峰车辆从第几圈开始全部发出  
105 - var _zgfBIndex; // 早高峰车辆从第几圈第几个班次全部发出  
106 - var _wgfQIndex; // 晚高峰车辆从第几圈开始全部发出  
107 - var _wgfBIndex; // 晚高峰车辆从第几圈第几个班次全部发出  
108 -  
109 - // 同一圈同一方向班次发车间隔的最小值  
110 - // 注意:这个值就是用来添加班次的时间增加单位,在后面相关的方法里会具体说明  
111 - var _qbcMinIntervalValue;  
112 -  
113 - var _initFun2 = function() { // 初始化方法2  
114 - // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次  
115 - // 以这个班次为早高峰起点,全部出车策略  
116 - var qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(  
117 - _paramObj.getMPeakStartTimeObj());  
118 - var qIndex = qbcIndexArray[0]; // 第几圈  
119 - var bIndex = qbcIndexArray[1]; // 第几个班次  
120 - var startbc = _internalLpArray[0].getBc(qIndex, bIndex);  
121 -  
122 - // 计算早高峰  
123 - var _clCount = _paramObj.calcuClzx();  
124 - var _c1 = Math.floor(_paramObj.calcuPeakZzsj() / _clCount);  
125 - var _c2 = _paramObj.calcuPeakZzsj() % _clCount;  
126 - var _kssj = startbc.getFcTimeObj();  
127 -  
128 - var i;  
129 - for (i = 2; i <= _clCount - _c2; i++) {  
130 - _kssj = _paramObj.addMinute(_kssj, _c1);  
131 - _internalLpArray[i - 1].setBc(  
132 - qIndex,  
133 - bIndex,  
134 - _factory.createBcObj(  
135 - "normal", startbc.isUp(),  
136 - _lpArray[i - 1].lpNo,  
137 - 1, _kssj, paramObj)  
138 - );  
139 - // 使用早高峰的发车间隔最为路牌纵向最小发车间隔  
140 - _internalLpArray[i - 1].setVerticalMinIntervalTime(_c1);  
141 - }  
142 - for (i = 1; i <= _c2; i++) {  
143 - _kssj = _paramObj.addMinute(_kssj, _c1 + 1);  
144 - _internalLpArray[_clCount - _c2 + i - 1].setBc(  
145 - qIndex,  
146 - bIndex,  
147 - _factory.createBcObj(  
148 - "normal", startbc.isUp(),  
149 - _lpArray[_clCount - _c2 + i - 1].lpNo,  
150 - 1, _kssj, paramObj)  
151 - );  
152 - // 使用早高峰的发车间隔最为路牌纵向最小发车间隔  
153 - _internalLpArray[_clCount - _c2 + i - 1].setVerticalMinIntervalTime(_c1);  
154 - }  
155 -  
156 - _zgfQIndex = qIndex;  
157 - _zgfBIndex = bIndex;  
158 -  
159 - // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次  
160 - // 以这个班次为早高峰起点,全部出车策略  
161 - qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(  
162 - _paramObj.getEPeakStartTimeObj());  
163 - qIndex = qbcIndexArray[0]; // 第几圈  
164 - bIndex = qbcIndexArray[1]; // 第几个班次  
165 - startbc = _internalLpArray[0].getBc(qIndex, bIndex);  
166 -  
167 - // 计算晚高峰  
168 - _clCount = _paramObj.calcuClzx();  
169 - _c1 = Math.floor(_paramObj.calcuPeakZzsj() / _clCount);  
170 - _c2 = _paramObj.calcuPeakZzsj() % _clCount;  
171 - _kssj = startbc.getFcTimeObj();  
172 -  
173 - for (i = 2; i <= _clCount - _c2; i++) {  
174 - _kssj = _paramObj.addMinute(_kssj, _c1);  
175 - _internalLpArray[i - 1].setBc(  
176 - qIndex,  
177 - bIndex,  
178 - _factory.createBcObj(  
179 - "normal", startbc.isUp(),  
180 - _lpArray[i - 1].lpNo,  
181 - 1, _kssj, _paramObj)  
182 - );  
183 - }  
184 - for (i = 1; i <= _c2; i++) {  
185 - _kssj = _paramObj.addMinute(_kssj, _c1 + 1);  
186 - _internalLpArray[_clCount - _c2 + i - 1].setBc(  
187 - qIndex,  
188 - bIndex,  
189 - _factory.createBcObj(  
190 - "normal", startbc.isUp(),  
191 - _lpArray[_clCount - _c2 + i - 1].lpNo,  
192 - 1, _kssj, _paramObj)  
193 - );  
194 - }  
195 -  
196 - _wgfQIndex = qIndex;  
197 - _wgfBIndex = bIndex;  
198 - _qbcMinIntervalValue = _c1;  
199 -  
200 - console.log("//---------------- 行车计划,初始化方法2 start ----------------//");  
201 - console.log("早高峰第" + _zgfQIndex + "(index)圈,第" + _zgfBIndex + "(index)班次车辆全部发出");  
202 - console.log("晚高峰第" + _wgfQIndex + "(index)圈,第" + _wgfBIndex + "(index)班次车辆全部发出");  
203 - console.log("同圈同方向班次最小间隔(分钟):" + _qbcMinIntervalValue);  
204 - console.log("//---------------- 行车计划,初始化方法2 end ----------------//");  
205 - };  
206 -  
207 - //----------------------- 初始化方法3,以及计算关联的内部变量 ----------------//  
208 - var _zbx_lpIndex; // 中标线对应第几个路牌  
209 -  
210 - var _initFun3 = function() { // 初始化方法3  
211 - // 构造中标线  
212 - // 中标线开始时间,就是方向的首班车时间  
213 - var st = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();  
214 - // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向  
215 - // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向  
216 - var et;  
217 - if (_paramObj.getUpLastDtimeObj().isBefore(  
218 - _paramObj.getDownLastDTimeObj())) {  
219 - et = _paramObj.getDownLastDTimeObj();  
220 - } else {  
221 - et = _paramObj.getUpLastDtimeObj();  
222 - }  
223 -  
224 - var tempLpObj = new InternalLpObj(-999, _qCount, _qIsUp);  
225 - tempLpObj.initDataFromTimeToTime(  
226 - st,  
227 - et,  
228 - !_qIsUp,  
229 - 0,  
230 - _paramObj,  
231 - _factory  
232 - );  
233 -  
234 - // 找出中标线对应的早高峰的班次对象  
235 - var _zb_bcobj = tempLpObj.getBc(_zgfQIndex, _zgfBIndex);  
236 -  
237 - // 把所有高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌  
238 - var _tempq_array = [];  
239 - var _temp_group;  
240 - var _temp_bc;  
241 - var i;  
242 - for (i = 0; i < _internalLpArray.length; i++) {  
243 - _temp_bc = _internalLpArray[i].getBc(_zgfQIndex, _zgfBIndex);  
244 - if (_temp_bc.isUp() == _qIsUp) {  
245 - _temp_group = new InternalGroupBcObj(_qIsUp, _temp_bc, undefined);  
246 - } else {  
247 - _temp_group = new InternalGroupBcObj(_qIsUp, undefined, _temp_bc);  
248 - }  
249 - _tempq_array.push(_temp_group);  
250 - }  
251 -  
252 - var _ttindex_ = tempLpObj.getgetQBcIndexWithFcTimeFromGroupArray(  
253 - _zb_bcobj.getFcTimeObj(),  
254 - _tempq_array  
255 - );  
256 - _zbx_lpIndex = _ttindex_[0]; // 中标线放在第几个路牌  
257 - tempLpObj.setLp(_lpArray[_zbx_lpIndex].lpNo);  
258 - tempLpObj.setVerticalMinIntervalTime( // 设置纵向最小发车间隔  
259 - _internalLpArray[_zbx_lpIndex].getVerticalMinIntervalTime()  
260 - );  
261 -  
262 - // 注意:这里直接把中标线数据替换到指定路牌位置  
263 - // TODO:由初始化方法1,初始化方法2得到的2个高峰的班次会被中标线对应班次覆盖  
264 - // TODO:目前使用中标线的班次覆盖,以后相互动态调整  
265 -  
266 - _internalLpArray[_zbx_lpIndex] = tempLpObj;  
267 -  
268 - console.log("//---------------- 行车计划,初始化方法3 start ----------------//");  
269 - console.log("中标线对应第" + (_zbx_lpIndex + 1) + "个路牌");  
270 - console.log("//---------------- 行车计划,初始化方法3 end ----------------//");  
271 -  
272 - };  
273 -  
274 - //----------------------- 初始化方法4,以及计算关联的内部变量 ----------------//  
275 - var _bx_lb_lpcount; // 连班路牌数  
276 - var _bx_5_2_fb_lpcount; // 5休2分班路牌数  
277 - var _bx_other_fb_lpcount; // 其他分班路牌数  
278 -  
279 - var _initFun4 = function() { // 初始化方法4  
280 - // 总共车辆数(高峰最大车辆数)  
281 - var cls = _paramObj.calcuClzx();  
282 - // 低谷最少配车(连班车数量)  
283 - var dgminpc = Math.round(_paramObj.calcuTroughZzsj() / _paramObj.getTroughMaxFcjx());  
284 - // 加班车路牌数(做5休2的路牌数)  
285 - var _5_2_lpes = _paramObj.getJBLpes();  
286 -  
287 - // 做些简单的验证  
288 - if (cls < dgminpc) {  
289 - alert("总配车数小于低谷最小配车");  
290 - throw "总配车数小于低谷最小配车";  
291 - }  
292 - if (dgminpc < 2) {  
293 - alert("连班路牌小于2,办不到啊");  
294 - throw "连班路牌小于2,办不到啊";  
295 - }  
296 - if (cls - dgminpc < _5_2_lpes) {  
297 - alert("总分班路牌数小于加班路牌数");  
298 - throw "总分班路牌数小于加班路牌数";  
299 - }  
300 -  
301 - _bx_lb_lpcount = dgminpc;  
302 - _bx_5_2_fb_lpcount = _5_2_lpes;  
303 - _bx_other_fb_lpcount = cls - dgminpc - _5_2_lpes;  
304 -  
305 - console.log("//---------------- 行车计划,初始化方法4 start ----------------//");  
306 - console.log("连班路牌数:" + _bx_lb_lpcount);  
307 - console.log("5休2分班路牌数:" + _bx_5_2_fb_lpcount);  
308 - console.log("其他分班路牌数:" + _bx_other_fb_lpcount);  
309 - console.log("//---------------- 行车计划,初始化方法4 end ----------------//");  
310 - };  
311 -  
312 -  
313 - return {  
314 - //------------- 布局初始化方法 ------------//  
315 - /**  
316 - * 初始化数据,使用标线初始化  
317 - */  
318 - initDataWithBxLayout: function() {  
319 - // 初始化布局1,构造上标线,计算圈数,把上标线数据放入第一个路牌中  
320 - _initFun1();  
321 - // 初始化布局2,从上标线的某个班次开始,构造所有路牌的早高峰班次,晚高峰班次  
322 - _initFun2();  
323 - // 初始化布局3,构造中标线,根据高峰班次,将中标线放入合适的路牌中  
324 - _initFun3();  
325 - // 初始化4,计算连班,分班相关路牌数  
326 - _initFun4();  
327 -  
328 - // 测试添加班次  
329 - //this._generateBc(8, 1, 0);  
330 - //this._generateBc(10, 1, 0);  
331 - //this._generateBc(11, 1, 0);  
332 - //this._generateBc(12, 1, 0);  
333 - //this._generateBc(13, 1, 0);  
334 - //this._generateBc(14, 1, 0);  
335 - //this._generateBc(15, 1, 0);  
336 - //this._generateBc(16, 1, 0);  
337 - //this._generateBc(17, 1, 0);  
338 - //this._generateBc(18, 1, 0);  
339 - //  
340 - //this._generateBc(10, 1, 1);  
341 - //this._generateBc(11, 1, 1);  
342 - //this._generateBc(12, 1, 1);  
343 - //this._generateBc(13, 1, 1);  
344 - //this._generateBc(14, 1, 1);  
345 - //this._generateBc(15, 1, 1);  
346 - //this._generateBc(16, 1, 1);  
347 - //this._generateBc(17, 1, 1);  
348 - //this._generateBc(18, 1, 1);  
349 -  
350 - // TODO:  
351 -  
352 - // 测试时间判定  
353 - //console.log("班次出车时间:" + _internalLpArray[0].getQBcIndexWithFcTime(  
354 - // _paramObj.getMPeakStartTimeObj()  
355 - // ));  
356 -  
357 - //// 测试画中标线,第6个路牌的位置,下行中标  
358 - //_internalLpArray[7].initDataFromTimeToTime(  
359 - // _paramObj.getDownFirstDTimeObj(),  
360 - // _paramObj.getUpLastDtimeObj(),  
361 - // false,  
362 - // 0,  
363 - // _paramObj,  
364 - // _factory  
365 - //);  
366 -  
367 - },  
368 -  
369 - // TODO:  
370 -  
371 - /**  
372 - * 根据每个路牌的连班班型补充班次。  
373 - * 补充连班的班次,参照上标线,中标线补充不足的班次  
374 - */  
375 - calcuLpBx_lb: function() {  
376 - // 补充连班的班次,参照上标线,中标线补充不足的班次  
377 - var _zgffcsj; // 早高峰发车时间  
378 - var _etsj = // 结束时间  
379 - _paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj()) ?  
380 - _paramObj.getDownLastDTimeObj() :  
381 - _paramObj.getUpLastDtimeObj();  
382 -  
383 - var _lp;  
384 - var _minbcPos;  
385 - var _bcObj;  
386 - var i;  
387 - for (i = 0; i < _internalLpArray.length; i++) {  
388 - _lp = _internalLpArray[i];  
389 - if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) {  
390 - _minbcPos = _lp.getMinBcObjPosition();  
391 - _bcObj = _lp.getBc(_minbcPos[0], _minbcPos[1]);  
392 - _zgffcsj = _bcObj.getFcTimeObj();  
393 - // 重新初始化连班班型班次  
394 - _lp.initDataFromTimeToTime(  
395 - _zgffcsj,  
396 - _etsj,  
397 - _bcObj.isUp(),  
398 - _minbcPos[0],  
399 - _paramObj,  
400 - _factory  
401 - );  
402 - }  
403 - }  
404 -  
405 - // 还要补充缺失的班次,差上标线几个班次要往前补上  
406 - var _bccount;  
407 - var j;  
408 - var _qIndex;  
409 - var _bIndex;  
410 - // 补上标线到中标线之间的连班路牌的班次  
411 - for (i = 0; i < _zbx_lpIndex; i++) {  
412 - _lp = _internalLpArray[i];  
413 - if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) {  
414 - _minbcPos = _lp.getMinBcObjPosition();  
415 - _qIndex = _minbcPos[0];  
416 - _bIndex = _minbcPos[1];  
417 - _bccount = (_qIndex - 1) * 2 + _bIndex; // 距离上标线起始站点差几个班次  
418 - for (j = 0; j < _bccount; j++) {  
419 - if (_bIndex == 0) {  
420 - _qIndex --;  
421 - _bIndex = 1;  
422 - this._generateBc(i, _qIndex, _bIndex);  
423 - } else if (_bIndex == 1) {  
424 - _bIndex --;  
425 - this._generateBc(i, _qIndex, _bIndex);  
426 - }  
427 - }  
428 - }  
429 - }  
430 - // 补中标线以下的连班路牌的班次  
431 - for (i = _zbx_lpIndex; i < _internalLpArray.length; i++) {  
432 - _lp = _internalLpArray[i];  
433 - if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) {  
434 - _minbcPos = _lp.getMinBcObjPosition();  
435 - _qIndex = _minbcPos[0];  
436 - _bIndex = _minbcPos[1];  
437 - _bccount = (_qIndex - 0) * 2 + _bIndex - 1; // 距离上标线起始站点差几个班次  
438 - for (j = 0; j < _bccount; j++) {  
439 - if (_bIndex == 0) {  
440 - _qIndex --;  
441 - _bIndex = 1;  
442 - this._generateBc(i, _qIndex, _bIndex);  
443 - } else if (_bIndex == 1) {  
444 - _bIndex --;  
445 - this._generateBc(i, _qIndex, _bIndex);  
446 - }  
447 - }  
448 - }  
449 - }  
450 -  
451 - },  
452 -  
453 - /**  
454 - * 计算每个路牌的班型及工时对应的圈数。  
455 - * 1、将连班,分班路牌分配到各个路牌上(分隔法),上标线,中标线上连班路牌  
456 - * 2、确定班型的工时,其中连班路牌的工时由上标线,中标线确定好了,5休2路牌工时也确定了,  
457 - * 其余分班路牌的工时由高峰低谷最大,最小发车间隔计算  
458 - */  
459 - calcuLpBx_fg: function() {  
460 - // 间隔法  
461 - // 除去上标线,中标线的连班路牌个数  
462 - var _lblbcount = _bx_lb_lpcount - 2;  
463 - // 计算由标线隔开的两个区域的路牌数比率  
464 - var _p1 = (_zbx_lpIndex + 1) / (_internalLpArray.length + 1);  
465 - var _p2 = (_internalLpArray.length - _zbx_lpIndex) / (_internalLpArray.length + 1);  
466 - var _p1_lpcount = _lblbcount * _p1;  
467 - var _p2_lpcount = _lblbcount * _p2;  
468 - if (parseInt(_p1_lpcount) != _p1_lpcount) { // 没有整除  
469 - _p1_lpcount = Math.floor(_p1_lpcount);  
470 - _p2_lpcount = Math.floor(_p2_lpcount) + 1;  
471 - }  
472 -  
473 - // 设定第一个区域的连班路牌  
474 - var i;  
475 - var _count = _p1_lpcount + 1;  
476 - var _c1 = Math.floor(_zbx_lpIndex / _count);  
477 - var _c2 = _zbx_lpIndex % _count;  
478 - var _c2_start_index;  
479 - for (i = 1; i <= _count - _c2; i++) {  
480 - _internalLpArray[(i - 1) * _c1].setBxLb(true);  
481 - _c2_start_index = (i - 1) * _c1;  
482 - }  
483 - for (i = 1; i <= _c2; i++) {  
484 - _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true);  
485 - }  
486 -  
487 - // 设定第二个区域的连班路牌  
488 - _count = _p2_lpcount + 1;  
489 - _c1 = Math.floor((_internalLpArray.length - _zbx_lpIndex - 1) / _count);  
490 - _c2 = (_internalLpArray.length - _zbx_lpIndex - 1) % _count;  
491 - for (i = 1; i <= _count - _c2; i++) {  
492 - _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxLb(true);  
493 - _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb(false);  
494 - _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb5_2(false);  
495 - _c2_start_index = (i - 1) * _c1 + _zbx_lpIndex;  
496 - }  
497 - for (i = 1; i <= _c2; i++) {  
498 - _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true);  
499 - _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb(false);  
500 - _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb5_2(false);  
501 - }  
502 -  
503 - // 设定分班路牌  
504 - var notlbIndexes = []; // 去除连班的路牌index列表  
505 - for (i = 0; i < _internalLpArray.length; i++) {  
506 - if (!_internalLpArray[i].isBxLb()) {  
507 - notlbIndexes.push(i);  
508 - }  
509 - }  
510 - // 先把全部放置分班路牌,在全部放置5休2路牌  
511 - for (i = 0; i < _bx_other_fb_lpcount; i++) {  
512 - _internalLpArray[notlbIndexes[i]].setBxFb(false);  
513 - _internalLpArray[notlbIndexes[i]].setBxFb(true);  
514 - _internalLpArray[notlbIndexes[i]].setBxFb5_2(false);  
515 - }  
516 - while (i < _bx_other_fb_lpcount + _bx_5_2_fb_lpcount) {  
517 - _internalLpArray[notlbIndexes[i]].setBxFb(false);  
518 - _internalLpArray[notlbIndexes[i]].setBxFb(true);  
519 - _internalLpArray[notlbIndexes[i]].setBxFb5_2(true);  
520 -  
521 - i++;  
522 - }  
523 -  
524 - // 测试打印  
525 - var lbIndexes = [];  
526 - for (i = 0; i < _internalLpArray.length; i++) {  
527 - if (_internalLpArray[i].isBxLb()) {  
528 - lbIndexes.push(i);  
529 - }  
530 - }  
531 - console.log("连班路牌indexes=" + lbIndexes);  
532 -  
533 - var _other_fbIndexes = [];  
534 - for (i = 0; i < _internalLpArray.length; i++) {  
535 - if (_internalLpArray[i].isBxFb() && !_internalLpArray[i].isBxFb5_2()) {  
536 - _other_fbIndexes.push(i);  
537 - }  
538 - }  
539 - console.log("其他分班路牌indexes=" + _other_fbIndexes);  
540 -  
541 - var _5_2_fbIndexes = [];  
542 - for (i = 0; i < _internalLpArray.length; i++) {  
543 - if (_internalLpArray[i].isBxFb() && _internalLpArray[i].isBxFb5_2()) {  
544 - _5_2_fbIndexes.push(i);  
545 - }  
546 - }  
547 - console.log("5休2分班路牌indexes=" + _5_2_fbIndexes);  
548 - },  
549 -  
550 - /**  
551 - * 在指定位置生成班次(内部重要方法)。  
552 - * @param lpIndex 第几个路牌  
553 - * @param qIndex 第几圈  
554 - * @param bcIndex 第几个班次  
555 - */  
556 - _generateBc: function(lpIndex, qIndex, bcIndex) {  
557 - // 在初始化布局后使用,否则没有参照班次加不了  
558 - // 初始化布局后,相当于把时刻表比作一个围棋棋盘,行为路牌数,列为圈数  
559 - // 上标线,中标线,早晚高峰已经布局在棋盘上,其余的空格可以创建班次  
560 -  
561 - // 这个生成班次是以上一班次时间,以发车间隔为基础添加的,纵向加  
562 - // 和生成标线时那种一直往后加班次时不一样,那种是以前一个班次为基础,横向加  
563 -  
564 - // 1、生成的班次以同一圈同一个方向里离它最早的班次的发车时间为基础  
565 - // 2、以每个路牌的纵向最小发车间隔时间为计算发车间隔  
566 - // 3、如果班次发车时间越界不管,有其余方法排除这种情况  
567 -  
568 - // 1、查找同圈同方向里最近的班次,找不到报错(因为有标线存在是不可能找不到的)  
569 - var _i;  
570 - var _bcObj;  
571 - for (_i = lpIndex - 1; _i >= 0; _i--) {  
572 - _bcObj = _internalLpArray[_i].getBc(qIndex, bcIndex);  
573 - if (_bcObj) {  
574 - break;  
575 - }  
576 - }  
577 - if (!_bcObj) {  
578 - alert("无法在指定位置生成班次");  
579 - throw "无法在路牌index=" + lpIndex + ",圈index=" + qIndex + ",班次index=" + bcIndex + "生成班次";  
580 - }  
581 -  
582 - // 2、计算发车间隔  
583 - var _intervalTime = 0;  
584 - for (_i = _i + 1; _i <= lpIndex; _i++) {  
585 - _intervalTime += _internalLpArray[_i].getVerticalMinIntervalTime();  
586 - }  
587 -  
588 - // 3、计算班次并添加班次  
589 - var _kssj = _paramObj.addMinute(_bcObj.getFcTimeObj(), _intervalTime);  
590 - _bcObj = _factory.createBcObj(  
591 - "normal", _bcObj.isUp(),  
592 - _lpArray[lpIndex].lpNo,  
593 - 1, _kssj, _paramObj);  
594 -  
595 - _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj);  
596 -  
597 - // TODO:这种添加班次的方法,可能造成相邻班次的停站时间问题  
598 - // TODO:主要是由于中标线的问题,但是误差不会很大,  
599 - // TODO:后面有方法直接调整停站时间(所谓的平滑过度时间)  
600 - },  
601 -  
602 - //------------- 其他方法 -------------//  
603 - /**  
604 - * 内部数据转化成显示用的班次数组。  
605 - */  
606 - toGanttBcArray: function() {  
607 - var bcData = [];  
608 - var i;  
609 - var lpObj;  
610 - for (i = 0; i < _internalLpArray.length; i++) {  
611 - lpObj = _internalLpArray[i];  
612 - bcData = bcData.concat(lpObj.getBcArray());  
613 - }  
614 -  
615 - var ganttBcData = [];  
616 - for (i = 0; i < bcData.length; i++) {  
617 - ganttBcData.push(bcData[i].toGanttBcObj());  
618 - }  
619 -  
620 - return ganttBcData;  
621 - }  
622 -  
623 - // TODO:  
624 - }; 1 +/**
  2 + * 内部行车计划对象。
  3 + * @constructor
  4 + */
  5 +var InternalScheduleObj = function(paramObj, lpArray, factory) {
  6 + // 参数对象
  7 + var _paramObj = paramObj;
  8 + // 外部的路牌数组
  9 + var _lpArray = lpArray;
  10 + // 工厂对象
  11 + var _factory = factory;
  12 +
  13 + //------------------ 初始化方法1,以及计算关联的内部变量 -----------------//
  14 + var _qIsUp; // 每一圈是上行开始还是下行开始
  15 + var _qCount = 0; // 总的圈数
  16 + var _internalLpArray = []; // 内部对象数组
  17 +
  18 + var _initFun1 = function() { // 初始化方法1
  19 +
  20 + //----------------------- 1、确定上标线的方向,圈的方向 -------------------//
  21 +
  22 + // 确定_qIsUp,哪个方向的首班车晚就用哪个
  23 + _qIsUp = _paramObj.getUpFirstDTimeObj().isBefore(
  24 + _paramObj.getDownFirstDTimeObj()) ? false : true;
  25 + // 上标线开始时间,就是方向的首班车时间
  26 + var st = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
  27 + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
  28 + var et;
  29 + var et_IsUp;
  30 + if (_paramObj.getUpLastDtimeObj().isBefore(
  31 + _paramObj.getDownLastDTimeObj())) {
  32 + et = _paramObj.getDownLastDTimeObj();
  33 + et_IsUp = false;
  34 + } else {
  35 + et = _paramObj.getUpLastDtimeObj();
  36 + et_IsUp = true;
  37 + }
  38 +
  39 + //------------------------ 2、计算总共有多少圈 ------------------------//
  40 +
  41 +
  42 +
  43 + // 以开始时间,结束时间,构造上标线用连班班次发车时间
  44 + var bcFcsjArrays = []; // 班次发车时间对象数组
  45 + var bcArsjArrays = []; // 班次到达时间对象数组
  46 + var isUp = _qIsUp; // 方向
  47 + var bcCount = 1; // 班次数
  48 +
  49 + var _kssj = st; // 开始时间
  50 + var _bcsj = paramObj.calcuTravelTime(_kssj, isUp); // 班次历时
  51 + var _arrsj = paramObj.addMinute(_kssj, _bcsj); // 到达时间
  52 + var _stoptime = paramObj.calcuFixedStopNumber(_arrsj, !isUp); // 停站时间
  53 +
  54 + do {
  55 + bcFcsjArrays.push(_kssj);
  56 + bcArsjArrays.push(_arrsj);
  57 + _kssj = paramObj.addMinute(_kssj, _bcsj + _stoptime);
  58 + bcCount ++;
  59 + isUp = !isUp;
  60 + } while(_kssj.isBefore(et));
  61 + bcCount--; // 因为先做do,所以总的班次要减1
  62 + if (bcCount > 0 && bcArsjArrays[bcCount - 1].isAfter(et)) {
  63 + // 如果最后一个班次的到达时间超过结束时间,也要去除
  64 + bcFcsjArrays.splice(bcCount - 1, 1);
  65 + bcArsjArrays.splice(bcCount - 1, 1);
  66 + bcCount--;
  67 + }
  68 + var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈
  69 + var _qCount_p2 = bcCount % 2; // 余下的1个班次也算一圈
  70 +
  71 + // 利用连班数组计算圈数
  72 + _qCount = 1; // 前面加1圈,补中标线的班次
  73 + _qCount += _qCount_p1;
  74 + _qCount += _qCount_p2;
  75 +
  76 + // 计算最后是不是还要补一圈
  77 + if (_qCount > 1) { // 总的圈数就1圈,没必要加了(其实是不可能的,除非参数里问题)
  78 + if (_qCount_p2 == 0) { // 没有余下班次,整数圈数
  79 + // 最后一个班次的方向一定和开始的方向相反,如:上-下,上-下,上-下,一共三圈,最后一个班次为下行
  80 + // 判定最后一个班次的方向和上标线判定结束时间的班次方向是否一致
  81 + if (!_qIsUp == et_IsUp) {
  82 + // 一致不用加圈数
  83 + } else {
  84 + // 不一致需要加圈补最后一个结束时间班次
  85 + _qCount ++;
  86 + }
  87 + } else {
  88 + // 有余下的圈数,最后要不补的班次不管上行,下行都在这一圈里
  89 + // 不需要在补圈数了
  90 + }
  91 + }
  92 +
  93 + //------------------------ 3、根据路牌数,圈数创建路牌对象 ----------------------//
  94 +
  95 + // 创建内部的路牌数组,并把之前的连班路牌添加进上标线路牌中
  96 + var i;
  97 + for (i = 0; i < _lpArray.length; i++) {
  98 + _internalLpArray.push(new InternalLpObj(_lpArray[i], _qCount, _qIsUp));
  99 + }
  100 + // 初始化上标线,从第1圈开始
  101 + _internalLpArray[0].initDataFromTimeToTime(bcFcsjArrays[0], et, _qIsUp, 1, _paramObj, _factory);
  102 +
  103 + console.log("//---------------- 行车计划,初始化方法1 start ----------------//");
  104 + console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") +
  105 + "上行末班车时间:" + _paramObj.getUpLastDtimeObj().format("HH:mm"));
  106 + console.log("下行首班车时间:" + _paramObj.getDownFirstDTimeObj().format("HH:mm") +
  107 + "下行末班车时间:" + _paramObj.getDownLastDTimeObj().format("HH:mm"));
  108 + console.log("总共计算的圈数:" + _qCount);
  109 + console.log("圈的方向isUP:" + _qIsUp);
  110 + console.log("//---------------- 行车计划,初始化方法1 end ----------------//");
  111 +
  112 + };
  113 +
  114 + //------------------ 初始化方法2,以及计算关联的内部变量 ----------------//
  115 + var _approximate_zgfQIndex; // 预估早高峰车辆从第几圈开始全部发出
  116 + var _approximate_zgfBIndex; // 预估早高峰车辆从第几圈第几个班次开始全部发出(上行或下行)
  117 + var _approximate_wgfQIndex; // 预估晚高峰车辆从第几圈开始全部发出
  118 + var _approximate_wgfBIndex; // 预估晚高峰车辆从第几圈第几个班次开始全部发出(上行或下行)
  119 +
  120 + // 同一圈同一方向班次发车间隔的最小值
  121 + // 注意:这个值就是用来添加班次的时间增加单位,在后面相关的方法里会具体说明
  122 + var _qbcMinIntervalValue;
  123 +
  124 + var _initFun2 = function() { // 初始化方法2
  125 + //------------------------ 1、预估早高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------//
  126 +
  127 + // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次
  128 + // 以这个班次为早高峰起点,全部出车策略
  129 + var qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(
  130 + _paramObj.getMPeakStartTimeObj());
  131 + var qIndex = qbcIndexArray[0]; // 第几圈
  132 + var bIndex = qbcIndexArray[1]; // 第几个班次
  133 + var startbc = _internalLpArray[0].getBc(qIndex, bIndex);
  134 +
  135 + // 计算早高峰
  136 + var _clCount = _paramObj.calcuClzx();
  137 + var _c1 = Math.floor(_paramObj.calcuPeakZzsj() / _clCount);
  138 + var _c2 = _paramObj.calcuPeakZzsj() % _clCount;
  139 + var _kssj = startbc.getFcTimeObj();
  140 +
  141 + var i;
  142 + for (i = 2; i <= _clCount - _c2; i++) {
  143 + _kssj = _paramObj.addMinute(_kssj, _c1);
  144 + _internalLpArray[i - 1].setBc(
  145 + qIndex,
  146 + bIndex,
  147 + _factory.createBcObj(
  148 + _internalLpArray[i - 1],
  149 + "normal", startbc.isUp(),
  150 + 1, _kssj, paramObj)
  151 + );
  152 + // 使用早高峰的发车间隔最为路牌纵向最小发车间隔,不能整除的话,小的放在前面的路牌
  153 + _internalLpArray[i - 1].setVerticalMinIntervalTime(_c1);
  154 + }
  155 + for (i = 1; i <= _c2; i++) {
  156 + _kssj = _paramObj.addMinute(_kssj, _c1 + 1);
  157 + _internalLpArray[_clCount - _c2 + i - 1].setBc(
  158 + qIndex,
  159 + bIndex,
  160 + _factory.createBcObj(
  161 + _internalLpArray[_clCount - _c2 + i - 1],
  162 + "normal", startbc.isUp(),
  163 + 1, _kssj, paramObj)
  164 + );
  165 + // 使用早高峰的发车间隔最为路牌纵向最小发车间隔,,不能整除的话,大的放在后面的路牌
  166 + _internalLpArray[_clCount - _c2 + i - 1].setVerticalMinIntervalTime(_c1);
  167 + }
  168 +
  169 + _approximate_zgfQIndex = qIndex;
  170 + _approximate_zgfBIndex = bIndex;
  171 +
  172 + //------------------------ 2、预估晚高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------//
  173 +
  174 + // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次
  175 + // 以这个班次为早高峰起点,全部出车策略
  176 + qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(
  177 + _paramObj.getEPeakStartTimeObj());
  178 + qIndex = qbcIndexArray[0]; // 第几圈
  179 + bIndex = qbcIndexArray[1]; // 第几个班次
  180 + startbc = _internalLpArray[0].getBc(qIndex, bIndex);
  181 +
  182 + // 计算晚高峰
  183 + _clCount = _paramObj.calcuClzx();
  184 + _c1 = Math.floor(_paramObj.calcuPeakZzsj() / _clCount);
  185 + _c2 = _paramObj.calcuPeakZzsj() % _clCount;
  186 + _kssj = startbc.getFcTimeObj();
  187 +
  188 + for (i = 2; i <= _clCount - _c2; i++) {
  189 + _kssj = _paramObj.addMinute(_kssj, _c1);
  190 + _internalLpArray[i - 1].setBc(
  191 + qIndex,
  192 + bIndex,
  193 + _factory.createBcObj(
  194 + _internalLpArray[i - 1],
  195 + "normal", startbc.isUp(),
  196 + 1, _kssj, _paramObj)
  197 + );
  198 + }
  199 + for (i = 1; i <= _c2; i++) {
  200 + _kssj = _paramObj.addMinute(_kssj, _c1 + 1);
  201 + _internalLpArray[_clCount - _c2 + i - 1].setBc(
  202 + qIndex,
  203 + bIndex,
  204 + _factory.createBcObj(
  205 + _internalLpArray[_clCount - _c2 + i - 1],
  206 + "normal", startbc.isUp(),
  207 + 1, _kssj, _paramObj)
  208 + );
  209 + }
  210 +
  211 + _approximate_wgfQIndex = qIndex;
  212 + _approximate_wgfBIndex = bIndex;
  213 + _qbcMinIntervalValue = _c1;
  214 +
  215 + console.log("//---------------- 行车计划,初始化方法2 start ----------------//");
  216 + console.log("预估早高峰第" + _approximate_zgfQIndex + "(index)圈,第" + _approximate_zgfBIndex + "(index)班次车辆全部发出");
  217 + console.log("预估晚高峰第" + _approximate_wgfQIndex + "(index)圈,第" + _approximate_wgfBIndex + "(index)班次车辆全部发出");
  218 + console.log("预估同圈同方向班次最小间隔(分钟):" + _qbcMinIntervalValue);
  219 + console.log("//---------------- 行车计划,初始化方法2 end ----------------//");
  220 + };
  221 +
  222 + //----------------------- 初始化方法3,以及计算关联的内部变量 ----------------//
  223 + var _zbx_lpIndex; // 中标线对应第几个路牌
  224 +
  225 + var _initFun3 = function() { // 初始化方法3
  226 + //---------------------------- 1、模拟一个中标线,使用临时路牌 ----------------------//
  227 +
  228 + // 构造中标线
  229 + // 中标线开始时间,就是方向的首班车时间
  230 + var st = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
  231 + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
  232 + // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向
  233 + var et;
  234 + if (_paramObj.getUpLastDtimeObj().isBefore(
  235 + _paramObj.getDownLastDTimeObj())) {
  236 + et = _paramObj.getDownLastDTimeObj();
  237 + } else {
  238 + et = _paramObj.getUpLastDtimeObj();
  239 + }
  240 +
  241 + var tempLpObj = new InternalLpObj({lpNo: -999, lpName: "-999"}, _qCount, _qIsUp);
  242 + tempLpObj.initDataFromTimeToTime(
  243 + st,
  244 + et,
  245 + !_qIsUp,
  246 + 0,
  247 + _paramObj,
  248 + _factory
  249 + );
  250 +
  251 + //------------------------ 2、找出中标线的早高峰班次,计算应该插在当前路牌数组的那个位置 ----------------//
  252 + // TODO:中标线的早高峰发车班次,和插入位置的早高分班次的时间会有误差的
  253 + // TODO:这里是直接把中标线班次覆盖,没有根据误差调整,以后改
  254 +
  255 + // 找出中标线对应的早高峰的班次对象
  256 + var _zb_bcobj = tempLpObj.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex);
  257 +
  258 + // 把所有高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌
  259 + var _tempq_array = [];
  260 + var _temp_group;
  261 + var _temp_bc;
  262 + var i;
  263 + for (i = 0; i < _internalLpArray.length; i++) {
  264 + _temp_bc = _internalLpArray[i].getBc(_approximate_zgfQIndex, _approximate_zgfBIndex);
  265 + if (_temp_bc.isUp() == _qIsUp) {
  266 + _temp_group = new InternalGroupObj(_internalLpArray[i], _qIsUp, _temp_bc, undefined);
  267 + } else {
  268 + _temp_group = new InternalGroupObj(_internalLpArray[i], _qIsUp, undefined, _temp_bc);
  269 + }
  270 + _tempq_array.push(_temp_group);
  271 + }
  272 +
  273 + var _ttindex_ = tempLpObj.getgetQBcIndexWithFcTimeFromGroupArray(
  274 + _zb_bcobj.getFcTimeObj(),
  275 + _tempq_array
  276 + );
  277 + _zbx_lpIndex = _ttindex_[0]; // 中标线放在第几个路牌
  278 + tempLpObj.setLp(_lpArray[_zbx_lpIndex]); // 设置原始路牌对象
  279 + tempLpObj.setVerticalMinIntervalTime( // 设置纵向最小发车间隔
  280 + _internalLpArray[_zbx_lpIndex].getVerticalMinIntervalTime()
  281 + );
  282 +
  283 + // 注意:这里直接把中标线数据替换到指定路牌位置
  284 + // TODO:由初始化方法1,初始化方法2得到的2个高峰的班次会被中标线对应班次覆盖
  285 + // TODO:目前使用中标线的班次覆盖,以后相互动态调整
  286 +
  287 + _internalLpArray[_zbx_lpIndex] = tempLpObj;
  288 +
  289 + console.log("//---------------- 行车计划,初始化方法3 start ----------------//");
  290 + console.log("中标线对应第" + (_zbx_lpIndex + 1) + "个路牌");
  291 + console.log("//---------------- 行车计划,初始化方法3 end ----------------//");
  292 +
  293 + };
  294 +
  295 + //----------------------- 初始化方法4,以及计算关联的内部变量 ----------------//
  296 + var _bx_lb_lpcount; // 连班路牌数
  297 + var _bx_5_2_fb_lpcount; // 5休2分班路牌数
  298 + var _bx_other_fb_lpcount; // 其他分班路牌数
  299 +
  300 + var _initFun4 = function() { // 初始化方法4
  301 + // 总共车辆数(高峰最大车辆数)
  302 + var cls = _paramObj.calcuClzx();
  303 + // 低谷最少配车(连班车数量)
  304 + var dgminpc = Math.round(_paramObj.calcuTroughZzsj() / _paramObj.getTroughMaxFcjx());
  305 + // 加班车路牌数(做5休2的路牌数)
  306 + var _5_2_lpes = _paramObj.getJBLpes();
  307 +
  308 + // 做些简单的验证
  309 + if (cls < dgminpc) {
  310 + alert("总配车数小于低谷最小配车");
  311 + throw "总配车数小于低谷最小配车";
  312 + }
  313 + if (dgminpc < 2) {
  314 + alert("连班路牌小于2,办不到啊");
  315 + throw "连班路牌小于2,办不到啊";
  316 + }
  317 + if (cls - dgminpc < _5_2_lpes) {
  318 + alert("总分班路牌数小于加班路牌数");
  319 + throw "总分班路牌数小于加班路牌数";
  320 + }
  321 +
  322 + _bx_lb_lpcount = dgminpc;
  323 + _bx_5_2_fb_lpcount = _5_2_lpes;
  324 + _bx_other_fb_lpcount = cls - dgminpc - _5_2_lpes;
  325 +
  326 + console.log("//---------------- 行车计划,初始化方法4 start ----------------//");
  327 + console.log("连班路牌数:" + _bx_lb_lpcount);
  328 + console.log("5休2分班路牌数:" + _bx_5_2_fb_lpcount);
  329 + console.log("其他分班路牌数:" + _bx_other_fb_lpcount);
  330 + console.log("//---------------- 行车计划,初始化方法4 end ----------------//");
  331 + };
  332 +
  333 + //-------------------- 重要的内部方法 -----------------------//
  334 + /**
  335 + * 在指定位置生成班次(内部重要方法)。
  336 + * @param lpIndex 第几个路牌
  337 + * @param qIndex 第几圈
  338 + * @param bcIndex 第几个班次
  339 + * @returns InternalBcObj
  340 + */
  341 + var _generateBc = function(lpIndex, qIndex, bcIndex) {
  342 + // 在初始化布局后使用,否则没有参照班次加不了
  343 + // 初始化布局后,相当于把时刻表比作一个围棋棋盘,行为路牌数,列为圈数
  344 + // 上标线,中标线,早晚高峰已经布局在棋盘上,其余的空格可以创建班次
  345 +
  346 + // 这个生成班次是以上一班次时间,以发车间隔为基础添加的,纵向加
  347 + // 和生成标线时那种一直往后加班次时不一样,那种是以前一个班次为基础,横向加
  348 +
  349 + // 1、生成的班次以同一圈同一个方向里离它最早的班次的发车时间为基础
  350 + // 2、以每个路牌的纵向最小发车间隔时间为计算发车间隔
  351 + // 3、如果班次发车时间越界不管,有其余方法排除这种情况
  352 +
  353 + // 1、查找同圈同方向里最近的班次,找不到报错(因为有标线存在是不可能找不到的)
  354 + var _i;
  355 + var _bcObj;
  356 + for (_i = lpIndex - 1; _i >= 0; _i--) {
  357 + _bcObj = _internalLpArray[_i].getBc(qIndex, bcIndex);
  358 + if (_bcObj) {
  359 + break;
  360 + }
  361 + }
  362 + if (!_bcObj) {
  363 + return false;
  364 + //alert("无法在指定位置生成班次");
  365 + //throw "无法在路牌index=" + lpIndex + ",圈index=" + qIndex + ",班次index=" + bcIndex + "生成班次";
  366 + }
  367 +
  368 + // 2、计算发车间隔
  369 + var _intervalTime = 0;
  370 + for (_i = _i + 1; _i <= lpIndex; _i++) {
  371 + _intervalTime += _internalLpArray[_i].getVerticalMinIntervalTime();
  372 + }
  373 +
  374 + // 3、计算班次并添加班次
  375 + var _kssj = _paramObj.addMinute(_bcObj.getFcTimeObj(), _intervalTime);
  376 + _bcObj = _factory.createBcObj(
  377 + _internalLpArray[lpIndex],
  378 + "normal", _bcObj.isUp(),
  379 + 1, _kssj, _paramObj);
  380 + _bcObj.setGroup(_internalLpArray[lpIndex].getGroup(qIndex));
  381 +
  382 + return _bcObj;
  383 +
  384 + // TODO:这种添加班次的方法,可能造成相邻班次的停站时间问题
  385 + // TODO:主要是由于中标线的问题,但是误差不会很大,
  386 + // TODO:后面有方法直接调整停站时间(所谓的平滑过度时间)
  387 + };
  388 +
  389 + /**
  390 + * 在指定位置生成班次并添加到路牌指定位置中。
  391 + * @param lpIndex 第几个路牌
  392 + * @param qIndex 第几圈
  393 + * @param bcIndex 第几个班次
  394 + */
  395 + var _generateBcAndSetBc = function(lpIndex, qIndex, bcIndex) {
  396 + var _bcObj = _generateBc(lpIndex, qIndex, bcIndex);
  397 + _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj);
  398 +
  399 + };
  400 +
  401 + /**
  402 + * 查找离指定时间最近的前面的班次索引信息
  403 + * @param timeObj 查找时间
  404 + * @param isUp 是否上行
  405 + * @returns [{路牌index},{圈index},{班次index}]
  406 + */
  407 + var _findUpClosedBcIndexWithTime = function(timeObj, isUp) {
  408 + var _lpObj;
  409 + var _groupObj;
  410 + var _bcObj;
  411 + var _i;
  412 + var _j;
  413 + var timediff; // 时间差取绝对值
  414 +
  415 + var _lpIndex;
  416 + var _up_qIndex;
  417 + var _up_bIndex;
  418 +
  419 + for (_i = 0; _i < _qCount; _i++) {
  420 + for (_j = 0; _j < _internalLpArray.length; _j++) {
  421 + _lpObj = _internalLpArray[_j];
  422 + _groupObj = _lpObj.getGroup(_i);
  423 + _bcObj = isUp ? _groupObj.getBc1() : _groupObj.getBc2();
  424 + if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的
  425 + _bcObj = _generateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
  426 + }
  427 + if (_bcObj) {
  428 + if (timeObj.diff(_bcObj.getFcTimeObj()) >= 0) {
  429 + if (!timediff) {
  430 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  431 + _lpIndex = _j;
  432 + _up_qIndex = _i;
  433 + _up_bIndex = isUp == _qIsUp ? 0 : 1;
  434 + } else {
  435 + if (timeObj.diff(_bcObj.getFcTimeObj()) < timediff) {
  436 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  437 + _lpIndex = _j;
  438 + _up_qIndex = _i;
  439 + _up_bIndex = isUp == _qIsUp ? 0 : 1;
  440 + }
  441 + }
  442 + }
  443 + }
  444 + }
  445 + }
  446 +
  447 + if (_lpIndex == undefined) {
  448 + return false;
  449 + }
  450 +
  451 + var bcindex = [];
  452 + bcindex.push(_lpIndex);
  453 + bcindex.push(_up_qIndex);
  454 + bcindex.push(_up_bIndex);
  455 +
  456 + return bcindex;
  457 + };
  458 +
  459 + /**
  460 + * 查找离指定时间最近的后面的班次索引信息
  461 + * @param timeObj 查找时间
  462 + * @param isUp 是否上行
  463 + * @returns [{路牌index},{圈index},{班次index}]
  464 + */
  465 + var _findDownClosedBcIndexWithTime = function(timeObj, isUp) {
  466 + var _lpObj;
  467 + var _groupObj;
  468 + var _bcObj;
  469 + var _i;
  470 + var _j;
  471 + var timediff; // 时间差取绝对值
  472 +
  473 + var _lpIndex;
  474 + var _down_qIndex;
  475 + var _down_bIndex;
  476 +
  477 + var flag;
  478 +
  479 + for (_i = 0; _i < _qCount; _i++) {
  480 + for (_j = 0; _j < _internalLpArray.length; _j++) {
  481 + _lpObj = _internalLpArray[_j];
  482 + _groupObj = _lpObj.getGroup(_i);
  483 + _bcObj = isUp ? _groupObj.getBc1() : _groupObj.getBc2();
  484 + if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的
  485 + _bcObj = _generateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
  486 + }
  487 + if (_bcObj) {
  488 + //console.log("timeobj -> bcobj diff flag " +
  489 + // timeObj.format("HH:mm") + "->" +
  490 + // _bcObj.getFcTimeObj().format("HH:mm") +
  491 + // timeObj.diff(_bcObj.getFcTimeObj()) +
  492 + // (timeObj.diff(_bcObj.getFcTimeObj()) <= 0)
  493 + //);
  494 +
  495 + flag = (timeObj.diff(_bcObj.getFcTimeObj())) <= 0;
  496 +
  497 + if (flag) {
  498 + if (!timediff) {
  499 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  500 + _lpIndex = _j;
  501 + _down_qIndex = _i;
  502 + _down_bIndex = isUp == _qIsUp ? 0 : 1;
  503 + } else {
  504 + if ((timeObj.diff(_bcObj.getFcTimeObj())) > timediff) {
  505 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  506 + _lpIndex = _j;
  507 + _down_qIndex = _i;
  508 + _down_bIndex = isUp == _qIsUp ? 0 : 1;
  509 + }
  510 + }
  511 + }
  512 + }
  513 + }
  514 + }
  515 +
  516 + if (_lpIndex == undefined) {
  517 + return false;
  518 + }
  519 +
  520 + var bcindex = [];
  521 + bcindex.push(_lpIndex);
  522 + bcindex.push(_down_qIndex);
  523 + bcindex.push(_down_bIndex);
  524 +
  525 + return bcindex;
  526 + };
  527 +
  528 + return {
  529 + //------------- 布局初始化方法 ------------//
  530 + /**
  531 + * 初始化数据,使用标线初始化
  532 + */
  533 + initDataWithBxLayout: function() {
  534 + // 初始化布局1,构造上标线,计算圈数,把上标线数据放入第一个路牌中
  535 + _initFun1();
  536 + // 初始化布局2,从上标线的某个班次开始,构造所有路牌的早高峰班次,晚高峰班次
  537 + _initFun2();
  538 + // 初始化布局3,构造中标线,根据高峰班次,将中标线放入合适的路牌中
  539 + _initFun3();
  540 + // 初始化4,计算连班,分班相关路牌数
  541 + _initFun4();
  542 +
  543 + // 测试添加班次
  544 + //this._generateBc(8, 1, 0);
  545 + //this._generateBc(10, 1, 0);
  546 + //this._generateBc(11, 1, 0);
  547 + //this._generateBc(12, 1, 0);
  548 + //this._generateBc(13, 1, 0);
  549 + //this._generateBc(14, 1, 0);
  550 + //this._generateBc(15, 1, 0);
  551 + //this._generateBc(16, 1, 0);
  552 + //this._generateBc(17, 1, 0);
  553 + //this._generateBc(18, 1, 0);
  554 + //
  555 + //this._generateBc(10, 1, 1);
  556 + //this._generateBc(11, 1, 1);
  557 + //this._generateBc(12, 1, 1);
  558 + //this._generateBc(13, 1, 1);
  559 + //this._generateBc(14, 1, 1);
  560 + //this._generateBc(15, 1, 1);
  561 + //this._generateBc(16, 1, 1);
  562 + //this._generateBc(17, 1, 1);
  563 + //this._generateBc(18, 1, 1);
  564 +
  565 + // 6:31 8:30
  566 + // 16:01 18:00
  567 +
  568 + // 测试找上界
  569 + console.log("上界:" + _findUpClosedBcIndexWithTime(_paramObj.getMPeakStartTimeObj(), false));
  570 + console.log("下界:" + _findDownClosedBcIndexWithTime(_paramObj.getMPeakEndTimeObj(), false));
  571 +
  572 + // TODO:
  573 +
  574 + // 测试时间判定
  575 + //console.log("班次出车时间:" + _internalLpArray[0].getQBcIndexWithFcTime(
  576 + // _paramObj.getMPeakStartTimeObj()
  577 + // ));
  578 +
  579 + //// 测试画中标线,第6个路牌的位置,下行中标
  580 + //_internalLpArray[7].initDataFromTimeToTime(
  581 + // _paramObj.getDownFirstDTimeObj(),
  582 + // _paramObj.getUpLastDtimeObj(),
  583 + // false,
  584 + // 0,
  585 + // _paramObj,
  586 + // _factory
  587 + //);
  588 +
  589 + // TODO:问题
  590 + // 1、中标线是直接赋值在具体位置的,没有修正班次时间
  591 + // 2、路牌间隔时间需要修正的
  592 +
  593 + },
  594 +
  595 + // TODO:
  596 +
  597 + /**
  598 + * 调整高峰班次,
  599 + * 初始化生成早高峰,晚高峰班次并不准确,因为根据高峰时间段,并不在一个完整圈内,应该是在两个或多个圈之间
  600 + * 当初始化定好布局后(上标线,中标线),然后确定每个路牌的班型(连班,分班,5休2分班)后
  601 + * 然后重新计算框在高峰时间段内的班次索引,不足的添加,之前多加的删除(只删除分班路牌上的)
  602 + * @param isZgf 是否早高峰
  603 + * @param isUp 是否上行
  604 + */
  605 + adjustGfbc : function(isZgf, isUp) {
  606 + var startTime; // 开始时间
  607 + var endTime; // 结束时间
  608 + var startBcIndex; // 开始班次索引
  609 + var endBcIndex; // 结束班次索引
  610 +
  611 + startTime = isZgf ? _paramObj.getMPeakStartTimeObj() : _paramObj.getEPeakStartTimeObj();
  612 + endTime = isZgf ? _paramObj.getMPeakEndTimeObj() : _paramObj.getEPeakEndTimeObj();
  613 +
  614 + startBcIndex = _findUpClosedBcIndexWithTime(startTime, isUp);
  615 + endBcIndex = _findDownClosedBcIndexWithTime(endTime, isUp);
  616 +
  617 + var _lpIndex;
  618 + var _qIndex;
  619 + var _bcIndex;
  620 + var _qInternelCount; // 高峰时间段中间包含的圈数
  621 + var i;
  622 + var j;
  623 +
  624 + var _lp;
  625 +
  626 + if (startBcIndex && endBcIndex) {
  627 + _lpIndex = startBcIndex[0];
  628 + _qIndex = startBcIndex[1];
  629 + _bcIndex = startBcIndex[2];
  630 +
  631 + // 处理头
  632 + // 删除头部多余班次
  633 + for (j = 0; j < _lpIndex; j++) {
  634 + _lp = _internalLpArray[j];
  635 + if (_lp.isBxFb() && _lp.getBc(_qIndex, _bcIndex)) {
  636 + _lp.removeBc(_qIndex, _bcIndex);
  637 + }
  638 + }
  639 +
  640 + for (j = _lpIndex; j < _internalLpArray.length; j++) {
  641 + _lp = _internalLpArray[j];
  642 + if (!_lp.getBc(_qIndex, _bcIndex)) {
  643 + _generateBcAndSetBc(j, _qIndex, _bcIndex);
  644 + }
  645 + }
  646 +
  647 + // 处理中间
  648 + _qInternelCount = endBcIndex[1] - startBcIndex[1] - 1;
  649 + for (i = 1; i <= _qInternelCount; i++) {
  650 + _lp = _internalLpArray[_qIndex + i];
  651 + if (!_lp.getBc(_qIndex + i, _bcIndex)) {
  652 + _generateBcAndSetBc(i, _qIndex + i, _bcIndex);
  653 + }
  654 + }
  655 +
  656 + // 处理尾部
  657 + _lpIndex = endBcIndex[0];
  658 + _qIndex = endBcIndex[1];
  659 + _bcIndex = endBcIndex[2];
  660 + for (j = 0; j < _lpIndex; j++) {
  661 + _lp = _internalLpArray[j];
  662 + if (!_lp.getBc(_qIndex, _bcIndex)) {
  663 + _generateBcAndSetBc(j, _qIndex, _bcIndex);
  664 + }
  665 + }
  666 + // 删除尾部多余的班次
  667 + for (j = _lpIndex; j < _internalLpArray.length; j++) {
  668 + _lp = _internalLpArray[j];
  669 + if (_lp.isBxFb() && _lp.getBc(_qIndex, _bcIndex)) {
  670 + _lp.removeBc(_qIndex, _bcIndex);
  671 + }
  672 + }
  673 + }
  674 +
  675 + },
  676 +
  677 + /**
  678 + * 补充做5休2的班型班次。
  679 + * 1、做5休2的路牌总工时不能超过7个小时
  680 + * 2、5休2的路牌全部从早晚高峰班次开始往前补充1个班次,组成早晚2圈
  681 + * 3、再根据余下工时及早晚高峰开始时间,确定向前或者向后加班次
  682 + */
  683 + calcuLpBx_5_2: function() {
  684 + // 1、先在早晚高峰班次前加1个班次压压惊
  685 + var i;
  686 + var _lp;
  687 + var _zgfbcpos; // 早高峰班次位置
  688 + var _wgfbcpos; // 晚高峰班次位置
  689 + var _qIndex;
  690 + var _bIndex;
  691 +
  692 + //for (i = 0; i < _internalLpArray.length; i++) {
  693 + // _lp = _internalLpArray[i];
  694 + // if (_lp.isBxFb5_2()) {
  695 + // _zgfbcpos = _lp.getMinBcObjPosition();
  696 + // _wgfbcpos = _lp.getMaxBcObjPosition();
  697 + //
  698 + // // TODO:测试向前添加一个班次
  699 + // _qIndex = _zgfbcpos[0];
  700 + // _bIndex = _zgfbcpos[1];
  701 + // _bIndex == 0 ?
  702 + // _generateBcAndSetBc(i, _qIndex - 1, 1) :
  703 + // _generateBcAndSetBc(i, _qIndex, 0);
  704 + //
  705 + // _qIndex = _wgfbcpos[0];
  706 + // _bIndex = _wgfbcpos[1];
  707 + // _bIndex == 0 ?
  708 + // _generateBcAndSetBc(i, _qIndex - 1, 1) :
  709 + // _generateBcAndSetBc(i, _qIndex, 0);
  710 + //
  711 + // }
  712 + //}
  713 +
  714 + // 2、
  715 + },
  716 +
  717 + /**
  718 + * 补充连班路牌班次。
  719 + * 1、上标线,中标线中间的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向上标线起始班次靠拢
  720 + * 2、中标线以下的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向中标线起始班次靠拢
  721 + */
  722 + calcuLpBx_lb: function() {
  723 + // 补充连班的班次,参照上标线,中标线补充不足的班次
  724 + var _zgffcsj; // 早高峰发车时间
  725 + var _etsj = // 结束时间
  726 + _paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj()) ?
  727 + _paramObj.getDownLastDTimeObj() :
  728 + _paramObj.getUpLastDtimeObj();
  729 +
  730 + var _lp;
  731 + var _minbcPos;
  732 + var _bcObj;
  733 + var i;
  734 + for (i = 0; i < _internalLpArray.length; i++) {
  735 + _lp = _internalLpArray[i];
  736 + if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) {
  737 + _minbcPos = _lp.getMinBcObjPosition();
  738 + _bcObj = _lp.getBc(_minbcPos[0], _minbcPos[1]);
  739 + _zgffcsj = _bcObj.getFcTimeObj();
  740 + // 重新初始化连班班型班次
  741 + _lp.initDataFromTimeToTime(
  742 + _zgffcsj,
  743 + _etsj,
  744 + _bcObj.isUp(),
  745 + _minbcPos[0],
  746 + _paramObj,
  747 + _factory
  748 + );
  749 + }
  750 + }
  751 +
  752 + // 还要补充缺失的班次,差上标线几个班次要往前补上
  753 + var _bccount;
  754 + var j;
  755 + var _qIndex;
  756 + var _bIndex;
  757 + // 补上标线到中标线之间的连班路牌的班次
  758 + for (i = 0; i < _zbx_lpIndex; i++) {
  759 + _lp = _internalLpArray[i];
  760 + if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) {
  761 + _minbcPos = _lp.getMinBcObjPosition();
  762 + _qIndex = _minbcPos[0];
  763 + _bIndex = _minbcPos[1];
  764 + _bccount = (_qIndex - 1) * 2 + _bIndex; // 距离上标线起始站点差几个班次
  765 + for (j = 0; j < _bccount; j++) {
  766 + if (_bIndex == 0) {
  767 + _qIndex --;
  768 + _bIndex = 1;
  769 + _generateBcAndSetBc(i, _qIndex, _bIndex);
  770 + } else if (_bIndex == 1) {
  771 + _bIndex --;
  772 + _generateBcAndSetBc(i, _qIndex, _bIndex);
  773 + }
  774 + }
  775 + }
  776 + }
  777 + // 补中标线以下的连班路牌的班次
  778 + for (i = _zbx_lpIndex; i < _internalLpArray.length; i++) {
  779 + _lp = _internalLpArray[i];
  780 + if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) {
  781 + _minbcPos = _lp.getMinBcObjPosition();
  782 + _qIndex = _minbcPos[0];
  783 + _bIndex = _minbcPos[1];
  784 + _bccount = (_qIndex - 0) * 2 + _bIndex - 1; // 距离上标线起始站点差几个班次
  785 + for (j = 0; j < _bccount; j++) {
  786 + if (_bIndex == 0) {
  787 + _qIndex --;
  788 + _bIndex = 1;
  789 + _generateBcAndSetBc(i, _qIndex, _bIndex);
  790 + } else if (_bIndex == 1) {
  791 + _bIndex --;
  792 + _generateBcAndSetBc(i, _qIndex, _bIndex);
  793 + }
  794 + }
  795 + }
  796 + }
  797 +
  798 + },
  799 +
  800 + /**
  801 + * 计算每个路牌的班型及工时对应的圈数。
  802 + * 1、将连班,分班路牌分配到各个路牌上(分隔法),上标线,中标线上连班路牌
  803 + * 2、确定班型的工时,其中连班路牌的工时由上标线,中标线确定好了,5休2路牌工时也确定了,
  804 + * 其余分班路牌的工时由高峰低谷最大,最小发车间隔计算
  805 + */
  806 + calcuLpBx_fg: function() {
  807 + // 间隔法
  808 +
  809 + //--------------------------- 1、间隔法分隔连班路牌 ----------------------//
  810 +
  811 + // 除去上标线,中标线的连班路牌个数
  812 + var _lblbcount = _bx_lb_lpcount - 2;
  813 + // 计算由标线隔开的两个区域的路牌数比率
  814 + var _p1 = (_zbx_lpIndex + 1) / (_internalLpArray.length + 1);
  815 + var _p2 = (_internalLpArray.length - _zbx_lpIndex) / (_internalLpArray.length + 1);
  816 + var _p1_lpcount = _lblbcount * _p1;
  817 + var _p2_lpcount = _lblbcount * _p2;
  818 + if (parseInt(_p1_lpcount) != _p1_lpcount) { // 没有整除
  819 + _p1_lpcount = Math.floor(_p1_lpcount);
  820 + _p2_lpcount = Math.floor(_p2_lpcount) + 1;
  821 + }
  822 +
  823 + // 设定第一个区域的连班路牌
  824 + var i;
  825 + var _count = _p1_lpcount + 1;
  826 + var _c1 = Math.floor(_zbx_lpIndex / _count);
  827 + var _c2 = _zbx_lpIndex % _count;
  828 + var _c2_start_index;
  829 + for (i = 1; i <= _count - _c2; i++) {
  830 + _internalLpArray[(i - 1) * _c1].setBxLb(true);
  831 + _internalLpArray[(i - 1) * _c1].setBxDesc("连班");
  832 + _c2_start_index = (i - 1) * _c1;
  833 + }
  834 + for (i = 1; i <= _c2; i++) {
  835 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true);
  836 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxDesc("连班");
  837 + }
  838 +
  839 + // 设定第二个区域的连班路牌
  840 + _count = _p2_lpcount + 1;
  841 + _c1 = Math.floor((_internalLpArray.length - _zbx_lpIndex - 1) / _count);
  842 + _c2 = (_internalLpArray.length - _zbx_lpIndex - 1) % _count;
  843 + for (i = 1; i <= _count - _c2; i++) {
  844 + _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxLb(true);
  845 + _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb(false);
  846 + _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb5_2(false);
  847 + _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxDesc("连班");
  848 + _c2_start_index = (i - 1) * _c1 + _zbx_lpIndex;
  849 + }
  850 + for (i = 1; i <= _c2; i++) {
  851 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true);
  852 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb(false);
  853 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb5_2(false);
  854 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxDesc("连班");
  855 + }
  856 +
  857 + //---------------------------- 2、分隔法,分隔分班路牌 -------------------------//
  858 +
  859 + // 设定分班路牌
  860 + var notlbIndexes = []; // 去除连班的路牌index列表
  861 + for (i = 0; i < _internalLpArray.length; i++) {
  862 + if (!_internalLpArray[i].isBxLb()) {
  863 + notlbIndexes.push(i);
  864 + }
  865 + }
  866 + // 获取离中标线最近的分班路牌索引
  867 + var _temp_fg_index;
  868 + for (i = 0; i < notlbIndexes.length; i++) {
  869 + if (notlbIndexes[i] == _zbx_lpIndex - 1) {
  870 + _temp_fg_index = i;
  871 + break;
  872 + }
  873 + }
  874 +
  875 + // 使用上面的分隔比率,分隔5休2班型
  876 + _p1_lpcount = _bx_5_2_fb_lpcount * _p1;
  877 + _p2_lpcount = _bx_5_2_fb_lpcount * _p2;
  878 + if (parseInt(_p1_lpcount) != _p1_lpcount) { // 没有整除
  879 + _p1_lpcount = Math.floor(_p1_lpcount);
  880 + _p2_lpcount = Math.floor(_p2_lpcount) + 1;
  881 + }
  882 + // 第一个区域
  883 + _count = _p1_lpcount;
  884 + _c1 = Math.floor(_temp_fg_index / _count);
  885 + _c2 = _temp_fg_index % _count;
  886 + for (i = 1; i <= _count - _c2; i++) {
  887 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxLb(false);
  888 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxFb(true);
  889 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxFb5_2(true);
  890 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxDesc("5休2分班");
  891 + _c2_start_index = (i - 1) * _c1;
  892 + }
  893 + for (i = 1; i <= _c2; i++) {
  894 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(false);
  895 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(true);
  896 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb5_2(true);
  897 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxDesc("5休2分班");
  898 + }
  899 + // 第二个区域
  900 + _count = _p2_lpcount;
  901 + _c1 = Math.floor((notlbIndexes.length - _temp_fg_index - 1) / _count);
  902 + _c2 = (notlbIndexes.length - _temp_fg_index - 1) % _count;
  903 + for (i = 1; i <= _count - _c2; i++) {
  904 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxLb(false);
  905 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxFb(true);
  906 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxFb5_2(true);
  907 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxDesc("5休2分班");
  908 + _c2_start_index = (i - 1) * _c1 + _temp_fg_index + 1;
  909 + }
  910 + for (i = 1; i <= _c2; i++) {
  911 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(false);
  912 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb(true);
  913 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb5_2(true);
  914 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxDesc("5休2分班");
  915 + }
  916 +
  917 + //-------------------------- 3、余下班次就是其他分班类型 ----------------------//
  918 +
  919 + for (i = 0; i < notlbIndexes.length; i++) {
  920 + if (!_internalLpArray[notlbIndexes[i]].isBxFb5_2()) {
  921 + _internalLpArray[notlbIndexes[i]].setBxLb(false);
  922 + _internalLpArray[notlbIndexes[i]].setBxFb(true);
  923 + _internalLpArray[notlbIndexes[i]].setBxFb5_2(false);
  924 + _internalLpArray[notlbIndexes[i]].setBxDesc("其他分班");
  925 + }
  926 + }
  927 +
  928 + // 测试打印
  929 + var lbIndexes = [];
  930 + for (i = 0; i < _internalLpArray.length; i++) {
  931 + if (_internalLpArray[i].isBxLb()) {
  932 + lbIndexes.push(i);
  933 + }
  934 + }
  935 + console.log("连班路牌indexes=" + lbIndexes);
  936 +
  937 + var _other_fbIndexes = [];
  938 + for (i = 0; i < _internalLpArray.length; i++) {
  939 + if (_internalLpArray[i].isBxFb() && !_internalLpArray[i].isBxFb5_2()) {
  940 + _other_fbIndexes.push(i);
  941 + }
  942 + }
  943 + console.log("其他分班路牌indexes=" + _other_fbIndexes);
  944 +
  945 + var _5_2_fbIndexes = [];
  946 + for (i = 0; i < _internalLpArray.length; i++) {
  947 + if (_internalLpArray[i].isBxFb() && _internalLpArray[i].isBxFb5_2()) {
  948 + _5_2_fbIndexes.push(i);
  949 + }
  950 + }
  951 + console.log("5休2分班路牌indexes=" + _5_2_fbIndexes);
  952 + },
  953 +
  954 + //------------- 其他方法 -------------//
  955 + /**
  956 + * 内部数据转化成显示用的班次数组。
  957 + */
  958 + toGanttBcArray: function() {
  959 + var bcData = [];
  960 + var lpObj;
  961 + for (i = 0; i < _internalLpArray.length; i++) {
  962 + lpObj = _internalLpArray[i];
  963 + bcData = bcData.concat(lpObj.getBcArray());
  964 + }
  965 +
  966 + var ganttBcData = [];
  967 + for (i = 0; i < bcData.length; i++) {
  968 + ganttBcData.push(bcData[i].toGanttBcObj());
  969 + }
  970 +
  971 + return ganttBcData;
  972 + }
  973 +
  974 + // TODO:
  975 + };
625 }; 976 };
626 \ No newline at end of file 977 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
1 -/**  
2 - * 主类。  
3 - */  
4 -var Main_v2 = function() {  
5 - // 内部工厂类  
6 - var _factoryFun = function() {  
7 - return {  
8 - // 创建参数  
9 - createParameterObj: function(formMap, dataMap) {  
10 - var paramObj = ParameterObj();  
11 - paramObj.wrap(formMap, dataMap);  
12 - return paramObj;  
13 - },  
14 - // 创建班次对象  
15 - createBcObj: function(bcType, isUp, lp, fcno, fcTimeObj, paramObj) {  
16 - var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType);  
17 - var _bcsj = paramObj.calcuTravelTime(fcTimeObj, isUp);  
18 - var _arrsj = paramObj.addMinute(fcTimeObj, _bcsj);  
19 - var _stoptime = paramObj.calcuFixedStopNumber(_arrsj, !isUp);  
20 - var _tccid = paramObj.getTTinfoId();  
21 - var _ttinfoid = paramObj.getTTinfoId();  
22 - var _xl = paramObj.getXlId();  
23 - var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id;  
24 - var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id;  
25 -  
26 - return new InternalBcObj(  
27 - bcType, // 班次类型(normal,in,out等)  
28 - isUp, // boolean是否上下行  
29 - lp, // 路牌标识符  
30 - fcno, // 发车顺序号  
31 - fcTimeObj, // 发车时间对象  
32 - _bclc, // 班次里程  
33 - _bcsj, // 班次历时  
34 - _arrsj, // 到达时间对象  
35 - _stoptime, // 停站时间  
36 - _tccid, // 停车场id  
37 - _ttinfoid, // 时刻表id  
38 - _xl, // 线路id  
39 - _qdz, // 起点站id  
40 - _zdz // 终点站id  
41 - );  
42 - }  
43 - };  
44 - };  
45 - var _factory = _factoryFun();  
46 -  
47 - // 所有的时间使用moment.js计算  
48 -  
49 - var _paramObj; // 参数对象  
50 -  
51 - var _bxDesc = [ // 班型描述  
52 - {'type':'六工一休','hoursV':6.66, 'minueV':'6:40', 'qcount': 0, 'avertime': 0},  
53 - {'type':'五工一休','hoursV':6.85, 'minueV':'6:51', 'qcount': 0, 'avertime': 0},  
54 - {'type':'四工一休','hoursV':7.14, 'minueV':'7:08', 'qcount': 0, 'avertime': 0},  
55 - {'type':'三工一休','hoursV':7.61, 'minueV':'7:37', 'qcount': 0, 'avertime': 0},  
56 - {'type':'二工一休','hoursV':8.57, 'minueV':'8:34', 'qcount': 0, 'avertime': 0},  
57 - {'type':'一工一休','hoursV':11.42, 'minueV':'11:25', 'qcount': 0, 'avertime': 0},  
58 - {'type':'五工二休','hoursV':7.99, 'minueV':'8:00', 'qcount': 0, 'avertime': 0},  
59 - {'type':'无工休', 'hoursV':5.43, 'minueV':'5:43', 'qcount': 0, 'avertime': 0}  
60 - ];  
61 -  
62 - return {  
63 - /**  
64 - * 工厂对象,创建不同的对象。  
65 - * @returns {{createParameterObj, createBcObj}}  
66 - */  
67 - getFactory: function() {  
68 - return _factory;  
69 - },  
70 -  
71 - /**  
72 - * 使用发车间隔策略生成时刻表。  
73 - * @param paramObj 参数对象  
74 - * @param lpArray 路牌数组  
75 - * @constructor  
76 - */  
77 - BXPplaceClassesTime03 : function(paramObj, lpArray) {  
78 - // 参数对象  
79 - _paramObj = paramObj;  
80 -  
81 - // 1、初始化行车计划  
82 - var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory);  
83 - schedule.initDataWithBxLayout();  
84 -  
85 - // 2、计算每个路牌的班型及对应工时  
86 - schedule.calcuLpBx_fg();  
87 -  
88 - // 3、根据班型补充所有的不足班次  
89 - schedule.calcuLpBx_lb();  
90 -  
91 - // TODO:4、确定末班车  
92 -  
93 - // TODO:5、补进出场班次  
94 -  
95 -  
96 - //-------------------- 输出ganut图上的班次,班型描述 ----------------------//  
97 - var gBcData = schedule.toGanttBcArray();  
98 - // TODO:班型再议  
99 - return {'json':gBcData,'bxrcgs':null};  
100 -  
101 - }  
102 -  
103 - };  
104 - 1 +/**
  2 + * 主类。
  3 + */
  4 +var Main_v2 = function() {
  5 + // 内部工厂类
  6 + var _factoryFun = function() {
  7 + return {
  8 + // 创建参数
  9 + createParameterObj: function(formMap, dataMap) {
  10 + var paramObj = ParameterObj();
  11 + paramObj.wrap(formMap, dataMap);
  12 + return paramObj;
  13 + },
  14 + // 创建班次对象
  15 + createBcObj: function(lpObj, bcType, isUp, fcno, fcTimeObj, paramObj) {
  16 + var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType);
  17 + var _bcsj = paramObj.calcuTravelTime(fcTimeObj, isUp);
  18 + var _arrsj = paramObj.addMinute(fcTimeObj, _bcsj);
  19 + var _stoptime = paramObj.calcuFixedStopNumber(_arrsj, !isUp);
  20 + var _tccid = paramObj.getTTinfoId();
  21 + var _ttinfoid = paramObj.getTTinfoId();
  22 + var _xl = paramObj.getXlId();
  23 + var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id;
  24 + var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id;
  25 +
  26 + var bcParamObj = {};
  27 + bcParamObj.bcType = bcType; // 班次类型(normal,in,out等)
  28 + bcParamObj.isUp = isUp; // boolean是否上下行
  29 + bcParamObj.fcno = fcno; // 发车顺序号
  30 + bcParamObj.fcTimeObj = fcTimeObj; // 发车时间对象
  31 + bcParamObj.bclc = _bclc; // 班次里程
  32 + bcParamObj.bcsj = _bcsj; // 班次历时
  33 + bcParamObj.arrtime = _arrsj; // 到达时间对象
  34 + bcParamObj.stoptime = _stoptime; // 停站时间
  35 + bcParamObj.tccid = _tccid; // 停车场id
  36 + bcParamObj.ttinfoid = _ttinfoid; // 时刻表id
  37 + bcParamObj.xl = _xl; // 线路id
  38 + bcParamObj.qdzid = _qdz; // 起点站id
  39 + bcParamObj.zdzid = _zdz; // 终点站id
  40 +
  41 + return new InternalBcObj(lpObj, bcParamObj);
  42 + }
  43 + };
  44 + };
  45 + var _factory = _factoryFun();
  46 +
  47 + // 所有的时间使用moment.js计算
  48 +
  49 + var _paramObj; // 参数对象
  50 +
  51 + var _bxDesc = [ // 班型描述
  52 + {'type':'六工一休','hoursV':6.66, 'minueV':'6:40', 'qcount': 0, 'avertime': 0},
  53 + {'type':'五工一休','hoursV':6.85, 'minueV':'6:51', 'qcount': 0, 'avertime': 0},
  54 + {'type':'四工一休','hoursV':7.14, 'minueV':'7:08', 'qcount': 0, 'avertime': 0},
  55 + {'type':'三工一休','hoursV':7.61, 'minueV':'7:37', 'qcount': 0, 'avertime': 0},
  56 + {'type':'二工一休','hoursV':8.57, 'minueV':'8:34', 'qcount': 0, 'avertime': 0},
  57 + {'type':'一工一休','hoursV':11.42, 'minueV':'11:25', 'qcount': 0, 'avertime': 0},
  58 + {'type':'五工二休','hoursV':7.99, 'minueV':'8:00', 'qcount': 0, 'avertime': 0},
  59 + {'type':'无工休', 'hoursV':5.43, 'minueV':'5:43', 'qcount': 0, 'avertime': 0}
  60 + ];
  61 +
  62 + return {
  63 + /**
  64 + * 工厂对象,创建不同的对象。
  65 + * @returns {{createParameterObj, createBcObj}}
  66 + */
  67 + getFactory: function() {
  68 + return _factory;
  69 + },
  70 +
  71 + /**
  72 + * 使用发车间隔策略生成时刻表。
  73 + * @param paramObj 参数对象
  74 + * @param lpArray 路牌数组
  75 + * @constructor
  76 + */
  77 + BXPplaceClassesTime03 : function(paramObj, lpArray) {
  78 + // 参数对象
  79 + _paramObj = paramObj;
  80 +
  81 + // 1、初始化行车计划
  82 + var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory);
  83 + schedule.initDataWithBxLayout();
  84 + // 2、计算每个路牌的班型及对应工时
  85 + schedule.calcuLpBx_fg();
  86 + // 3、将连班路牌的班次补足
  87 + schedule.calcuLpBx_lb();
  88 +
  89 + // 4、修正针对初始化时生成的高峰班次,之前不足的补上,多余的删除
  90 + schedule.adjustGfbc(true, true); // 修正上行早高峰
  91 + schedule.adjustGfbc(true, false); // 修正下行早高峰
  92 + schedule.adjustGfbc(false, true); // 修正上行晚高峰
  93 + schedule.adjustGfbc(false, false); // 修正下行晚高峰
  94 +
  95 + // 5、TODO:根据班型补充所有的不足班次
  96 + schedule.calcuLpBx_5_2();
  97 +
  98 + // TODO:6、确定末班车
  99 +
  100 + // TODO:8、修正不准确的停站时间,微调发车间隔
  101 +
  102 + // TODO:9、补进出场报道班次
  103 +
  104 +
  105 + //-------------------- 输出ganut图上的班次,班型描述 ----------------------//
  106 + var gBcData = schedule.toGanttBcArray();
  107 + // TODO:班型再议
  108 + return {'json':gBcData,'bxrcgs':null};
  109 +
  110 + }
  111 +
  112 + };
  113 +
105 }(); 114 }();
106 \ No newline at end of file 115 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/tepms/fcjx_temp.html
@@ -231,7 +231,7 @@ @@ -231,7 +231,7 @@
231 231
232 <div class="col-md-6"> 232 <div class="col-md-6">
233 <label class="control-label col-md-5"> 233 <label class="control-label col-md-5">
234 - <span class="required"> * </span> 高峰建议配车数 :</label> 234 + <span class="required"> * </span> 建议高峰配车数 :</label>
235 <div class="col-md-5"> 235 <div class="col-md-5">
236 <input type="text" class="form-control" placeholder="车辆数" name="gfjypcs" id="gfjypcsInput" min="1"> 236 <input type="text" class="form-control" placeholder="车辆数" name="gfjypcs" id="gfjypcsInput" min="1">
237 </div> 237 </div>
@@ -477,7 +477,7 @@ @@ -477,7 +477,7 @@
477 </div> 477 </div>
478 478
479 <div class="col-md-6"> 479 <div class="col-md-6">
480 - <label class="control-label col-md-5"> 高峰建议配车数 : </label> 480 + <label class="control-label col-md-5"> 建议高峰配车数 : </label>
481 <div class="col-md-4"> 481 <div class="col-md-4">
482 <p class="form-control-static" data-display="gfjypcs"> </p> 482 <p class="form-control-static" data-display="gfjypcs"> </p>
483 </div> 483 </div>
src/main/resources/static/pages/forms/statement/scheduleDaily.html
@@ -427,7 +427,7 @@ @@ -427,7 +427,7 @@
427 layer.msg("请选择时间"); 427 layer.msg("请选择时间");
428 return; 428 return;
429 } 429 }
430 - $("#xlmc").html(xlName); 430 + $("#xlmc").html(xlName+" "+date+" ");
431 // $("#ddrbBody").height($(window).height()-300); 431 // $("#ddrbBody").height($(window).height()-300);
432 $("c").html("全日"); 432 $("c").html("全日");
433 $("#export").removeAttr("disabled"); 433 $("#export").removeAttr("disabled");
src/main/resources/static/pages/forms/statement/statisticsDaily.html
@@ -316,7 +316,7 @@ @@ -316,7 +316,7 @@
316 </script> 316 </script>
317 <script type="text/html" id="statisticsDaily"> 317 <script type="text/html" id="statisticsDaily">
318 {{each list as obj i}} 318 {{each list as obj i}}
319 - <tr> 319 + <tr {{if obj.zt==1}}style='color: red'{{/if}}>
320 <td>{{obj.xlName}}</td> 320 <td>{{obj.xlName}}</td>
321 <td>{{obj.jhzlc}}</td> 321 <td>{{obj.jhzlc}}</td>
322 <td>{{obj.jhlc}}</td> 322 <td>{{obj.jhlc}}</td>