Commit b487422f3a2a19845da320ceec7f87680833a683

Authored by YRF
1 parent babfdcd9

线路版本

Showing 47 changed files with 3006 additions and 231 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 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 95 * @Description :TODO(编辑线路走向)
78 96 *
79 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/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 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 276 \ No newline at end of file
... ...
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 192 @Modifying
193 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 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 313 public void stationRouteIsDestroyUpdBatch(Integer ids);
314 314  
315 315 /**
316   - * 更新路线前撤销线路原有站点
  316 + *
317 317 *
318 318 * @param line
319 319 * @param dir
... ... @@ -321,4 +321,14 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
321 321 @Modifying
322 322 @Query(value="insert into (select * from bsth_c_stationroute_cache where line = ?1 and directions = ?2) bsth_c_stationroute", nativeQuery=true)
323 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 62 List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map);
63 63  
64 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 35 Map<String, Object> sectionCut(Map<String, Object> map);
36 36  
37 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 112 * @return
113 113 */
114 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/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 385 }
386 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 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 17 import com.alibaba.fastjson.JSONObject;
18 18 import com.bsth.common.ResponseCode;
19 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 23 import com.bsth.entity.Section;
21 24 import com.bsth.entity.SectionRoute;
22 25 import com.bsth.entity.SectionRouteCache;
23 26 import com.bsth.entity.StationRoute;
24 27 import com.bsth.entity.StationRouteCache;
25 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 32 import com.bsth.repository.SectionRepository;
27 33 import com.bsth.repository.SectionRouteCacheRepository;
28 34 import com.bsth.repository.SectionRouteRepository;
... ... @@ -62,15 +68,24 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
62 68 LineRepository lineRepository;
63 69  
64 70 @Autowired
  71 + LineVersionsRepository lineVersionsRepository;
  72 +
  73 + @Autowired
65 74 SectionRouteRepository routeRepository;
66 75  
67 76 @Autowired
  77 + LsSectionRouteRepository lsRouteRepository;
  78 +
  79 + @Autowired
68 80 SectionRouteCacheRepository routeCacheRepository;
69 81  
70 82 @Autowired
71 83 StationRouteRepository stationRouteRepository;
72 84  
73 85 @Autowired
  86 + LsStationRouteRepository lsStationRouteRepository;
  87 +
  88 + @Autowired
74 89 StationRouteCacheRepository stationRouteCacheRepository;
75 90  
76 91 /**
... ... @@ -88,119 +103,12 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
88 103 // 路段点List
89 104 List<Point> bPointsList = new ArrayList<>();
90 105 // 截取路段点List
91   - List<Point> bPointsCutList = new ArrayList<>();
  106 +// List<Point> bPointsCutList = new ArrayList<>();
92 107 // 截取后的路段
93 108 List<Map<String, String>> sectionArrayList = new ArrayList<>();
94 109 String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString();
95 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 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 125 // 路段长度
218 126 Double sectionDistance = 0.0;
219 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 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 135 // 限速
228 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 140 Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
233 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 151 String middleNode="";
244 152 String sectionType="";
245 153 String csectionVector="";
246   - // 撤销原有路段
247   - routeRepository.sectionRouteUpdDestroy(Integer.parseInt(lineCode),directions);
  154 + // 撤销原有路段路由
  155 + routeRepository.sectionRouteUpdDestroy(sectionRouteLine,directions);
248 156 // 路段保存
249 157 for (int i = 0; i < sectionArrayList.size(); i++) {
250 158 long sectionMaxId = GetUIDAndCode.getSectionId();
... ... @@ -263,7 +171,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
263 171 String bsectionVectorS = null;
264 172 if(!sectionsBpoints.equals(""))
265 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 175 SectionRoute route = new SectionRoute();
268 176 Line line = lineRepository.findOne(sectionRouteLine);
269 177 Section section = repository.findOne(sectionId);
... ... @@ -271,7 +179,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
271 179 route.setLineCode(lineCode);
272 180 route.setSectionCode(sectionCode);
273 181 route.setDirections(directions);
274   - route.setVersions(version);
  182 + route.setVersions(versions);
275 183 route.setDestroy(destroy);
276 184 route.setDescriptions(descriptions);
277 185 route.setCreateBy(createBy);
... ... @@ -282,9 +190,9 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
282 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 197 List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(lineCode,directions);
290 198 for(int i=0; i < stationRouteList.size(); i++) {
... ... @@ -305,7 +213,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
305 213 stationRoute.setEndTime(stationRouteCache.getEndTime());
306 214 stationRoute.setDescriptions(stationRouteCache.getDescriptions());
307 215 stationRoute.setDestroy(stationRouteCache.getDestroy());
308   - stationRoute.setVersions(stationRouteCache.getVersions());
  216 + stationRoute.setVersions(versions);
309 217 stationRoute.setCreateBy(stationRouteCache.getCreateBy());
310 218 stationRoute.setCreateDate(stationRouteCache.getCreateDate());
311 219 stationRoute.setUpdateBy(stationRouteCache.getCreateBy());
... ... @@ -313,7 +221,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
313 221 stationRouteRepository.save(stationRoute);
314 222 }
315 223 // 删除缓存站点
316   - stationRouteCacheRepository.stationRouteCacheDel(Integer.parseInt(lineCode),directions);
  224 + stationRouteCacheRepository.stationRouteCacheDel(sectionRouteLine,directions);
317 225  
318 226 resultMap.put("status", ResponseCode.SUCCESS);
319 227 } catch (Exception e) {
... ... @@ -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 480 * @Description :TODO(编辑线路走向)
328 481 *
329 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 84 List<String> title = new ArrayList<String>();
85 85 title.add("线路ID");
86 86 title.add("方向");
87   - title.add("站点ID");
  87 + title.add("站点编码");
88 88 title.add("站点顺序号");
89 89 title.add("站点备注");
90 90 title.add("站点名称");
... ... @@ -1268,4 +1268,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1268 1268 }
1269 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/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 5 <div class="modal-dialog">
5   -
  6 +
6 7 <div class="modal-content">
7   -
  8 +
8 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 12 <h4 class="modal-title">生成路线(站点和路段)</h4>
11 13 </div>
12   -
  14 +
13 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 23 </div>
20   -
  24 +
21 25 <!-- 站点名称 -->
22 26 <div class="form-body">
23   -
  27 +
24 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 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 35 </div>
31   - </div>
  36 + </div>
32 37 </div>
33 38 <div class="form-group">
34 39 <label class="col-md-3 control-label">选择方向:</label>
35 40 <div class="col-md-9">
36 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 46 </label>
43 47 </div>
44 48 </div>
45 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 72 </form>
61 73 </div>
62 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 77 <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button>
65 78 </div>
66 79 </div>
... ... @@ -139,20 +152,21 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
139 152 var directionData = $("input[name='dirCheck']:checked").val();
140 153 editRoute.setLineDir(directionData);
141 154 // 弹出正在加载层
142   - var i = layer.load(0,{offset:['200px', '280px']});
  155 + var i = layer.load(2);
143 156 // 表单序列化
144 157 var paramsForm = form.serializeJSON();
145 158 // 切割坐标点
146 159 var array = paramsForm.points.split('\r\n');
147 160 // 把坐标点转换为站点或路段
148 161 var arrayFormat = inputStationValueFormat(array);
149   - var stationList = arrayFormat.stationList;
  162 + var stationList = arrayFormat.stationList;
150 163 var sectionListTemp = arrayFormat.sectionList;
151 164 var sectionList = [];
152 165 // 隔30个取一个点(相当于30s)
153 166 for(var i = 0; i*30 < sectionListTemp.length; i++) {
154 167 sectionList[i] = sectionListTemp[i*30];
155 168 }
  169 + sectionList[sectionList.length] = sectionListTemp[sectionListTemp.length-1];
156 170  
157 171 var sectionListFinal = [];
158 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 241 }
228 242 for(var i = 0 ;i<sectionList.length;i++) {
229 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 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 94 // 需要验证的表单元素
95 95 rules : {
96 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 104 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度.
105 105 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度.
106 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 120 var index = parseInt(arguments.callee.count) - 1;
121 121  
122 122 if (index >= len-1) {
123   -
124 123 callback && callback(points);
125 124  
126 125 return;
... ...
src/main/resources/static/pages/base/line/js/line-list-table.js
... ... @@ -347,27 +347,14 @@
347 347 return ;
348 348 }else {
349 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 41 <a href="javascript:;" data-action="1" id="editRoute" class="tool-action"> <i class="fa fa-level-up"></i>上传GPS生成路线</a>
42 42 </li>
43 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 45 </li>
46 46 <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印
47 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 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 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 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 23 <thead>
20 24 <tr role="row" class="heading">
21   - <th >截取路段</th>
  25 + <th>截取路段</th>
22 26 </tr>
23 27 </thead>
24 28 <tbody></tbody>
25 29 </table>
26 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 36 </div>
33 37 </div>
34 38 </div>
... ... @@ -45,8 +49,9 @@
45 49 </tr>
46 50 {{/if}}
47 51 </script>
48   -<!--上传GPS坐标生成路线监听事件 -->
49   -<<script type="text/javascript">
  52 +<!--上传GPS坐标生成路线监听事件 -->
  53 +<
  54 +<script type="text/javascript">
50 55 $(function(){
51 56 // 关闭左侧栏
52 57 if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
... ... @@ -111,7 +116,16 @@ $(function(){
111 116 // 提交截取事件
112 117 $('#cutSection').on('click', function() {
113 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 129 btn: ['提交','取消'] //按钮
116 130 }, function(){
117 131 var sectionList = WorldsBMapLine.getSectionList();
... ... @@ -131,7 +145,7 @@ $(function(){
131 145 layer.msg('提交失败...');
132 146 }
133 147 });
134   - });
  148 + }); */
135 149 } else {
136 150 layer.msg("请先截取路段!!!");
137 151 }
... ... @@ -170,11 +184,11 @@ $(function(){
170 184 }).on('mouseleave',function() {
171 185 $('.defeat-scroll').css('overflow','hidden');
172 186 });
173   -});
  187 +});
174 188 </script>
175 189 <!--编辑路线类 -->
176 190 <script src="/pages/base/line/js/editRoute.js"></script>
177   - <!--坐标转换类 -->
  191 +<!--坐标转换类 -->
178 192 <script src="/pages/base/line/js/transGPS.js"></script>
179 193 <!-- 地图类 -->
180 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 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 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 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 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 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 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 222 \ No newline at end of file
... ...
src/main/resources/static/pages/base/section/add.html
... ... @@ -245,7 +245,7 @@
245 245 <div class="form-group">
246 246 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;:</label>
247 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 249 </div>
250 250 </div>
251 251 </div>
... ...
src/main/resources/static/pages/base/section/js/add-form-events.js
... ... @@ -6,13 +6,22 @@ $(function(){
6 6 // 监听线路名称下拉框值改变事件.
7 7 $('#lineSelect').on("change", function (e) {
8 8 var lineSelectValue = $('#lineSelect').val();// 获取线路名称值.
9   - if(lineSelectValue=='') {
  9 + if(lineSelectValue=='' || lineSelectValue==null) {
10 10 $('#lineCodeInput').val('');// 设值线路编码.
11 11 $('#lineIdInput').val('');// 设值线路ID.
12 12 }else {
  13 + debugger
13 14 var lineSelectValueArray = lineSelectValue.split('_');// 切割线路名称值.
14 15 $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
15 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 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 27 // 线路下拉框初始化.
28 28 PublicFunctions.getLineAllInfo(function(array,compD) {
29 29 var len_ = array.length,paramsD = new Array();
  30 +// paramsD.push({'id':'','text':'请选择...'});
30 31 if(len_>0) {
31 32 $.each(array, function(i, g){
32 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 33 $('#speedLimitInput').val(Section.sectionSpeedLimit);// 道路限速
34 34 $('#sectionDistanceInput').val(Section.sectionDistance);// 路段长度
35 35 $('#sectionTimeInput').val(Section.sectionTime);// 路段长度
36   - $('#versionsInput').val(Section.sectionVersion);// 版本号
  36 + $('#versionsInput').val(Section.sectionRouteVersions);// 版本号
37 37 $('#destroySelect').val(Section.sectionRouteDestroy);// 是否撤销
38 38 $('#descriptionsTextarea').val(Section.sectionRouteDescriptions);// 描述/说明
39 39 $('#isRoadeSpeedInput').val(Section.isRoadeSpeed);// 是否有路段限速数据 <0:分段;1:未分段>
... ...
src/main/resources/static/pages/base/station/add.html
... ... @@ -288,7 +288,7 @@
288 288 <div class="form-group">
289 289 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
290 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 292 </div>
293 293 </div>
294 294 </div>
... ...
src/main/resources/static/pages/base/station/edit.html
... ... @@ -184,7 +184,7 @@
184 184 <div class="form-group">
185 185 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
186 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 188 </div>
189 189 </div>
190 190 </div>
... ... @@ -253,7 +253,7 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu
253 253 'stationMark' : {required : true},// 站点类型 必填项
254 254 'bJwpoints' : {required : true},// 经纬度坐标点 必填项
255 255 'shapesType' : {required : true},// 几何图形类型 必填项
256   - 'radius' : {required : true},// 圆形半径 必填项
  256 + 'radius' : {required : true, number : true,},// 圆形半径 必填项
257 257 'destroy' : {required : true},// 是否撤销 必填项
258 258 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
259 259 'distances' : {number : true},// 到站距离 // 到站距离
... ...
src/main/resources/static/pages/base/station/js/add-form-events.js
... ... @@ -14,7 +14,7 @@ $(function(){
14 14 // 监听线路名称值改变事件.
15 15 $('#lineSelect').on("change", function (e) {
16 16 var lineSelectValue = $(this).val();
17   - if(lineSelectValue=='' && lineSelectValue ==null) {
  17 + if(lineSelectValue=='' || lineSelectValue ==null) {
18 18 $('#lineCodeInput').val('');
19 19 $('#lineIdInput').val('');
20 20 }else {
... ... @@ -23,6 +23,14 @@ $(function(){
23 23 $('#lineIdInput').val(lineSelectValueArray[0]);
24 24 $('#lineCodeInput').val(lineSelectValueArray[1]);
25 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 34 initSelect(params);
27 35 }
28 36 });
... ... @@ -58,8 +66,8 @@ $(function(){
58 66 PublicFunctions.getStationRouteInfo(p,function(array) {
59 67 // 定义路段路由长度、渲染拼音检索下拉框格式数据.
60 68 var len_ = array.length,paramsD = new Array();
  69 +// paramsD.push({'id':'','text':'请选择...'});
61 70 if(len_>0) {
62   - paramsD.push({'id':'','text':'请选择...'});
63 71 // 遍历.
64 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 25 $('#destroySelect').val('0');
26 26 PublicFunctions.getLineAllInfo(function(array,compD) {
27 27 var len_ = array.length,paramsD = new Array();
  28 +// paramsD.push({'id':'','text':'请选择...'});
28 29 if(len_>0) {
29 30 $.each(array, function(i, g){
30 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 36 'directions' : {required : true,},// 站点方向 必填项
37 37 'bJwpoints' : {required : true,},// 经纬度坐标点 必填项
38 38 'shapesType' : {required : true,},// 范围图形类型 必填项
39   - 'radius': {required : true,},// 圆形半径
  39 + 'radius': {required : true, number : true,},// 圆形半径
40 40 'destroy' : {required : true,},// 是否撤销 必填项.
41 41 'toTime' : {number : true,},// 路段时长 必须输入合法的数字(负数,小数)。
42 42 'distances' : {number : true,},// 路段时长 必须输入合法的数字(负数,小数)。
... ...
src/main/resources/static/pages/base/station/js/station-list-edit.js
... ... @@ -54,7 +54,7 @@
54 54 'stationRouteCode' : {isStart : true},// 站点序号
55 55 'bJwpoints' : {required : true},// 经纬度坐标点 必填项
56 56 'shapesType' : {required : true},// 几何图形类型 必填项
57   - 'radius' : {required : true},// 圆形半径 必填项
  57 + 'radius' : {required : true, number : true,},// 圆形半径 必填项
58 58 'destroy' : {required : true},// 是否撤销 必填项
59 59 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
60 60 'distances' : {number : true},// 到站距离 // 到站距离
... ...
src/main/resources/static/pages/base/station/js/station-positions-function.js
... ... @@ -150,6 +150,8 @@ var PositionsPublicFunctions = function () {
150 150 $('#toTimeInput').val(stationObj.stationRouteToTime);
151 151 // 到站距离
152 152 $('#distancesInput').val(stationObj.stationRouteDistances);
  153 + // 版本号
  154 + $('#versionsInput').val(stationObj.stationRouteVersions);
153 155 // 描述/说明
154 156 $('#descriptionsTextarea').val(stationObj.stationRouteDescriptions);
155 157 },
... ... @@ -194,6 +196,8 @@ var PositionsPublicFunctions = function () {
194 196 $('#toTimeInput').val(stationObj.stationRouteToTime);
195 197 // 到站距离
196 198 $('#distancesInput').val(stationObj.stationRouteDistances);
  199 + // 版本号
  200 + $('#versionsInput').val(stationObj.stationRouteVersions);
197 201 // 描述/说明
198 202 $('#descriptionsTextarea').val(stationObj.stationRouteDescriptions);
199 203 },
... ...
src/main/resources/static/pages/base/station/list_edit.html
... ... @@ -241,7 +241,7 @@
241 241 <label class="control-label col-md-5"><span class="required"> </span> 版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
242 242 </label>
243 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 245 </div>
246 246 </div>
247 247 </div>
... ...
src/main/resources/static/pages/base/stationroute/add.html
... ... @@ -173,7 +173,7 @@
173 173 <div class="form-group">
174 174 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
175 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 177 </div>
178 178 </div>
179 179 </div>
... ... @@ -236,6 +236,15 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao
236 236 $('#radiusInput').val(Station.radius);
237 237 // 是否撤销
238 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 248 var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir};
240 249 initSelect(initzdlyP);
241 250 });
... ...
src/main/resources/static/pages/base/stationroute/edit.html
... ... @@ -171,7 +171,7 @@
171 171 <div class="form-group">
172 172 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
173 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 175 </div>
176 176 </div>
177 177 </div>
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
... ... @@ -277,7 +277,6 @@ var PublicFunctions = function () {
277 277  
278 278 /** @param directionV_ :方向 */
279 279 stationRevoke : function(directionV_) {
280   - debugger
281 280 // 获取树选中节点对象
282 281 var obj = PublicFunctions.getCurrSelNode(directionV_);
283 282 // 是否选中,选中节点是否为站点
... ... @@ -377,6 +376,8 @@ var PublicFunctions = function () {
377 376 $('#toTimeInput').val(editStationParmas.stationRouteToTime);
378 377 // 到站距离
379 378 $('#distancesInput').val(editStationParmas.stationRouteDistances);
  379 + // 线路版本号
  380 + $('#versionsInput').val(editStationParmas.stationRouteVersions);
380 381 // 描述/说明
381 382 $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions);
382 383 },
... ...