Commit 703fbefe782201d70c610ec481b3b496222a3082

Authored by 王通
2 parents 08bab103 dfd3a192

1.线调tip窗体加入驾驶的联系方式(如果有的话)

src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
... ... @@ -8,7 +8,6 @@ import com.bsth.data.BasicData;
8 8 import com.bsth.security.SsoConfig;
9 9 import com.bsth.service.SectionService;
10 10 import com.bsth.service.StationService;
11   -import com.bsth.data.SystemParamCache;
12 11 import com.bsth.data.directive.DayOfDirectives;
13 12 import com.bsth.data.directive.DirectivesPstThread;
14 13 import com.bsth.data.directive.GatewayHttpUtils;
... ...
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
1   -package com.bsth.controller.realcontrol;
2   -
3   -import com.alibaba.fastjson.serializer.PropertyFilter;
4   -import com.bsth.common.ResponseCode;
5   -import com.bsth.data.BasicData;
6   -import com.bsth.data.Station2ParkBuffer;
7   -import com.bsth.data.pinyin.PersionPinYin;
8   -import com.bsth.data.pinyin.PersionPinYinBuffer;
9   -import com.bsth.entity.Line;
10   -import com.bsth.entity.realcontrol.StationToPark;
11   -import com.google.common.base.Splitter;
12   -import com.google.common.collect.ArrayListMultimap;
13   -import com.google.common.collect.BiMap;
14   -import org.slf4j.Logger;
15   -import org.slf4j.LoggerFactory;
16   -import org.springframework.beans.factory.annotation.Autowired;
17   -import org.springframework.web.bind.annotation.RequestMapping;
18   -import org.springframework.web.bind.annotation.RequestMethod;
19   -import org.springframework.web.bind.annotation.RequestParam;
20   -import org.springframework.web.bind.annotation.RestController;
21   -
22   -import java.util.*;
23   -
24   -@RestController
25   -@RequestMapping("/basic")
26   -public class BasicDataController {
27   -
28   - @Autowired
29   - BasicData.BasicDataLoader dataLoader;
30   -
31   - @Autowired
32   - BasicData basicData;
33   -
34   - Logger logger = LoggerFactory.getLogger(this.getClass());
35   -
36   - @Autowired
37   - Station2ParkBuffer station2ParkBuffer;
38   -
39   - @Autowired
40   - PersionPinYinBuffer persionPinYinBuffer;
41   -
42   - @RequestMapping("/cars")
43   - public Iterable<String> findAllNbbm(Map<String, Object> map){
44   - return BasicData.deviceId2NbbmMap.values();
45   - }
46   -
47   - @RequestMapping("/nbbm2deviceId")
48   - public Map<String, String> nbbm2deviceId(Map<String, Object> map){
49   - return BasicData.deviceId2NbbmMap.inverse();
50   - }
51   -
52   - @RequestMapping("/lineCode2Name")
53   - public Map<String, String> findLineCodeMap(){
54   - return BasicData.lineCode2NameMap;
55   - }
56   -
57   - @RequestMapping("/parks")
58   - public Map<String, String> findParks(){
59   - Map<String, String> rs = new HashMap<>();
60   - List<String> codes = BasicData.parkCodeList;
61   - for(String code : codes){
62   - rs.put(code, BasicData.stationCode2NameMap.get(code));
63   - }
64   - return rs;
65   - }
66   -
67   - /*@RequestMapping("/personnel")
68   - public Map<String, Object> findPersonnelInfo(){
69   - Map<String, Object> rs = new HashMap<>();
70   - PersonnelFieldFilter filter=new PersonnelFieldFilter();
71   - //驾驶员
72   - rs.put("jsy", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter)));
73   - //售票员
74   - rs.put("spy", JSON.parse(JSON.toJSONString(BasicData.spyMap.values(), filter)));*//*
75   - return rs;
76   - }*/
77   -
78   - @RequestMapping(value = "/all_personnel_py", method = RequestMethod.GET)
79   - public List<PersionPinYin> findAll_PY(){
80   - return persionPinYinBuffer.getAll();
81   - }
82   -
83   - @RequestMapping("/all_personnel")
84   - public Map<String, String> all_personnel(){
85   - return BasicData.allPerson;
86   - }
87   -
88   -
89   - public class PersonnelFieldFilter implements PropertyFilter{
90   -
91   - String[] whiteList=new String[]{"jobCode", "personnelName", "brancheCompany"};
92   - @Override
93   - public boolean apply(Object object, String name, Object value) {
94   - for(String f : whiteList){
95   - if(name.equals(f))
96   - return true;
97   - }
98   - return false;
99   - }
100   - }
101   -
102   - /**
103   - * 刷新车辆和设备号对照数据
104   - * @return
105   - */
106   - @RequestMapping(value = "/refresh_nbbm2Device", method = RequestMethod.POST)
107   - public Map<String, Object> refreshNbbm2DeviceId(){
108   - Map<String, Object> rs = new HashMap<>();
109   - try {
110   - dataLoader.loadDeviceInfo();
111   - rs.put("status", ResponseCode.SUCCESS);
112   - }catch (Exception e){
113   - rs.put("status", ResponseCode.ERROR);
114   - rs.put("msg", e.getMessage());
115   - logger.error("", e);
116   - }
117   - return rs;
118   - }
119   -
120   - /**
121   - * 刷新员工对照数据
122   - * @return
123   - */
124   - @RequestMapping(value = "/refresh_person_data", method = RequestMethod.POST)
125   - public Map<String, Object> refreshPersonData(){
126   - Map<String, Object> rs = new HashMap<>();
127   - try {
128   - dataLoader.loadPersonnelInfo();
129   - rs.put("status", ResponseCode.SUCCESS);
130   - }catch (Exception e){
131   - rs.put("status", ResponseCode.ERROR);
132   - rs.put("msg", e.getMessage());
133   - logger.error("", e);
134   - }
135   - return rs;
136   - }
137   -
138   - /**
139   - * 车辆自编号和车牌号对照
140   - * @return
141   - */
142   - @RequestMapping("/nbbm2PlateNo")
143   - public Map<String, String> nbbm2PlateNo(){
144   - return basicData.nbbmCompanyPlateMap;
145   - }
146   -
147   -
148   - /**
149   - * 获取线路配车信息
150   - * @return
151   - */
152   - @RequestMapping("/ccInfo")
153   - public Map<String, Collection<String>> ccInfo(){
154   -
155   - ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create();
156   - Set<String> ks = BasicData.nbbm2LineMap.keySet();
157   -
158   - Line line;
159   - for(String nbbm : ks){
160   - line = BasicData.nbbm2LineMap.get(nbbm);
161   - listMultimap.put(line.getLineCode(), nbbm);
162   - }
163   - return listMultimap.asMap();
164   - }
165   -
166   - /**
167   - * 获取车辆信息
168   - * @return
169   - */
170   - @RequestMapping("/ccInfo/lineArray")
171   - public List<Map<String, String>> ccInfoByLine(@RequestParam String idx){
172   - List<String> lines = Splitter.on(",").splitToList(idx);
173   - List<Map<String, String>> rs = new ArrayList<>();
174   - Map<String, String> map;
175   -
176   - //ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create();
177   - Set<String> ks = BasicData.nbbm2LineMap.keySet();
178   - BiMap<String,String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse();
179   -
180   - Line line;
181   - for(String nbbm : ks){
182   - line = BasicData.nbbm2LineMap.get(nbbm);
183   - if(lines.contains(line.getLineCode())){
184   - map = new HashMap<>();
185   - map.put("nbbm", nbbm);
186   - map.put("deviceId", nbbm2deviceMap.get(nbbm));
187   - map.put("lineName", line.getName());
188   - map.put("lineCode", line.getLineCode());
189   - rs.add(map);
190   - }
191   - }
192   - return rs;
193   - }
194   -
195   - /**
196   - * 获取站点和停车场历时公里对照表
197   - * @param idx
198   - * @return
199   - */
200   - @RequestMapping("/station2ParkData")
201   - public Map<String, Collection<StationToPark>> findStation2ParkData(@RequestParam String idx){
202   - List<String> lines = Splitter.on(",").splitToList(idx);
203   - ArrayListMultimap<String, StationToPark> rs = ArrayListMultimap.create();
204   -
205   - for(String lineCode : lines){
206   - rs.putAll(lineCode, Station2ParkBuffer.get(lineCode));
207   - }
208   - return rs.asMap();
209   - }
210   -
211   - @RequestMapping(value = "/deleteStation2Park", method = RequestMethod.POST)
212   - public Map<String, Object> deleteStation2Park(@RequestParam String lineCode,@RequestParam Integer id){
213   - return station2ParkBuffer.delete(lineCode, id);
214   - }
215   -}
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.alibaba.fastjson.serializer.PropertyFilter;
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.data.BasicData;
  6 +import com.bsth.data.Station2ParkBuffer;
  7 +import com.bsth.data.pinyin.PersionPinYin;
  8 +import com.bsth.data.pinyin.PersionPinYinBuffer;
  9 +import com.bsth.entity.Line;
  10 +import com.bsth.entity.Personnel;
  11 +import com.bsth.entity.realcontrol.StationToPark;
  12 +import com.google.common.base.Splitter;
  13 +import com.google.common.collect.ArrayListMultimap;
  14 +import com.google.common.collect.BiMap;
  15 +import org.slf4j.Logger;
  16 +import org.slf4j.LoggerFactory;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.web.bind.annotation.RequestMapping;
  19 +import org.springframework.web.bind.annotation.RequestMethod;
  20 +import org.springframework.web.bind.annotation.RequestParam;
  21 +import org.springframework.web.bind.annotation.RestController;
  22 +
  23 +import java.util.*;
  24 +
  25 +@RestController
  26 +@RequestMapping("/basic")
  27 +public class BasicDataController {
  28 +
  29 + @Autowired
  30 + BasicData.BasicDataLoader dataLoader;
  31 +
  32 + @Autowired
  33 + BasicData basicData;
  34 +
  35 + Logger logger = LoggerFactory.getLogger(this.getClass());
  36 +
  37 + @Autowired
  38 + Station2ParkBuffer station2ParkBuffer;
  39 +
  40 + @Autowired
  41 + PersionPinYinBuffer persionPinYinBuffer;
  42 +
  43 + @RequestMapping("/cars")
  44 + public Iterable<String> findAllNbbm(Map<String, Object> map){
  45 + return BasicData.deviceId2NbbmMap.values();
  46 + }
  47 +
  48 + @RequestMapping("/nbbm2deviceId")
  49 + public Map<String, String> nbbm2deviceId(Map<String, Object> map){
  50 + return BasicData.deviceId2NbbmMap.inverse();
  51 + }
  52 +
  53 + @RequestMapping("/lineCode2Name")
  54 + public Map<String, String> findLineCodeMap(){
  55 + return BasicData.lineCode2NameMap;
  56 + }
  57 +
  58 + @RequestMapping("/parks")
  59 + public Map<String, String> findParks(){
  60 + Map<String, String> rs = new HashMap<>();
  61 + List<String> codes = BasicData.parkCodeList;
  62 + for(String code : codes){
  63 + rs.put(code, BasicData.stationCode2NameMap.get(code));
  64 + }
  65 + return rs;
  66 + }
  67 +
  68 + /*@RequestMapping("/personnel")
  69 + public Map<String, Object> findPersonnelInfo(){
  70 + Map<String, Object> rs = new HashMap<>();
  71 + PersonnelFieldFilter filter=new PersonnelFieldFilter();
  72 + //驾驶员
  73 + rs.put("jsy", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter)));
  74 + //售票员
  75 + rs.put("spy", JSON.parse(JSON.toJSONString(BasicData.spyMap.values(), filter)));*//*
  76 + return rs;
  77 + }*/
  78 +
  79 + @RequestMapping(value = "/all_personnel_py", method = RequestMethod.GET)
  80 + public List<PersionPinYin> findAll_PY(){
  81 + return persionPinYinBuffer.getAll();
  82 + }
  83 +
  84 + @RequestMapping("/all_personnel")
  85 + public Map<String, String> all_personnel(){
  86 + return BasicData.allPerson;
  87 + }
  88 +
  89 + @RequestMapping("/allPersonnelMobile")
  90 + public Map<String, String> allPersonnelMobile(){
  91 + Map<String, String> result = new HashMap<>();
  92 + for (Personnel personnel : BasicData.perMap.values()) {
  93 + result.put(personnel.getJobCode(), personnel.getMobile());
  94 + }
  95 +
  96 + return result;
  97 + }
  98 +
  99 + public class PersonnelFieldFilter implements PropertyFilter{
  100 +
  101 + String[] whiteList=new String[]{"jobCode", "personnelName", "brancheCompany"};
  102 + @Override
  103 + public boolean apply(Object object, String name, Object value) {
  104 + for(String f : whiteList){
  105 + if(name.equals(f))
  106 + return true;
  107 + }
  108 + return false;
  109 + }
  110 + }
  111 +
  112 + /**
  113 + * 刷新车辆和设备号对照数据
  114 + * @return
  115 + */
  116 + @RequestMapping(value = "/refresh_nbbm2Device", method = RequestMethod.POST)
  117 + public Map<String, Object> refreshNbbm2DeviceId(){
  118 + Map<String, Object> rs = new HashMap<>();
  119 + try {
  120 + dataLoader.loadDeviceInfo();
  121 + rs.put("status", ResponseCode.SUCCESS);
  122 + }catch (Exception e){
  123 + rs.put("status", ResponseCode.ERROR);
  124 + rs.put("msg", e.getMessage());
  125 + logger.error("", e);
  126 + }
  127 + return rs;
  128 + }
  129 +
  130 + /**
  131 + * 刷新员工对照数据
  132 + * @return
  133 + */
  134 + @RequestMapping(value = "/refresh_person_data", method = RequestMethod.POST)
  135 + public Map<String, Object> refreshPersonData(){
  136 + Map<String, Object> rs = new HashMap<>();
  137 + try {
  138 + dataLoader.loadPersonnelInfo();
  139 + rs.put("status", ResponseCode.SUCCESS);
  140 + }catch (Exception e){
  141 + rs.put("status", ResponseCode.ERROR);
  142 + rs.put("msg", e.getMessage());
  143 + logger.error("", e);
  144 + }
  145 + return rs;
  146 + }
  147 +
  148 + /**
  149 + * 车辆自编号和车牌号对照
  150 + * @return
  151 + */
  152 + @RequestMapping("/nbbm2PlateNo")
  153 + public Map<String, String> nbbm2PlateNo(){
  154 + return basicData.nbbmCompanyPlateMap;
  155 + }
  156 +
  157 +
  158 + /**
  159 + * 获取线路配车信息
  160 + * @return
  161 + */
  162 + @RequestMapping("/ccInfo")
  163 + public Map<String, Collection<String>> ccInfo(){
  164 +
  165 + ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create();
  166 + Set<String> ks = BasicData.nbbm2LineMap.keySet();
  167 +
  168 + Line line;
  169 + for(String nbbm : ks){
  170 + line = BasicData.nbbm2LineMap.get(nbbm);
  171 + listMultimap.put(line.getLineCode(), nbbm);
  172 + }
  173 + return listMultimap.asMap();
  174 + }
  175 +
  176 + /**
  177 + * 获取车辆信息
  178 + * @return
  179 + */
  180 + @RequestMapping("/ccInfo/lineArray")
  181 + public List<Map<String, String>> ccInfoByLine(@RequestParam String idx){
  182 + List<String> lines = Splitter.on(",").splitToList(idx);
  183 + List<Map<String, String>> rs = new ArrayList<>();
  184 + Map<String, String> map;
  185 +
  186 + //ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create();
  187 + Set<String> ks = BasicData.nbbm2LineMap.keySet();
  188 + BiMap<String,String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse();
  189 +
  190 + Line line;
  191 + for(String nbbm : ks){
  192 + line = BasicData.nbbm2LineMap.get(nbbm);
  193 + if(lines.contains(line.getLineCode())){
  194 + map = new HashMap<>();
  195 + map.put("nbbm", nbbm);
  196 + map.put("deviceId", nbbm2deviceMap.get(nbbm));
  197 + map.put("lineName", line.getName());
  198 + map.put("lineCode", line.getLineCode());
  199 + rs.add(map);
  200 + }
  201 + }
  202 + return rs;
  203 + }
  204 +
  205 + /**
  206 + * 获取站点和停车场历时公里对照表
  207 + * @param idx
  208 + * @return
  209 + */
  210 + @RequestMapping("/station2ParkData")
  211 + public Map<String, Collection<StationToPark>> findStation2ParkData(@RequestParam String idx){
  212 + List<String> lines = Splitter.on(",").splitToList(idx);
  213 + ArrayListMultimap<String, StationToPark> rs = ArrayListMultimap.create();
  214 +
  215 + for(String lineCode : lines){
  216 + rs.putAll(lineCode, Station2ParkBuffer.get(lineCode));
  217 + }
  218 + return rs.asMap();
  219 + }
  220 +
  221 + @RequestMapping(value = "/deleteStation2Park", method = RequestMethod.POST)
  222 + public Map<String, Object> deleteStation2Park(@RequestParam String lineCode,@RequestParam Integer id){
  223 + return station2ParkBuffer.delete(lineCode, id);
  224 + }
  225 +}
... ...
src/main/java/com/bsth/controller/realcontrol/dto/StationSpatialData.java
1   -package com.bsth.controller.realcontrol.dto;
2   -
3   -/**
4   - * Created by panzhao on 2016/11/23.
5   - */
6   -public class StationSpatialData {
7   -
8   - private String lineCode;
9   -
10   - private String stationName;
11   -
12   - private String stationCode;
13   -
14   - private String stationMark;
15   -
16   - private int directions;
17   -
18   - private Float distances;
19   -
20   - private Float toTime;
21   -
22   - private Integer versions;
23   -
24   - private Float gLonx;
25   -
26   - private Float gLaty;
27   -
28   - private Float radius;
29   -
30   - private String shapesType;
31   -
32   - private String gPolygonGrid;
33   -
34   - private Integer stationRouteCode;
35   -
36   - public String getLineCode() {
37   - return lineCode;
38   - }
39   -
40   - public void setLineCode(String lineCode) {
41   - this.lineCode = lineCode;
42   - }
43   -
44   - public String getStationName() {
45   - return stationName;
46   - }
47   -
48   - public void setStationName(String stationName) {
49   - this.stationName = stationName;
50   - }
51   -
52   - public String getStationCode() {
53   - return stationCode;
54   - }
55   -
56   - public void setStationCode(String stationCode) {
57   - this.stationCode = stationCode;
58   - }
59   -
60   - public String getStationMark() {
61   - return stationMark;
62   - }
63   -
64   - public void setStationMark(String stationMark) {
65   - this.stationMark = stationMark;
66   - }
67   -
68   - public int getDirections() {
69   - return directions;
70   - }
71   -
72   - public void setDirections(int directions) {
73   - this.directions = directions;
74   - }
75   -
76   - public Float getDistances() {
77   - return distances;
78   - }
79   -
80   - public void setDistances(Float distances) {
81   - this.distances = distances;
82   - }
83   -
84   - public Float getToTime() {
85   - return toTime;
86   - }
87   -
88   - public void setToTime(Float toTime) {
89   - this.toTime = toTime;
90   - }
91   -
92   - public Integer getVersions() {
93   - return versions;
94   - }
95   -
96   - public void setVersions(Integer versions) {
97   - this.versions = versions;
98   - }
99   -
100   - public Float getgLonx() {
101   - return gLonx;
102   - }
103   -
104   - public void setgLonx(Float gLonx) {
105   - this.gLonx = gLonx;
106   - }
107   -
108   - public Float getgLaty() {
109   - return gLaty;
110   - }
111   -
112   - public void setgLaty(Float gLaty) {
113   - this.gLaty = gLaty;
114   - }
115   -
116   - public Float getRadius() {
117   - return radius;
118   - }
119   -
120   - public void setRadius(Float radius) {
121   - this.radius = radius;
122   - }
123   -
124   - public String getShapesType() {
125   - return shapesType;
126   - }
127   -
128   - public void setShapesType(String shapesType) {
129   - this.shapesType = shapesType;
130   - }
131   -
132   - public String getgPolygonGrid() {
133   - return gPolygonGrid;
134   - }
135   -
136   - public void setgPolygonGrid(String gPolygonGrid) {
137   - this.gPolygonGrid = gPolygonGrid;
138   - }
139   -
140   - public Integer getStationRouteCode() {
141   - return stationRouteCode;
142   - }
143   -
144   - public void setStationRouteCode(Integer stationRouteCode) {
145   - this.stationRouteCode = stationRouteCode;
146   - }
147   -}
  1 +package com.bsth.controller.realcontrol.dto;
  2 +
  3 +/**
  4 + * Created by panzhao on 2016/11/23.
  5 + */
  6 +public class StationSpatialData {
  7 +
  8 + private Integer stationRouteId;
  9 +
  10 + private String lineCode;
  11 +
  12 + private String stationName;
  13 +
  14 + private String stationCode;
  15 +
  16 + private String stationMark;
  17 +
  18 + private int directions;
  19 +
  20 + private Float distances;
  21 +
  22 + private Float toTime;
  23 +
  24 + private Integer versions;
  25 +
  26 + private Float gLonx;
  27 +
  28 + private Float gLaty;
  29 +
  30 + private Float radius;
  31 +
  32 + private String shapesType;
  33 +
  34 + private String gPolygonGrid;
  35 +
  36 + private Integer stationRouteCode;
  37 +
  38 + public Integer getStationRouteId() {
  39 + return stationRouteId;
  40 + }
  41 +
  42 + public void setStationRouteId(Integer stationRouteId) {
  43 + this.stationRouteId = stationRouteId;
  44 + }
  45 +
  46 + public String getLineCode() {
  47 + return lineCode;
  48 + }
  49 +
  50 + public void setLineCode(String lineCode) {
  51 + this.lineCode = lineCode;
  52 + }
  53 +
  54 + public String getStationName() {
  55 + return stationName;
  56 + }
  57 +
  58 + public void setStationName(String stationName) {
  59 + this.stationName = stationName;
  60 + }
  61 +
  62 + public String getStationCode() {
  63 + return stationCode;
  64 + }
  65 +
  66 + public void setStationCode(String stationCode) {
  67 + this.stationCode = stationCode;
  68 + }
  69 +
  70 + public String getStationMark() {
  71 + return stationMark;
  72 + }
  73 +
  74 + public void setStationMark(String stationMark) {
  75 + this.stationMark = stationMark;
  76 + }
  77 +
  78 + public int getDirections() {
  79 + return directions;
  80 + }
  81 +
  82 + public void setDirections(int directions) {
  83 + this.directions = directions;
  84 + }
  85 +
  86 + public Float getDistances() {
  87 + return distances;
  88 + }
  89 +
  90 + public void setDistances(Float distances) {
  91 + this.distances = distances;
  92 + }
  93 +
  94 + public Float getToTime() {
  95 + return toTime;
  96 + }
  97 +
  98 + public void setToTime(Float toTime) {
  99 + this.toTime = toTime;
  100 + }
  101 +
  102 + public Integer getVersions() {
  103 + return versions;
  104 + }
  105 +
  106 + public void setVersions(Integer versions) {
  107 + this.versions = versions;
  108 + }
  109 +
  110 + public Float getgLonx() {
  111 + return gLonx;
  112 + }
  113 +
  114 + public void setgLonx(Float gLonx) {
  115 + this.gLonx = gLonx;
  116 + }
  117 +
  118 + public Float getgLaty() {
  119 + return gLaty;
  120 + }
  121 +
  122 + public void setgLaty(Float gLaty) {
  123 + this.gLaty = gLaty;
  124 + }
  125 +
  126 + public Float getRadius() {
  127 + return radius;
  128 + }
  129 +
  130 + public void setRadius(Float radius) {
  131 + this.radius = radius;
  132 + }
  133 +
  134 + public String getShapesType() {
  135 + return shapesType;
  136 + }
  137 +
  138 + public void setShapesType(String shapesType) {
  139 + this.shapesType = shapesType;
  140 + }
  141 +
  142 + public String getgPolygonGrid() {
  143 + return gPolygonGrid;
  144 + }
  145 +
  146 + public void setgPolygonGrid(String gPolygonGrid) {
  147 + this.gPolygonGrid = gPolygonGrid;
  148 + }
  149 +
  150 + public Integer getStationRouteCode() {
  151 + return stationRouteCode;
  152 + }
  153 +
  154 + public void setStationRouteCode(Integer stationRouteCode) {
  155 + this.stationRouteCode = stationRouteCode;
  156 + }
  157 +}
... ...
src/main/java/com/bsth/entity/Personnel.java
... ... @@ -79,6 +79,11 @@ public class Personnel extends BEntity {
79 79 private String remark;
80 80  
81 81 /**
  82 + * 移动电话
  83 + */
  84 + private String mobile;
  85 +
  86 + /**
82 87 * 0为不锁定 1为锁定
83 88 * 因人员与金蝶同步 但存在调度需要独立添加人员并不会被同步掉的情况
84 89 */
... ... @@ -285,6 +290,14 @@ public class Personnel extends BEntity {
285 290 this.destroy = destroy;
286 291 }
287 292  
  293 + public String getMobile() {
  294 + return mobile;
  295 + }
  296 +
  297 + public void setMobile(String mobile) {
  298 + this.mobile = mobile;
  299 + }
  300 +
288 301 public Integer getLocked() {
289 302 return locked;
290 303 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
... ... @@ -11,7 +11,11 @@ import com.bsth.repository.realcontrol.ChildTaskPlanRepository;
11 11 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
12 12 import com.bsth.service.impl.BaseServiceImpl;
13 13 import com.bsth.service.realcontrol.ChildTaskPlanService;
  14 +import com.bsth.util.PrivilegeUtils;
14 15 import org.apache.commons.lang3.StringUtils;
  16 +import org.joda.time.DateTime;
  17 +import org.joda.time.format.DateTimeFormat;
  18 +import org.joda.time.format.DateTimeFormatter;
15 19 import org.slf4j.Logger;
16 20 import org.slf4j.LoggerFactory;
17 21 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -231,7 +235,15 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
231 235 public Map<String, Object> saveHistory(ChildTaskPlan t) {
232 236 Map<String, Object> rs = new HashMap();
233 237 try {
234   - ScheduleRealInfo sch = t.getSchedule();
  238 + ScheduleRealInfo sch = scheduleRealInfoRepository.findById(t.getSchedule().getId()).get();
  239 + // 检查调度日期
  240 + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
  241 + long today = formatter.parseMillis(new DateTime().toString("yyyy-MM-dd")), scheduleDate = formatter.parseMillis(sch.getScheduleDateStr());
  242 + if (today < scheduleDate || today - scheduleDate > 86400000 * PrivilegeUtils.getHistoryEditDays()) {
  243 + rs.put("status", ResponseCode.ERROR);
  244 + rs.put("msg", "无效的调度日期");
  245 + return rs;
  246 + }
235 247 //保存起终点名称
236 248 String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
237 249 if(StringUtils.isEmpty(t.getStartStationName()))
... ... @@ -253,6 +265,25 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
253 265  
254 266 @Override
255 267 public Map<String, Object> delHistory(Long id) {
256   - return super.delete(id);
  268 + Map<String, Object> rs = new HashMap();
  269 + try {
  270 + ScheduleRealInfo sch = childTaskPlanRepository.findById(id).get().getSchedule();
  271 + // 检查调度日期
  272 + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
  273 + long today = formatter.parseMillis(new DateTime().toString("yyyy-MM-dd")), scheduleDate = formatter.parseMillis(sch.getScheduleDateStr());
  274 + if (today < scheduleDate || today - scheduleDate > 86400000 * PrivilegeUtils.getHistoryEditDays()) {
  275 + rs.put("status", ResponseCode.ERROR);
  276 + rs.put("msg", "无效的调度日期");
  277 + return rs;
  278 + }
  279 +
  280 + return super.delete(id);
  281 + } catch (Exception e) {
  282 + logger.error("", e);
  283 + rs.put("status", ResponseCode.ERROR);
  284 + rs.put("msg", e.getMessage());
  285 + }
  286 +
  287 + return rs;
257 288 }
258 289 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
... ... @@ -42,7 +42,7 @@ public class RealMapServiceImpl implements RealMapService {
42 42 }
43 43 inStr = " (" + inStr.substring(1) + ")";
44 44  
45   - String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,ST_X(s.CENTER_POINT_WGS) G_LONX,ST_Y(s.CENTER_POINT_WGS) G_LATY,r.RADIUS,r.SHAPED_TYPE shapes_type,ST_AsText(r.BUFFER_POLYGON_WGS) as G_POLYGON_GRID, r.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in " + inStr + " and r.destroy=0";
  45 + String sql = "select r.ID STATION_ROUTE_ID,r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,ST_X(s.CENTER_POINT_WGS) G_LONX,ST_Y(s.CENTER_POINT_WGS) G_LATY,r.RADIUS,r.SHAPED_TYPE shapes_type,ST_AsText(r.BUFFER_POLYGON_WGS) as G_POLYGON_GRID, r.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in " + inStr + " and r.destroy=0";
46 46  
47 47 List<StationSpatialData> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(StationSpatialData.class));
48 48 rs.put("status", ResponseCode.SUCCESS);
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
... ... @@ -458,7 +458,11 @@
458 458 <div class="form-group">
459 459 <label class="col-md-2 control-label">是否氢能源车:</label>
460 460 <div class="col-md-3">
461   - <sa-Radiogroup model="ctrl.busInfoForSave.hydrogen" dicgroup="truefalseType" name="hydrogen"></sa-Radiogroup>
  461 + <sa-Radiogroup model="ctrl.busInfoForSave.hydrogen" dicgroup="truefalseType" name="hydrogen" required></sa-Radiogroup>
  462 + </div>
  463 + <!-- 隐藏快,显示验证信息 -->
  464 + <div class="alert alert-danger well-sm" ng-show="myForm.hydrogen.$error.required">
  465 + 是否氢能源车必须选择
462 466 </div>
463 467 </div>
464 468  
... ... @@ -488,4 +492,4 @@
488 492  
489 493 </div>
490 494  
491   -</div>
492 495 \ No newline at end of file
  496 +</div>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
... ... @@ -450,7 +450,11 @@
450 450 <div class="form-group">
451 451 <label class="col-md-2 control-label">是否氢能源车:</label>
452 452 <div class="col-md-3">
453   - <sa-Radiogroup model="ctrl.busInfoForSave.hydrogen" dicgroup="truefalseType" name="hydrogen"></sa-Radiogroup>
  453 + <sa-Radiogroup model="ctrl.busInfoForSave.hydrogen" dicgroup="truefalseType" name="hydrogen" required></sa-Radiogroup>
  454 + </div>
  455 + <!-- 隐藏快,显示验证信息 -->
  456 + <div class="alert alert-danger well-sm" ng-show="myForm.hydrogen.$error.required">
  457 + 是否氢能源车必须选择
454 458 </div>
455 459 </div>
456 460  
... ... @@ -481,4 +485,4 @@
481 485 </div>
482 486  
483 487  
484   -</div>
485 488 \ No newline at end of file
  489 +</div>
... ...
src/main/resources/static/real_control_v2/fragments/home/tooltip.html
... ... @@ -37,6 +37,11 @@
37 37 <div>
38 38 <span class="field">驾驶员:</span>{{sch.jGh}}/{{sch.jName}}
39 39 </div>
  40 + {{if sch.mobile!=null && sch.mobile!=""}}
  41 + <div>
  42 + <span class="field">电话:</span>{{sch.mobile}}
  43 + </div>
  44 + {{/if}}
40 45 {{if sch.sGh!=null && sch.sGh!=""}}
41 46 <div>
42 47 <span class="field">售票员:</span>{{sch.sGh}}/{{sch.sName}}
... ...
src/main/resources/static/real_control_v2/js/data/data_basic.js
... ... @@ -2,9 +2,9 @@
2 2  
3 3 var gb_data_basic = (function () {
4 4  
5   - var stationRoutes, lineCode2NameAll, lineInformations, nbbm2deviceMap, device2nbbmMap, allPersonnel, svgAttrs;
6   - var ep = EventProxy.create("stationRoutes", "lineCode2Name", "lineInformations", "nbbm2deviceId", "all_personnel", "svg_attrs"
7   - , function (routes, code2Name, informations, nbbm2device, all_personnel, svgAttrMap) {
  5 + var stationRoutes, lineCode2NameAll, lineInformations, nbbm2deviceMap, device2nbbmMap, allPersonnel, svgAttrs, gh2mobileMap;
  6 + var ep = EventProxy.create("stationRoutes", "lineCode2Name", "lineInformations", "nbbm2deviceId", "all_personnel", "svg_attrs", "all_mobile"
  7 + , function (routes, code2Name, informations, nbbm2device, all_personnel, svgAttrMap, all_mobile) {
8 8 stationRoutes = routes;
9 9 lineCode2NameAll = code2Name;
10 10 lineInformations = informations;
... ... @@ -12,6 +12,7 @@ var gb_data_basic = (function () {
12 12 device2nbbmMap = gb_common.inverse(nbbm2deviceMap);
13 13 allPersonnel = all_personnel;
14 14 svgAttrs = svgAttrMap;
  15 + gh2mobileMap = all_mobile;
15 16 gb_main_ep.emitLater('data-basic');
16 17 });
17 18  
... ... @@ -71,6 +72,12 @@ var gb_data_basic = (function () {
71 72 });
72 73 }
73 74  
  75 + (function loadAllPersonnelMobile() {
  76 + $.get('/basic/allPersonnelMobile', function (rs) {
  77 + ep.emit('all_mobile', rs);
  78 + });
  79 + })();
  80 +
74 81 var carparks = {};
75 82 //停车场数据
76 83 gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) {
... ... @@ -259,6 +266,9 @@ var gb_data_basic = (function () {
259 266 },
260 267 reload_stat_park_data: function () {
261 268 load_stat_park_data();
  269 + },
  270 + gh2mobileMap: function () {
  271 + return gh2mobileMap;
262 272 }
263 273 };
264 274 })();
... ...
src/main/resources/static/real_control_v2/js/data/data_gps.js
1   -/* gps 数据管理模块 */
2   -
3   -var gb_data_gps = (function () {
4   -
5   - //fixed time refresh delay
6   - var delay = 1000 * 7;
7   - //deviceId ——> gps
8   - var realData = {};
9   - //refresh after callback
10   - var refreshEventCallbacks = [];
11   - //register callback function
12   - var registerCallback = function (cb) {
13   - if (cb)
14   - refreshEventCallbacks.push(cb);
15   - };
16   -
17   - var refresh = function (cb) {
18   - $.ajax({
19   - url: '/gps/real/line',
20   - data: {lineCodes: gb_data_basic.line_idx},
21   - dataType: 'json',
22   - success: function (rs) {
23   - //用定时的gps来检测session断开
24   - if(rs.status && rs.status==407){
25   - location.href = '/login.html';
26   - return;
27   - }
28   - refreshData(rs);
29   - cb();
30   - },
31   - error: function (xr, t) {
32   - notify_err('刷新GPS失败,稍后重试' + t);
33   - cb();
34   - }
35   - });
36   - };
37   -
38   - var refreshData = function (rs) {
39   - var old, addArr = [],
40   - upArr = [],
41   - upDownChange = [];
42   -
43   - var schArray;
44   - $.each(rs.gpsList, function () {
45   - old = realData[this.deviceId];
46   - if (old) {
47   - if (this.timestamp > old.timestamp) {
48   - if (old.upDown != this.upDown)
49   - upDownChange.push(this);
50   - else
51   - upArr.push(this);
52   - }
53   -
54   - } else
55   - addArr.push(this);
56   -
57   - //班次信息
58   - if (this.schId) {
59   - schArray = gb_schedule_table.findScheduleByLine(this.lineId);
60   - if (schArray)
61   - this.sch = schArray[this.schId];
62   - }
63   -
64   - //时间格式化
65   - this.dateStr = moment(this.timestamp).format('YYYY-MM-DD HH:mm:ss');
66   - realData[this.deviceId] = this;
67   - });
68   -
69   - //console.log('add array size: ' + addArr.length, 'up array size: ' + upArr.length);
70   - //CCCallFuncN
71   - $.each(refreshEventCallbacks, function (i, cb) {
72   - cb(addArr, upArr, upDownChange, rs.overspeedList);
73   - });
74   -
75   - //班次站点编码检查信息
76   - if(rs['scis'] && rs['scis'].length > 0)
77   - gb_schedule_table.putSCodeErrorInfo(rs['scis']);
78   -
79   - //超速数据回调
80   - //console.log('超速,,,', rs.overspeedList);
81   -
82   - };
83   -
84   - var startFixedTime;
85   - var fixedTimeRefresh = function () {
86   - if (startFixedTime)
87   - return;
88   - startFixedTime = true;
89   -
90   - (function () {
91   - var f = arguments.callee;
92   - refresh(function () {
93   - setTimeout(f, delay);
94   - });
95   - })();
96   - };
97   -
98   - var gpsByLineCode = function (lineCode) {
99   - var rs = [];
100   - for (var device in realData) {
101   - if (realData[device].lineId == lineCode)
102   - rs.push(realData[device]);
103   - }
104   - return rs;
105   - };
106   -
107   - var findOne = function (deviceId) {
108   - return realData[deviceId];
109   - };
110   -
111   - var findGpsByNbbm = function (nbbm) {
112   - return realData[gb_data_basic.nbbm2deviceMap()[nbbm]];
113   - };
114   -
115   - /**
116   - * 设备掉线事件
117   - */
118   - var deviceOffline = function (gps) {
119   - $.each(offlineCallbacks, function (i, cb) {
120   - cb(gps);
121   - });
122   - };
123   -
124   - //注册掉线事件回调函数
125   - var offlineCallbacks = [];
126   - var registerOfflineCb = function (cb) {
127   - if (cb)
128   - offlineCallbacks.push(cb);
129   - };
130   -
131   - return {
132   - fixedTimeRefresh: fixedTimeRefresh,
133   - registerCallback: registerCallback,
134   - allGps: realData,
135   - gpsByLineCode: gpsByLineCode,
136   - findOne: findOne,
137   - findGpsByNbbm: findGpsByNbbm,
138   - deviceOffline: deviceOffline,
139   - registerOfflineCb: registerOfflineCb
140   - };
141   -})();
  1 +/* gps 数据管理模块 */
  2 +
  3 +var gb_data_gps = (function () {
  4 +
  5 + //fixed time refresh delay
  6 + var delay = 1000 * 7;
  7 + //deviceId ——> gps
  8 + var realData = {};
  9 + //refresh after callback
  10 + var refreshEventCallbacks = [];
  11 + //register callback function
  12 + var registerCallback = function (cb) {
  13 + if (cb)
  14 + refreshEventCallbacks.push(cb);
  15 + };
  16 +
  17 + var refresh = function (cb) {
  18 + $.ajax({
  19 + url: '/gps/real/line',
  20 + data: {lineCodes: gb_data_basic.line_idx},
  21 + dataType: 'json',
  22 + success: function (rs) {
  23 + //用定时的gps来检测session断开
  24 + if(rs.status && rs.status==407){
  25 + location.href = '/login.html';
  26 + return;
  27 + }
  28 + refreshData(rs);
  29 + cb();
  30 + },
  31 + error: function (xr, t) {
  32 + notify_err('刷新GPS失败,稍后重试' + t);
  33 + cb();
  34 + }
  35 + });
  36 + };
  37 +
  38 + var refreshData = function (rs) {
  39 + var old, addArr = [],
  40 + upArr = [],
  41 + upDownChange = [];
  42 +
  43 + var schArray;
  44 + $.each(rs.gpsList, function () {
  45 + old = realData[this.deviceId];
  46 + if (old) {
  47 + if (this.timestamp > old.timestamp) {
  48 + if (old.upDown != this.upDown)
  49 + upDownChange.push(this);
  50 + else
  51 + upArr.push(this);
  52 + }
  53 +
  54 + } else
  55 + addArr.push(this);
  56 +
  57 + //班次信息
  58 + if (this.schId) {
  59 + schArray = gb_schedule_table.findScheduleByLine(this.lineId);
  60 + if (schArray) {
  61 + var sch = schArray[this.schId];
  62 + if (sch) {
  63 + this.sch = sch;
  64 + this.sch.mobile = gb_data_basic.gh2mobileMap()[sch.gsBm + '-' + sch.jGh];
  65 + }
  66 + }
  67 + }
  68 +
  69 + //时间格式化
  70 + this.dateStr = moment(this.timestamp).format('YYYY-MM-DD HH:mm:ss');
  71 + realData[this.deviceId] = this;
  72 + });
  73 +
  74 + //console.log('add array size: ' + addArr.length, 'up array size: ' + upArr.length);
  75 + //CCCallFuncN
  76 + $.each(refreshEventCallbacks, function (i, cb) {
  77 + cb(addArr, upArr, upDownChange, rs.overspeedList);
  78 + });
  79 +
  80 + //班次站点编码检查信息
  81 + if(rs['scis'] && rs['scis'].length > 0)
  82 + gb_schedule_table.putSCodeErrorInfo(rs['scis']);
  83 +
  84 + //超速数据回调
  85 + //console.log('超速,,,', rs.overspeedList);
  86 +
  87 + };
  88 +
  89 + var startFixedTime;
  90 + var fixedTimeRefresh = function () {
  91 + if (startFixedTime)
  92 + return;
  93 + startFixedTime = true;
  94 +
  95 + (function () {
  96 + var f = arguments.callee;
  97 + refresh(function () {
  98 + setTimeout(f, delay);
  99 + });
  100 + })();
  101 + };
  102 +
  103 + var gpsByLineCode = function (lineCode) {
  104 + var rs = [];
  105 + for (var device in realData) {
  106 + if (realData[device].lineId == lineCode)
  107 + rs.push(realData[device]);
  108 + }
  109 + return rs;
  110 + };
  111 +
  112 + var findOne = function (deviceId) {
  113 + return realData[deviceId];
  114 + };
  115 +
  116 + var findGpsByNbbm = function (nbbm) {
  117 + return realData[gb_data_basic.nbbm2deviceMap()[nbbm]];
  118 + };
  119 +
  120 + /**
  121 + * 设备掉线事件
  122 + */
  123 + var deviceOffline = function (gps) {
  124 + $.each(offlineCallbacks, function (i, cb) {
  125 + cb(gps);
  126 + });
  127 + };
  128 +
  129 + //注册掉线事件回调函数
  130 + var offlineCallbacks = [];
  131 + var registerOfflineCb = function (cb) {
  132 + if (cb)
  133 + offlineCallbacks.push(cb);
  134 + };
  135 +
  136 + return {
  137 + fixedTimeRefresh: fixedTimeRefresh,
  138 + registerCallback: registerCallback,
  139 + allGps: realData,
  140 + gpsByLineCode: gpsByLineCode,
  141 + findOne: findOne,
  142 + findGpsByNbbm: findGpsByNbbm,
  143 + deviceOffline: deviceOffline,
  144 + registerOfflineCb: registerOfflineCb
  145 + };
  146 +})();
... ...
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_infowindow.html
... ... @@ -28,6 +28,21 @@
28 28 {{/if}}
29 29 </p>
30 30 <p>设备号:{{deviceId}}</p>
  31 + {{if sch!=null}}
  32 + <div>
  33 + <span class="field">驾驶员:</span>{{sch.jGh}}/{{sch.jName}}
  34 + </div>
  35 + {{if sch.mobile!=null && sch.mobile!=""}}
  36 + <div>
  37 + <span class="field">电话:</span>{{sch.mobile}}
  38 + </div>
  39 + {{/if}}
  40 + {{if sch.sGh!=null && sch.sGh!=""}}
  41 + <div>
  42 + <span class="field">售票员:</span>{{sch.sGh}}/{{sch.sName}}
  43 + </div>
  44 + {{/if}}
  45 + {{/if}}
31 46 <p>速度:{{speed>99?'..':speed}}</p>
32 47 <p>角度:{{direction}}</p>
33 48 <p>经度:{{lon}}</p>
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
... ... @@ -282,7 +282,7 @@ var gb_map_baidu = (function(){
282 282 //绘制多边形
283 283 drawPolygon: function(opt){
284 284 var station = opt.station
285   - ,code = station.stationCode;
  285 + ,code = station.stationRouteId;
286 286 if(electronicFences[code]){
287 287 electronicFences[code].show();
288 288 return;
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/gaode.js
... ... @@ -168,7 +168,7 @@ var gb_map_gaode = (function() {
168 168 //绘制多边形
169 169 drawPolygon: function(opt){
170 170 var station = opt.station
171   - ,code = station.stationCode;
  171 + ,code = station.stationRouteId;
172 172 if(electronicFences[code]){
173 173 electronicFences[code].show();
174 174 return;
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/map_overlay_manager.js
1   -var gb_map_overlay_mge = (function () {
2   -
3   - var storage = window.localStorage;
4   -
5   - var temps;
6   - $.get('/real_control_v2/mapmonitor/fragments/map_infowindow.html', function (dom) {
7   - temps = gb_common.compileTempByDom(dom, {compress: true});
8   - });
9   -
10   - var $abnormNoticePanel = $('.c_b_abnorm_notice');
11   - var gpsRefresh = function (addArr, upArr, upDownChange, overspeedList) {
12   - if(!$('.main-container .map-panel').is(':visible'))
13   - return;
14   - //如果地图正在重绘,暂时不刷新GPS
15   - if(reDrawing)
16   - return;
17   - //var all = addArr.concat(upArr).concat(upDownChange);
18   - gpsRefreshAll(addArr, upArr, upDownChange);
19   -
20   - //渲染超速信息
21   - overspeedList.sort(overspeed_sort);
22   - var htmlStr = template('map_abnorm_overspeed_list-temp', {list: overspeedList});
23   - $abnormNoticePanel.html(htmlStr).scrollTop($abnormNoticePanel[0].scrollHeight);
24   - };
25   -
26   - var overspeed_sort = function (a, b) {
27   - if(a.ets && !b.ets)
28   - return -1;
29   - if(!a.ets && b.ets)
30   - return 1;
31   - return a.st - b.st;
32   - };
33   -
34   - /**
35   - * 超速点击
36   - */
37   - $abnormNoticePanel.on('click', '.c_b_item', function () {
38   - var nbbm = $(this).data('nbbm');
39   - gb_map_gps_tree.selectitem(null, {value: nbbm});
40   - });
41   -
42   - var gpsRefreshAll = function (addArr, upArr, upDownChange) {
43   - //更新设备树菜单
44   - if(gb_map_gps_tree.readyStatus()){
45   - gb_map_gps_tree.create_node(addArr);
46   - gb_map_gps_tree.update_node(upArr);
47   - gb_map_gps_tree.changeUpDown(upDownChange);
48   - }
49   -
50   - //更新地图
51   - var all = addArr.concat(upArr).concat(upDownChange);
52   - gb_map_imap.call('drawRealGpsMarker', {gpsList: all});
53   - };
54   -
55   - var reload_gps = function () {
56   - var array = gb_common.get_vals(gb_data_gps.allGps);
57   - gb_map_gps_tree.refresh();
58   - gb_map_imap.call('drawRealGpsMarker', {gpsList: array});
59   - };
60   -
61   - var deviceFilter = function (node) {
62   - return node.a_attr && node.a_attr.type=='device';
63   - };
64   -
65   - //绘制线路走向
66   - var drawAllSection=function () {
67   - //绘制线路走向
68   - var lines=JSON.parse(storage.getItem('lineControlItems'));
69   - $.each(lines, function () {
70   - //从storage里获取路由数据
71   - var lineCode=this.lineCode;
72   - var route = JSON.parse(storage.getItem(lineCode + '_route'));
73   - //上行
74   - gb_map_imap.call('drawLine', {
75   - route: route,
76   - style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.up},
77   - id: lineCode+'_0',
78   - upDown: 0,
79   - hide: true
80   - });
81   - //下行
82   - gb_map_imap.call('drawLine', {
83   - route: route,
84   - style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.down},
85   - id: lineCode+'_1',
86   - upDown: 1,
87   - hide: true
88   - });
89   -
90   - });
91   - };
92   -
93   - //根据选中项显示路段
94   - var showSection = function (chs) {
95   - var idx = {};
96   - $.each(chs, function () {
97   - idx[this.data.lineId+'_'+this.data.upDown]=1;
98   - });
99   -
100   - gb_map_imap.call('refreshPolyline', {idx: gb_common.get_keys(idx)});
101   - };
102   -
103   -
104   - //是否正在重绘
105   - var reDrawing;
106   - var reDraw = function () {
107   - reDrawing = true;
108   -
109   - gb_map_imap.call('clearAll');
110   -
111   - try{
112   - drawAllSection();
113   - }catch (e){
114   - console.log(e);
115   - }
116   - //重绘GPS
117   - gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)});
118   -
119   - showOverlayByChecks();
120   - //显示路段
121   - showSection(getCheckedDevice());
122   -
123   - reDrawing = false;
124   - };
125   -
126   - //重绘GPS
127   - var reDrawGps = function () {
128   - reDrawing = true;
129   - gb_map_imap.call('clearAllGps');
130   - //重绘GPS
131   - gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)});
132   -
133   - showOverlayByChecks();
134   - reDrawing = false;
135   - };
136   -
137   - var init = function () {
138   - reDraw();
139   - //注册GPS刷新事件
140   - gb_data_gps.registerCallback(gpsRefresh);
141   -
142   - centerToRational();
143   - };
144   -
145   -
146   - var showOverlayByChecks = function () {
147   - var chs = getCheckedDevice(),chsMap={};
148   - $.each(chs, function () {
149   - chsMap[this.a_attr.device]=true;
150   - });
151   -
152   - gb_map_imap.call('showGpsMarker', {chs: chsMap});
153   -
154   - //路段
155   - showSection(chs);
156   -
157   - };
158   -
159   - var _focus = function (deviceId) {
160   - gb_map_imap.call('goToMarker', {deviceId: deviceId});
161   - //打开信息窗口
162   - gb_map_imap.call('openWindow',{deviceId: deviceId});
163   - };
164   -
165   - //站点获得焦点
166   - var _focus_station = function (station) {
167   - gb_map_imap.call('goToStation', station.stationCode);
168   - };
169   -
170   - //停车场获得焦点
171   - var _focus_carpark = function (carpark) {
172   - //console.log('_focus_carpark', carpark);
173   - gb_map_imap.call('goToCarpark', carpark.parkCode);
174   - };
175   -
176   - function getCheckedDevice() {
177   - return gb_map_gps_tree.getChecked().filter(deviceFilter);
178   - }
179   -
180   - //绘制站点
181   - var drawStation = function () {
182   - var list = gb_map_spatial_data.getCheckedStation();
183   - //绘制站点
184   - gb_map_imap.call('drawStationMarker', {list: list});
185   - //绘制电子围栏
186   - drawElectronicFence(list);
187   - };
188   -
189   - //绘制电子围栏
190   - var drawElectronicFence = function (list) {
191   - var config = gb_map_config.getConfig().spatialData;
192   - if(!config.electronicFence)
193   - return;
194   -
195   - if(!list){
196   - list = gb_map_spatial_data.getCheckedStation();
197   - }
198   -
199   -
200   - gb_map_imap.call('hideAllCircles');
201   - $.each(list, function () {
202   - fun=this.shapesType=='r'?drawCircle:drawPolygon;
203   - fun(this);
204   - });
205   - };
206   -
207   - //绘制停车场
208   - var drawCarpark = function () {
209   - var list = gb_map_spatial_data.gteCheckedCarpark();
210   - gb_map_imap.call('drawCarpark', {list: list});
211   - };
212   -
213   - var drawCircle=function (data) {
214   - var config = gb_map_config.getConfig().section.color;
215   - var color = data.directions==0?config.up:config.down;
216   -
217   - var opt = {
218   - lon: data.lon,
219   - lat: data.lat,
220   - text: data.stationName,
221   - color: color,
222   - weight: 2,
223   - radius: parseFloat(data.radius),
224   - id: data.stationCode
225   - };
226   -
227   - gb_map_imap.call('drawCircle', opt);
228   - };
229   -
230   - var drawPolygon=function (data) {
231   - var config = gb_map_config.getConfig().section.color;
232   - var color = data.directions==0?config.up:config.down;
233   -
234   - var opt = {
235   - //id:data.stationCode,
236   - color: color,
237   - weight: 2,
238   - station: data
239   - };
240   -
241   - gb_map_imap.call('drawPolygon', opt);
242   - };
243   -
244   - //地图居中至合理的位置
245   - var centerToRational=function () {
246   - var chs=getCheckedDevice();
247   - if(chs && chs.length > 0){
248   - var id=chs[0].data.lineId+'_'+chs[0].data.upDown;
249   - gb_map_imap.call('centerToLine', {id: id});
250   - }
251   - };
252   -
253   - return {
254   - init: init,
255   - refresh: showOverlayByChecks,
256   - _focus: _focus,
257   - _focus_station: _focus_station,
258   - _focus_carpark: _focus_carpark,
259   - map_gps_win_temp: function (data) {
260   - var url='http://58.247.254.118:9999/pf/getPassengerFlow?deviceId='+data.deviceId;
261   - console.log(url);
262   - $.ajax({async:false,url:url, success:function(res) {
263   - console.log(res);
264   - data.num=res.num;
265   - data.photo=res.photo;
266   - }})
267   - console.log("数据回显");
268   - return temps['map-win-gps-detail-temp'](data);
269   - },
270   - map_station_win_temp: function (data) {
271   - return temps['map-win-station-detail-temp'](data);
272   - },
273   - map_carpark_win_temp: function (data) {
274   - return temps['map-win-carpark-detail-temp'](data);
275   - },
276   - reDraw: reDraw,
277   - reDrawGps: reDrawGps,
278   - getCheckedDevice: getCheckedDevice,
279   - drawStation: drawStation,
280   - drawElectronicFence: drawElectronicFence,
281   - drawCarpark: drawCarpark,
282   - centerToRational:centerToRational,
283   - reload_gps: reload_gps
284   - };
  1 +var gb_map_overlay_mge = (function () {
  2 +
  3 + var storage = window.localStorage;
  4 +
  5 + var temps;
  6 + $.get('/real_control_v2/mapmonitor/fragments/map_infowindow.html', function (dom) {
  7 + temps = gb_common.compileTempByDom(dom, {compress: true});
  8 + });
  9 +
  10 + var $abnormNoticePanel = $('.c_b_abnorm_notice');
  11 + var gpsRefresh = function (addArr, upArr, upDownChange, overspeedList) {
  12 + if(!$('.main-container .map-panel').is(':visible'))
  13 + return;
  14 + //如果地图正在重绘,暂时不刷新GPS
  15 + if(reDrawing)
  16 + return;
  17 + //var all = addArr.concat(upArr).concat(upDownChange);
  18 + gpsRefreshAll(addArr, upArr, upDownChange);
  19 +
  20 + //渲染超速信息
  21 + overspeedList.sort(overspeed_sort);
  22 + var htmlStr = template('map_abnorm_overspeed_list-temp', {list: overspeedList});
  23 + $abnormNoticePanel.html(htmlStr).scrollTop($abnormNoticePanel[0].scrollHeight);
  24 + };
  25 +
  26 + var overspeed_sort = function (a, b) {
  27 + if(a.ets && !b.ets)
  28 + return -1;
  29 + if(!a.ets && b.ets)
  30 + return 1;
  31 + return a.st - b.st;
  32 + };
  33 +
  34 + /**
  35 + * 超速点击
  36 + */
  37 + $abnormNoticePanel.on('click', '.c_b_item', function () {
  38 + var nbbm = $(this).data('nbbm');
  39 + gb_map_gps_tree.selectitem(null, {value: nbbm});
  40 + });
  41 +
  42 + var gpsRefreshAll = function (addArr, upArr, upDownChange) {
  43 + //更新设备树菜单
  44 + if(gb_map_gps_tree.readyStatus()){
  45 + gb_map_gps_tree.create_node(addArr);
  46 + gb_map_gps_tree.update_node(upArr);
  47 + gb_map_gps_tree.changeUpDown(upDownChange);
  48 + }
  49 +
  50 + //更新地图
  51 + var all = addArr.concat(upArr).concat(upDownChange);
  52 + gb_map_imap.call('drawRealGpsMarker', {gpsList: all});
  53 + };
  54 +
  55 + var reload_gps = function () {
  56 + var array = gb_common.get_vals(gb_data_gps.allGps);
  57 + gb_map_gps_tree.refresh();
  58 + gb_map_imap.call('drawRealGpsMarker', {gpsList: array});
  59 + };
  60 +
  61 + var deviceFilter = function (node) {
  62 + return node.a_attr && node.a_attr.type=='device';
  63 + };
  64 +
  65 + //绘制线路走向
  66 + var drawAllSection=function () {
  67 + //绘制线路走向
  68 + var lines=JSON.parse(storage.getItem('lineControlItems'));
  69 + $.each(lines, function () {
  70 + //从storage里获取路由数据
  71 + var lineCode=this.lineCode;
  72 + var route = JSON.parse(storage.getItem(lineCode + '_route'));
  73 + //上行
  74 + gb_map_imap.call('drawLine', {
  75 + route: route,
  76 + style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.up},
  77 + id: lineCode+'_0',
  78 + upDown: 0,
  79 + hide: true
  80 + });
  81 + //下行
  82 + gb_map_imap.call('drawLine', {
  83 + route: route,
  84 + style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.down},
  85 + id: lineCode+'_1',
  86 + upDown: 1,
  87 + hide: true
  88 + });
  89 +
  90 + });
  91 + };
  92 +
  93 + //根据选中项显示路段
  94 + var showSection = function (chs) {
  95 + var idx = {};
  96 + $.each(chs, function () {
  97 + idx[this.data.lineId+'_'+this.data.upDown]=1;
  98 + });
  99 +
  100 + gb_map_imap.call('refreshPolyline', {idx: gb_common.get_keys(idx)});
  101 + };
  102 +
  103 +
  104 + //是否正在重绘
  105 + var reDrawing;
  106 + var reDraw = function () {
  107 + reDrawing = true;
  108 +
  109 + gb_map_imap.call('clearAll');
  110 +
  111 + try{
  112 + drawAllSection();
  113 + }catch (e){
  114 + console.log(e);
  115 + }
  116 + //重绘GPS
  117 + gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)});
  118 +
  119 + showOverlayByChecks();
  120 + //显示路段
  121 + showSection(getCheckedDevice());
  122 +
  123 + reDrawing = false;
  124 + };
  125 +
  126 + //重绘GPS
  127 + var reDrawGps = function () {
  128 + reDrawing = true;
  129 + gb_map_imap.call('clearAllGps');
  130 + //重绘GPS
  131 + gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)});
  132 +
  133 + showOverlayByChecks();
  134 + reDrawing = false;
  135 + };
  136 +
  137 + var init = function () {
  138 + reDraw();
  139 + //注册GPS刷新事件
  140 + gb_data_gps.registerCallback(gpsRefresh);
  141 +
  142 + centerToRational();
  143 + };
  144 +
  145 +
  146 + var showOverlayByChecks = function () {
  147 + var chs = getCheckedDevice(),chsMap={};
  148 + $.each(chs, function () {
  149 + chsMap[this.a_attr.device]=true;
  150 + });
  151 +
  152 + gb_map_imap.call('showGpsMarker', {chs: chsMap});
  153 +
  154 + //路段
  155 + showSection(chs);
  156 +
  157 + };
  158 +
  159 + var _focus = function (deviceId) {
  160 + gb_map_imap.call('goToMarker', {deviceId: deviceId});
  161 + //打开信息窗口
  162 + gb_map_imap.call('openWindow',{deviceId: deviceId});
  163 + };
  164 +
  165 + //站点获得焦点
  166 + var _focus_station = function (station) {
  167 + gb_map_imap.call('goToStation', station.stationCode);
  168 + };
  169 +
  170 + //停车场获得焦点
  171 + var _focus_carpark = function (carpark) {
  172 + //console.log('_focus_carpark', carpark);
  173 + gb_map_imap.call('goToCarpark', carpark.parkCode);
  174 + };
  175 +
  176 + function getCheckedDevice() {
  177 + return gb_map_gps_tree.getChecked().filter(deviceFilter);
  178 + }
  179 +
  180 + //绘制站点
  181 + var drawStation = function () {
  182 + var list = gb_map_spatial_data.getCheckedStation();
  183 + //绘制站点
  184 + gb_map_imap.call('drawStationMarker', {list: list});
  185 + //绘制电子围栏
  186 + drawElectronicFence(list);
  187 + };
  188 +
  189 + //绘制电子围栏
  190 + var drawElectronicFence = function (list) {
  191 + var config = gb_map_config.getConfig().spatialData;
  192 + if(!config.electronicFence)
  193 + return;
  194 +
  195 + if(!list){
  196 + list = gb_map_spatial_data.getCheckedStation();
  197 + }
  198 +
  199 +
  200 + gb_map_imap.call('hideAllCircles');
  201 + $.each(list, function () {
  202 + fun=this.shapesType=='r'?drawCircle:drawPolygon;
  203 + fun(this);
  204 + });
  205 + };
  206 +
  207 + //绘制停车场
  208 + var drawCarpark = function () {
  209 + var list = gb_map_spatial_data.gteCheckedCarpark();
  210 + gb_map_imap.call('drawCarpark', {list: list});
  211 + };
  212 +
  213 + var drawCircle=function (data) {
  214 + var config = gb_map_config.getConfig().section.color;
  215 + var color = data.directions==0?config.up:config.down;
  216 +
  217 + var opt = {
  218 + lon: data.lon,
  219 + lat: data.lat,
  220 + text: data.stationName,
  221 + color: color,
  222 + weight: 2,
  223 + radius: parseFloat(data.radius),
  224 + id: data.stationRouteId
  225 + };
  226 +
  227 + gb_map_imap.call('drawCircle', opt);
  228 + };
  229 +
  230 + var drawPolygon=function (data) {
  231 + var config = gb_map_config.getConfig().section.color;
  232 + var color = data.directions==0?config.up:config.down;
  233 +
  234 + var opt = {
  235 + //id:data.stationCode,
  236 + color: color,
  237 + weight: 2,
  238 + station: data
  239 + };
  240 +
  241 + gb_map_imap.call('drawPolygon', opt);
  242 + };
  243 +
  244 + //地图居中至合理的位置
  245 + var centerToRational=function () {
  246 + var chs=getCheckedDevice();
  247 + if(chs && chs.length > 0){
  248 + var id=chs[0].data.lineId+'_'+chs[0].data.upDown;
  249 + gb_map_imap.call('centerToLine', {id: id});
  250 + }
  251 + };
  252 +
  253 + return {
  254 + init: init,
  255 + refresh: showOverlayByChecks,
  256 + _focus: _focus,
  257 + _focus_station: _focus_station,
  258 + _focus_carpark: _focus_carpark,
  259 + map_gps_win_temp: function (data) {
  260 + var url='http://58.247.254.118:9999/pf/getPassengerFlow?deviceId='+data.deviceId;
  261 + console.log(url);
  262 + $.ajax({async:false,url:url, success:function(res) {
  263 + console.log(res);
  264 + data.num=res.num;
  265 + data.photo=res.photo;
  266 + }})
  267 + console.log("数据回显");
  268 + return temps['map-win-gps-detail-temp'](data);
  269 + },
  270 + map_station_win_temp: function (data) {
  271 + return temps['map-win-station-detail-temp'](data);
  272 + },
  273 + map_carpark_win_temp: function (data) {
  274 + return temps['map-win-carpark-detail-temp'](data);
  275 + },
  276 + reDraw: reDraw,
  277 + reDrawGps: reDrawGps,
  278 + getCheckedDevice: getCheckedDevice,
  279 + drawStation: drawStation,
  280 + drawElectronicFence: drawElectronicFence,
  281 + drawCarpark: drawCarpark,
  282 + centerToRational:centerToRational,
  283 + reload_gps: reload_gps
  284 + };
285 285 })();
286 286 \ No newline at end of file
... ...