Commit c7218aacb19d52f81c427f80d4b6f5703f2bdeb2
Merge branch 'minhang' of http://222.66.0.204:8090//panzhaov5/bsth_control into minhang
Showing
54 changed files
with
4268 additions
and
311 deletions
pom.xml
| @@ -299,6 +299,11 @@ | @@ -299,6 +299,11 @@ | ||
| 299 | <version>3.3.0</version> | 299 | <version>3.3.0</version> |
| 300 | </dependency> | 300 | </dependency> |
| 301 | 301 | ||
| 302 | + <dependency> | ||
| 303 | + <groupId>com.github.stuxuhai</groupId> | ||
| 304 | + <artifactId>jpinyin</artifactId> | ||
| 305 | + <version>1.1.8</version> | ||
| 306 | + </dependency> | ||
| 302 | </dependencies> | 307 | </dependencies> |
| 303 | 308 | ||
| 304 | <dependencyManagement> | 309 | <dependencyManagement> |
src/main/java/com/bsth/XDApplication.java
| @@ -129,7 +129,7 @@ public class XDApplication implements CommandLineRunner { | @@ -129,7 +129,7 @@ public class XDApplication implements CommandLineRunner { | ||
| 129 | 129 | ||
| 130 | //运管处静态数据提交 | 130 | //运管处静态数据提交 |
| 131 | log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | 131 | log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); |
| 132 | - sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 132 | + sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiff / 1000 + 60 * 60 * 5, 60 * 60 * 24, TimeUnit.SECONDS); |
| 133 | //计算油、公里加注 | 133 | //计算油、公里加注 |
| 134 | sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | 134 | sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 135 | 135 |
src/main/java/com/bsth/controller/PersonnelController.java
| 1 | package com.bsth.controller; | 1 | package com.bsth.controller; |
| 2 | 2 | ||
| 3 | +import com.bsth.common.Constants; | ||
| 4 | +import com.bsth.data.pinyin.PersionPinYin; | ||
| 5 | +import com.bsth.data.pinyin.PersionPinYinBuffer; | ||
| 3 | import com.bsth.entity.Personnel; | 6 | import com.bsth.entity.Personnel; |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 4 | import com.bsth.service.PersonnelService; | 8 | import com.bsth.service.PersonnelService; |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | import org.springframework.web.bind.annotation.RequestMapping; | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
| @@ -8,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -8,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | import org.springframework.web.bind.annotation.RequestParam; | 12 | import org.springframework.web.bind.annotation.RequestParam; |
| 9 | import org.springframework.web.bind.annotation.RestController; | 13 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 14 | ||
| 15 | +import javax.servlet.http.HttpServletRequest; | ||
| 11 | import java.util.List; | 16 | import java.util.List; |
| 12 | import java.util.Map; | 17 | import java.util.Map; |
| 13 | 18 | ||
| @@ -21,8 +26,22 @@ public class PersonnelController extends BaseController<Personnel, Integer> { | @@ -21,8 +26,22 @@ public class PersonnelController extends BaseController<Personnel, Integer> { | ||
| 21 | @Autowired | 26 | @Autowired |
| 22 | private PersonnelService service; | 27 | private PersonnelService service; |
| 23 | 28 | ||
| 29 | + @Autowired | ||
| 30 | + PersionPinYinBuffer persionPinYinBuffer; | ||
| 31 | + | ||
| 24 | @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET) | 32 | @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET) |
| 25 | public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) { | 33 | public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) { |
| 26 | return service.sreachPersonnel(jobCode); | 34 | return service.sreachPersonnel(jobCode); |
| 27 | } | 35 | } |
| 36 | + | ||
| 37 | + @RequestMapping(value = "/all_py", method = RequestMethod.GET) | ||
| 38 | + public List<PersionPinYin> findAll_PY(){ | ||
| 39 | + return persionPinYinBuffer.getAll(); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @RequestMapping(value = "/list_py", method = RequestMethod.GET) | ||
| 43 | + public List<PersionPinYin> findByCurrUser_PY(HttpServletRequest request){ | ||
| 44 | + List<CompanyAuthority> auths = (List<CompanyAuthority>) request.getSession().getAttribute(Constants.COMPANY_AUTHORITYS); | ||
| 45 | + return persionPinYinBuffer.getAll(auths); | ||
| 46 | + } | ||
| 28 | } | 47 | } |
src/main/java/com/bsth/controller/SectionController.java
| @@ -60,6 +60,26 @@ public class SectionController extends BaseController<Section, Integer> { | @@ -60,6 +60,26 @@ public class SectionController extends BaseController<Section, Integer> { | ||
| 60 | * | 60 | * |
| 61 | * @return Map<String, Object> <SUCCESS ; ERROR> | 61 | * @return Map<String, Object> <SUCCESS ; ERROR> |
| 62 | */ | 62 | */ |
| 63 | + @RequestMapping(value="sectionCut" , method = RequestMethod.POST) | ||
| 64 | + public Map<String, Object> sectionCut(@RequestParam Map<String, Object> map) { | ||
| 65 | + | ||
| 66 | + map.put("updateBy", ""); | ||
| 67 | + | ||
| 68 | + map.put("createBy", ""); | ||
| 69 | + | ||
| 70 | + map.put("createDate", ""); | ||
| 71 | + | ||
| 72 | + return service.sectionCut(map); | ||
| 73 | + | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @Description :TODO(编辑线路走向) | ||
| 78 | + * | ||
| 79 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 80 | + * | ||
| 81 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 82 | + */ | ||
| 63 | @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) | 83 | @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) |
| 64 | public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) { | 84 | public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) { |
| 65 | 85 | ||
| @@ -74,6 +94,22 @@ public class SectionController extends BaseController<Section, Integer> { | @@ -74,6 +94,22 @@ public class SectionController extends BaseController<Section, Integer> { | ||
| 74 | } | 94 | } |
| 75 | 95 | ||
| 76 | /** | 96 | /** |
| 97 | + * @Description :TODO(编辑缓存线路走向) | ||
| 98 | + */ | ||
| 99 | + @RequestMapping(value="sectionCacheUpdate" , method = RequestMethod.POST) | ||
| 100 | + public Map<String, Object> sectionCacheUpdate(@RequestParam Map<String, Object> map) { | ||
| 101 | + | ||
| 102 | + map.put("updateBy", ""); | ||
| 103 | + | ||
| 104 | + map.put("createBy", ""); | ||
| 105 | + | ||
| 106 | + map.put("createDate", ""); | ||
| 107 | + | ||
| 108 | + return service.sectionCacheUpdate(map); | ||
| 109 | + | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 77 | * @Description :TODO(查询路段编码) | 113 | * @Description :TODO(查询路段编码) |
| 78 | * | 114 | * |
| 79 | * @return int <sectionCode路段编码> | 115 | * @return int <sectionCode路段编码> |
src/main/java/com/bsth/controller/SectionRouteController.java
| @@ -70,6 +70,18 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | @@ -70,6 +70,18 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | ||
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | /** | 72 | /** |
| 73 | + * @Description :TODO(查询路段信息) | ||
| 74 | + * | ||
| 75 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 76 | + * | ||
| 77 | + * @return Map<String, Object> | ||
| 78 | + */ | ||
| 79 | + @RequestMapping(value = "/findSectionCache" , method = RequestMethod.GET) | ||
| 80 | + public List<Map<String, Object>> findPointsCache(@RequestParam Map<String, Object> map) { | ||
| 81 | + return routeService.getSectionRouteCache(map); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 73 | * @Description : TODO(根据路段路由Id查询详情) | 85 | * @Description : TODO(根据路段路由Id查询详情) |
| 74 | * | 86 | * |
| 75 | * @param map <id:路段路由ID> | 87 | * @param map <id:路段路由ID> |
src/main/java/com/bsth/controller/StationController.java
| @@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | import org.springframework.web.bind.annotation.RequestParam; | 8 | import org.springframework.web.bind.annotation.RequestParam; |
| 9 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 10 | ||
| 11 | +import antlr.collections.List; | ||
| 12 | + | ||
| 11 | import com.bsth.entity.Station; | 13 | import com.bsth.entity.Station; |
| 12 | import com.bsth.service.StationService; | 14 | import com.bsth.service.StationService; |
| 13 | import com.bsth.util.GetUIDAndCode; | 15 | import com.bsth.util.GetUIDAndCode; |
| @@ -36,6 +38,17 @@ public class StationController extends BaseController<Station, Integer> { | @@ -36,6 +38,17 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 36 | private StationService service; | 38 | private StationService service; |
| 37 | 39 | ||
| 38 | /** | 40 | /** |
| 41 | + * @Description :TODO(根据坐标点匹配数据库中的站点) | ||
| 42 | + * | ||
| 43 | + * @param map: <point:坐标点; name:站点名> | ||
| 44 | + * | ||
| 45 | + */ | ||
| 46 | + @RequestMapping(value="matchStation" , method = RequestMethod.GET) | ||
| 47 | + public Map<String, Object> matchStation(@RequestParam Map<String, Object> map) { | ||
| 48 | + return service.matchStation(map); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 39 | * @Description :TODO(系统规划保存数据) | 52 | * @Description :TODO(系统规划保存数据) |
| 40 | * | 53 | * |
| 41 | * @param map <stationJSON:站点信息; | 54 | * @param map <stationJSON:站点信息; |
| @@ -68,6 +81,11 @@ public class StationController extends BaseController<Station, Integer> { | @@ -68,6 +81,11 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 68 | return service.manualSave(map); | 81 | return service.manualSave(map); |
| 69 | } | 82 | } |
| 70 | 83 | ||
| 84 | + @RequestMapping(value="cacheSave" , method = RequestMethod.POST) | ||
| 85 | + public Map<String, Object> cacheSave(@RequestParam Map<String, Object> map) { | ||
| 86 | + return service.cacheSave(map); | ||
| 87 | + } | ||
| 88 | + | ||
| 71 | /** | 89 | /** |
| 72 | * @Description :TODO(新增站点保存) | 90 | * @Description :TODO(新增站点保存) |
| 73 | * | 91 | * |
src/main/java/com/bsth/controller/StationRouteController.java
| @@ -99,6 +99,18 @@ public class StationRouteController extends BaseController<StationRoute, Integer | @@ -99,6 +99,18 @@ public class StationRouteController extends BaseController<StationRoute, Integer | ||
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | /** | 101 | /** |
| 102 | + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | ||
| 103 | + * | ||
| 104 | + * @param map <lineId:线路ID; direction:方向> | ||
| 105 | + * | ||
| 106 | + * @return List<Map<String, Object>> | ||
| 107 | + */ | ||
| 108 | + @RequestMapping(value = "/getStationRouteCacheCenterPoints" , method = RequestMethod.GET) | ||
| 109 | + public List<Map<String, Object>> getStationRouteCacheCenterPoints(@RequestParam Map<String, Object> map) { | ||
| 110 | + return service.getStationRouteCacheCenterPoints(map); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 102 | * @Description :TODO(撤销站点) | 114 | * @Description :TODO(撤销站点) |
| 103 | * | 115 | * |
| 104 | * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> | 116 | * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.serializer.PropertyFilter; | 3 | import com.alibaba.fastjson.serializer.PropertyFilter; |
| 5 | import com.bsth.common.ResponseCode; | 4 | import com.bsth.common.ResponseCode; |
| 6 | import com.bsth.data.BasicData; | 5 | import com.bsth.data.BasicData; |
| @@ -60,16 +59,16 @@ public class BasicDataController { | @@ -60,16 +59,16 @@ public class BasicDataController { | ||
| 60 | return rs; | 59 | return rs; |
| 61 | } | 60 | } |
| 62 | 61 | ||
| 63 | - @RequestMapping("/personnel") | 62 | + /*@RequestMapping("/personnel") |
| 64 | public Map<String, Object> findPersonnelInfo(){ | 63 | public Map<String, Object> findPersonnelInfo(){ |
| 65 | Map<String, Object> rs = new HashMap<>(); | 64 | Map<String, Object> rs = new HashMap<>(); |
| 66 | PersonnelFieldFilter filter=new PersonnelFieldFilter(); | 65 | PersonnelFieldFilter filter=new PersonnelFieldFilter(); |
| 67 | //驾驶员 | 66 | //驾驶员 |
| 68 | rs.put("jsy", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter))); | 67 | rs.put("jsy", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter))); |
| 69 | //售票员 | 68 | //售票员 |
| 70 | - rs.put("spy", JSON.parse(JSON.toJSONString(BasicData.spyMap.values(), filter))); | 69 | + rs.put("spy", JSON.parse(JSON.toJSONString(BasicData.spyMap.values(), filter)));*//* |
| 71 | return rs; | 70 | return rs; |
| 72 | - } | 71 | + }*/ |
| 73 | 72 | ||
| 74 | @RequestMapping("/all_personnel") | 73 | @RequestMapping("/all_personnel") |
| 75 | public Map<String, String> all_personnel(){ | 74 | public Map<String, String> all_personnel(){ |
| @@ -179,15 +178,12 @@ public class BasicDataController { | @@ -179,15 +178,12 @@ public class BasicDataController { | ||
| 179 | map.put("lineCode", line.getLineCode()); | 178 | map.put("lineCode", line.getLineCode()); |
| 180 | rs.add(map); | 179 | rs.add(map); |
| 181 | } | 180 | } |
| 182 | - //listMultimap.put(line.getName(), nbbm); | ||
| 183 | } | 181 | } |
| 184 | - //return listMultimap.asMap(); | ||
| 185 | - | ||
| 186 | return rs; | 182 | return rs; |
| 187 | } | 183 | } |
| 188 | 184 | ||
| 189 | /** | 185 | /** |
| 190 | - * 获取站点和停车场对照表 | 186 | + * 获取站点和停车场历时公里对照表 |
| 191 | * @param idx | 187 | * @param idx |
| 192 | * @return | 188 | * @return |
| 193 | */ | 189 | */ |
src/main/java/com/bsth/controller/report/ReportController.java
| @@ -269,9 +269,11 @@ public class ReportController { | @@ -269,9 +269,11 @@ public class ReportController { | ||
| 269 | 269 | ||
| 270 | @RequestMapping(value="/countBusMileage") | 270 | @RequestMapping(value="/countBusMileage") |
| 271 | public List<Map<String,Object>> countBusMileage(@RequestParam Map<String, Object> map){ | 271 | public List<Map<String,Object>> countBusMileage(@RequestParam Map<String, Object> map){ |
| 272 | - | ||
| 273 | return service.countByBusList(map); | 272 | return service.countByBusList(map); |
| 274 | } | 273 | } |
| 275 | 274 | ||
| 276 | - | 275 | + @RequestMapping(value="/countDjg") |
| 276 | + public List<Map<String, Object>> countDjg(@RequestParam Map<String, Object> map){ | ||
| 277 | + return service.countDjg(map); | ||
| 278 | + } | ||
| 277 | } | 279 | } |
src/main/java/com/bsth/data/BasicData.java
| @@ -2,6 +2,7 @@ package com.bsth.data; | @@ -2,6 +2,7 @@ package com.bsth.data; | ||
| 2 | 2 | ||
| 3 | import com.bsth.Application; | 3 | import com.bsth.Application; |
| 4 | import com.bsth.data.gpsdata.arrival.GeoCacheData; | 4 | import com.bsth.data.gpsdata.arrival.GeoCacheData; |
| 5 | +import com.bsth.data.pinyin.PersionPinYinBuffer; | ||
| 5 | import com.bsth.entity.*; | 6 | import com.bsth.entity.*; |
| 6 | import com.bsth.entity.schedule.CarConfigInfo; | 7 | import com.bsth.entity.schedule.CarConfigInfo; |
| 7 | import com.bsth.repository.*; | 8 | import com.bsth.repository.*; |
| @@ -64,10 +65,10 @@ public class BasicData implements CommandLineRunner { | @@ -64,10 +65,10 @@ public class BasicData implements CommandLineRunner { | ||
| 64 | //线路Code和shangHaiLinecode 对照 | 65 | //线路Code和shangHaiLinecode 对照 |
| 65 | public static Map<String, String> lineCode2ShangHaiCodeMap; | 66 | public static Map<String, String> lineCode2ShangHaiCodeMap; |
| 66 | 67 | ||
| 67 | - //驾驶员工号 和 personnel 对象映射 | 68 | + /*//驾驶员工号 和 personnel 对象映射 |
| 68 | public static Map<String, Personnel> jsyMap; | 69 | public static Map<String, Personnel> jsyMap; |
| 69 | //售票员工号 和 personnel 对象映射 | 70 | //售票员工号 和 personnel 对象映射 |
| 70 | - public static Map<String, Personnel> spyMap; | 71 | + public static Map<String, Personnel> spyMap;*/ |
| 71 | //所以员工和personnerl 对象映射 | 72 | //所以员工和personnerl 对象映射 |
| 72 | public static Map<String, Personnel> perMap; | 73 | public static Map<String, Personnel> perMap; |
| 73 | //全量员工 工号和姓名对照 | 74 | //全量员工 工号和姓名对照 |
| @@ -137,6 +138,9 @@ public class BasicData implements CommandLineRunner { | @@ -137,6 +138,9 @@ public class BasicData implements CommandLineRunner { | ||
| 137 | @Autowired | 138 | @Autowired |
| 138 | Station2ParkBuffer station2ParkBuffer; | 139 | Station2ParkBuffer station2ParkBuffer; |
| 139 | 140 | ||
| 141 | + @Autowired | ||
| 142 | + PersionPinYinBuffer persionPinYinBuffer; | ||
| 143 | + | ||
| 140 | 144 | ||
| 141 | @Override | 145 | @Override |
| 142 | public void run() { | 146 | public void run() { |
| @@ -165,6 +169,8 @@ public class BasicData implements CommandLineRunner { | @@ -165,6 +169,8 @@ public class BasicData implements CommandLineRunner { | ||
| 165 | geoCacheData.loadData(); | 169 | geoCacheData.loadData(); |
| 166 | station2ParkBuffer.saveAll(); | 170 | station2ParkBuffer.saveAll(); |
| 167 | logger.info("加载基础数据成功!,"); | 171 | logger.info("加载基础数据成功!,"); |
| 172 | + //人员拼音转换 | ||
| 173 | + persionPinYinBuffer.refresh(); | ||
| 168 | } catch (Exception e) { | 174 | } catch (Exception e) { |
| 169 | logger.error("加载基础数据时出现异常,", e); | 175 | logger.error("加载基础数据时出现异常,", e); |
| 170 | } | 176 | } |
| @@ -321,7 +327,7 @@ public class BasicData implements CommandLineRunner { | @@ -321,7 +327,7 @@ public class BasicData implements CommandLineRunner { | ||
| 321 | public void loadPersonnelInfo() { | 327 | public void loadPersonnelInfo() { |
| 322 | Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); | 328 | Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); |
| 323 | 329 | ||
| 324 | - Map<String, Personnel> jsyTempMap = new HashMap<>(), spyTempMap = new HashMap<>(),perTempMap=new HashMap<>(); | 330 | + Map<String, Personnel> /*jsyTempMap = new HashMap<>(), spyTempMap = new HashMap<>(),*/perTempMap=new HashMap<>(); |
| 325 | Map<String, String> allPersonMap = new HashMap<>(); | 331 | Map<String, String> allPersonMap = new HashMap<>(); |
| 326 | 332 | ||
| 327 | Personnel p; | 333 | Personnel p; |
| @@ -333,20 +339,20 @@ public class BasicData implements CommandLineRunner { | @@ -333,20 +339,20 @@ public class BasicData implements CommandLineRunner { | ||
| 333 | if (StringUtils.isEmpty(jobCode)) | 339 | if (StringUtils.isEmpty(jobCode)) |
| 334 | continue; | 340 | continue; |
| 335 | 341 | ||
| 336 | - if (p.getPosts() != null) { | 342 | + /*if (p.getPosts() != null) { |
| 337 | if (p.getPosts().equals("1")) | 343 | if (p.getPosts().equals("1")) |
| 338 | jsyTempMap.put(jobCode, p); | 344 | jsyTempMap.put(jobCode, p); |
| 339 | else if (p.getPosts().equals("2")) | 345 | else if (p.getPosts().equals("2")) |
| 340 | spyTempMap.put(jobCode, p); | 346 | spyTempMap.put(jobCode, p); |
| 341 | - } | 347 | + }*/ |
| 342 | 348 | ||
| 343 | perTempMap.put(jobCode, p); | 349 | perTempMap.put(jobCode, p); |
| 344 | 350 | ||
| 345 | allPersonMap.put(jobCode, p.getPersonnelName()); | 351 | allPersonMap.put(jobCode, p.getPersonnelName()); |
| 346 | } | 352 | } |
| 347 | 353 | ||
| 348 | - jsyMap = jsyTempMap; | ||
| 349 | - spyMap = spyTempMap; | 354 | + //jsyMap = jsyTempMap; |
| 355 | + //spyMap = spyTempMap; | ||
| 350 | allPerson = allPersonMap; | 356 | allPerson = allPersonMap; |
| 351 | perMap = perTempMap; | 357 | perMap = perTempMap; |
| 352 | } | 358 | } |
src/main/java/com/bsth/data/gpsdata/arrival/utils/SignalSchPlanMatcher.java
| @@ -40,8 +40,8 @@ public class SignalSchPlanMatcher { | @@ -40,8 +40,8 @@ public class SignalSchPlanMatcher { | ||
| 40 | return; | 40 | return; |
| 41 | 41 | ||
| 42 | long dt = fbFirst.getDfsjT(); | 42 | long dt = fbFirst.getDfsjT(); |
| 43 | - //前5后10 -执行分班的首个营运 | ||
| 44 | - if(dt - t < 1000 * 60 * 5 || t - dt < 1000 * 60 * 10){ | 43 | + //晚于待发前4分钟 -执行分班的首个营运 |
| 44 | + if(dt - t < 1000 * 60 * 4){ | ||
| 45 | dayOfSchedule.addExecPlan(fbFirst); | 45 | dayOfSchedule.addExecPlan(fbFirst); |
| 46 | return; | 46 | return; |
| 47 | } | 47 | } |
src/main/java/com/bsth/data/pinyin/PersionPinYin.java
0 → 100644
| 1 | +package com.bsth.data.pinyin; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 人员拼音映射 | ||
| 7 | + * Created by panzhao on 2017/7/19. | ||
| 8 | + */ | ||
| 9 | +public class PersionPinYin { | ||
| 10 | + | ||
| 11 | + /** | ||
| 12 | + * 工号 | ||
| 13 | + */ | ||
| 14 | + private String workId; | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 姓名 | ||
| 18 | + */ | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 全拼 | ||
| 23 | + */ | ||
| 24 | + private String fullChars; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 简便 | ||
| 28 | + */ | ||
| 29 | + private String camelChars; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 所属公司编码 | ||
| 33 | + */ | ||
| 34 | + @JsonIgnore | ||
| 35 | + private String companyId; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 所属分公司编码 | ||
| 39 | + */ | ||
| 40 | + @JsonIgnore | ||
| 41 | + private String fgsCompanyId; | ||
| 42 | + | ||
| 43 | + public String getWorkId() { | ||
| 44 | + return workId; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public void setWorkId(String workId) { | ||
| 48 | + this.workId = workId; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public String getName() { | ||
| 52 | + return name; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public void setName(String name) { | ||
| 56 | + this.name = name; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public String getFullChars() { | ||
| 60 | + return fullChars; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void setFullChars(String fullChars) { | ||
| 64 | + this.fullChars = fullChars; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public String getCamelChars() { | ||
| 68 | + return camelChars; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public void setCamelChars(String camelChars) { | ||
| 72 | + this.camelChars = camelChars; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public String getCompanyId() { | ||
| 76 | + return companyId; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setCompanyId(String companyId) { | ||
| 80 | + this.companyId = companyId; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public String getFgsCompanyId() { | ||
| 84 | + return fgsCompanyId; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void setFgsCompanyId(String fgsCompanyId) { | ||
| 88 | + this.fgsCompanyId = fgsCompanyId; | ||
| 89 | + } | ||
| 90 | +} |
src/main/java/com/bsth/data/pinyin/PersionPinYinBuffer.java
0 → 100644
| 1 | +package com.bsth.data.pinyin; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.entity.Personnel; | ||
| 5 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 6 | +import com.github.stuxuhai.jpinyin.PinyinException; | ||
| 7 | +import com.github.stuxuhai.jpinyin.PinyinFormat; | ||
| 8 | +import com.github.stuxuhai.jpinyin.PinyinHelper; | ||
| 9 | +import com.google.common.collect.ArrayListMultimap; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.stereotype.Component; | ||
| 13 | + | ||
| 14 | +import java.util.ArrayList; | ||
| 15 | +import java.util.Collection; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 人员拼音数据映射缓存 | ||
| 20 | + * Created by panzhao on 2017/7/19. | ||
| 21 | + */ | ||
| 22 | +@Component | ||
| 23 | +public class PersionPinYinBuffer { | ||
| 24 | + | ||
| 25 | + static ArrayListMultimap<String, PersionPinYin> listMultimap = ArrayListMultimap.create(); | ||
| 26 | + static List<PersionPinYin> all = new ArrayList<>(); | ||
| 27 | + | ||
| 28 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + public void refresh(){ | ||
| 32 | + ArrayListMultimap<String, PersionPinYin> listMultimapCopy = ArrayListMultimap.create(); | ||
| 33 | + List<PersionPinYin> allCopy = new ArrayList<>(); | ||
| 34 | + PersionPinYin ppy; | ||
| 35 | + | ||
| 36 | + Collection<Personnel> list = BasicData.perMap.values(); | ||
| 37 | + for(Personnel p : list){ | ||
| 38 | + ppy = new PersionPinYin(); | ||
| 39 | + ppy.setCompanyId(p.getCompanyCode()); | ||
| 40 | + ppy.setFgsCompanyId(p.getBrancheCompanyCode()); | ||
| 41 | + ppy.setName(p.getPersonnelName()); | ||
| 42 | + ppy.setWorkId(p.getJobCode()); | ||
| 43 | + try { | ||
| 44 | + ppy.setFullChars(PinyinHelper.convertToPinyinString(ppy.getName(), "" , PinyinFormat.WITHOUT_TONE)); | ||
| 45 | + ppy.setCamelChars(PinyinHelper.getShortPinyin(ppy.getName())); | ||
| 46 | + }catch (PinyinException pye){ | ||
| 47 | + log.error("拼音转换出现异常," + ppy.getName(), pye); | ||
| 48 | + continue; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + listMultimapCopy.put(ppy.getCompanyId() + "_" + ppy.getFgsCompanyId(), ppy); | ||
| 52 | + allCopy.add(ppy); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + if(allCopy.size() > 0){ | ||
| 56 | + all = allCopy; | ||
| 57 | + listMultimap = listMultimapCopy; | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public List<PersionPinYin> getAll(){ | ||
| 62 | + return all; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public List<PersionPinYin> getAll(List<CompanyAuthority> auths){ | ||
| 66 | + List<PersionPinYin> rs = new ArrayList<>(); | ||
| 67 | + for(CompanyAuthority ca : auths){ | ||
| 68 | + rs.addAll(listMultimap.get(ca.getCompanyCode() + "_" + ca.getSubCompanyCode())); | ||
| 69 | + } | ||
| 70 | + return rs; | ||
| 71 | + } | ||
| 72 | +} |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -7,6 +7,7 @@ import com.bsth.common.ResponseCode; | @@ -7,6 +7,7 @@ import com.bsth.common.ResponseCode; | ||
| 7 | import com.bsth.data.LineConfigData; | 7 | import com.bsth.data.LineConfigData; |
| 8 | import com.bsth.data.gpsdata.GpsRealData; | 8 | import com.bsth.data.gpsdata.GpsRealData; |
| 9 | import com.bsth.data.gpsdata.recovery.GpsDataRecovery; | 9 | import com.bsth.data.gpsdata.recovery.GpsDataRecovery; |
| 10 | +import com.bsth.data.schedule.f_a_l.FirstAndLastHandler; | ||
| 10 | import com.bsth.entity.realcontrol.LineConfig; | 11 | import com.bsth.entity.realcontrol.LineConfig; |
| 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 12 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 12 | import com.bsth.entity.schedule.SchedulePlanInfo; | 13 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| @@ -176,6 +177,8 @@ public class DayOfSchedule { | @@ -176,6 +177,8 @@ public class DayOfSchedule { | ||
| 176 | //添加到缓存 | 177 | //添加到缓存 |
| 177 | putAll(list); | 178 | putAll(list); |
| 178 | 179 | ||
| 180 | + //标记首末班 | ||
| 181 | + FirstAndLastHandler.marks(list); | ||
| 179 | 182 | ||
| 180 | Set<String> lps = searchAllLP(list); | 183 | Set<String> lps = searchAllLP(list); |
| 181 | for (String lp : lps) { | 184 | for (String lp : lps) { |
src/main/java/com/bsth/data/schedule/f_a_l/FirstAndLastHandler.java
0 → 100644
| 1 | +package com.bsth.data.schedule.f_a_l; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 5 | +import com.bsth.data.schedule.ScheduleComparator; | ||
| 6 | +import com.bsth.data.schedule.f_a_l.entity.ToGateway; | ||
| 7 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 8 | +import com.bsth.util.db.DBUtils_MS; | ||
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.jdbc.core.BatchPreparedStatementSetter; | ||
| 13 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 14 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | ||
| 15 | +import org.springframework.stereotype.Component; | ||
| 16 | +import org.springframework.transaction.TransactionDefinition; | ||
| 17 | +import org.springframework.transaction.TransactionStatus; | ||
| 18 | +import org.springframework.transaction.support.DefaultTransactionDefinition; | ||
| 19 | + | ||
| 20 | +import java.sql.PreparedStatement; | ||
| 21 | +import java.sql.SQLException; | ||
| 22 | +import java.util.ArrayList; | ||
| 23 | +import java.util.Collections; | ||
| 24 | +import java.util.List; | ||
| 25 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 26 | + | ||
| 27 | +/** | ||
| 28 | + * 首末班处理程序 | ||
| 29 | + * Created by panzhao on 2017/7/19. | ||
| 30 | + */ | ||
| 31 | +@Component | ||
| 32 | +public class FirstAndLastHandler { | ||
| 33 | + | ||
| 34 | + static ConcurrentHashMap<String, ToGateway> maps = new ConcurrentHashMap<>(); | ||
| 35 | + | ||
| 36 | + static Logger log = LoggerFactory.getLogger(FirstAndLastHandler.class); | ||
| 37 | + | ||
| 38 | + static boolean flag; | ||
| 39 | + | ||
| 40 | + @Autowired | ||
| 41 | + DayOfSchedule dayOfSchedule; | ||
| 42 | + | ||
| 43 | + public void marks(String lineCode){ | ||
| 44 | + marks(dayOfSchedule.findByLineCode(lineCode)); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 标记首末班 | ||
| 49 | + * @param list | ||
| 50 | + */ | ||
| 51 | + public static void marks(List<ScheduleRealInfo> list){ | ||
| 52 | + try{ | ||
| 53 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | ||
| 54 | + //按上下行分组 | ||
| 55 | + List<ScheduleRealInfo> ups = new ArrayList<>(), | ||
| 56 | + downs = new ArrayList<>(); | ||
| 57 | + | ||
| 58 | + for(ScheduleRealInfo sch : list){ | ||
| 59 | + if(sch.getXlDir().equals("0")) | ||
| 60 | + ups.add(sch); | ||
| 61 | + else | ||
| 62 | + downs.add(sch); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + markOneWay(ups); | ||
| 66 | + markOneWay(downs); | ||
| 67 | + }catch (Exception e){ | ||
| 68 | + log.error("", e); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 标记单程,上行或下行 | ||
| 74 | + * @param list | ||
| 75 | + */ | ||
| 76 | + private static void markOneWay(List<ScheduleRealInfo> list){ | ||
| 77 | + ScheduleRealInfo first = null, last = null; | ||
| 78 | + | ||
| 79 | + for(ScheduleRealInfo sch: list){ | ||
| 80 | + if(sch._isInout() || sch.getBcType().equals("region") | ||
| 81 | + || sch.getBcType().equals("venting")) | ||
| 82 | + continue; | ||
| 83 | + | ||
| 84 | + if(first == null) | ||
| 85 | + first = sch; | ||
| 86 | + | ||
| 87 | + last = sch; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + put(first, last); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + private static void put(ScheduleRealInfo first, ScheduleRealInfo last){ | ||
| 94 | + if(first == null || last == null) | ||
| 95 | + return; | ||
| 96 | + | ||
| 97 | + ToGateway tg = new ToGateway(); | ||
| 98 | + tg.setLineCode(first.getXlBm()); | ||
| 99 | + tg.setUpDown(Integer.parseInt(first.getXlDir())); | ||
| 100 | + tg.setsDeviceId(BasicData.deviceId2NbbmMap.inverse().get(first.getClZbh())); | ||
| 101 | + tg.setSt(first.getDfsjT()); | ||
| 102 | + | ||
| 103 | + tg.setRq(first.getScheduleDateStr()); | ||
| 104 | + | ||
| 105 | + tg.seteDeviceId(BasicData.deviceId2NbbmMap.inverse().get(last.getClZbh())); | ||
| 106 | + tg.setEt(last.getDfsjT()); | ||
| 107 | + | ||
| 108 | + maps.put(tg.getLineCode() + "_" + tg.getUpDown(), tg); | ||
| 109 | + flag = true; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public static void saveAll(){ | ||
| 113 | + if(!flag) | ||
| 114 | + return; | ||
| 115 | + | ||
| 116 | + final List<ToGateway> pstList = new ArrayList<>(maps.values()); | ||
| 117 | + if(pstList == null || pstList.size() == 0) | ||
| 118 | + return; | ||
| 119 | + | ||
| 120 | + flag = false; | ||
| 121 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_MS.getDataSource()); | ||
| 122 | + //编程式事务 | ||
| 123 | + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemp.getDataSource()); | ||
| 124 | + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | ||
| 125 | + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | ||
| 126 | + TransactionStatus status = tran.getTransaction(def); | ||
| 127 | + | ||
| 128 | + try{ | ||
| 129 | + //删除 | ||
| 130 | + jdbcTemp.update("delete from bsth_t_first_last"); | ||
| 131 | + //重新写入 | ||
| 132 | + jdbcTemp.batchUpdate("insert into bsth_t_first_last(line_code, s_device_id, st, e_device_id, et, up_down, rq) VALUES(?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() { | ||
| 133 | + @Override | ||
| 134 | + public void setValues(PreparedStatement ps, int i) throws SQLException { | ||
| 135 | + ToGateway tg = pstList.get(i); | ||
| 136 | + ps.setString(1, tg.getLineCode()); | ||
| 137 | + ps.setString(2, tg.getsDeviceId()); | ||
| 138 | + ps.setLong(3, tg.getSt()); | ||
| 139 | + ps.setString(4, tg.geteDeviceId()); | ||
| 140 | + ps.setLong(5, tg.getEt()); | ||
| 141 | + ps.setInt(6, tg.getUpDown()); | ||
| 142 | + ps.setString(7, tg.getRq()); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + @Override | ||
| 146 | + public int getBatchSize() { | ||
| 147 | + return pstList.size(); | ||
| 148 | + } | ||
| 149 | + }); | ||
| 150 | + | ||
| 151 | + log.info("首末班数据入库," + pstList.size()); | ||
| 152 | + tran.commit(status); | ||
| 153 | + }catch (Exception e){ | ||
| 154 | + log.error("", e); | ||
| 155 | + tran.rollback(status); | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | +} |
src/main/java/com/bsth/data/schedule/f_a_l/entity/ToGateway.java
0 → 100644
| 1 | +package com.bsth.data.schedule.f_a_l.entity; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 发送给网关的首末班数据格式 | ||
| 5 | + * Created by panzhao on 2017/7/19. | ||
| 6 | + */ | ||
| 7 | +public class ToGateway { | ||
| 8 | + | ||
| 9 | + /** 线路 */ | ||
| 10 | + private String lineCode; | ||
| 11 | + | ||
| 12 | + /** 上下行 */ | ||
| 13 | + private int upDown; | ||
| 14 | + | ||
| 15 | + /** 首班设备号 */ | ||
| 16 | + private String sDeviceId; | ||
| 17 | + | ||
| 18 | + /** 首班时间 */ | ||
| 19 | + private Long st; | ||
| 20 | + | ||
| 21 | + /** 末班设备号 */ | ||
| 22 | + private String eDeviceId; | ||
| 23 | + | ||
| 24 | + /** 末班时间 */ | ||
| 25 | + private Long et; | ||
| 26 | + | ||
| 27 | + /** 班次日期 */ | ||
| 28 | + private String rq; | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + public String getLineCode() { | ||
| 32 | + return lineCode; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public void setLineCode(String lineCode) { | ||
| 36 | + this.lineCode = lineCode; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public Long getSt() { | ||
| 40 | + return st; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public void setSt(Long st) { | ||
| 44 | + this.st = st; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public Long getEt() { | ||
| 48 | + return et; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public void setEt(Long et) { | ||
| 52 | + this.et = et; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public String getRq() { | ||
| 56 | + return rq; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public void setRq(String rq) { | ||
| 60 | + this.rq = rq; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public int getUpDown() { | ||
| 64 | + return upDown; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public void setUpDown(int upDown) { | ||
| 68 | + this.upDown = upDown; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public String getsDeviceId() { | ||
| 72 | + return sDeviceId; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public void setsDeviceId(String sDeviceId) { | ||
| 76 | + this.sDeviceId = sDeviceId; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public String geteDeviceId() { | ||
| 80 | + return eDeviceId; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public void seteDeviceId(String eDeviceId) { | ||
| 84 | + this.eDeviceId = eDeviceId; | ||
| 85 | + } | ||
| 86 | +} |
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| @@ -5,6 +5,7 @@ import com.bsth.data.LineConfigData; | @@ -5,6 +5,7 @@ import com.bsth.data.LineConfigData; | ||
| 5 | import com.bsth.data.directive.DayOfDirectives; | 5 | import com.bsth.data.directive.DayOfDirectives; |
| 6 | import com.bsth.data.pilot80.PilotReport; | 6 | import com.bsth.data.pilot80.PilotReport; |
| 7 | import com.bsth.data.schedule.DayOfSchedule; | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| 8 | +import com.bsth.data.schedule.f_a_l.FirstAndLastHandler; | ||
| 8 | import com.bsth.entity.realcontrol.LineConfig; | 9 | import com.bsth.entity.realcontrol.LineConfig; |
| 9 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
| 10 | import org.slf4j.LoggerFactory; | 11 | import org.slf4j.LoggerFactory; |
| @@ -69,7 +70,9 @@ public class ScheduleRefreshThread extends Thread{ | @@ -69,7 +70,9 @@ public class ScheduleRefreshThread extends Thread{ | ||
| 69 | logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size()); | 70 | logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size()); |
| 70 | } | 71 | } |
| 71 | } | 72 | } |
| 72 | - | 73 | + |
| 74 | + //首末班入库(给网关用的数据) | ||
| 75 | + FirstAndLastHandler.saveAll(); | ||
| 73 | } catch (Exception e) { | 76 | } catch (Exception e) { |
| 74 | logger.error("", e); | 77 | logger.error("", e); |
| 75 | } | 78 | } |
src/main/java/com/bsth/entity/SectionRouteCache.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 | + * @Data :2016-04-21 | ||
| 24 | + * | ||
| 25 | + * @Version 公交调度系统BS版 0.1 | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | + | ||
| 29 | +@Entity | ||
| 30 | +@Table(name = "bsth_c_sectionroute_cache") | ||
| 31 | +public class SectionRouteCache { | ||
| 32 | + | ||
| 33 | + @Id | ||
| 34 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 35 | + private Integer id; | ||
| 36 | + | ||
| 37 | + // 路段路由序号 | ||
| 38 | + private Integer sectionrouteCode; | ||
| 39 | + | ||
| 40 | + // 线路编号 | ||
| 41 | + private String lineCode; | ||
| 42 | + | ||
| 43 | + // 路段编号 | ||
| 44 | + private String sectionCode; | ||
| 45 | + | ||
| 46 | + // 路段路由方向 | ||
| 47 | + private Integer directions; | ||
| 48 | + | ||
| 49 | + // 版本号 | ||
| 50 | + private Integer versions; | ||
| 51 | + | ||
| 52 | + // 是否撤销 | ||
| 53 | + private Integer destroy; | ||
| 54 | + | ||
| 55 | + /** 是否有路段限速数据 <0:分段;1:未分段>*/ | ||
| 56 | + private Integer isRoadeSpeed; | ||
| 57 | + | ||
| 58 | + // 描述 | ||
| 59 | + private String descriptions; | ||
| 60 | + | ||
| 61 | + // 创建人 | ||
| 62 | + private Integer createBy; | ||
| 63 | + | ||
| 64 | + // 修改人 | ||
| 65 | + private Integer updateBy; | ||
| 66 | + | ||
| 67 | + // 创建日期 | ||
| 68 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 69 | + private Date createDate; | ||
| 70 | + | ||
| 71 | + // 修改日期 | ||
| 72 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
| 73 | + private Date updateDate; | ||
| 74 | + | ||
| 75 | + // 路段信息 | ||
| 76 | + @OneToOne | ||
| 77 | + private Section section; | ||
| 78 | + | ||
| 79 | + // 线路信息 | ||
| 80 | + @ManyToOne | ||
| 81 | + private Line line; | ||
| 82 | + | ||
| 83 | + public Integer getIsRoadeSpeed() { | ||
| 84 | + return isRoadeSpeed; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void setIsRoadeSpeed(Integer isRoadeSpeed) { | ||
| 88 | + this.isRoadeSpeed = isRoadeSpeed; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public Integer getId() { | ||
| 92 | + return id; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void setId(Integer id) { | ||
| 96 | + this.id = id; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public Integer getSectionrouteCode() { | ||
| 100 | + return sectionrouteCode; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void setSectionrouteCode(Integer sectionrouteCode) { | ||
| 104 | + this.sectionrouteCode = sectionrouteCode; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public String getLineCode() { | ||
| 108 | + return lineCode; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public void setLineCode(String lineCode) { | ||
| 112 | + this.lineCode = lineCode; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public String getSectionCode() { | ||
| 116 | + return sectionCode; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public void setSectionCode(String sectionCode) { | ||
| 120 | + this.sectionCode = sectionCode; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public Integer getDirections() { | ||
| 124 | + return directions; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public void setDirections(Integer directions) { | ||
| 128 | + this.directions = directions; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public Integer getVersions() { | ||
| 132 | + return versions; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public void setVersions(Integer versions) { | ||
| 136 | + this.versions = versions; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public Integer getDestroy() { | ||
| 140 | + return destroy; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public void setDestroy(Integer destroy) { | ||
| 144 | + this.destroy = destroy; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public String getDescriptions() { | ||
| 148 | + return descriptions; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public void setDescriptions(String descriptions) { | ||
| 152 | + this.descriptions = descriptions; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public Integer getCreateBy() { | ||
| 156 | + return createBy; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public void setCreateBy(Integer createBy) { | ||
| 160 | + this.createBy = createBy; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public Integer getUpdateBy() { | ||
| 164 | + return updateBy; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public void setUpdateBy(Integer updateBy) { | ||
| 168 | + this.updateBy = updateBy; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public Date getCreateDate() { | ||
| 172 | + return createDate; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public void setCreateDate(Date createDate) { | ||
| 176 | + this.createDate = createDate; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public Date getUpdateDate() { | ||
| 180 | + return updateDate; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public void setUpdateDate(Date updateDate) { | ||
| 184 | + this.updateDate = updateDate; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public Section getSection() { | ||
| 188 | + return section; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public void setSection(Section section) { | ||
| 192 | + this.section = section; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + public Line getLine() { | ||
| 196 | + return line; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + public void setLine(Line line) { | ||
| 200 | + this.line = line; | ||
| 201 | + } | ||
| 202 | +} |
src/main/java/com/bsth/entity/StationRouteCache.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | + | ||
| 3 | +import javax.persistence.*; | ||
| 4 | + | ||
| 5 | +import java.util.Date; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * | ||
| 9 | + * @ClassName : StationRouteCache(站点路由缓存实体类) | ||
| 10 | + * | ||
| 11 | + * @Author : bsth@lq | ||
| 12 | + * | ||
| 13 | + * @Description : TODO(站点路由) | ||
| 14 | + * | ||
| 15 | + * @Data :2016-04-19 | ||
| 16 | + * | ||
| 17 | + * @Version 公交调度系统BS版 0.1 | ||
| 18 | + * | ||
| 19 | + */ | ||
| 20 | + | ||
| 21 | +@Entity | ||
| 22 | +@Table(name = "bsth_c_stationroute_cache") | ||
| 23 | +@NamedEntityGraphs({ | ||
| 24 | + @NamedEntityGraph(name = "stationRoute_station_cache", attributeNodes = { | ||
| 25 | + @NamedAttributeNode("station"), | ||
| 26 | + @NamedAttributeNode("line") | ||
| 27 | + }) | ||
| 28 | +}) | ||
| 29 | +public class StationRouteCache { | ||
| 30 | + | ||
| 31 | + //站点路由ID | ||
| 32 | + @Id | ||
| 33 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 34 | + private Integer id; | ||
| 35 | + | ||
| 36 | + // 站点路由序号 | ||
| 37 | + private Integer stationRouteCode; | ||
| 38 | + | ||
| 39 | + // 站点编码 | ||
| 40 | + private String stationCode; | ||
| 41 | + | ||
| 42 | + // 站点名称 | ||
| 43 | + private String stationName; | ||
| 44 | + | ||
| 45 | + // 线路编码 | ||
| 46 | + private String lineCode; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 站点类型 | ||
| 50 | + * | ||
| 51 | + * ------ B:起点站 | ||
| 52 | + * | ||
| 53 | + * ------ Z:中途站 | ||
| 54 | + * | ||
| 55 | + * ------ E:终点站 | ||
| 56 | + * | ||
| 57 | + * ------ T:停车场 | ||
| 58 | + * | ||
| 59 | + */ | ||
| 60 | + private String stationMark; | ||
| 61 | + | ||
| 62 | + // 站点路由出站序号 | ||
| 63 | + private Integer outStationNmber; | ||
| 64 | + | ||
| 65 | + // 站点路由到站距离 | ||
| 66 | + private Double distances; | ||
| 67 | + | ||
| 68 | + // 站点路由到站时间 | ||
| 69 | + private Double toTime; | ||
| 70 | + | ||
| 71 | + // 首班时间 | ||
| 72 | + private String firstTime; | ||
| 73 | + | ||
| 74 | + // 末班时间 | ||
| 75 | + private String endTime; | ||
| 76 | + | ||
| 77 | + // 站点路由方向 | ||
| 78 | + private Integer directions; | ||
| 79 | + | ||
| 80 | + // 版本号 | ||
| 81 | + private Integer versions; | ||
| 82 | + | ||
| 83 | + // 是否撤销 | ||
| 84 | + private Integer destroy; | ||
| 85 | + | ||
| 86 | + // 描述 | ||
| 87 | + private String descriptions; | ||
| 88 | + | ||
| 89 | + // 创建人 | ||
| 90 | + private Integer createBy; | ||
| 91 | + | ||
| 92 | + // 修改人 | ||
| 93 | + private Integer updateBy; | ||
| 94 | + | ||
| 95 | + // 创建日期 | ||
| 96 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 97 | + private Date createDate; | ||
| 98 | + | ||
| 99 | + // 修改日期 | ||
| 100 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
| 101 | + private Date updateDate; | ||
| 102 | + | ||
| 103 | + // 站点信息 | ||
| 104 | + @ManyToOne(fetch = FetchType.LAZY) | ||
| 105 | + private Station station; | ||
| 106 | + | ||
| 107 | + // 线路信息 | ||
| 108 | + @ManyToOne | ||
| 109 | + private Line line; | ||
| 110 | + | ||
| 111 | + public Integer getId() { | ||
| 112 | + return id; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public void setId(Integer id) { | ||
| 116 | + this.id = id; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public Integer getStationRouteCode() { | ||
| 120 | + return stationRouteCode; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public void setStationRouteCode(Integer stationRouteCode) { | ||
| 124 | + this.stationRouteCode = stationRouteCode; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public String getStationCode() { | ||
| 128 | + return stationCode; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public void setStationCode(String stationCode) { | ||
| 132 | + this.stationCode = stationCode; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public String getStationName() { | ||
| 136 | + return stationName; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public void setStationName(String stationName) { | ||
| 140 | + this.stationName = stationName; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public String getLineCode() { | ||
| 144 | + return lineCode; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public void setLineCode(String lineCode) { | ||
| 148 | + this.lineCode = lineCode; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public String getStationMark() { | ||
| 152 | + return stationMark; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public void setStationMark(String stationMark) { | ||
| 156 | + this.stationMark = stationMark; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public Integer getOutStationNmber() { | ||
| 160 | + return outStationNmber; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public void setOutStationNmber(Integer outStationNmber) { | ||
| 164 | + this.outStationNmber = outStationNmber; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public Double getDistances() { | ||
| 168 | + return distances; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public void setDistances(Double distances) { | ||
| 172 | + this.distances = distances; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public Double getToTime() { | ||
| 176 | + return toTime; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public void setToTime(Double toTime) { | ||
| 180 | + this.toTime = toTime; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public String getFirstTime() { | ||
| 184 | + return firstTime; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public void setFirstTime(String firstTime) { | ||
| 188 | + this.firstTime = firstTime; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public String getEndTime() { | ||
| 192 | + return endTime; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + public void setEndTime(String endTime) { | ||
| 196 | + this.endTime = endTime; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + public Integer getDirections() { | ||
| 200 | + return directions; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + public void setDirections(Integer directions) { | ||
| 204 | + this.directions = directions; | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + public Integer getVersions() { | ||
| 208 | + return versions; | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + public void setVersions(Integer versions) { | ||
| 212 | + this.versions = versions; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + public Integer getDestroy() { | ||
| 216 | + return destroy; | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + public void setDestroy(Integer destroy) { | ||
| 220 | + this.destroy = destroy; | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + public String getDescriptions() { | ||
| 224 | + return descriptions; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + public void setDescriptions(String descriptions) { | ||
| 228 | + this.descriptions = descriptions; | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + public Integer getCreateBy() { | ||
| 232 | + return createBy; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + public void setCreateBy(Integer createBy) { | ||
| 236 | + this.createBy = createBy; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + public Integer getUpdateBy() { | ||
| 240 | + return updateBy; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + public void setUpdateBy(Integer updateBy) { | ||
| 244 | + this.updateBy = updateBy; | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + public Date getCreateDate() { | ||
| 248 | + return createDate; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + public void setCreateDate(Date createDate) { | ||
| 252 | + this.createDate = createDate; | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + public Date getUpdateDate() { | ||
| 256 | + return updateDate; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + public void setUpdateDate(Date updateDate) { | ||
| 260 | + this.updateDate = updateDate; | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + public Station getStation() { | ||
| 264 | + return station; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + public void setStation(Station station) { | ||
| 268 | + this.station = station; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + public Line getLine() { | ||
| 272 | + return line; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + public void setLine(Line line) { | ||
| 276 | + this.line = line; | ||
| 277 | + } | ||
| 278 | +} | ||
| 0 | \ No newline at end of file | 279 | \ No newline at end of file |
src/main/java/com/bsth/repository/SectionRouteCacheRepository.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 | +import org.springframework.transaction.annotation.Transactional; | ||
| 9 | + | ||
| 10 | +import com.bsth.entity.SectionRoute; | ||
| 11 | +import com.bsth.entity.SectionRouteCache; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * | ||
| 15 | + * @Interface: SectionRouteRepository(路段路由Repository数据持久层接口) | ||
| 16 | + * | ||
| 17 | + * @Extends : BaseRepository | ||
| 18 | + * | ||
| 19 | + * @Description: TODO(路段路由Repository数据持久层接口) | ||
| 20 | + * | ||
| 21 | + * @Author bsth@lq | ||
| 22 | + * | ||
| 23 | + * @Date 2016年05月03日 上午9:21:17 | ||
| 24 | + * | ||
| 25 | + * @Version 公交调度系统BS版 0.1 | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | + | ||
| 29 | +@Repository | ||
| 30 | +public interface SectionRouteCacheRepository extends BaseRepository<SectionRouteCache, Integer> { | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * @Description :TODO(查询路段信息) | ||
| 34 | + * | ||
| 35 | + * @param map <lineId:线路ID; directions:方向> | ||
| 36 | + * | ||
| 37 | + * @return List<Object[]> | ||
| 38 | + */ | ||
| 39 | + @Query(value ="SELECT a.sectionrouteId," + | ||
| 40 | + "a.sectionrouteLine," + | ||
| 41 | + " a.sectionrouteLineCode," + | ||
| 42 | + " a.sectionrouteSection," + | ||
| 43 | + " a.sectionrouteSectionCode," + | ||
| 44 | + " a.sectionrouteCode," + | ||
| 45 | + " a.sectionrouteDirections," + | ||
| 46 | + " b.id AS sectionId," + | ||
| 47 | + " b.section_code AS sectionCode," + | ||
| 48 | + " b.section_name AS sectionName," + | ||
| 49 | + " b.croses_road AS sectionRoad," + | ||
| 50 | + " b.end_node AS sectionEndNode," + | ||
| 51 | + " b.start_node AS sectionStartNode," + | ||
| 52 | + " b.middle_node AS sectionMiddleNode," + | ||
| 53 | + " b.section_type AS sectionType," + | ||
| 54 | + " b.csection_vector AS sectionCsectionVector," + | ||
| 55 | + " ST_AsText(b.bsection_vector) AS sectionBsectionVector," + | ||
| 56 | + " ST_AsText(b.gsection_vector) AS sectionGsectionVector," + | ||
| 57 | + " b.road_coding AS sectionRoadCoding," + | ||
| 58 | + " b.section_distance AS sectionDistance," + | ||
| 59 | + " b.section_time AS sectionTime," + | ||
| 60 | + " b.db_type AS sectiondbType," + | ||
| 61 | + " b.speed_limit AS sectionSpeedLimet ,a.destroy,a.versions,a.descriptions,a.isRoadeSpeed FROM (" + | ||
| 62 | + "SELECT r.id AS sectionrouteId," + | ||
| 63 | + "r.line AS sectionrouteLine," + | ||
| 64 | + "r.line_code AS sectionrouteLineCode," + | ||
| 65 | + "r.section AS sectionrouteSection," + | ||
| 66 | + "r.section_code AS sectionrouteSectionCode," + | ||
| 67 | + "r.sectionroute_code AS sectionrouteCode," + | ||
| 68 | + "r.directions AS sectionrouteDirections," + | ||
| 69 | + "r.destroy AS destroy," + | ||
| 70 | + "r.versions AS versions," + | ||
| 71 | + "r.descriptions AS descriptions, r.is_roade_speed AS isRoadeSpeed" + | ||
| 72 | + " FROM bsth_c_sectionroute_cache r where r.line = ?1 and r.directions = ?2 and r.destroy=0 ) a " + | ||
| 73 | + " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true) | ||
| 74 | + List<Object[]> getSectionRouteCache(int lineId, int directions); | ||
| 75 | + | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * @Description :TODO(查询路段信息) | ||
| 79 | + * | ||
| 80 | + * @param map <id:路段路由ID> | ||
| 81 | + * | ||
| 82 | + * @return List<Object[]> | ||
| 83 | + */ | ||
| 84 | + @Query(value ="SELECT a.sectionRouteId," + | ||
| 85 | + "a.sectionRouteLineCode," + | ||
| 86 | + "a.sectionRouteCode," + | ||
| 87 | + "a.sectionRouteDirections," + | ||
| 88 | + "a.sectionRouteLine," + | ||
| 89 | + "a.sectionRouteSection," + | ||
| 90 | + "a.sectionRouteDescriptions," + | ||
| 91 | + "a.sectionRouteCreateBy," + | ||
| 92 | + "a.sectionRouteCreateDate," + | ||
| 93 | + "a.sectionRouteUpdateBy," + | ||
| 94 | + "a.sectionRouteUpdateDate," + | ||
| 95 | + "a.sectionRouteVersions," + | ||
| 96 | + "a.sectionRouteDestroy," + | ||
| 97 | + "b.id AS sectionId," + | ||
| 98 | + "b.section_code AS sectionCode," + | ||
| 99 | + "b.section_name AS sectionName," + | ||
| 100 | + "b.road_coding AS sectionRoadCoding," + | ||
| 101 | + "b.end_node AS sectionEndCode," + | ||
| 102 | + "b.start_node AS sectionStartNode," + | ||
| 103 | + "b.middle_node AS sectionMiddleNode," + | ||
| 104 | + "b.section_type AS sectionType," + | ||
| 105 | + "ST_AsText(b.csection_vector) AS sectionCsectionVector," + | ||
| 106 | + "ST_AsText(b.bsection_vector) AS sectionBsectionVector," + | ||
| 107 | + "ST_AsText(b.gsection_vector) AS sectionGsectionVector," + | ||
| 108 | + "b.section_distance AS sectionDistance," + | ||
| 109 | + "b.section_time AS sectionTime," + | ||
| 110 | + "b.db_type AS sectionDbtype," + | ||
| 111 | + "b.speed_limit AS sectionSpeedLimit," + | ||
| 112 | + "b.descriptions AS sectionDescriptions," + | ||
| 113 | + "b.create_by AS sectionCreateBy," + | ||
| 114 | + "b.create_date AS sectionCreateDate," + | ||
| 115 | + "b.update_by AS sectionUpdateBy," + | ||
| 116 | + "b.update_date AS sectionUpdateDate," + | ||
| 117 | + "b.versions AS sectionVersion , a.isRoadeSpeed FROM (" + | ||
| 118 | + " SELECT s.id AS sectionRouteId," + | ||
| 119 | + "s.line_code AS sectionRouteLineCode," + | ||
| 120 | + "s.sectionroute_code AS sectionRouteCode," + | ||
| 121 | + "s.directions AS sectionRouteDirections," + | ||
| 122 | + "s.line AS sectionRouteLine," + | ||
| 123 | + "s.section AS sectionRouteSection," + | ||
| 124 | + "s.descriptions AS sectionRouteDescriptions," + | ||
| 125 | + "s.create_by AS sectionRouteCreateBy," + | ||
| 126 | + "s.create_date AS sectionRouteCreateDate," + | ||
| 127 | + "s.update_by AS sectionRouteUpdateBy," + | ||
| 128 | + "s.update_date AS sectionRouteUpdateDate," + | ||
| 129 | + "s.versions AS sectionRouteVersions," + | ||
| 130 | + "s.destroy AS sectionRouteDestroy, s.is_roade_speed AS isRoadeSpeed " + | ||
| 131 | + " FROM bsth_c_sectionroute s where s.id =?1) a " + | ||
| 132 | + " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true) | ||
| 133 | + List<Object[]> findSectionRouteInfoFormId(int id); | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * 更新路线删除线路缓存路段 | ||
| 137 | + * | ||
| 138 | + * @param line | ||
| 139 | + * @param dir | ||
| 140 | + */ | ||
| 141 | + @Modifying | ||
| 142 | + @Query(value="delete from bsth_c_sectionroute_cache where line = ?1 and directions = ?2", nativeQuery=true) | ||
| 143 | + public void sectionRouteCacheDel(Integer line,Integer dir); | ||
| 144 | +} |
src/main/java/com/bsth/repository/SectionRouteRepository.java
| @@ -177,7 +177,17 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -177,7 +177,17 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 177 | 177 | ||
| 178 | @Modifying | 178 | @Modifying |
| 179 | @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true) | 179 | @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true) |
| 180 | - public void sectionRouteIsDestroyUpdBatch(Integer ids); | 180 | + public void sectionRouteIsDestroyUpdBatch(Integer id); |
| 181 | + | ||
| 182 | + /** | ||
| 183 | + * 更新路线前撤销线路原有路段 | ||
| 184 | + * | ||
| 185 | + * @param line | ||
| 186 | + * @param dir | ||
| 187 | + */ | ||
| 188 | + @Modifying | ||
| 189 | + @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where line = ?1 and directions = ?2", nativeQuery=true) | ||
| 190 | + public void sectionRouteUpdDestroy(Integer line,Integer dir); | ||
| 181 | 191 | ||
| 182 | @Modifying | 192 | @Modifying |
| 183 | @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) | 193 | @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) |
src/main/java/com/bsth/repository/StationRepository.java
| @@ -40,17 +40,10 @@ public interface StationRepository extends BaseRepository<Station, Integer> { | @@ -40,17 +40,10 @@ public interface StationRepository extends BaseRepository<Station, Integer> { | ||
| 40 | /*@Query(value = "SELECT s.b_jwpoints,s.id FROM bsth_c_station s where s.station_name like ?1" | 40 | /*@Query(value = "SELECT s.b_jwpoints,s.id FROM bsth_c_station s where s.station_name like ?1" |
| 41 | , nativeQuery=true) | 41 | , nativeQuery=true) |
| 42 | List<Object[]> findStationName(String stationName);*/ | 42 | List<Object[]> findStationName(String stationName);*/ |
| 43 | - /*@Query(value = " SELECT t.b_jwpoints,t.id FROM (" + | ||
| 44 | - " SELECT b.id,b.b_jwpoints,b.station_name,a.directions FROM (" + | ||
| 45 | - " SELECT s.station,s.station_name,s.directions FROM bsth_c_stationroute s where s.destroy = 0 and s.directions = ?1) a " + | ||
| 46 | - " LEFT JOIN bsth_c_station b on a.station = b. id) t where t.station_name LIKE ?2" | ||
| 47 | - , nativeQuery=true)*/ | ||
| 48 | @Query(value = " SELECT t.b_jwpoints,t.id FROM (" + | 43 | @Query(value = " SELECT t.b_jwpoints,t.id FROM (" + |
| 49 | " SELECT b.id,b.b_jwpoints,b.station_name,a.directions FROM (" + | 44 | " SELECT b.id,b.b_jwpoints,b.station_name,a.directions FROM (" + |
| 50 | " SELECT s.station,s.station_name,s.directions FROM bsth_c_stationroute s where s.destroy = 0 and s.directions = ?1) a " + | 45 | " SELECT s.station,s.station_name,s.directions FROM bsth_c_stationroute s where s.destroy = 0 and s.directions = ?1) a " + |
| 51 | - " LEFT JOIN " + | ||
| 52 | - " (SELECT r.id,r.b_jwpoints,r.station_name from bsth_c_station r where r.destroy = 0 and r.station_name LIKE ?2 ) " + | ||
| 53 | - " b on a.station = b. id) t where t.station_name LIKE ?2 " | 46 | + " LEFT JOIN bsth_c_station b on a.station = b. id) t where t.station_name LIKE ?2" |
| 54 | , nativeQuery=true) | 47 | , nativeQuery=true) |
| 55 | List<Object[]> findStationName(Integer dir , String stationName); | 48 | List<Object[]> findStationName(Integer dir , String stationName); |
| 56 | 49 | ||
| @@ -108,24 +101,18 @@ public interface StationRepository extends BaseRepository<Station, Integer> { | @@ -108,24 +101,18 @@ public interface StationRepository extends BaseRepository<Station, Integer> { | ||
| 108 | "y = ?9 , " + | 101 | "y = ?9 , " + |
| 109 | "b_polygon_grid = ST_GeomFromText(?10) , " + | 102 | "b_polygon_grid = ST_GeomFromText(?10) , " + |
| 110 | "g_polygon_grid = ST_GeomFromText(?11) , " + | 103 | "g_polygon_grid = ST_GeomFromText(?11) , " + |
| 111 | - /*"destroy = ?12 , " +*/ | ||
| 112 | - "radius = ?12 , " + | ||
| 113 | - "shapes_type = ?13 , " + | ||
| 114 | - "versions = ?14 , " + | ||
| 115 | - "descriptions = ?15 " + | ||
| 116 | - " WHERE id = ?16 ", nativeQuery=true) | 104 | + "destroy = ?12 , " + |
| 105 | + "radius = ?13 , " + | ||
| 106 | + "shapes_type = ?14 , " + | ||
| 107 | + "versions = ?15 , " + | ||
| 108 | + "descriptions = ?16 " + | ||
| 109 | + " WHERE id = ?17 ", nativeQuery=true) | ||
| 117 | public void stationUpdate(String stationCod,String stationName,String roadCoding,String dbType,String bJwpoints, | 110 | public void stationUpdate(String stationCod,String stationName,String roadCoding,String dbType,String bJwpoints, |
| 118 | - | ||
| 119 | - Float gLonx,Float gLaty,Float x,Float y, String bPolygonGrid,String gPolygonGrid, | ||
| 120 | - | ||
| 121 | - Integer radius,String shapesType, Integer versions,String descriptions,Integer stationId); | ||
| 122 | - | ||
| 123 | - /*public void stationUpdate(String stationCod,String stationName,String roadCoding,String dbType,String bJwpoints, | ||
| 124 | 111 | ||
| 125 | Float gLonx,Float gLaty,Float x,Float y, String bPolygonGrid,String gPolygonGrid, | 112 | Float gLonx,Float gLaty,Float x,Float y, String bPolygonGrid,String gPolygonGrid, |
| 126 | 113 | ||
| 127 | Integer destroy, Integer radius,String shapesType, Integer versions,String descriptions,Integer stationId); | 114 | Integer destroy, Integer radius,String shapesType, Integer versions,String descriptions,Integer stationId); |
| 128 | - */ | 115 | + |
| 129 | 116 | ||
| 130 | @Query(value = "select st_astext(g_polygon_grid) as g_polygon_grid, shapes_type,concat(g_lonx, ' ', g_laty) as g_center_point ,radius, station_cod,station_name from bsth_c_station where station_cod=?1", nativeQuery = true) | 117 | @Query(value = "select st_astext(g_polygon_grid) as g_polygon_grid, shapes_type,concat(g_lonx, ' ', g_laty) as g_center_point ,radius, station_cod,station_name from bsth_c_station where station_cod=?1", nativeQuery = true) |
| 131 | public Object[][] bufferAera(String stationCode); | 118 | public Object[][] bufferAera(String stationCode); |
src/main/java/com/bsth/repository/StationRouteCacheRepository.java
0 → 100644
| 1 | +package com.bsth.repository; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.data.domain.Page; | ||
| 7 | +import org.springframework.data.domain.Pageable; | ||
| 8 | +import org.springframework.data.domain.Sort; | ||
| 9 | +import org.springframework.data.jpa.domain.Specification; | ||
| 10 | +import org.springframework.data.jpa.repository.EntityGraph; | ||
| 11 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 12 | +import org.springframework.data.jpa.repository.Query; | ||
| 13 | +import org.springframework.stereotype.Repository; | ||
| 14 | +import org.springframework.transaction.annotation.Transactional; | ||
| 15 | + | ||
| 16 | +import com.bsth.entity.Line; | ||
| 17 | +import com.bsth.entity.StationRoute; | ||
| 18 | +import com.bsth.entity.StationRouteCache; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * | ||
| 22 | + * @Interface: StationRouteRepository(站点路由Repository数据持久层接口) | ||
| 23 | + * | ||
| 24 | + * @Extends : BaseRepository | ||
| 25 | + * | ||
| 26 | + * @Description: TODO(站点路由Repository数据持久层接口) | ||
| 27 | + * | ||
| 28 | + * @Author bsth@lq | ||
| 29 | + * | ||
| 30 | + * @Date 2016年5月03日 上午9:21:17 | ||
| 31 | + * | ||
| 32 | + * @Version 公交调度系统BS版 0.1 | ||
| 33 | + * | ||
| 34 | + */ | ||
| 35 | + | ||
| 36 | +@Repository | ||
| 37 | +public interface StationRouteCacheRepository extends BaseRepository<StationRouteCache, Integer> { | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * @Description :TODO(站点中心点坐标查询) | ||
| 41 | + * | ||
| 42 | + * @param map <lineId:线路ID; direction:方向> | ||
| 43 | + * | ||
| 44 | + * @return List<Object[]> | ||
| 45 | + */ | ||
| 46 | + /*@Query(value = "SELECT s.b_jwpoints,s.station_name FROM (" + | ||
| 47 | + "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + | ||
| 48 | + "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true)*/ | ||
| 49 | + @Query(value = "SELECT s.b_jwpoints,r.station_name,r.station_route_code FROM (" + | ||
| 50 | + "SELECT b.station,b.station_route_code,b.station_name FROM bsth_c_stationroute_cache b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + | ||
| 51 | + "LEFT JOIN bsth_c_station s on r.station = s.id order by r.station_route_code asc", nativeQuery=true) | ||
| 52 | + List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 查询站点路由 | ||
| 56 | + */ | ||
| 57 | + @Query("select r from StationRouteCache r where r.lineCode=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") | ||
| 58 | + public List<StationRouteCache> findstationRoute(String lineCode,Integer dir); | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 更新路线删除线路缓存站点 | ||
| 62 | + * | ||
| 63 | + * @param line | ||
| 64 | + * @param dir | ||
| 65 | + */ | ||
| 66 | + @Modifying | ||
| 67 | + @Query(value="delete from bsth_c_stationroute_cache where line = ?1 and directions = ?2 ", nativeQuery=true) | ||
| 68 | + public void stationRouteCacheDel(Integer line,Integer dir); | ||
| 69 | + | ||
| 70 | +} |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -266,6 +266,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -266,6 +266,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 266 | "StationRoute s " + | 266 | "StationRoute s " + |
| 267 | "WHERE " + | 267 | "WHERE " + |
| 268 | "s.destroy = 0 " + | 268 | "s.destroy = 0 " + |
| 269 | + "and s.lineCode in(select lineCode from Line where inUse = 1) " + | ||
| 269 | "ORDER BY " + | 270 | "ORDER BY " + |
| 270 | "lineCode,directions,stationRouteCode") | 271 | "lineCode,directions,stationRouteCode") |
| 271 | List<Map<String, String>> findAllLineWithYgc(); | 272 | List<Map<String, String>> findAllLineWithYgc(); |
| @@ -282,7 +283,27 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -282,7 +283,27 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 282 | @Query(value="UPDATE bsth_c_stationroute set station_route_code = (station_route_code+10) where line = ?1 and directions = ?2 and station_route_code >=?3 and destroy = 0", nativeQuery=true) | 283 | @Query(value="UPDATE bsth_c_stationroute set station_route_code = (station_route_code+10) where line = ?1 and directions = ?2 and station_route_code >=?3 and destroy = 0", nativeQuery=true) |
| 283 | public void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod); | 284 | public void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod); |
| 284 | 285 | ||
| 286 | + /** | ||
| 287 | + * 更新路线前撤销线路原有站点 | ||
| 288 | + * | ||
| 289 | + * @param line | ||
| 290 | + * @param dir | ||
| 291 | + */ | ||
| 292 | + @Modifying | ||
| 293 | + @Query(value="UPDATE bsth_c_stationroute set destroy = 1 where line = ?1 and directions = ?2", nativeQuery=true) | ||
| 294 | + public void stationRouteUpdDestroy(Integer line,Integer dir); | ||
| 295 | + | ||
| 285 | @Modifying | 296 | @Modifying |
| 286 | @Query(value="UPDATE bsth_c_stationroute set destroy = 1 where id = ?1", nativeQuery=true) | 297 | @Query(value="UPDATE bsth_c_stationroute set destroy = 1 where id = ?1", nativeQuery=true) |
| 287 | public void stationRouteIsDestroyUpdBatch(Integer ids); | 298 | public void stationRouteIsDestroyUpdBatch(Integer ids); |
| 299 | + | ||
| 300 | + /** | ||
| 301 | + * 更新路线前撤销线路原有站点 | ||
| 302 | + * | ||
| 303 | + * @param line | ||
| 304 | + * @param dir | ||
| 305 | + */ | ||
| 306 | + @Modifying | ||
| 307 | + @Query(value="insert into (select * from bsth_c_stationroute_cache where line = ?1 and directions = ?2) bsth_c_stationroute", nativeQuery=true) | ||
| 308 | + public void stationRouteUpdate(Integer line,Integer dir); | ||
| 288 | } | 309 | } |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -147,16 +147,20 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -147,16 +147,20 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 147 | List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); | 147 | List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); |
| 148 | 148 | ||
| 149 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 149 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 150 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)") | ||
| 151 | + List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date); | ||
| 152 | + | ||
| 153 | + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | ||
| 150 | @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)") | 154 | @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)") |
| 151 | List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date); | 155 | List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date); |
| 152 | 156 | ||
| 153 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 157 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 154 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm,s.adjustExps,s.fcsj") | 158 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm,s.adjustExps,s.fcsj") |
| 155 | List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date); | 159 | List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date); |
| 156 | 160 | ||
| 157 | //按月统计 | 161 | //按月统计 |
| 158 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 162 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 159 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out') order by s.xlBm") | 163 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm") |
| 160 | List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date); | 164 | List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date); |
| 161 | 165 | ||
| 162 | //按照时间段统计 | 166 | //按照时间段统计 |
src/main/java/com/bsth/service/SectionRouteService.java
| @@ -32,6 +32,8 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> | @@ -32,6 +32,8 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> | ||
| 32 | 32 | ||
| 33 | List<Map<String, Object>> getSectionRoute(Map<String, Object> map); | 33 | List<Map<String, Object>> getSectionRoute(Map<String, Object> map); |
| 34 | 34 | ||
| 35 | + List<Map<String, Object>> getSectionRouteCache(Map<String, Object> map); | ||
| 36 | + | ||
| 35 | /** | 37 | /** |
| 36 | * @Description : TODO(根据路段路由Id批量撤销路段) | 38 | * @Description : TODO(根据路段路由Id批量撤销路段) |
| 37 | * | 39 | * |
| @@ -60,4 +62,5 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> | @@ -60,4 +62,5 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> | ||
| 60 | List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map); | 62 | List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map); |
| 61 | 63 | ||
| 62 | Map<String, Object> quoteSection(Map<String, Object> map); | 64 | Map<String, Object> quoteSection(Map<String, Object> map); |
| 65 | + | ||
| 63 | } | 66 | } |
src/main/java/com/bsth/service/SectionService.java
| @@ -31,4 +31,8 @@ public interface SectionService extends BaseService<Section, Integer> { | @@ -31,4 +31,8 @@ public interface SectionService extends BaseService<Section, Integer> { | ||
| 31 | Map<String, Object> sectionUpdate(Map<String, Object> map); | 31 | Map<String, Object> sectionUpdate(Map<String, Object> map); |
| 32 | 32 | ||
| 33 | Map<String, Object> sectionSave(Map<String, Object> map); | 33 | Map<String, Object> sectionSave(Map<String, Object> map); |
| 34 | + | ||
| 35 | + Map<String, Object> sectionCut(Map<String, Object> map); | ||
| 36 | + | ||
| 37 | + Map<String, Object> sectionCacheUpdate(Map<String, Object> map); | ||
| 34 | } | 38 | } |
src/main/java/com/bsth/service/StationRouteService.java
| @@ -77,6 +77,9 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | @@ -77,6 +77,9 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | ||
| 77 | */ | 77 | */ |
| 78 | Map<String, Object> stationRouteIsDestroy(Map<String, Object> map); | 78 | Map<String, Object> stationRouteIsDestroy(Map<String, Object> map); |
| 79 | 79 | ||
| 80 | + | ||
| 81 | + List<Map<String, Object>> getStationRouteCacheCenterPoints(Map<String, Object> map); | ||
| 82 | + | ||
| 80 | /** | 83 | /** |
| 81 | * @Description : TODO(根据线路ID生成行单) | 84 | * @Description : TODO(根据线路ID生成行单) |
| 82 | * | 85 | * |
| @@ -102,4 +105,5 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | @@ -102,4 +105,5 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | ||
| 102 | 105 | ||
| 103 | Map<String, Object> upddis(Map<String, Object> map); | 106 | Map<String, Object> upddis(Map<String, Object> map); |
| 104 | 107 | ||
| 108 | + | ||
| 105 | } | 109 | } |
src/main/java/com/bsth/service/StationService.java
| @@ -69,4 +69,17 @@ public interface StationService extends BaseService<Station, Integer> { | @@ -69,4 +69,17 @@ public interface StationService extends BaseService<Station, Integer> { | ||
| 69 | */ | 69 | */ |
| 70 | Map<String, Object> stationUpdate(Map<String, Object> map); | 70 | Map<String, Object> stationUpdate(Map<String, Object> map); |
| 71 | 71 | ||
| 72 | + /** | ||
| 73 | + * @Description :TODO(根据坐标点匹配数据库中的站点) | ||
| 74 | + * | ||
| 75 | + * @param map: <point:坐标点; name:站点名> | ||
| 76 | + * | ||
| 77 | + */ | ||
| 78 | + Map<String, Object> matchStation(Map<String, Object> map); | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * 上传的GPS点生成的路线保存在缓存表 | ||
| 82 | + */ | ||
| 83 | + Map<String, Object> cacheSave(Map<String, Object> map); | ||
| 84 | + | ||
| 72 | } | 85 | } |
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
| @@ -22,6 +22,7 @@ import com.bsth.entity.SectionRoute; | @@ -22,6 +22,7 @@ import com.bsth.entity.SectionRoute; | ||
| 22 | import com.bsth.entity.search.CustomerSpecs; | 22 | import com.bsth.entity.search.CustomerSpecs; |
| 23 | import com.bsth.repository.LineRepository; | 23 | import com.bsth.repository.LineRepository; |
| 24 | import com.bsth.repository.SectionRepository; | 24 | import com.bsth.repository.SectionRepository; |
| 25 | +import com.bsth.repository.SectionRouteCacheRepository; | ||
| 25 | import com.bsth.repository.SectionRouteRepository; | 26 | import com.bsth.repository.SectionRouteRepository; |
| 26 | import com.bsth.service.SectionRouteService; | 27 | import com.bsth.service.SectionRouteService; |
| 27 | import com.bsth.util.GetUIDAndCode; | 28 | import com.bsth.util.GetUIDAndCode; |
| @@ -49,6 +50,9 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -49,6 +50,9 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 49 | SectionRouteRepository repository; | 50 | SectionRouteRepository repository; |
| 50 | 51 | ||
| 51 | @Autowired | 52 | @Autowired |
| 53 | + SectionRouteCacheRepository Cacherepository; | ||
| 54 | + | ||
| 55 | + @Autowired | ||
| 52 | SectionRepository repository2; | 56 | SectionRepository repository2; |
| 53 | 57 | ||
| 54 | @Autowired | 58 | @Autowired |
| @@ -117,7 +121,55 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -117,7 +121,55 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 117 | return resultList; | 121 | return resultList; |
| 118 | } | 122 | } |
| 119 | 123 | ||
| 120 | - | 124 | + /** |
| 125 | + * @Description :TODO(查询路段信息) | ||
| 126 | + * | ||
| 127 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 128 | + * | ||
| 129 | + * @return Map<String, Object> | ||
| 130 | + */ | ||
| 131 | + @Transactional | ||
| 132 | + @Override | ||
| 133 | + public List<Map<String, Object>> getSectionRouteCache(Map<String, Object> map) { | ||
| 134 | + int lineId = map.get("line.id_eq").equals("") ? 0 : Integer.parseInt(map.get("line.id_eq").toString()); | ||
| 135 | + int directions = map.get("directions_eq").equals("") ? 0 : Integer.parseInt(map.get("directions_eq").toString()); | ||
| 136 | + List<Object[]> listObjArray = Cacherepository.getSectionRouteCache(lineId, directions); | ||
| 137 | + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | ||
| 138 | + if(listObjArray.size()>0) { | ||
| 139 | + for(int i = 0 ; i<listObjArray.size() ; i++){ | ||
| 140 | + Map<String, Object> tempM = new HashMap<String, Object>(); | ||
| 141 | + tempM.put("sectionrouteId",listObjArray.get(i)[0]); | ||
| 142 | + tempM.put("sectionrouteLine",listObjArray.get(i)[1]); | ||
| 143 | + tempM.put("sectionrouteLineCode",listObjArray.get(i)[2]); | ||
| 144 | + tempM.put("sectionrouteSection",listObjArray.get(i)[3]); | ||
| 145 | + tempM.put("sectionrouteSectionCode",listObjArray.get(i)[4]); | ||
| 146 | + tempM.put("sectionrouteCode",listObjArray.get(i)[5]); | ||
| 147 | + tempM.put("sectionrouteDirections",listObjArray.get(i)[6]); | ||
| 148 | + tempM.put("sectionId",listObjArray.get(i)[7]); | ||
| 149 | + tempM.put("sectionCode",listObjArray.get(i)[8]); | ||
| 150 | + tempM.put("sectionName",listObjArray.get(i)[9]); | ||
| 151 | + tempM.put("sectionCrosesRoad",listObjArray.get(i)[10]); | ||
| 152 | + tempM.put("sectionEndNode",listObjArray.get(i)[11]); | ||
| 153 | + tempM.put("sectionStartNode",listObjArray.get(i)[12]); | ||
| 154 | + tempM.put("sectionMiddleNode",listObjArray.get(i)[13]); | ||
| 155 | + tempM.put("sectionType",listObjArray.get(i)[14]); | ||
| 156 | + tempM.put("sectionCsectionVector",listObjArray.get(i)[15]); | ||
| 157 | + tempM.put("sectionBsectionVector",listObjArray.get(i)[16]); | ||
| 158 | + tempM.put("sectionGsectionVector",listObjArray.get(i)[17]); | ||
| 159 | + tempM.put("sectionRoadCoding",listObjArray.get(i)[18]); | ||
| 160 | + tempM.put("sectionDistance",listObjArray.get(i)[19]); | ||
| 161 | + tempM.put("sectionTime",listObjArray.get(i)[20]); | ||
| 162 | + tempM.put("sectiondbType",listObjArray.get(i)[21]); | ||
| 163 | + tempM.put("sectionSpeedLimet",listObjArray.get(i)[22]); | ||
| 164 | + tempM.put("destroy",listObjArray.get(i)[23]); | ||
| 165 | + tempM.put("versions",listObjArray.get(i)[24]); | ||
| 166 | + tempM.put("descriptions",listObjArray.get(i)[25]); | ||
| 167 | + tempM.put("isRoadeSpeed",listObjArray.get(i)[26]); | ||
| 168 | + resultList.add(tempM); | ||
| 169 | + } | ||
| 170 | + } | ||
| 171 | + return resultList; | ||
| 172 | + } | ||
| 121 | 173 | ||
| 122 | 174 | ||
| 123 | /** | 175 | /** |
| @@ -239,7 +291,6 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -239,7 +291,6 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 239 | if(reslutList.get(0)!=null) { | 291 | if(reslutList.get(0)!=null) { |
| 240 | for(int i = 0 ; i <reslutList.size() ;i++){ | 292 | for(int i = 0 ; i <reslutList.size() ;i++){ |
| 241 | Map<String, Object> tempM = new HashMap<String, Object>(); | 293 | Map<String, Object> tempM = new HashMap<String, Object>(); |
| 242 | - System.out.println(reslutList.get(i)); | ||
| 243 | tempM.put("sectionrouteCode", reslutList.get(i)); | 294 | tempM.put("sectionrouteCode", reslutList.get(i)); |
| 244 | list.add(tempM); | 295 | list.add(tempM); |
| 245 | } | 296 | } |
| @@ -325,13 +376,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -325,13 +376,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 325 | //int i = 0; | 376 | //int i = 0; |
| 326 | String[] idsStr = map.get("ids").toString().split(",") ; | 377 | String[] idsStr = map.get("ids").toString().split(",") ; |
| 327 | for (String id : idsStr) { | 378 | for (String id : idsStr) { |
| 328 | - /* entityManager.persist(Integer.parseInt(id));*/ | ||
| 329 | repository.sectionRouteIsDestroyUpdBatch(Integer.parseInt(id)); | 379 | repository.sectionRouteIsDestroyUpdBatch(Integer.parseInt(id)); |
| 330 | -/* i++; | ||
| 331 | - if (i % batchSize == 0) { | ||
| 332 | - entityManager.flush(); | ||
| 333 | - entityManager.clear(); | ||
| 334 | - }*/ | ||
| 335 | } | 380 | } |
| 336 | resultMap.put("status", ResponseCode.SUCCESS); | 381 | resultMap.put("status", ResponseCode.SUCCESS); |
| 337 | } catch (Exception e) { | 382 | } catch (Exception e) { |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| 1 | package com.bsth.service.impl; | 1 | package com.bsth.service.impl; |
| 2 | 2 | ||
| 3 | import java.text.SimpleDateFormat; | 3 | import java.text.SimpleDateFormat; |
| 4 | +import java.util.ArrayList; | ||
| 4 | import java.util.Date; | 5 | import java.util.Date; |
| 5 | import java.util.HashMap; | 6 | import java.util.HashMap; |
| 7 | +import java.util.List; | ||
| 6 | import java.util.Map; | 8 | import java.util.Map; |
| 7 | 9 | ||
| 10 | +import org.mozilla.javascript.ObjArray; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | +import org.springframework.data.jpa.domain.Specification; | ||
| 9 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| 10 | import org.springframework.transaction.annotation.Transactional; | 14 | import org.springframework.transaction.annotation.Transactional; |
| 11 | 15 | ||
| 12 | import com.alibaba.fastjson.JSONArray; | 16 | import com.alibaba.fastjson.JSONArray; |
| 17 | +import com.alibaba.fastjson.JSONObject; | ||
| 13 | import com.bsth.common.ResponseCode; | 18 | import com.bsth.common.ResponseCode; |
| 14 | import com.bsth.entity.Line; | 19 | import com.bsth.entity.Line; |
| 15 | import com.bsth.entity.Section; | 20 | import com.bsth.entity.Section; |
| 16 | import com.bsth.entity.SectionRoute; | 21 | import com.bsth.entity.SectionRoute; |
| 22 | +import com.bsth.entity.SectionRouteCache; | ||
| 23 | +import com.bsth.entity.StationRoute; | ||
| 24 | +import com.bsth.entity.StationRouteCache; | ||
| 17 | import com.bsth.repository.LineRepository; | 25 | import com.bsth.repository.LineRepository; |
| 18 | import com.bsth.repository.SectionRepository; | 26 | import com.bsth.repository.SectionRepository; |
| 27 | +import com.bsth.repository.SectionRouteCacheRepository; | ||
| 19 | import com.bsth.repository.SectionRouteRepository; | 28 | import com.bsth.repository.SectionRouteRepository; |
| 29 | +import com.bsth.repository.StationRouteCacheRepository; | ||
| 30 | +import com.bsth.repository.StationRouteRepository; | ||
| 20 | import com.bsth.service.SectionService; | 31 | import com.bsth.service.SectionService; |
| 32 | +import com.bsth.util.GetUIDAndCode; | ||
| 21 | import com.bsth.util.TransGPS; | 33 | import com.bsth.util.TransGPS; |
| 22 | import com.bsth.util.TransGPS.Location; | 34 | import com.bsth.util.TransGPS.Location; |
| 35 | +import com.bsth.util.Geo.GeoUtils; | ||
| 36 | +import com.bsth.util.Geo.Point; | ||
| 37 | +import com.google.gson.JsonObject; | ||
| 23 | 38 | ||
| 24 | /** | 39 | /** |
| 25 | * | 40 | * |
| @@ -49,6 +64,265 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -49,6 +64,265 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 49 | @Autowired | 64 | @Autowired |
| 50 | SectionRouteRepository routeRepository; | 65 | SectionRouteRepository routeRepository; |
| 51 | 66 | ||
| 67 | + @Autowired | ||
| 68 | + SectionRouteCacheRepository routeCacheRepository; | ||
| 69 | + | ||
| 70 | + @Autowired | ||
| 71 | + StationRouteRepository stationRouteRepository; | ||
| 72 | + | ||
| 73 | + @Autowired | ||
| 74 | + StationRouteCacheRepository stationRouteCacheRepository; | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @Description :TODO(生成新的线路走向) | ||
| 78 | + * | ||
| 79 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 80 | + * | ||
| 81 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 82 | + */ | ||
| 83 | + @Override | ||
| 84 | + @Transactional | ||
| 85 | + public Map<String, Object> sectionCut(Map<String, Object> map) { | ||
| 86 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 87 | + try { | ||
| 88 | + // 路段点List | ||
| 89 | + List<Point> bPointsList = new ArrayList<>(); | ||
| 90 | + // 截取路段点List | ||
| 91 | + List<Point> bPointsCutList = new ArrayList<>(); | ||
| 92 | + // 截取后的路段 | ||
| 93 | + List<Map<String, String>> sectionArrayList = new ArrayList<>(); | ||
| 94 | + String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString(); | ||
| 95 | + 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 | + } | ||
| 204 | + | ||
| 205 | + // 原坐标类型 | ||
| 206 | + String dbType = map.get("sectiondbType").equals("") ? "" : map.get("sectiondbType").toString(); | ||
| 207 | + // 说明 | ||
| 208 | + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); | ||
| 209 | + // 是否撤销 | ||
| 210 | + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); | ||
| 211 | + // 方向 | ||
| 212 | + Integer directions = map.get("sectionrouteDirections").equals("") ? null : Integer.parseInt(map.get("sectionrouteDirections").toString()); | ||
| 213 | + // 线路ID | ||
| 214 | + Integer sectionRouteLine = map.get("sectionrouteLine").equals("") ? null : Integer.parseInt(map.get("sectionrouteLine").toString()); | ||
| 215 | + // 道路编码 | ||
| 216 | + String roadCoding = map.get("sectionRoadCoding").equals("") ? "" : map.get("sectionRoadCoding").toString(); | ||
| 217 | + // 路段长度 | ||
| 218 | + Double sectionDistance = 0.0; | ||
| 219 | + // 路段路由Id | ||
| 220 | + Integer sectionRouteId = map.get("sectionrouteId").equals("") ? null : Integer.valueOf(map.get("sectionrouteId").toString()); | ||
| 221 | + // 线路编码 | ||
| 222 | + String lineCode =map.get("sectionrouteLineCode").equals("") ? "" : map.get("sectionrouteLineCode").toString(); | ||
| 223 | + // 路段时长 | ||
| 224 | + Double sectionTime = 0.0; | ||
| 225 | + // 路段路由 | ||
| 226 | + Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); | ||
| 227 | + // 限速 | ||
| 228 | + Double speedLimit = map.get("sectionSpeedLimet").equals("") ? null : Double.valueOf(map.get("sectionSpeedLimet").toString()); | ||
| 229 | + // 版本 | ||
| 230 | + Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | ||
| 231 | + | ||
| 232 | + Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | ||
| 233 | + String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | ||
| 234 | + Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | ||
| 235 | + Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); | ||
| 236 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | ||
| 237 | + Date date = new Date(); | ||
| 238 | + // 修改日期 | ||
| 239 | + String updateDate = formatter.format(date); | ||
| 240 | + String crosesRoad=""; | ||
| 241 | + String endNode=""; | ||
| 242 | + String startNode=""; | ||
| 243 | + String middleNode=""; | ||
| 244 | + String sectionType=""; | ||
| 245 | + String csectionVector=""; | ||
| 246 | + // 撤销原有路段 | ||
| 247 | + routeRepository.sectionRouteUpdDestroy(Integer.parseInt(lineCode),directions); | ||
| 248 | + // 路段保存 | ||
| 249 | + for (int i = 0; i < sectionArrayList.size(); i++) { | ||
| 250 | + long sectionMaxId = GetUIDAndCode.getSectionId(); | ||
| 251 | + // 路段编码 | ||
| 252 | + String sectionCode = String.valueOf(sectionMaxId); | ||
| 253 | + // 路段ID | ||
| 254 | + int sectionId = (int)sectionMaxId; | ||
| 255 | + String sectionName = sectionArrayList.get(i).get("sectionName").toString(); | ||
| 256 | + String sectionsBpoints = sectionArrayList.get(i).get("sectionsBpoints").toString(); | ||
| 257 | + String sectionsWJPpoints = sectionArrayList.get(i).get("sectionsWJPpoints").toString(); | ||
| 258 | + // WGS坐标点集合 | ||
| 259 | + String gsectionVector = null; | ||
| 260 | + if(!sectionsWJPpoints.equals("")) | ||
| 261 | + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | ||
| 262 | + // 原坐标点集合 | ||
| 263 | + String bsectionVectorS = null; | ||
| 264 | + if(!sectionsBpoints.equals("")) | ||
| 265 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 266 | + repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, sectionId); | ||
| 267 | + SectionRoute route = new SectionRoute(); | ||
| 268 | + Line line = lineRepository.findOne(sectionRouteLine); | ||
| 269 | + Section section = repository.findOne(sectionId); | ||
| 270 | + route.setSectionrouteCode(sectionrouteCode+i*100); | ||
| 271 | + route.setLineCode(lineCode); | ||
| 272 | + route.setSectionCode(sectionCode); | ||
| 273 | + route.setDirections(directions); | ||
| 274 | + route.setVersions(version); | ||
| 275 | + route.setDestroy(destroy); | ||
| 276 | + route.setDescriptions(descriptions); | ||
| 277 | + route.setCreateBy(createBy); | ||
| 278 | + route.setUpdateBy(updateBy); | ||
| 279 | + route.setLine(line); | ||
| 280 | + route.setSection(section); | ||
| 281 | + route.setIsRoadeSpeed(isRoadeSpeed); | ||
| 282 | + routeRepository.save(route); | ||
| 283 | + } | ||
| 284 | + // 删除缓存路段 | ||
| 285 | + routeCacheRepository.sectionRouteCacheDel(Integer.parseInt(lineCode),directions); | ||
| 286 | + // 撤销原有站点 | ||
| 287 | + stationRouteRepository.stationRouteUpdDestroy(Integer.parseInt(lineCode),directions); | ||
| 288 | + // 站点保存 | ||
| 289 | + List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(lineCode,directions); | ||
| 290 | + for(int i=0; i < stationRouteList.size(); i++) { | ||
| 291 | + StationRouteCache stationRouteCache = stationRouteList.get(i); | ||
| 292 | + StationRoute stationRoute = new StationRoute(); | ||
| 293 | + stationRoute.setLine(stationRouteCache.getLine()); | ||
| 294 | + stationRoute.setStation(stationRouteCache.getStation()); | ||
| 295 | + stationRoute.setStationName(stationRouteCache.getStationName()); | ||
| 296 | + stationRoute.setStationRouteCode(stationRouteCache.getStationRouteCode()); | ||
| 297 | + stationRoute.setLineCode(stationRouteCache.getLineCode()); | ||
| 298 | + stationRoute.setStationCode(stationRouteCache.getStationCode()); | ||
| 299 | + stationRoute.setStationMark(stationRouteCache.getStationMark()); | ||
| 300 | + stationRoute.setOutStationNmber(stationRouteCache.getOutStationNmber()); | ||
| 301 | + stationRoute.setDirections(stationRouteCache.getDirections()); | ||
| 302 | + stationRoute.setDistances(stationRouteCache.getDistances()); | ||
| 303 | + stationRoute.setToTime(stationRouteCache.getToTime()); | ||
| 304 | + stationRoute.setFirstTime(stationRouteCache.getFirstTime()); | ||
| 305 | + stationRoute.setEndTime(stationRouteCache.getEndTime()); | ||
| 306 | + stationRoute.setDescriptions(stationRouteCache.getDescriptions()); | ||
| 307 | + stationRoute.setDestroy(stationRouteCache.getDestroy()); | ||
| 308 | + stationRoute.setVersions(stationRouteCache.getVersions()); | ||
| 309 | + stationRoute.setCreateBy(stationRouteCache.getCreateBy()); | ||
| 310 | + stationRoute.setCreateDate(stationRouteCache.getCreateDate()); | ||
| 311 | + stationRoute.setUpdateBy(stationRouteCache.getCreateBy()); | ||
| 312 | + stationRoute.setUpdateDate(stationRouteCache.getUpdateDate()); | ||
| 313 | + stationRouteRepository.save(stationRoute); | ||
| 314 | + } | ||
| 315 | + // 删除缓存站点 | ||
| 316 | + stationRouteCacheRepository.stationRouteCacheDel(Integer.parseInt(lineCode),directions); | ||
| 317 | + | ||
| 318 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 319 | + } catch (Exception e) { | ||
| 320 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 321 | + logger.error("save erro.", e); | ||
| 322 | + } | ||
| 323 | + return resultMap; | ||
| 324 | + } | ||
| 325 | + | ||
| 52 | /** | 326 | /** |
| 53 | * @Description :TODO(编辑线路走向) | 327 | * @Description :TODO(编辑线路走向) |
| 54 | * | 328 | * |
| @@ -177,6 +451,130 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -177,6 +451,130 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 177 | return resultMap; | 451 | return resultMap; |
| 178 | } | 452 | } |
| 179 | 453 | ||
| 454 | + /** | ||
| 455 | + * @Description :TODO(编辑缓存线路走向) | ||
| 456 | + */ | ||
| 457 | + @Override | ||
| 458 | + public Map<String, Object> sectionCacheUpdate(Map<String, Object> map) { | ||
| 459 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 460 | + try { | ||
| 461 | + String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString(); | ||
| 462 | + // 原始线状图形坐标集合 | ||
| 463 | + String sectionsBpoints = ""; | ||
| 464 | + // WGS线状图形坐标集合 | ||
| 465 | + String sectionsWJPpoints = ""; | ||
| 466 | + if(!bsectionVector.equals("")) { | ||
| 467 | + // 转换成JSON数组 | ||
| 468 | + JSONArray sectionsArray = JSONArray.parseArray(bsectionVector); | ||
| 469 | + // 遍历 | ||
| 470 | + for(int s = 0 ;s<sectionsArray.size();s++) { | ||
| 471 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | ||
| 472 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | ||
| 473 | + /** to WGS坐标 */ | ||
| 474 | + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | ||
| 475 | + String WGSLngStr = String.valueOf(resultPoint.getLng()); | ||
| 476 | + String WGSLatStr = String.valueOf(resultPoint.getLat()); | ||
| 477 | + if(s==0) { | ||
| 478 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | ||
| 479 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | ||
| 480 | + }else { | ||
| 481 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | ||
| 482 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | ||
| 483 | + } | ||
| 484 | + } | ||
| 485 | + } | ||
| 486 | + // 原坐标类型 | ||
| 487 | + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | ||
| 488 | + // 说明 | ||
| 489 | + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); | ||
| 490 | + // 是否撤销 | ||
| 491 | + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); | ||
| 492 | + // 方向 | ||
| 493 | + Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); | ||
| 494 | + // 线路ID | ||
| 495 | + Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString()); | ||
| 496 | + // 道路编码 | ||
| 497 | + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | ||
| 498 | + // 路段编码 | ||
| 499 | + String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); | ||
| 500 | + // 路段长度 | ||
| 501 | + Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); | ||
| 502 | + // 路段ID | ||
| 503 | + Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString()); | ||
| 504 | + // 路段名称 | ||
| 505 | + String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); | ||
| 506 | + // 路段路由Id | ||
| 507 | + Integer sectionRouteId = map.get("sectionRouteId").equals("") ? null : Integer.valueOf(map.get("sectionRouteId").toString()); | ||
| 508 | + // 线路编码 | ||
| 509 | + String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); | ||
| 510 | + // 路段时长 | ||
| 511 | + Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); | ||
| 512 | + // 路段路由 | ||
| 513 | + Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); | ||
| 514 | + SectionRouteCache resultS = routeCacheRepository.findOne(sectionRouteId); | ||
| 515 | + int old_code = resultS.getSectionrouteCode(); | ||
| 516 | + if(sectionrouteCode!=null) { | ||
| 517 | + int new_code = sectionrouteCode+100; | ||
| 518 | + if(new_code==old_code){ | ||
| 519 | + sectionrouteCode = new_code; | ||
| 520 | + }else { | ||
| 521 | + sectionrouteCode = new_code-100+1; | ||
| 522 | + } | ||
| 523 | + }else { | ||
| 524 | + sectionrouteCode = old_code; | ||
| 525 | + } | ||
| 526 | + // 限速 | ||
| 527 | + Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | ||
| 528 | + // 版本 | ||
| 529 | + Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | ||
| 530 | + // WGS坐标点集合 | ||
| 531 | + String gsectionVector = null; | ||
| 532 | + if(!sectionsWJPpoints.equals("")) | ||
| 533 | + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | ||
| 534 | + // 原坐标点集合 | ||
| 535 | + String bsectionVectorS = null; | ||
| 536 | + if(!sectionsBpoints.equals("")) | ||
| 537 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 538 | + Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | ||
| 539 | + String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | ||
| 540 | + Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | ||
| 541 | + Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); | ||
| 542 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | ||
| 543 | + Date date = new Date(); | ||
| 544 | + // 修改日期 | ||
| 545 | + String updateDate = formatter.format(date); | ||
| 546 | + String crosesRoad=""; | ||
| 547 | + String endNode=""; | ||
| 548 | + String startNode=""; | ||
| 549 | + String middleNode=""; | ||
| 550 | + String sectionType=""; | ||
| 551 | + // 更新 | ||
| 552 | + repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); | ||
| 553 | + SectionRouteCache route = new SectionRouteCache(); | ||
| 554 | + Line line = lineRepository.findOne(sectionRouteLine); | ||
| 555 | + Section section = repository.findOne(sectionId); | ||
| 556 | + route.setId(sectionRouteId); | ||
| 557 | + route.setSectionrouteCode(sectionrouteCode); | ||
| 558 | + route.setLineCode(lineCode); | ||
| 559 | + route.setSectionCode(sectionCode); | ||
| 560 | + route.setDirections(directions); | ||
| 561 | + route.setVersions(version); | ||
| 562 | + route.setDestroy(destroy); | ||
| 563 | + route.setDescriptions(descriptions); | ||
| 564 | + route.setCreateBy(createBy); | ||
| 565 | + route.setUpdateBy(updateBy); | ||
| 566 | + route.setLine(line); | ||
| 567 | + route.setSection(section); | ||
| 568 | + route.setIsRoadeSpeed(isRoadeSpeed); | ||
| 569 | + routeCacheRepository.save(route); | ||
| 570 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 571 | + } catch (Exception e) { | ||
| 572 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 573 | + logger.error("save erro.", e); | ||
| 574 | + } | ||
| 575 | + return resultMap; | ||
| 576 | + } | ||
| 577 | + | ||
| 180 | /** 百度坐标转WGS坐标 */ | 578 | /** 百度坐标转WGS坐标 */ |
| 181 | public Location FromBDPointToWGSPoint(String bLonx,String bLatx) { | 579 | public Location FromBDPointToWGSPoint(String bLonx,String bLatx) { |
| 182 | 580 |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| @@ -8,6 +8,7 @@ import com.bsth.entity.search.CustomerSpecs; | @@ -8,6 +8,7 @@ import com.bsth.entity.search.CustomerSpecs; | ||
| 8 | import com.bsth.repository.LineRepository; | 8 | import com.bsth.repository.LineRepository; |
| 9 | import com.bsth.repository.SectionRouteRepository; | 9 | import com.bsth.repository.SectionRouteRepository; |
| 10 | import com.bsth.repository.StationRepository; | 10 | import com.bsth.repository.StationRepository; |
| 11 | +import com.bsth.repository.StationRouteCacheRepository; | ||
| 11 | import com.bsth.repository.StationRouteRepository; | 12 | import com.bsth.repository.StationRouteRepository; |
| 12 | import com.bsth.service.StationRouteService; | 13 | import com.bsth.service.StationRouteService; |
| 13 | import com.bsth.util.FTPClientUtils; | 14 | import com.bsth.util.FTPClientUtils; |
| @@ -51,6 +52,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -51,6 +52,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 51 | private StationRouteRepository repository; | 52 | private StationRouteRepository repository; |
| 52 | 53 | ||
| 53 | @Autowired | 54 | @Autowired |
| 55 | + private StationRouteCacheRepository cacheRepository; | ||
| 56 | + | ||
| 57 | + @Autowired | ||
| 54 | private SectionRouteRepository routeRepository; | 58 | private SectionRouteRepository routeRepository; |
| 55 | 59 | ||
| 56 | @Autowired | 60 | @Autowired |
| @@ -493,6 +497,46 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -493,6 +497,46 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 493 | return resultList; | 497 | return resultList; |
| 494 | } | 498 | } |
| 495 | 499 | ||
| 500 | + | ||
| 501 | + /** | ||
| 502 | + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | ||
| 503 | + * | ||
| 504 | + * @param map <lineId:线路ID; direction:方向> | ||
| 505 | + * | ||
| 506 | + * @return List<Map<String, Object>> | ||
| 507 | + */ | ||
| 508 | + @Override | ||
| 509 | + public List<Map<String, Object>> getStationRouteCacheCenterPoints(Map<String, Object> map) { | ||
| 510 | + | ||
| 511 | + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | ||
| 512 | + | ||
| 513 | + // 线路ID | ||
| 514 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 515 | + | ||
| 516 | + // 方向 | ||
| 517 | + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); | ||
| 518 | + | ||
| 519 | + List<Object[]> list = cacheRepository.getSelectStationRouteCenterPoints(lineId, direction); | ||
| 520 | + | ||
| 521 | + if(list.size()>0) { | ||
| 522 | + | ||
| 523 | + for(int i = 0;i<list.size();i++) { | ||
| 524 | + | ||
| 525 | + Map<String, Object> tempM = new HashMap<String,Object>(); | ||
| 526 | + | ||
| 527 | + tempM.put("bJwpoints", list.get(i)[0]); | ||
| 528 | + | ||
| 529 | + tempM.put("stationName", list.get(i)[1]); | ||
| 530 | + | ||
| 531 | + resultList.add(tempM); | ||
| 532 | + | ||
| 533 | + } | ||
| 534 | + | ||
| 535 | + } | ||
| 536 | + | ||
| 537 | + return resultList; | ||
| 538 | + } | ||
| 539 | + | ||
| 496 | /** | 540 | /** |
| 497 | * @Description :TODO(撤销站点) | 541 | * @Description :TODO(撤销站点) |
| 498 | * | 542 | * |
| @@ -668,6 +712,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -668,6 +712,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 668 | * @return String | 712 | * @return String |
| 669 | */ | 713 | */ |
| 670 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { | 714 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { |
| 715 | + | ||
| 671 | // 返回值String | 716 | // 返回值String |
| 672 | String stationRStr = ""; | 717 | String stationRStr = ""; |
| 673 | // windows下的文本文件换行符 | 718 | // windows下的文本文件换行符 |
| @@ -771,6 +816,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -771,6 +816,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 771 | 816 | ||
| 772 | } | 817 | } |
| 773 | return stationRStr; | 818 | return stationRStr; |
| 819 | + | ||
| 774 | } | 820 | } |
| 775 | 821 | ||
| 776 | public String hxTextFileToFtp(List<Object[]> objects,Integer lineId) { | 822 | public String hxTextFileToFtp(List<Object[]> objects,Integer lineId) { |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| @@ -2,6 +2,7 @@ package com.bsth.service.impl; | @@ -2,6 +2,7 @@ package com.bsth.service.impl; | ||
| 2 | 2 | ||
| 3 | import java.math.BigDecimal; | 3 | import java.math.BigDecimal; |
| 4 | import java.util.HashMap; | 4 | import java.util.HashMap; |
| 5 | +import java.util.Iterator; | ||
| 5 | import java.util.List; | 6 | import java.util.List; |
| 6 | import java.util.Map; | 7 | import java.util.Map; |
| 7 | 8 | ||
| @@ -20,18 +21,23 @@ import com.bsth.entity.Line; | @@ -20,18 +21,23 @@ import com.bsth.entity.Line; | ||
| 20 | import com.bsth.entity.LineInformation; | 21 | import com.bsth.entity.LineInformation; |
| 21 | import com.bsth.entity.Section; | 22 | import com.bsth.entity.Section; |
| 22 | import com.bsth.entity.SectionRoute; | 23 | import com.bsth.entity.SectionRoute; |
| 24 | +import com.bsth.entity.SectionRouteCache; | ||
| 23 | import com.bsth.entity.Station; | 25 | import com.bsth.entity.Station; |
| 24 | import com.bsth.entity.StationRoute; | 26 | import com.bsth.entity.StationRoute; |
| 27 | +import com.bsth.entity.StationRouteCache; | ||
| 25 | import com.bsth.repository.LineInformationRepository; | 28 | import com.bsth.repository.LineInformationRepository; |
| 26 | import com.bsth.repository.LineRepository; | 29 | import com.bsth.repository.LineRepository; |
| 27 | import com.bsth.repository.SectionRepository; | 30 | import com.bsth.repository.SectionRepository; |
| 31 | +import com.bsth.repository.SectionRouteCacheRepository; | ||
| 28 | import com.bsth.repository.SectionRouteRepository; | 32 | import com.bsth.repository.SectionRouteRepository; |
| 29 | import com.bsth.repository.StationRepository; | 33 | import com.bsth.repository.StationRepository; |
| 34 | +import com.bsth.repository.StationRouteCacheRepository; | ||
| 30 | import com.bsth.repository.StationRouteRepository; | 35 | import com.bsth.repository.StationRouteRepository; |
| 31 | import com.bsth.service.StationService; | 36 | import com.bsth.service.StationService; |
| 32 | import com.bsth.util.GetUIDAndCode; | 37 | import com.bsth.util.GetUIDAndCode; |
| 33 | import com.bsth.util.TransGPS; | 38 | import com.bsth.util.TransGPS; |
| 34 | import com.bsth.util.TransGPS.Location; | 39 | import com.bsth.util.TransGPS.Location; |
| 40 | +import com.bsth.util.Geo.Circle; | ||
| 35 | import com.bsth.util.Geo.GeoUtils; | 41 | import com.bsth.util.Geo.GeoUtils; |
| 36 | import com.bsth.util.Geo.Point; | 42 | import com.bsth.util.Geo.Point; |
| 37 | 43 | ||
| @@ -61,6 +67,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -61,6 +67,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 61 | private StationRouteRepository routeRepository; | 67 | private StationRouteRepository routeRepository; |
| 62 | 68 | ||
| 63 | @Autowired | 69 | @Autowired |
| 70 | + private StationRouteCacheRepository routeCacheRepository; | ||
| 71 | + | ||
| 72 | + @Autowired | ||
| 64 | private LineInformationRepository informationRepository; | 73 | private LineInformationRepository informationRepository; |
| 65 | 74 | ||
| 66 | @Autowired | 75 | @Autowired |
| @@ -72,6 +81,11 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -72,6 +81,11 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 72 | @Autowired | 81 | @Autowired |
| 73 | private SectionRouteRepository sectionRouteRepository; | 82 | private SectionRouteRepository sectionRouteRepository; |
| 74 | 83 | ||
| 84 | + @Autowired | ||
| 85 | + private SectionRouteCacheRepository sectionRouteCacheRepository; | ||
| 86 | + | ||
| 87 | + private GeoUtils geoUtils; | ||
| 88 | + | ||
| 75 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 89 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 76 | 90 | ||
| 77 | /** | 91 | /** |
| @@ -118,6 +132,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -118,6 +132,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 118 | Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); | 132 | Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); |
| 119 | String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); | 133 | String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); |
| 120 | if(!stationJSON.equals("")) { | 134 | if(!stationJSON.equals("")) { |
| 135 | + // 保存前先撤销原有站点 | ||
| 136 | + | ||
| 121 | // 保存站点与站点路由信息 | 137 | // 保存站点与站点路由信息 |
| 122 | resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); | 138 | resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); |
| 123 | } | 139 | } |
| @@ -930,8 +946,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -930,8 +946,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 930 | Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); | 946 | Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); |
| 931 | Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); | 947 | Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); |
| 932 | // 更新 | 948 | // 更新 |
| 933 | - /*repository.stationUpdate(stationCod, zdmc, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPloygonGrid, gPloygonGrid, destroy, radius, shapesType, versions, descriptions, stationId);*/ | ||
| 934 | - repository.stationUpdate(stationCod, zdmc, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPloygonGrid, gPloygonGrid, radius, shapesType, versions, descriptions, stationId); | 949 | + repository.stationUpdate(stationCod, zdmc, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPloygonGrid, gPloygonGrid, destroy, radius, shapesType, versions, descriptions, stationId); |
| 935 | // 站点路由Id | 950 | // 站点路由Id |
| 936 | Integer stationRouteId = map.get("stationRouteId").equals("") ? null : Integer.parseInt(map.get("stationRouteId").toString()); | 951 | Integer stationRouteId = map.get("stationRouteId").equals("") ? null : Integer.parseInt(map.get("stationRouteId").toString()); |
| 937 | StationRoute resultS = routeRepository.findOne(stationRouteId); | 952 | StationRoute resultS = routeRepository.findOne(stationRouteId); |
| @@ -1000,7 +1015,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -1000,7 +1015,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 1000 | 1015 | ||
| 1001 | } | 1016 | } |
| 1002 | 1017 | ||
| 1003 | - | 1018 | + @Transactional |
| 1004 | @Override | 1019 | @Override |
| 1005 | public Map<String, Object> manualSave(Map<String, Object> map) { | 1020 | public Map<String, Object> manualSave(Map<String, Object> map) { |
| 1006 | Map<String, Object> resultMap = new HashMap<String,Object>(); | 1021 | Map<String, Object> resultMap = new HashMap<String,Object>(); |
| @@ -1073,6 +1088,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -1073,6 +1088,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 1073 | Integer destroy,Integer directions) { | 1088 | Integer destroy,Integer directions) { |
| 1074 | // 转换成JSON数组 | 1089 | // 转换成JSON数组 |
| 1075 | JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); | 1090 | JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); |
| 1091 | + // 更新路线前撤销线路原有路段 | ||
| 1092 | + sectionRouteRepository.sectionRouteUpdDestroy(Integer.parseInt(resultLine.getLineCode()),directions); | ||
| 1076 | // 遍历 | 1093 | // 遍历 |
| 1077 | for(int s = 0 ;s<sectionsArray.size();s++) { | 1094 | for(int s = 0 ;s<sectionsArray.size();s++) { |
| 1078 | // 站点名称 | 1095 | // 站点名称 |
| @@ -1093,11 +1110,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -1093,11 +1110,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 1093 | if(p==pointsArray.size()-1){ | 1110 | if(p==pointsArray.size()-1){ |
| 1094 | sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr; | 1111 | sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr; |
| 1095 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr; | 1112 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr; |
| 1096 | - // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat"); | ||
| 1097 | }else { | 1113 | }else { |
| 1098 | sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; | 1114 | sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; |
| 1099 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ","; | 1115 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ","; |
| 1100 | - // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat") +","; | ||
| 1101 | } | 1116 | } |
| 1102 | } | 1117 | } |
| 1103 | } | 1118 | } |
| @@ -1150,10 +1165,369 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -1150,10 +1165,369 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 1150 | sectionRoute.setVersions(versions); | 1165 | sectionRoute.setVersions(versions); |
| 1151 | sectionRoute.setDestroy(destroy); | 1166 | sectionRoute.setDestroy(destroy); |
| 1152 | // 方向 | 1167 | // 方向 |
| 1153 | - sectionRoute.setDirections(directions); | 1168 | + sectionRoute.setDirections(directions); |
| 1169 | + // 保存路段 | ||
| 1154 | sectionRouteRepository.save(sectionRoute); | 1170 | sectionRouteRepository.save(sectionRoute); |
| 1155 | } | 1171 | } |
| 1156 | 1172 | ||
| 1157 | } | 1173 | } |
| 1158 | 1174 | ||
| 1175 | + /** | ||
| 1176 | + * @Description :TODO(根据坐标点匹配数据库中的站点) | ||
| 1177 | + * | ||
| 1178 | + * @param map: <point:坐标点; name:站点名> | ||
| 1179 | + * | ||
| 1180 | + */ | ||
| 1181 | + @Override | ||
| 1182 | + @Transactional | ||
| 1183 | + public Map<String, Object> matchStation(Map<String, Object> map) { | ||
| 1184 | + boolean isMatch = false; | ||
| 1185 | + double lat = Double.parseDouble(map.get("potion[lat]").toString()); | ||
| 1186 | + double lon = Double.parseDouble(map.get("potion[lng]").toString()); | ||
| 1187 | + Point point = new Point(lon, lat); | ||
| 1188 | + Iterable<Station> Stations = repository.findAll(); | ||
| 1189 | + for (Station s : Stations) { | ||
| 1190 | + String libraryPointstr = s.getbJwpoints(); | ||
| 1191 | + String points[] = libraryPointstr.toString().split(" "); | ||
| 1192 | + Point center = new Point(Double.parseDouble(points[0]), Double.parseDouble(points[1])); | ||
| 1193 | + // 在100m内认为是同一个站点 | ||
| 1194 | + Circle circle = new Circle(center, 100); | ||
| 1195 | + // 匹配到了用数据库中的点替换 | ||
| 1196 | + if (geoUtils.isPointInCircle(point, circle)) { | ||
| 1197 | + map.put("name", s.getStationName().toString()); | ||
| 1198 | + map.put("potion_lng", points[0]); | ||
| 1199 | + map.put("potion_lat", points[1]); | ||
| 1200 | + map.put("isHave", "true"); | ||
| 1201 | + map.put("id", s.getId()); | ||
| 1202 | + isMatch = true; | ||
| 1203 | + break; | ||
| 1204 | + } | ||
| 1205 | + } | ||
| 1206 | + // 如果没有匹配到站点就用这个点 | ||
| 1207 | + if (!isMatch) { | ||
| 1208 | + map.put("potion_lng", lon); | ||
| 1209 | + map.put("potion_lat", lat); | ||
| 1210 | + map.put("isHave", "false"); | ||
| 1211 | + map.put("id", ""); | ||
| 1212 | + } | ||
| 1213 | + return map; | ||
| 1214 | + } | ||
| 1215 | + | ||
| 1216 | + /** | ||
| 1217 | + * @Description :TODO(把上传Gps生成的路线放到缓存表中) | ||
| 1218 | + * | ||
| 1219 | + * @param map: 站点和坐标 | ||
| 1220 | + * | ||
| 1221 | + */ | ||
| 1222 | + @Transactional | ||
| 1223 | + @Override | ||
| 1224 | + public Map<String, Object> cacheSave(Map<String, Object> map) { | ||
| 1225 | + Map<String, Object> resultMap = new HashMap<String,Object>(); | ||
| 1226 | + try { | ||
| 1227 | + // 站点信息字符传 | ||
| 1228 | + String stationJSON = map.get("stationJSON").equals("") ? "" : map.get("stationJSON").toString(); | ||
| 1229 | + // 路段信息字符串 | ||
| 1230 | + String sectionJSON = map.get("sectionJSON").equals("") ? "" : map.get("sectionJSON").toString(); | ||
| 1231 | + // 方向 | ||
| 1232 | + int directions = Integer.parseInt(map.get("directions").toString()); | ||
| 1233 | + // 是否撤销 | ||
| 1234 | + int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); | ||
| 1235 | + // 版本 | ||
| 1236 | + int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString()); | ||
| 1237 | + // 坐标类型 | ||
| 1238 | + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | ||
| 1239 | + // 限速 | ||
| 1240 | + String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString(); | ||
| 1241 | + // 线路ID | ||
| 1242 | + int lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); | ||
| 1243 | + // 半径 | ||
| 1244 | + int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString()); | ||
| 1245 | + // 图形类型 | ||
| 1246 | + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); | ||
| 1247 | + // 线路信息 | ||
| 1248 | + Line resultLine = lineRepository.findOne(lineId); | ||
| 1249 | + // 路段距离 | ||
| 1250 | + Double sectionDistance = 0.0d; | ||
| 1251 | + // 路段时长 | ||
| 1252 | + Double sectionDuration = 0.0d; | ||
| 1253 | + // 里程(上或者下) | ||
| 1254 | + double sumUpOrDownMileage = 0.0d; | ||
| 1255 | + Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); | ||
| 1256 | + String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); | ||
| 1257 | + | ||
| 1258 | + if(!stationJSON.equals("")) { | ||
| 1259 | + // 保存站点与站点路由信息 | ||
| 1260 | + resultSaveMapm = savaStationAndStationRouteCacheInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); | ||
| 1261 | + } | ||
| 1262 | + // 路段长度 | ||
| 1263 | + sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString()); | ||
| 1264 | + // 路段时长 | ||
| 1265 | + sectionDuration = Double.valueOf(resultSaveMapm.get("sectionDuration").toString()); | ||
| 1266 | + // 如果路段信息JSON字符串不为空 | ||
| 1267 | + if(!sectionJSON.equals("")) { | ||
| 1268 | + SaveSectionAndSectionRouteCache(sectionJSON, speedLimitStr, sectionDistance, sectionDuration, dbType, versions, resultLine, destroy, directions); | ||
| 1269 | + } | ||
| 1270 | + // 里程 | ||
| 1271 | + sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString()); | ||
| 1272 | + BigDecimal s = new BigDecimal(sumUpOrDownMileage); | ||
| 1273 | + sumUpOrDownMileage = s.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | ||
| 1274 | + // 更新里程 | ||
| 1275 | + // updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage); | ||
| 1276 | + if(directions==0) { | ||
| 1277 | + // lineUpdateStationName(resultLine); | ||
| 1278 | + } | ||
| 1279 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 1280 | + resultMap.put("stationData", resultSaveMapm.get("stationdata")); | ||
| 1281 | + } catch (Exception e) { | ||
| 1282 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 1283 | + logger.error("save erro.", e); | ||
| 1284 | + } | ||
| 1285 | + | ||
| 1286 | + return resultMap; | ||
| 1287 | + } | ||
| 1288 | + | ||
| 1289 | + /** | ||
| 1290 | + * @param isHaveId 存在站点的id | ||
| 1291 | + * @param isHave 是否存在站点 | ||
| 1292 | + * @Description :TODO(保存站点和缓存站点路由信息) | ||
| 1293 | + * | ||
| 1294 | + */ | ||
| 1295 | + public Map<String, Object> savaStationAndStationRouteCacheInfo(String stationJSON,double sectionDistance,double sectionDuration,String dbType, | ||
| 1296 | + int radius,String shapesType,int destroy,int versions,double sumUpOrDownMileage,int directions,Line resultLine,String baseRes) throws Exception{ | ||
| 1297 | + Map<String, Object> paramsMeleageAndDistncDura = new HashMap<String,Object>(); | ||
| 1298 | + JSONArray stationsArray = JSONArray.parseArray(stationJSON); | ||
| 1299 | + if(stationsArray.size()>0) { | ||
| 1300 | + // 更新路线前删除线路缓存站点 | ||
| 1301 | + routeCacheRepository.stationRouteCacheDel(Integer.parseInt(resultLine.getLineCode()),directions); | ||
| 1302 | + for(int i = 0;i <stationsArray.size();i++) { | ||
| 1303 | + // 站点名称 | ||
| 1304 | + String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); | ||
| 1305 | + Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0.0d : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString()); | ||
| 1306 | + // 转成公里 | ||
| 1307 | + distance = distance/1000; | ||
| 1308 | + BigDecimal d = new BigDecimal(distance); | ||
| 1309 | + distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | ||
| 1310 | + sectionDistance= distance + sectionDistance; | ||
| 1311 | + Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0.0d : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString()); | ||
| 1312 | + // 转成分钟 | ||
| 1313 | + duration = duration/60; | ||
| 1314 | + BigDecimal t = new BigDecimal(duration); | ||
| 1315 | + duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | ||
| 1316 | + sectionDuration = duration + sectionDuration; | ||
| 1317 | + // 百度经纬度坐标 | ||
| 1318 | + String bJwpoints = ""; | ||
| 1319 | + // 百度坐标经度 | ||
| 1320 | + String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString(); | ||
| 1321 | + bLonx = bLonx==null || bLonx.equals("") ? "0" : bLonx; | ||
| 1322 | + // 百度坐标纬度 | ||
| 1323 | + String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString(); | ||
| 1324 | + bLatx = bLatx==null || bLatx.equals("") ? "0" : bLatx; | ||
| 1325 | + List<Object[]> stationNameList = repository.findStationName(directions,stationName); | ||
| 1326 | + //Map<String, Object> isHaveMap = isHaveStationname(bLonx,bLatx,stationNameList); | ||
| 1327 | + // 初始化站点对象 | ||
| 1328 | + Station arg0 = new Station(); | ||
| 1329 | + // 存在的点就不添加到数据库 | ||
| 1330 | + if(Boolean.parseBoolean(stationsArray.getJSONObject(i).get("isHave").toString())) { | ||
| 1331 | + Integer stationId = Integer.parseInt(stationsArray.getJSONObject(i).get("id").toString()); | ||
| 1332 | + arg0 = repository.findOne(stationId); | ||
| 1333 | + }else { | ||
| 1334 | + // 站点编码 | ||
| 1335 | + long stationCode = GetUIDAndCode.getStationId(); | ||
| 1336 | + arg0.setStationCod(String.valueOf(stationCode)); | ||
| 1337 | + arg0.setId((int)stationCode); | ||
| 1338 | + arg0.setStationName(stationName); | ||
| 1339 | + // 原坐标类型 | ||
| 1340 | + arg0.setDbType(dbType); | ||
| 1341 | + String gLonxStr = JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("x").equals("") ? null : JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("x").toString(); | ||
| 1342 | + String gLatyStr = JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("y").equals("") ? null : JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("y").toString(); | ||
| 1343 | + float gLonx = 0.0f; | ||
| 1344 | + float gLaty = 0.0f; | ||
| 1345 | + Location resultPoint = null; | ||
| 1346 | + if(baseRes.equals("No")){ | ||
| 1347 | + /** BD to WGS坐标 */ | ||
| 1348 | + resultPoint = FromBDPointToWGSPoint(bLonx,bLatx); | ||
| 1349 | + if(gLonxStr==null) | ||
| 1350 | + gLonx = (float)resultPoint.getLng(); | ||
| 1351 | + else | ||
| 1352 | + gLonx = Float.valueOf(gLonxStr); | ||
| 1353 | + if(gLatyStr==null) | ||
| 1354 | + gLaty = (float)resultPoint.getLat(); | ||
| 1355 | + else | ||
| 1356 | + gLaty = Float.valueOf(gLatyStr); | ||
| 1357 | + arg0.setgLonx(gLonx); | ||
| 1358 | + arg0.setgLaty(gLaty); | ||
| 1359 | + // 百度经纬度 | ||
| 1360 | + bJwpoints = bLonx + " " + bLatx; | ||
| 1361 | + arg0.setbJwpoints(bJwpoints); | ||
| 1362 | + }else if(baseRes.equals("GCJ02")){ | ||
| 1363 | + Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr)); | ||
| 1364 | + Location location = TransGPS.bd_encrypt(bdLoc); | ||
| 1365 | + String GCJLng = String.valueOf(location.getLng()); | ||
| 1366 | + String GCJLat = String.valueOf(location.getLat()); | ||
| 1367 | + resultPoint = FromBDPointToWGSPoint(GCJLng,GCJLat); | ||
| 1368 | + bJwpoints = GCJLng + " " +GCJLat; | ||
| 1369 | + arg0.setgLonx((float)location.getLng()); | ||
| 1370 | + arg0.setgLaty((float)location.getLat()); | ||
| 1371 | + arg0.setbJwpoints(bJwpoints); | ||
| 1372 | + }else if(baseRes.equals("BD09")){ | ||
| 1373 | + resultPoint = FromBDPointToWGSPoint(gLonxStr, gLatyStr); | ||
| 1374 | + bJwpoints = gLonxStr+ " " + gLatyStr; | ||
| 1375 | + arg0.setgLonx((float)resultPoint.getLng()); | ||
| 1376 | + arg0.setgLaty((float)resultPoint.getLat()); | ||
| 1377 | + }else if(baseRes.equals("WGS84")){ | ||
| 1378 | + Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr)); | ||
| 1379 | + Location gcjLoc = TransGPS.transformFromWGSToGCJ(bdLoc); | ||
| 1380 | + Location bdEn = TransGPS.bd_encrypt(gcjLoc); | ||
| 1381 | + bJwpoints = String.valueOf(bdEn.getLng()) + " " + String.valueOf(bdEn.getLat()); | ||
| 1382 | + arg0.setbJwpoints(bJwpoints); | ||
| 1383 | + arg0.setgLonx(Float.valueOf(gLonxStr)); | ||
| 1384 | + arg0.setgLaty(Float.valueOf(gLatyStr)); | ||
| 1385 | + } | ||
| 1386 | + arg0.setRadius(radius); | ||
| 1387 | + arg0.setShapesType(shapesType); | ||
| 1388 | + // 是否想撤销 | ||
| 1389 | + arg0.setDestroy(destroy); | ||
| 1390 | + // 版本号 | ||
| 1391 | + arg0.setVersions(versions); | ||
| 1392 | + arg0.setbJwpoints(bJwpoints); | ||
| 1393 | + // 插入站点信息 | ||
| 1394 | + repository.save(arg0); | ||
| 1395 | + | ||
| 1396 | + } | ||
| 1397 | + // 站点路由对象 | ||
| 1398 | + StationRouteCache route = new StationRouteCache(); | ||
| 1399 | + // 站点名称 | ||
| 1400 | + route.setStationName(stationName); | ||
| 1401 | + route.setDistances(distance); | ||
| 1402 | + sumUpOrDownMileage = sumUpOrDownMileage + distance; | ||
| 1403 | + route.setToTime(duration); | ||
| 1404 | + // 站点编码 | ||
| 1405 | + route.setStationCode(arg0.getStationCod()); | ||
| 1406 | + // 站点序号 | ||
| 1407 | + route.setStationRouteCode((i+1)*100); | ||
| 1408 | + // 站点类型 | ||
| 1409 | + if(i==0) { | ||
| 1410 | + // 起始站 | ||
| 1411 | + route.setStationMark("B"); | ||
| 1412 | + }else if(i==stationsArray.size()-1) { | ||
| 1413 | + // 终点站 | ||
| 1414 | + route.setStationMark("E"); | ||
| 1415 | + }else { | ||
| 1416 | + // 中途站 | ||
| 1417 | + route.setStationMark("Z"); | ||
| 1418 | + } | ||
| 1419 | + // 版本号 | ||
| 1420 | + route.setVersions(versions); | ||
| 1421 | + // 站点ID | ||
| 1422 | + route.setStation(arg0); | ||
| 1423 | + // 方向 | ||
| 1424 | + route.setDirections(directions); | ||
| 1425 | + // 线路ID | ||
| 1426 | + route.setLine(resultLine); | ||
| 1427 | + // 线路编码 | ||
| 1428 | + route.setLineCode(resultLine.getLineCode()); | ||
| 1429 | + route.setDestroy(destroy); | ||
| 1430 | + // 插入站点路由信息 | ||
| 1431 | + routeCacheRepository.save(route); | ||
| 1432 | + | ||
| 1433 | + } | ||
| 1434 | + paramsMeleageAndDistncDura.put("sumUpOrDownMileage", sumUpOrDownMileage); | ||
| 1435 | + paramsMeleageAndDistncDura.put("sectionDistance", sectionDistance); | ||
| 1436 | + paramsMeleageAndDistncDura.put("sectionDuration", sectionDuration); | ||
| 1437 | + paramsMeleageAndDistncDura.put("stationdata",stationsArray); | ||
| 1438 | + } | ||
| 1439 | + return paramsMeleageAndDistncDura; | ||
| 1440 | + } | ||
| 1441 | + | ||
| 1442 | + /** | ||
| 1443 | + * @Description :TODO(保存路段和缓存路段路由信息) | ||
| 1444 | + * | ||
| 1445 | + */ | ||
| 1446 | + public void SaveSectionAndSectionRouteCache(String sectionJSON,String speedLimitStr,double sectionDistance, double sectionTime, | ||
| 1447 | + String dbType,Integer versions,Line resultLine,Integer destroy,Integer directions) { | ||
| 1448 | + // 转换成JSON数组 | ||
| 1449 | + JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); | ||
| 1450 | + // 更新路线前删除线路缓存路段 | ||
| 1451 | + sectionRouteCacheRepository.sectionRouteCacheDel(Integer.parseInt(resultLine.getLineCode()),directions); | ||
| 1452 | + // 遍历 | ||
| 1453 | + for(int s = 0 ;s<sectionsArray.size();s++) { | ||
| 1454 | + // 站点名称 | ||
| 1455 | + String sectionName = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("sectionName").toString(); | ||
| 1456 | + String pointsStr = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("points").toString(); | ||
| 1457 | + // 原始线状图形坐标集合 | ||
| 1458 | + String sectionsBpoints = ""; | ||
| 1459 | + // WGS线状图形坐标集合 | ||
| 1460 | + String sectionsWJPpoints = ""; | ||
| 1461 | + if(!pointsStr.equals("")){ | ||
| 1462 | + JSONArray pointsArray = JSONArray.parseArray(pointsStr); | ||
| 1463 | + for(int p =0;p<pointsArray.size();p++){ | ||
| 1464 | + String pointsLngStr = pointsArray.getJSONObject(p).get("lng").toString(); | ||
| 1465 | + String pointsLatStr = pointsArray.getJSONObject(p).get("lat").toString(); | ||
| 1466 | + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | ||
| 1467 | + String WGSLngStr = String.valueOf(resultPoint.getLng()); | ||
| 1468 | + String WGSLatStr = String.valueOf(resultPoint.getLat()); | ||
| 1469 | + if(p==pointsArray.size()-1){ | ||
| 1470 | + sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr; | ||
| 1471 | + sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr; | ||
| 1472 | + }else { | ||
| 1473 | + sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; | ||
| 1474 | + sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ","; | ||
| 1475 | + } | ||
| 1476 | + } | ||
| 1477 | + } | ||
| 1478 | + long sectionMaxId = GetUIDAndCode.getSectionId(); | ||
| 1479 | + String sectionCode = String.valueOf(sectionMaxId); | ||
| 1480 | + int sectionId = (int) (sectionMaxId); | ||
| 1481 | + // 交出路 | ||
| 1482 | + String crosesRoad = ""; | ||
| 1483 | + // 终止节点 | ||
| 1484 | + String endNode = ""; | ||
| 1485 | + // 开始节点 | ||
| 1486 | + String startNode = ""; | ||
| 1487 | + // 中间节点 | ||
| 1488 | + String middleNode = ""; | ||
| 1489 | + // WGS坐标点集合 | ||
| 1490 | + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | ||
| 1491 | + // 原坐标点集合 | ||
| 1492 | + String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 1493 | + // 城建坐标点集合 | ||
| 1494 | + String csectionVector = ""; | ||
| 1495 | + // 路段类型 | ||
| 1496 | + String sectionType = ""; | ||
| 1497 | + // 道路编码 | ||
| 1498 | + String roadCoding = ""; | ||
| 1499 | + // 限速 | ||
| 1500 | + double speedLimit = Double.parseDouble(speedLimitStr); | ||
| 1501 | + // 说明 | ||
| 1502 | + String descriptions = ""; | ||
| 1503 | + sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, | ||
| 1504 | + | ||
| 1505 | + middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, | ||
| 1506 | + | ||
| 1507 | + roadCoding, sectionDistance, sectionTime, dbType, speedLimit, | ||
| 1508 | + | ||
| 1509 | + descriptions, versions,sectionId); | ||
| 1510 | + Section section = sectionRepository.findOne(Integer.parseInt(sectionCode)); | ||
| 1511 | + // 路段路由 | ||
| 1512 | + SectionRouteCache sectionRoute = new SectionRouteCache(); | ||
| 1513 | + // 路段序号 | ||
| 1514 | + sectionRoute.setSectionrouteCode((s+1)*100); | ||
| 1515 | + // 线路编码 | ||
| 1516 | + sectionRoute.setLineCode(resultLine.getLineCode()); | ||
| 1517 | + // 路段ID | ||
| 1518 | + sectionRoute.setSection(section); | ||
| 1519 | + // 线路ID | ||
| 1520 | + sectionRoute.setLine(resultLine); | ||
| 1521 | + // 路段编码 | ||
| 1522 | + sectionRoute.setSectionCode(sectionCode); | ||
| 1523 | + // 版本 | ||
| 1524 | + sectionRoute.setVersions(versions); | ||
| 1525 | + sectionRoute.setDestroy(destroy); | ||
| 1526 | + // 方向 | ||
| 1527 | + sectionRoute.setDirections(directions); | ||
| 1528 | + // 保存路段 | ||
| 1529 | + sectionRouteCacheRepository.save(sectionRoute); | ||
| 1530 | + } | ||
| 1531 | + | ||
| 1532 | + } | ||
| 1159 | } | 1533 | } |
src/main/java/com/bsth/service/report/ReportService.java
| @@ -46,4 +46,6 @@ public interface ReportService { | @@ -46,4 +46,6 @@ public interface ReportService { | ||
| 46 | List<Map<String, Object>> countByList(Map<String, Object> map); | 46 | List<Map<String, Object>> countByList(Map<String, Object> map); |
| 47 | 47 | ||
| 48 | List<Map<String, Object>> countByBusList(Map<String, Object> map); | 48 | List<Map<String, Object>> countByBusList(Map<String, Object> map); |
| 49 | + | ||
| 50 | + List<Map<String, Object>> countDjg(Map<String, Object> map); | ||
| 49 | } | 51 | } |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| @@ -8,15 +8,19 @@ import com.bsth.entity.oil.Dlb; | @@ -8,15 +8,19 @@ import com.bsth.entity.oil.Dlb; | ||
| 8 | import com.bsth.entity.oil.Ylb; | 8 | import com.bsth.entity.oil.Ylb; |
| 9 | import com.bsth.entity.realcontrol.ChildTaskPlan; | 9 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 10 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 10 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 11 | +import com.bsth.entity.sys.Interval; | ||
| 11 | import com.bsth.repository.LineRepository; | 12 | import com.bsth.repository.LineRepository; |
| 12 | import com.bsth.repository.StationRouteRepository; | 13 | import com.bsth.repository.StationRouteRepository; |
| 13 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | 14 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 14 | import com.bsth.service.report.CulateMileageService; | 15 | import com.bsth.service.report.CulateMileageService; |
| 15 | import com.bsth.service.report.ReportService; | 16 | import com.bsth.service.report.ReportService; |
| 16 | import com.bsth.util.Arith; | 17 | import com.bsth.util.Arith; |
| 18 | +import com.bsth.util.ComparableChild; | ||
| 17 | import com.bsth.util.ComparableJob; | 19 | import com.bsth.util.ComparableJob; |
| 18 | import com.bsth.util.ReportUtils; | 20 | import com.bsth.util.ReportUtils; |
| 19 | import com.bsth.util.db.DBUtils_MS; | 21 | import com.bsth.util.db.DBUtils_MS; |
| 22 | +import com.google.protobuf.StringValue; | ||
| 23 | + | ||
| 20 | import org.apache.commons.lang.StringUtils; | 24 | import org.apache.commons.lang.StringUtils; |
| 21 | import org.slf4j.Logger; | 25 | import org.slf4j.Logger; |
| 22 | import org.slf4j.LoggerFactory; | 26 | import org.slf4j.LoggerFactory; |
| @@ -57,6 +61,7 @@ public class ReportServiceImpl implements ReportService{ | @@ -57,6 +61,7 @@ public class ReportServiceImpl implements ReportService{ | ||
| 57 | LineRepository lineRepository; | 61 | LineRepository lineRepository; |
| 58 | @Autowired | 62 | @Autowired |
| 59 | StationRouteRepository stationRouteRepository; | 63 | StationRouteRepository stationRouteRepository; |
| 64 | + | ||
| 60 | @Override | 65 | @Override |
| 61 | public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) { | 66 | public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) { |
| 62 | // TODO Auto-generated method stub | 67 | // TODO Auto-generated method stub |
| @@ -2221,5 +2226,244 @@ public class ReportServiceImpl implements ReportService{ | @@ -2221,5 +2226,244 @@ public class ReportServiceImpl implements ReportService{ | ||
| 2221 | } | 2226 | } |
| 2222 | return lMap; | 2227 | return lMap; |
| 2223 | } | 2228 | } |
| 2229 | + @Override | ||
| 2230 | + public List<Map<String, Object>> countDjg(Map<String, Object> map) { | ||
| 2231 | + // TODO Auto-generated method stub | ||
| 2232 | + List<Map<String, Object>> lMap=new ArrayList<Map<String,Object>>(); | ||
| 2233 | + String line=map.get("line").toString().trim(); | ||
| 2234 | + String date=map.get("date").toString(); | ||
| 2235 | + String gsbm=map.get("gsbm").toString(); | ||
| 2236 | + String fgsbm=map.get("fgsbm").toString(); | ||
| 2237 | + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | ||
| 2238 | + if(line.equals("")){ | ||
| 2239 | + list=scheduleRealInfoRepository.scheduleByDateAndLineByGs(gsbm, fgsbm, date); | ||
| 2240 | + | ||
| 2241 | + }else{ | ||
| 2242 | + list=scheduleRealInfoRepository.scheduleByDateAndLine2(line, date); | ||
| 2243 | + } | ||
| 2244 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 2245 | +// Collections.sort(listInfo,new ComparableAcuals()); | ||
| 2246 | + //查询所有线路 | ||
| 2247 | + String xlSql="select line_code,spac_grade from bsth_c_line "; | ||
| 2248 | + if(line.equals("")){ | ||
| 2249 | + xlSql +=" where company ='"+gsbm+"'"; | ||
| 2250 | + }else{ | ||
| 2251 | + xlSql +=" where line_code ='"+line+"'"; | ||
| 2252 | + } | ||
| 2253 | + | ||
| 2254 | + List<Map<String, Object>> xlList=jdbcTemplate.query(xlSql, new RowMapper<Map<String, Object>>() { | ||
| 2255 | + @Override | ||
| 2256 | + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 2257 | + Map<String, Object> map=new HashMap<String,Object>(); | ||
| 2258 | + map.put("line",arg0.getString("line_code")); | ||
| 2259 | + map.put("grade", arg0.getString("spac_grade")); | ||
| 2260 | + return map; | ||
| 2261 | + } | ||
| 2262 | + }); | ||
| 2263 | + //查询大间隔时间 | ||
| 2264 | + String djgSql="select * from bsth_c_interval"; | ||
| 2265 | + List<Interval> djgList=jdbcTemplate.query(djgSql, new RowMapper<Interval>() { | ||
| 2266 | + @Override | ||
| 2267 | + public Interval mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 2268 | + Interval m=new Interval(); | ||
| 2269 | + m.setLevel(arg0.getString("level")); | ||
| 2270 | + m.setPeak(arg0.getInt("peak")); | ||
| 2271 | + m.setTrough(arg0.getInt("trough")); | ||
| 2272 | + return m; | ||
| 2273 | + } | ||
| 2274 | + }); | ||
| 2275 | + | ||
| 2276 | + | ||
| 2277 | + for (int i = 0; i < xlList.size(); i++) { | ||
| 2278 | + String lineCode=xlList.get(i).get("line").toString(); | ||
| 2279 | + String grade =xlList.get(i).get("grade").toString(); | ||
| 2280 | + int peak=0; | ||
| 2281 | + int trough=0; | ||
| 2282 | + for (int j = 0; j < djgList.size(); j++) { | ||
| 2283 | + Interval il=djgList.get(j); | ||
| 2284 | + if(il.getLevel().equals(grade)){ | ||
| 2285 | + peak=il.getPeak(); | ||
| 2286 | + trough=il.getTrough(); | ||
| 2287 | + continue; | ||
| 2288 | + } | ||
| 2289 | + } | ||
| 2290 | + List<ScheduleRealInfo> list_=new ArrayList<ScheduleRealInfo>(); | ||
| 2291 | + List<ScheduleRealInfo> listInfo=new ArrayList<ScheduleRealInfo>(); | ||
| 2292 | + for (int j = 0; j < list.size(); j++) { | ||
| 2293 | + ScheduleRealInfo sinfo=list.get(j); | ||
| 2294 | + try { | ||
| 2295 | + if(sinfo.getXlBm().equals(lineCode)){ | ||
| 2296 | + list_.add(sinfo); | ||
| 2297 | + ScheduleRealInfo s=checkBc(sinfo); | ||
| 2298 | + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual(); | ||
| 2299 | + if(!fcsj.equals("")){ | ||
| 2300 | + Long fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime(); | ||
| 2301 | + s.setFcsjActualTime(fcsjAcual); | ||
| 2302 | + s.setFcsjActual(fcsj); | ||
| 2303 | + listInfo.add(s); | ||
| 2304 | + } | ||
| 2305 | + | ||
| 2306 | + } | ||
| 2307 | + } catch (ParseException e) { | ||
| 2308 | + // TODO Auto-generated catch block | ||
| 2309 | + e.printStackTrace(); | ||
| 2310 | + } | ||
| 2311 | + } | ||
| 2312 | + if(listInfo.size()>0){ | ||
| 2313 | + int sjbcs=culateService.culateSjbc(list_, "")+culateService.culateLjbc(list_, ""); | ||
| 2314 | + Map<String, Object> m=listDjg(gsbm,fgsbm,lineCode,sjbcs,peak,trough,listInfo,grade); | ||
| 2315 | + lMap.add(m); | ||
| 2316 | + } | ||
| 2317 | + | ||
| 2318 | + } | ||
| 2319 | + return lMap; | ||
| 2320 | + } | ||
| 2224 | 2321 | ||
| 2322 | + public ScheduleRealInfo checkBc(ScheduleRealInfo s){ | ||
| 2323 | + //如果班次有子任务 且 子任务中有属于营运的。把该子任务的发车时间设置成班次的发车时间 | ||
| 2324 | + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual(); | ||
| 2325 | + if(fcsj.equals("")){ | ||
| 2326 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | ||
| 2327 | + if(!childTaskPlans.isEmpty()){ | ||
| 2328 | + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans); | ||
| 2329 | + Collections.sort(listit, new ComparableChild()); | ||
| 2330 | + for (int i = 0; i < listit.size(); i++) { | ||
| 2331 | + ChildTaskPlan c=listit.get(i); | ||
| 2332 | + if(!c.isDestroy()){ | ||
| 2333 | + if(c.getMileageType().equals("service")){ | ||
| 2334 | + s.setFcsjActual(c.getStartDate()); | ||
| 2335 | + break; | ||
| 2336 | + } | ||
| 2337 | + | ||
| 2338 | + } | ||
| 2339 | + } | ||
| 2340 | + } | ||
| 2341 | + } | ||
| 2342 | + return s; | ||
| 2343 | + } | ||
| 2344 | + | ||
| 2345 | + public Map<String, Object> listDjg(String gsdm,String fgsdm,String line,int sjbcs,int peak,int trough,List<ScheduleRealInfo> listInfo,String grade){ | ||
| 2346 | + DecimalFormat df = new DecimalFormat("#0.00"); | ||
| 2347 | + Collections.sort(listInfo,new ComparableAcuals()); | ||
| 2348 | + List<ScheduleRealInfo> listInfo0=new ArrayList<ScheduleRealInfo>(); | ||
| 2349 | + List<ScheduleRealInfo> listInfo1=new ArrayList<ScheduleRealInfo>(); | ||
| 2350 | + for (int i = 0; i < listInfo.size(); i++) { | ||
| 2351 | + ScheduleRealInfo s=listInfo.get(i); | ||
| 2352 | + if(s.getXlDir().equals("0")){ | ||
| 2353 | + listInfo0.add(s); | ||
| 2354 | + }else{ | ||
| 2355 | + listInfo0.add(s); | ||
| 2356 | + } | ||
| 2357 | + | ||
| 2358 | + } | ||
| 2359 | + Map<String, Object> map=new HashMap<String, Object>(); | ||
| 2360 | + map.put("line", line); | ||
| 2361 | + map.put("xlName", BasicData.lineCode2NameMap.get(line)); | ||
| 2362 | + map.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 2363 | + map.put("bcs", sjbcs); | ||
| 2364 | + map.put("djgde", grade); | ||
| 2365 | + int djgcs=0; | ||
| 2366 | + List<Map<String, Object>> mapList=new ArrayList<Map<String, Object>>(); | ||
| 2367 | + for (int i = 0; i < listInfo0.size(); i++) { | ||
| 2368 | + ScheduleRealInfo s=listInfo.get(i); | ||
| 2369 | + Long fcsjTime=s.getFcsjActualTime(); | ||
| 2370 | + String time=s.getFcsjActual(); | ||
| 2371 | + String[] fcsjStr = time.split(":"); | ||
| 2372 | + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | ||
| 2373 | + if(i<listInfo.size()-1){ | ||
| 2374 | + Long djg=0l; | ||
| 2375 | + Long fscjNext=listInfo.get(i+1).getFcsjActualTime(); | ||
| 2376 | + if((fcsj>=zgf1&&fcsj<=zgf2)||(fcsj>=wgf1&&fcsj<=wgf2)){ | ||
| 2377 | + djg = (long) (peak*60*1000); | ||
| 2378 | + if(fscjNext-fcsjTime>djg){ | ||
| 2379 | + djgcs ++; | ||
| 2380 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 2381 | + m.put("xlName", BasicData.lineCode2NameMap.get(line)); | ||
| 2382 | + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 2383 | + m.put("djgde", grade); | ||
| 2384 | + m.put("qJh", s.getFcsj()); | ||
| 2385 | + m.put("qSj", time); | ||
| 2386 | + m.put("hJh", listInfo.get(i+1).getFcsj()); | ||
| 2387 | + m.put("hSj", listInfo.get(i+1).getFcsjActual()); | ||
| 2388 | + mapList.add(m); | ||
| 2389 | + } | ||
| 2390 | + }else{ | ||
| 2391 | + djg = (long) (trough*60*1000); | ||
| 2392 | + if(fscjNext-fcsjTime>djg){ | ||
| 2393 | + djgcs ++; | ||
| 2394 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 2395 | + m.put("xlName", BasicData.lineCode2NameMap.get(line)); | ||
| 2396 | + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 2397 | + m.put("djgde", grade); | ||
| 2398 | + m.put("qJh", s.getFcsj()); | ||
| 2399 | + m.put("qSj", time); | ||
| 2400 | + m.put("hJh", listInfo.get(i+1).getFcsj()); | ||
| 2401 | + m.put("hSj", listInfo.get(i+1).getFcsjActual()); | ||
| 2402 | + mapList.add(m); | ||
| 2403 | + } | ||
| 2404 | + } | ||
| 2405 | + } | ||
| 2406 | + } | ||
| 2407 | + | ||
| 2408 | + for (int i = 0; i < listInfo1.size(); i++) { | ||
| 2409 | + ScheduleRealInfo s=listInfo.get(i); | ||
| 2410 | + Long fcsjTime=s.getFcsjActualTime(); | ||
| 2411 | + String time=s.getFcsjActual(); | ||
| 2412 | + String[] fcsjStr = time.split(":"); | ||
| 2413 | + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | ||
| 2414 | + if(i<listInfo.size()-1){ | ||
| 2415 | + Long djg=0l; | ||
| 2416 | + Long fscjNext=listInfo.get(i+1).getFcsjActualTime(); | ||
| 2417 | + if((fcsj>=zgf1&&fcsj<=zgf2)||(fcsj>=wgf1&&fcsj<=wgf2)){ | ||
| 2418 | + djg = (long) (peak*60*1000); | ||
| 2419 | + if(fscjNext-fcsjTime>djg){ | ||
| 2420 | + djgcs ++; | ||
| 2421 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 2422 | + m.put("xlName", BasicData.lineCode2NameMap.get(line)); | ||
| 2423 | + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 2424 | + m.put("djgde", grade); | ||
| 2425 | + m.put("qJh", s.getFcsj()); | ||
| 2426 | + m.put("qSj", time); | ||
| 2427 | + m.put("hJh", listInfo.get(i+1).getFcsj()); | ||
| 2428 | + m.put("hSj", listInfo.get(i+1).getFcsjActual()); | ||
| 2429 | + mapList.add(m); | ||
| 2430 | + } | ||
| 2431 | + }else{ | ||
| 2432 | + djg = (long) (trough*60*1000); | ||
| 2433 | + if(fscjNext-fcsjTime>djg){ | ||
| 2434 | + djgcs ++; | ||
| 2435 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 2436 | + m.put("xlName", BasicData.lineCode2NameMap.get(line)); | ||
| 2437 | + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 2438 | + m.put("djgde", grade); | ||
| 2439 | + m.put("qJh", s.getFcsj()); | ||
| 2440 | + m.put("qSj", time); | ||
| 2441 | + m.put("hJh", listInfo.get(i+1).getFcsj()); | ||
| 2442 | + m.put("hSj", listInfo.get(i+1).getFcsjActual()); | ||
| 2443 | + mapList.add(m); | ||
| 2444 | + } | ||
| 2445 | + } | ||
| 2446 | + } | ||
| 2447 | + } | ||
| 2448 | + double fsl=0.0; | ||
| 2449 | + if(sjbcs>0){ | ||
| 2450 | + fsl=Arith.div(djgcs,sjbcs, 2)*100; | ||
| 2451 | + } | ||
| 2452 | + | ||
| 2453 | + map.put("djgcs", djgcs); | ||
| 2454 | + map.put("fsl", df.format(fsl)+"%"); | ||
| 2455 | + map.put("djgxx", mapList); | ||
| 2456 | + return map; | ||
| 2457 | + } | ||
| 2458 | + | ||
| 2459 | +} | ||
| 2460 | + | ||
| 2461 | +class ComparableAcuals implements Comparator<ScheduleRealInfo>{ | ||
| 2462 | + | ||
| 2463 | + @Override | ||
| 2464 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | ||
| 2465 | + // TODO Auto-generated method stub | ||
| 2466 | + return o1.getFcsjActualTime().compareTo(o2.getFcsjActualTime()); | ||
| 2467 | + } | ||
| 2468 | + | ||
| 2225 | } | 2469 | } |
src/main/resources/static/pages/base/line/details.html
| @@ -191,46 +191,7 @@ | @@ -191,46 +191,7 @@ | ||
| 191 | <!-- 是否撤销 START --> | 191 | <!-- 是否撤销 START --> |
| 192 | </div> | 192 | </div> |
| 193 | <!-- 表单分组组件 form-group END --> | 193 | <!-- 表单分组组件 form-group END --> |
| 194 | - <!-- 表单分组组件 form-group START --> | ||
| 195 | - <div class="form-group"> | ||
| 196 | - <!-- 是否营运START (因为options值基本固定,所以在页面固定。【以后可以根具需求修改成使用字典表实现】) --> | ||
| 197 | - <div class="col-md-6"> | ||
| 198 | - <label class="control-label col-md-5"> | ||
| 199 | - <span class="required"> * </span>是否营运线路 : | ||
| 200 | - </label> | ||
| 201 | - <div class="col-md-4"> | ||
| 202 | - <div class="md-radio-inline"> | ||
| 203 | - <div class="md-radio"> | ||
| 204 | - <input type="radio" id="radio18" name="sfyy" class="md-radiobtn" value="1" data-title="是" checked="checked" > | ||
| 205 | - <label for="radio18"> | ||
| 206 | - <span></span> | ||
| 207 | - <span class="check"></span> | ||
| 208 | - <span class="box"></span> 是 | ||
| 209 | - </label> | ||
| 210 | - </div> | ||
| 211 | - <div class="md-radio has-error"> | ||
| 212 | - <input type="radio" id="radio19" name="sfyy" class="md-radiobtn" value="0" data-title="否" > | ||
| 213 | - <label for="radio19" style="color:#FFC0CB"> | ||
| 214 | - <span></span> | ||
| 215 | - <span class="check"></span> | ||
| 216 | - <span class="box"></span> 否 | ||
| 217 | - </label> | ||
| 218 | - </div> | ||
| 219 | - </div> | ||
| 220 | - </div> | ||
| 221 | - </div> | ||
| 222 | - <!-- 是否营运 END --> | ||
| 223 | - <!-- 权证车辆数 START --> | ||
| 224 | - <div class="col-md-6"> | ||
| 225 | - <label class="control-label col-md-5"> 权证车辆数 : </label> | ||
| 226 | - <div class="col-md-4"> | ||
| 227 | - <input type="text" class="form-control" name="warrantCar" id="warrantCarInput" placeholder="权证车辆数"> | ||
| 228 | - </div> | ||
| 229 | - </div> | ||
| 230 | - <!-- 权证车辆数 END --> | ||
| 231 | - | ||
| 232 | - </div> | ||
| 233 | - <!-- 表单分组组件 form-group END --> | 194 | + |
| 234 | <!-- 表单分组组件 form-group START --> | 195 | <!-- 表单分组组件 form-group START --> |
| 235 | <div class="form-group"> | 196 | <div class="form-group"> |
| 236 | <!-- 起始站名称 START (该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值) --> | 197 | <!-- 起始站名称 START (该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值) --> |
| @@ -321,20 +282,14 @@ | @@ -321,20 +282,14 @@ | ||
| 321 | </div> | 282 | </div> |
| 322 | <!-- 线路规划类型 (* 必填项) END --> | 283 | <!-- 线路规划类型 (* 必填项) END --> |
| 323 | 284 | ||
| 324 | - <!--大间隔等级 START --> | 285 | + <!-- 开辟日期 START --> |
| 325 | <div class="col-md-6"> | 286 | <div class="col-md-6"> |
| 326 | - <label class="control-label col-md-5"> 大间隔等级 : </label> | 287 | + <label class="control-label col-md-5"> 开辟日期 : </label> |
| 327 | <div class="col-md-4"> | 288 | <div class="col-md-4"> |
| 328 | - <select name="spacGrade" class="form-control" id="spacGradeSelect"> | ||
| 329 | - <option value="">-- 请选择大间隔等级 --</option> | ||
| 330 | - <option value="1">一级</option> | ||
| 331 | - <option value="2">二级</option> | ||
| 332 | - <option value="3">三级</option> | ||
| 333 | - <option value="4">四级</option> | ||
| 334 | - </select> | 289 | + <input type="text" class="form-control" name="openDate" id="openDateInput" placeholder="开辟日期"> |
| 335 | </div> | 290 | </div> |
| 336 | </div> | 291 | </div> |
| 337 | - <!-- 大间隔等级END --> | 292 | + <!-- 开辟日期 END --> |
| 338 | </div> | 293 | </div> |
| 339 | <!-- 表单分组组件 form-group START --> | 294 | <!-- 表单分组组件 form-group START --> |
| 340 | 295 | ||
| @@ -436,15 +391,6 @@ | @@ -436,15 +391,6 @@ | ||
| 436 | </div> | 391 | </div> |
| 437 | </div> | 392 | </div> |
| 438 | <!-- 空调车辆数 END --> | 393 | <!-- 空调车辆数 END --> |
| 439 | - | ||
| 440 | - <!-- 开辟日期 START --> | ||
| 441 | - <div class="col-md-6"> | ||
| 442 | - <label class="control-label col-md-5"> 开辟日期 : </label> | ||
| 443 | - <div class="col-md-4"> | ||
| 444 | - <input type="text" class="form-control" name="openDate" id="openDateInput" placeholder="开辟日期"> | ||
| 445 | - </div> | ||
| 446 | - </div> | ||
| 447 | - <!-- 开辟日期 END --> | ||
| 448 | </div> | 394 | </div> |
| 449 | <!-- 表单分组组件 form-group END --> | 395 | <!-- 表单分组组件 form-group END --> |
| 450 | 396 |
src/main/resources/static/pages/base/line/edit.html
| @@ -43,7 +43,7 @@ | @@ -43,7 +43,7 @@ | ||
| 43 | <!-- 表单内容 START --> | 43 | <!-- 表单内容 START --> |
| 44 | <div class="form-body"> | 44 | <div class="form-body"> |
| 45 | <input type="hidden" name="id" id="lineId"> | 45 | <input type="hidden" name="id" id="lineId"> |
| 46 | - <input type="hidden" name="inUse" id="inUse"> | 46 | + |
| 47 | <!-- 表单分组组件 form-group START --> | 47 | <!-- 表单分组组件 form-group START --> |
| 48 | <div class="form-group"> | 48 | <div class="form-group"> |
| 49 | <!-- 线路编码 (* 必填项) START --> | 49 | <!-- 线路编码 (* 必填项) START --> |
| @@ -199,46 +199,7 @@ | @@ -199,46 +199,7 @@ | ||
| 199 | <!-- 是否撤销 START --> | 199 | <!-- 是否撤销 START --> |
| 200 | </div> | 200 | </div> |
| 201 | <!-- 表单分组组件 form-group END --> | 201 | <!-- 表单分组组件 form-group END --> |
| 202 | - <!-- 表单分组组件 form-group START --> | ||
| 203 | - <div class="form-group"> | ||
| 204 | - <!-- 是否营运START (因为options值基本固定,所以在页面固定。【以后可以根具需求修改成使用字典表实现】) --> | ||
| 205 | - <div class="col-md-6"> | ||
| 206 | - <label class="control-label col-md-5"> | ||
| 207 | - <span class="required"> * </span>是否营运线路 : | ||
| 208 | - </label> | ||
| 209 | - <div class="col-md-4"> | ||
| 210 | - <div class="md-radio-inline"> | ||
| 211 | - <div class="md-radio"> | ||
| 212 | - <input type="radio" id="radio18" name="sfyy" class="md-radiobtn" value="1" data-title="是" checked="checked" > | ||
| 213 | - <label for="radio18"> | ||
| 214 | - <span></span> | ||
| 215 | - <span class="check"></span> | ||
| 216 | - <span class="box"></span> 是 | ||
| 217 | - </label> | ||
| 218 | - </div> | ||
| 219 | - <div class="md-radio has-error"> | ||
| 220 | - <input type="radio" id="radio19" name="sfyy" class="md-radiobtn" value="0" data-title="否" > | ||
| 221 | - <label for="radio19" style="color:#FFC0CB"> | ||
| 222 | - <span></span> | ||
| 223 | - <span class="check"></span> | ||
| 224 | - <span class="box"></span> 否 | ||
| 225 | - </label> | ||
| 226 | - </div> | ||
| 227 | - </div> | ||
| 228 | - </div> | ||
| 229 | - </div> | ||
| 230 | - <!-- 是否营运 END --> | ||
| 231 | - | ||
| 232 | - <!-- 权证车辆数 START --> | ||
| 233 | - <div class="col-md-6"> | ||
| 234 | - <label class="control-label col-md-5"> 权证车辆数 : </label> | ||
| 235 | - <div class="col-md-4"> | ||
| 236 | - <input type="text" class="form-control" name="warrantCar" id="warrantCarInput" placeholder="权证车辆数"> | ||
| 237 | - </div> | ||
| 238 | - </div> | ||
| 239 | - <!-- 权证车辆数 END --> | ||
| 240 | - </div> | ||
| 241 | - <!-- 表单分组组件 form-group END --> | 202 | + |
| 242 | <!-- 表单分组组件 form-group START --> | 203 | <!-- 表单分组组件 form-group START --> |
| 243 | <div class="form-group"> | 204 | <div class="form-group"> |
| 244 | <!-- 起始站名称 START (该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值) --> | 205 | <!-- 起始站名称 START (该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值) --> |
| @@ -329,20 +290,14 @@ | @@ -329,20 +290,14 @@ | ||
| 329 | </div> | 290 | </div> |
| 330 | <!-- 线路规划类型 (* 必填项) END --> | 291 | <!-- 线路规划类型 (* 必填项) END --> |
| 331 | 292 | ||
| 332 | - <!--大间隔等级 START --> | 293 | + <!-- 开辟日期 START --> |
| 333 | <div class="col-md-6"> | 294 | <div class="col-md-6"> |
| 334 | - <label class="control-label col-md-5"> 大间隔等级 : </label> | 295 | + <label class="control-label col-md-5"> 开辟日期 : </label> |
| 335 | <div class="col-md-4"> | 296 | <div class="col-md-4"> |
| 336 | - <select name="spacGrade" class="form-control" id="spacGradeSelect"> | ||
| 337 | - <option value="">-- 请选择大间隔等级 --</option> | ||
| 338 | - <option value="1">一级</option> | ||
| 339 | - <option value="2">二级</option> | ||
| 340 | - <option value="3">三级</option> | ||
| 341 | - <option value="4">四级</option> | ||
| 342 | - </select> | 297 | + <input type="text" class="form-control" name="openDate" id="openDateInput" placeholder="开辟日期"> |
| 343 | </div> | 298 | </div> |
| 344 | </div> | 299 | </div> |
| 345 | - <!-- 大间隔等级END --> | 300 | + <!-- 开辟日期 END --> |
| 346 | </div> | 301 | </div> |
| 347 | <!-- 表单分组组件 form-group START --> | 302 | <!-- 表单分组组件 form-group START --> |
| 348 | 303 | ||
| @@ -444,15 +399,6 @@ | @@ -444,15 +399,6 @@ | ||
| 444 | </div> | 399 | </div> |
| 445 | </div> | 400 | </div> |
| 446 | <!-- 空调车辆数 END --> | 401 | <!-- 空调车辆数 END --> |
| 447 | - | ||
| 448 | - <!-- 开辟日期 START --> | ||
| 449 | - <div class="col-md-6"> | ||
| 450 | - <label class="control-label col-md-5"> 开辟日期 : </label> | ||
| 451 | - <div class="col-md-4"> | ||
| 452 | - <input type="text" class="form-control" name="openDate" id="openDateInput" placeholder="开辟日期"> | ||
| 453 | - </div> | ||
| 454 | - </div> | ||
| 455 | - <!-- 开辟日期 END --> | ||
| 456 | </div> | 402 | </div> |
| 457 | <!-- 表单分组组件 form-group END --> | 403 | <!-- 表单分组组件 form-group END --> |
| 458 | 404 |
src/main/resources/static/pages/base/line/editRoute.html
0 → 100644
| 1 | +<!-- 手动添加站点 --> | ||
| 2 | +<div class="modal fade" id="edit_route_mobal" tabindex="-1" role="basic" aria-hidden="true"> | ||
| 3 | + | ||
| 4 | + <div class="modal-dialog"> | ||
| 5 | + | ||
| 6 | + <div class="modal-content"> | ||
| 7 | + | ||
| 8 | + <div class="modal-header"> | ||
| 9 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | ||
| 10 | + <h4 class="modal-title">生成路线(站点和路段)</h4> | ||
| 11 | + </div> | ||
| 12 | + | ||
| 13 | + <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> | ||
| 18 | + 您的输入有误,请检查下面的输入项 | ||
| 19 | + </div> | ||
| 20 | + | ||
| 21 | + <!-- 站点名称 --> | ||
| 22 | + <div class="form-body"> | ||
| 23 | + | ||
| 24 | + <div class="form-group"> | ||
| 25 | + <label class="control-label col-md-2"> | ||
| 26 | + <span class="required"> * </span> 坐标: | ||
| 27 | + </label> | ||
| 28 | + <div class="col-md-10"> | ||
| 29 | + <textarea class="form-control" rows="12" name="points" id="pointInput" placeholder="坐标点"></textarea> | ||
| 30 | + </div> | ||
| 31 | + </div> | ||
| 32 | + </div> | ||
| 33 | + <div class="form-group"> | ||
| 34 | + <label class="col-md-3 control-label">选择方向:</label> | ||
| 35 | + <div class="col-md-9"> | ||
| 36 | + <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> | ||
| 43 | + </div> | ||
| 44 | + </div> | ||
| 45 | + </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 | + 请在文本域中按顺序依次输坐标点(如果是站点,请将在坐标后面用【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> | ||
| 60 | + </form> | ||
| 61 | + </div> | ||
| 62 | + <div class="modal-footer"> | ||
| 63 | + <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button> | ||
| 64 | + <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button> | ||
| 65 | + </div> | ||
| 66 | + </div> | ||
| 67 | + </div> | ||
| 68 | +</div> | ||
| 69 | +<script type="text/javascript"> | ||
| 70 | + | ||
| 71 | +$('#edit_route_mobal').on('editRouteMobal.show', function(e,transGPS,editRoute,map,dra,ajaxd,fun){ | ||
| 72 | + // 延迟加载显示mobal | ||
| 73 | + setTimeout(function(){$('#edit_route_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200); | ||
| 74 | + // 获取表单元素 | ||
| 75 | + var form = $('#save_route_template_form'); | ||
| 76 | + | ||
| 77 | + // 获取错误提示信息元素 | ||
| 78 | + var error = $('.alert-danger', form); | ||
| 79 | + | ||
| 80 | + // 提交数据点击事件 | ||
| 81 | + $('.modal-footer #templateSaveData').on('click',function() { | ||
| 82 | + form.submit(); | ||
| 83 | + }); | ||
| 84 | + // 表单验证 | ||
| 85 | + form.validate({ | ||
| 86 | + | ||
| 87 | + errorElement : 'span', | ||
| 88 | + | ||
| 89 | + errorClass : 'help-block help-block-error', | ||
| 90 | + | ||
| 91 | + focusInvalid : false, | ||
| 92 | + | ||
| 93 | + rules : { | ||
| 94 | + | ||
| 95 | + 'points' : { | ||
| 96 | + | ||
| 97 | + required : true, | ||
| 98 | + | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + }, | ||
| 102 | + | ||
| 103 | + invalidHandler : function(event, validator) { | ||
| 104 | + | ||
| 105 | + error.show(); | ||
| 106 | + | ||
| 107 | + App.scrollTo(error, -200); | ||
| 108 | + | ||
| 109 | + }, | ||
| 110 | + | ||
| 111 | + highlight : function(element) { | ||
| 112 | + | ||
| 113 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 114 | + | ||
| 115 | + }, | ||
| 116 | + | ||
| 117 | + unhighlight : function(element) { | ||
| 118 | + | ||
| 119 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 120 | + | ||
| 121 | + }, | ||
| 122 | + | ||
| 123 | + success : function(label) { | ||
| 124 | + | ||
| 125 | + label.closest('.form-group').removeClass('has-error'); | ||
| 126 | + | ||
| 127 | + }, | ||
| 128 | + submitHandler : function(f) { | ||
| 129 | + // 隐藏手动规划弹出层 | ||
| 130 | + $('#edit_route_mobal').modal('hide'); | ||
| 131 | + // 获取线路对象 | ||
| 132 | + var line = editRoute.getLineObj(); | ||
| 133 | + // 原坐标类型 | ||
| 134 | + var baseRes = "WGS84"; | ||
| 135 | + // 定义线路名称 | ||
| 136 | + var lineNameV = $('.portlet-title .caption').text(); | ||
| 137 | + var dirStr = ''; | ||
| 138 | + // 路线方向 | ||
| 139 | + var directionData = $("input[name='dirCheck']:checked").val(); | ||
| 140 | + editRoute.setLineDir(directionData); | ||
| 141 | + // 弹出正在加载层 | ||
| 142 | + var i = layer.load(0,{offset:['200px', '280px']}); | ||
| 143 | + // 表单序列化 | ||
| 144 | + var paramsForm = form.serializeJSON(); | ||
| 145 | + // 切割坐标点 | ||
| 146 | + var array = paramsForm.points.split('\r\n'); | ||
| 147 | + // 把坐标点转换为站点或路段 | ||
| 148 | + var arrayFormat = inputStationValueFormat(array); | ||
| 149 | + var stationList = arrayFormat.stationList; | ||
| 150 | + var sectionListTemp = arrayFormat.sectionList; | ||
| 151 | + var sectionList = []; | ||
| 152 | + // 隔50个取一个点(相当于50s) | ||
| 153 | + for(var i = 0; i*40 < sectionListTemp.length; i++) { | ||
| 154 | + sectionList[i] = sectionListTemp[i*40]; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + var sectionListFinal = []; | ||
| 158 | + sectionListFinal.push({sectionName : lineNameV, points : sectionList}); | ||
| 159 | + // 根据站点名称获取百度坐标 | ||
| 160 | + map.stationsPointsToLibraryPoint(stationList,function(resultJson) { | ||
| 161 | + // 根据坐标点获取两点之间的时间与距离 | ||
| 162 | + map.getDistanceAndDuration(resultJson,function(stationdataList) { | ||
| 163 | + // 设置第一个站的距离 | ||
| 164 | + stationdataList[0].distance = ''; | ||
| 165 | + // 设置第一个站的时间 | ||
| 166 | + stationdataList[0].duration = ''; | ||
| 167 | + // 定义站点信息JSON字符串 | ||
| 168 | + var stationJSON = JSON.stringify(stationdataList); | ||
| 169 | + // 参数集合 | ||
| 170 | + var params = {}; | ||
| 171 | + params.baseRes = baseRes; | ||
| 172 | + // 是否添加该站点 | ||
| 173 | + | ||
| 174 | + // 站点信息JSON字符串 | ||
| 175 | + params.stationJSON = stationJSON; | ||
| 176 | + // 线路ID | ||
| 177 | + params.lineId = line.id; | ||
| 178 | + // 方向 | ||
| 179 | + params.directions = directionData; | ||
| 180 | + // 原始坐标类型 | ||
| 181 | + params.dbType = 'b'; | ||
| 182 | + // 圆形半径 | ||
| 183 | + params.radius = '100'; | ||
| 184 | + // 限速 | ||
| 185 | + params.speedLimit = '60'; | ||
| 186 | + // 图形类型(r:圆形;p:多边形) | ||
| 187 | + params.shapesType = 'r'; | ||
| 188 | + // destroy:是否撤销 | ||
| 189 | + params.destroy = '0'; | ||
| 190 | + // versions:版本号 | ||
| 191 | + params.versions = '1'; | ||
| 192 | + // 定义路段信息字符串 | ||
| 193 | + var sectionJSON = JSON.stringify(sectionListFinal); | ||
| 194 | + // 路段信息JSON字符串 | ||
| 195 | + params.sectionJSON = sectionJSON; | ||
| 196 | + addSave(params,line.id,directionData); | ||
| 197 | + }); | ||
| 198 | + | ||
| 199 | + }); | ||
| 200 | + }, | ||
| 201 | + | ||
| 202 | + }); | ||
| 203 | + | ||
| 204 | + function inputStationValueFormat(paramsStationsArray) { | ||
| 205 | + var stationList = []; | ||
| 206 | + var sectionList = []; | ||
| 207 | + var routeList = {"stationList":stationList, "sectionList":sectionList}; | ||
| 208 | + var len = paramsStationsArray.length; | ||
| 209 | + // 处理相同站点判断值 | ||
| 210 | + var isPush = true; | ||
| 211 | + for(var k =0;k<len;k++) { | ||
| 212 | + if(paramsStationsArray[k]=="") | ||
| 213 | + continue; | ||
| 214 | + var tempStr = paramsStationsArray[k].split('\t'); | ||
| 215 | + var tempPoint = transGpsLoc(tempStr[0],tempStr[1]); | ||
| 216 | + var point = {lng:tempPoint.lng, lat:tempPoint.lat}; | ||
| 217 | + if(tempStr.length < 4){ | ||
| 218 | + sectionList[k] = point; | ||
| 219 | + isPush = true; | ||
| 220 | + }else { | ||
| 221 | + if(isPush) { | ||
| 222 | + sectionList[k] = point; | ||
| 223 | + stationList.push({name:tempStr[3], potion:{lng:tempPoint.lng, lat:tempPoint.lat} , wgs:{x:tempStr[0], y:tempStr[1]}}); | ||
| 224 | + } | ||
| 225 | + isPush = false; | ||
| 226 | + } | ||
| 227 | + } | ||
| 228 | + for(var i = 0 ;i<sectionList.length;i++) { | ||
| 229 | + if(sectionList[i] == "" || typeof(sectionList[i]) == "undefined" || sectionList[i] == null) { | ||
| 230 | + sectionList.splice(i,1); | ||
| 231 | + i= i-1; | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + } | ||
| 235 | + return routeList; | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + function transGpsLoc(lng,lat) { | ||
| 239 | + var bdLoc = transGPS.locationMake(lng, lat); | ||
| 240 | + var gcjLoc = transGPS.transformFromWGSToGCJ(bdLoc); | ||
| 241 | + var bdEn = transGPS.bd_encrypt(gcjLoc); | ||
| 242 | + return bdEn; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + function addSave(params,lineid,directionData) { | ||
| 246 | + // 保存 | ||
| 247 | + $post("/station/cacheSave",params,function(rd) { | ||
| 248 | + // 关闭弹出层 | ||
| 249 | + layer.closeAll(); | ||
| 250 | + if(rd.status='SUCCESS') { | ||
| 251 | + layer.msg('生成路线成功!'); | ||
| 252 | + var stationD = rd.stationData,isNullStr = ''; | ||
| 253 | + for(var t = 0 ;t<stationD.length;t++) { | ||
| 254 | + if(stationD[t].potion.lat =='' || stationD[t].potion.lat ==null || | ||
| 255 | + stationD[t].potion.lng =='' || stationD[t].potion.lng ==null) | ||
| 256 | + isNullStr = isNullStr + stationD[t].name + ' , '; | ||
| 257 | + } | ||
| 258 | + if(isNullStr!='') { | ||
| 259 | + layer.open({ | ||
| 260 | + title: '提示', | ||
| 261 | + content:'【' + isNullStr + '】' + '地址系统无法解析!,请手动调整位置!' | ||
| 262 | + }); | ||
| 263 | + } | ||
| 264 | + // 清除地图覆盖物 | ||
| 265 | + map.clearMarkAndOverlays(); | ||
| 266 | + // 查询路段信息 | ||
| 267 | + $get('/sectionroute/findSectionCache',{'line.id_eq' : lineid , 'directions_eq' : directionData},function(data) { | ||
| 268 | + // 在地图上画出线路走向 | ||
| 269 | + fun.linePanlThree(lineid,data,directionData); | ||
| 270 | + }); | ||
| 271 | + $('#cutSection').removeClass('hidden'); | ||
| 272 | + $('#Undo').removeClass('hidden'); | ||
| 273 | + $('#uploadRoute').addClass('hidden'); | ||
| 274 | + layer.msg('请先编辑路段,然后放大地图切点,不然数据可能会有误差!!!'); | ||
| 275 | + }else { | ||
| 276 | + layer.msg('生成路线失败!'); | ||
| 277 | + } | ||
| 278 | + }); | ||
| 279 | + } | ||
| 280 | +}); | ||
| 281 | +</script> | ||
| 0 | \ No newline at end of file | 282 | \ No newline at end of file |
src/main/resources/static/pages/base/line/editsection.html
0 → 100644
| 1 | +<!-- 编辑路段 --> | ||
| 2 | +<div class="modal fade" id="edit_section_mobal_cache" role="basic" aria-hidden="true"> | ||
| 3 | + <div class="modal-dialog"> | ||
| 4 | + <div class="modal-content"> | ||
| 5 | + <div class="modal-header"> | ||
| 6 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | ||
| 7 | + <h4 class="modal-title">路段修改</h4> | ||
| 8 | + </div> | ||
| 9 | + <div class="modal-body"> | ||
| 10 | + <form class="form-horizontal" role="form" id="edit_section_form_cache" action="" method="post"> | ||
| 11 | + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> | ||
| 12 | + 您的输入有误,请检查下面的输入项 | ||
| 13 | + </div> | ||
| 14 | + <!-- 线路ID --> | ||
| 15 | + <input type="hidden" name="sectionId" id="sectionIdInput"> | ||
| 16 | + <input type="hidden" name="sectionRouteId" id="sectionRouteIdInput"> | ||
| 17 | + <input type="hidden" name="sectionRouteLine" id="sectionRouteLineInput"> | ||
| 18 | + <input type="hidden" name="lineCode" id="lineCodeInput"> | ||
| 19 | + <input type="hidden" name="bsectionVector" id="bsectionVectorInput" /> | ||
| 20 | + <input type="hidden" name="csectionVector" id="csectionVectorInput" value=""/> | ||
| 21 | + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/> | ||
| 22 | + <input type="hidden" name="isRoadeSpeed" id="isRoadeSpeedInput"/> | ||
| 23 | + <!-- 路段名称 --> | ||
| 24 | + <div class="form-body"> | ||
| 25 | + <div class="form-group"> | ||
| 26 | + <label class="control-label col-md-3"> | ||
| 27 | + <span class="required"> * </span> 路段名称: | ||
| 28 | + </label> | ||
| 29 | + <div class="col-md-6"> | ||
| 30 | + <input type="text" class="form-control" name="sectionName" id="sectionNameInput" placeholder="路段名称"> | ||
| 31 | + </div> | ||
| 32 | + </div> | ||
| 33 | + </div> | ||
| 34 | + <!-- 路段编码 --> | ||
| 35 | + <div class="form-body"> | ||
| 36 | + <div class="form-group"> | ||
| 37 | + <label class="control-label col-md-3"> | ||
| 38 | + <span class="required"> * </span> 路段编码: | ||
| 39 | + </label> | ||
| 40 | + <div class="col-md-6"> | ||
| 41 | + <input type="text" class="form-control" name="sectionCode" id="sectionCodeInput" placeholder="路段编码" readonly="readonly"> | ||
| 42 | + </div> | ||
| 43 | + </div> | ||
| 44 | + </div> | ||
| 45 | + <!-- 路段序号 --> | ||
| 46 | + <div class="form-body"> | ||
| 47 | + <div class="form-group"> | ||
| 48 | + <label class="control-label col-md-3"> | ||
| 49 | + 上一路段: | ||
| 50 | + </label> | ||
| 51 | + <div class="col-md-6"> | ||
| 52 | + <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect" style="width:100%"></select> | ||
| 53 | + <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span> | ||
| 54 | + </div> | ||
| 55 | + </div> | ||
| 56 | + </div> | ||
| 57 | + <!-- 路段方向 --> | ||
| 58 | + <div class="form-body"> | ||
| 59 | + <div class="form-group"> | ||
| 60 | + <label class="control-label col-md-3"> | ||
| 61 | + <span class="required"> * </span>路段方向: | ||
| 62 | + </label> | ||
| 63 | + <div class="col-md-6"> | ||
| 64 | + <select name="directions" class="form-control" id="directionsSection"> | ||
| 65 | + <option value="">-- 请选择路段类型 --</option> | ||
| 66 | + <option value="0">上行</option> | ||
| 67 | + <option value="1">下行</option> | ||
| 68 | + </select> | ||
| 69 | + </div> | ||
| 70 | + </div> | ||
| 71 | + </div> | ||
| 72 | + <!-- 路段限速 --> | ||
| 73 | + <div class="form-body"> | ||
| 74 | + <div class="form-group"> | ||
| 75 | + <label class="control-label col-md-3"> | ||
| 76 | + <span class="required"> * </span> 路段限速: | ||
| 77 | + </label> | ||
| 78 | + <div class="col-md-6"> | ||
| 79 | + <input type="text" class="form-control" name="speedLimit" id="speedLimitInput" placeholder="路段限速"> | ||
| 80 | + </div> | ||
| 81 | + </div> | ||
| 82 | + </div> | ||
| 83 | + <!-- 是否撤销 --> | ||
| 84 | + <div class="form-body"> | ||
| 85 | + <div class="form-group"> | ||
| 86 | + <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销:</label> | ||
| 87 | + <div class="col-md-6"> | ||
| 88 | + <select name="destroy" class="form-control" id="destroySelect"> | ||
| 89 | + <option value="">-- 请选择撤销类型 --</option> | ||
| 90 | + <option value="0">否</option> | ||
| 91 | + <option value="1">是</option> | ||
| 92 | + </select> | ||
| 93 | + </div> | ||
| 94 | + </div> | ||
| 95 | + </div> | ||
| 96 | + <!-- 道路编码--> | ||
| 97 | + <div class="form-body"> | ||
| 98 | + <div class="form-group"> | ||
| 99 | + <label class="control-label col-md-3">道路编码:</label> | ||
| 100 | + <div class="col-md-6"> | ||
| 101 | + <input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput" placeholder="道路编码"> | ||
| 102 | + </div> | ||
| 103 | + </div> | ||
| 104 | + </div> | ||
| 105 | + <!-- 路段长度 --> | ||
| 106 | + <div class="form-body"> | ||
| 107 | + <div class="form-group"> | ||
| 108 | + <label class="col-md-3 control-label">路段长度:</label> | ||
| 109 | + <div class="col-md-6"> | ||
| 110 | + <input type="text" class="form-control" name="sectionDistance" id="sectionDistanceInput" placeholder="路段长度"> | ||
| 111 | + <span class="help-block">单位:公里(km)</span> | ||
| 112 | + </div> | ||
| 113 | + </div> | ||
| 114 | + </div> | ||
| 115 | + <!-- 路段历时 --> | ||
| 116 | + <div class="form-body"> | ||
| 117 | + <div class="form-group"> | ||
| 118 | + <label class="col-md-3 control-label">路段历时:</label> | ||
| 119 | + <div class="col-md-6"> | ||
| 120 | + <input type="text" class="form-control" name="sectionTime" id="sectionTimeInput" placeholder="路段历时"> | ||
| 121 | + <span class="help-block">单位:分钟(min)</span> | ||
| 122 | + </div> | ||
| 123 | + </div> | ||
| 124 | + </div> | ||
| 125 | + <!-- 版本号 --> | ||
| 126 | + <div class="form-body"> | ||
| 127 | + <div class="form-group"> | ||
| 128 | + <label class="col-md-3 control-label">版本号 :</label> | ||
| 129 | + <div class="col-md-6"> | ||
| 130 | + <input type="text" class="form-control" name="versions" id="versionsInput" Readonly> | ||
| 131 | + </div> | ||
| 132 | + </div> | ||
| 133 | + </div> | ||
| 134 | + <!-- 描述/说明 --> | ||
| 135 | + <div class="form-group"> | ||
| 136 | + <label class="control-label col-md-3"> 描述/说明: </label> | ||
| 137 | + <div class="col-md-6"> | ||
| 138 | + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> | ||
| 139 | + </div> | ||
| 140 | + </div> | ||
| 141 | + </form> | ||
| 142 | + </div> | ||
| 143 | + <div class="modal-footer"> | ||
| 144 | + <button type="button" class="btn default" data-dismiss="modal">取消</button> | ||
| 145 | + <button type="button" class="btn btn-primary" id="editSectionCacheButton">提交数据</button> | ||
| 146 | + </div> | ||
| 147 | + </div> | ||
| 148 | + </div> | ||
| 149 | +</div> | ||
| 150 | +<script type="text/javascript"> | ||
| 151 | + | ||
| 152 | +$('#edit_section_mobal_cache').on('editSectionMobalCache_show', function(e, map_,ajaxd,section,fun){ | ||
| 153 | + var Section = section.getEitdSection(); | ||
| 154 | + fun.setSectionFormValue(Section); | ||
| 155 | + // 方向 | ||
| 156 | + var dir = Section.sectionrouteDirections; | ||
| 157 | + var lineId = Section.sectionrouteLine; | ||
| 158 | + // 获取路段号元素,并添加下拉属性值 | ||
| 159 | + ajaxd.getStation(lineId,dir,function(treeData) { | ||
| 160 | + var array = treeData[0].children[1].children,paramsD =new Array(); | ||
| 161 | + var eq_scetionRouteCode = Section.sectionrouteCode; | ||
| 162 | + paramsD.push({'id':'请选择...','text':'请选择...'}); | ||
| 163 | + // 遍历. | ||
| 164 | + $.each(array, function(i, g){ | ||
| 165 | + // 判断. | ||
| 166 | + if(g.sectionName!='' || g.sectionName != null) { | ||
| 167 | + var ptions_v = g.sectionrouteCode; | ||
| 168 | + if(eq_scetionRouteCode != ptions_v){ | ||
| 169 | + // 添加拼音检索下拉框格式数据数组. | ||
| 170 | + paramsD.push({'id':ptions_v, | ||
| 171 | + 'text':g.sectionName + '(' + ptions_v + ')' + ' --' + fun.dirdmToName(g.sectionrouteDirections)}); | ||
| 172 | + } | ||
| 173 | + } | ||
| 174 | + }); | ||
| 175 | + // 初始化上一个路段拼音检索下拉框. | ||
| 176 | + initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) { | ||
| 177 | + $('#sectionDirSelect').val('');// 设值方向. | ||
| 178 | + ajaxd.findUpSectionRouteCode(lineId,dir,eq_scetionRouteCode,function(str) { | ||
| 179 | + if(str.length>0){ | ||
| 180 | + var upStationRouteCode = str[0].sectionrouteCode; | ||
| 181 | + $('#sectionrouteCodeSelect').select2('val',upStationRouteCode); | ||
| 182 | + }else { | ||
| 183 | + $('#sectionrouteCodeSelect').select2('val','请选择...'); | ||
| 184 | + } | ||
| 185 | + }); | ||
| 186 | + }); | ||
| 187 | + }); | ||
| 188 | + // 显示mobal | ||
| 189 | + $('#edit_section_mobal_cache').modal({show : true,backdrop: 'static',keyboard: false}); | ||
| 190 | + // 当调用 hide 实例方法时触发 | ||
| 191 | + $('#edit_section_mobal_cache').on('hide.bs.modal', function () { | ||
| 192 | + closeMobleSetClean(); | ||
| 193 | + }); | ||
| 194 | + function closeMobleSetClean() { | ||
| 195 | + // 清除地图覆盖物 | ||
| 196 | + map_.clearMarkAndOverlays(); | ||
| 197 | + /** 设置修改路段集合对象为空 */ | ||
| 198 | + section.setEitdSection({}); | ||
| 199 | + // fun.editAChangeCssRemoveDisabled(); | ||
| 200 | + $get('/sectionroute/findSectionCache',{'line.id_eq' : lineId , 'directions_eq' : dir},function(data) { | ||
| 201 | + fun.linePanlThree(lineId,data,dir); | ||
| 202 | + }); | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + // 编辑表单元素 | ||
| 206 | + var form = $('#edit_section_form_cache'); | ||
| 207 | + // 获取错误提示元素 | ||
| 208 | + var error = $('.alert-danger', form); | ||
| 209 | + // 提交数据按钮事件 | ||
| 210 | + $('#editSectionCacheButton').on('click', function() { | ||
| 211 | + // 表单提交 | ||
| 212 | + form.submit(); | ||
| 213 | + }); | ||
| 214 | + // 表单验证 | ||
| 215 | + form.validate({ | ||
| 216 | + errorElement : 'span', | ||
| 217 | + errorClass : 'help-block help-block-error', | ||
| 218 | + focusInvalid : false, | ||
| 219 | + rules : { | ||
| 220 | + 'sectionName' : {required : true,maxlength:50},// 路段名称 必填项 | ||
| 221 | + 'sectionCode': {required : true,},// 路段编码 必填项 | ||
| 222 | + 'directions' : {required : true,},// 路段方向 必填项 | ||
| 223 | + 'speedLimit' : {required : true,number : true},// 路段限速 必须输入合法的数字(负数,小数)。 | ||
| 224 | + 'destroy' : {required : true,},// 是否撤销 必填项. | ||
| 225 | + 'roadCoding' : {number : true},// 道路编码 必须输入合法的数字(负数,小数)。 | ||
| 226 | + 'sectionTime' : {number : true},// 路段时长 必须输入合法的数字(负数,小数)。 | ||
| 227 | + 'sectionDistance' : {number : true},// 路段长度 必须输入合法的数字(负数,小数)。 | ||
| 228 | + 'descriptions' : {maxlength: 150}// 描述与说明 最大长度. | ||
| 229 | + }, | ||
| 230 | + invalidHandler : function(event, validator) { | ||
| 231 | + error.show(); | ||
| 232 | + App.scrollTo(error, -200); | ||
| 233 | + }, | ||
| 234 | + highlight : function(element) { | ||
| 235 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 236 | + }, | ||
| 237 | + unhighlight : function(element) { | ||
| 238 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 239 | + }, | ||
| 240 | + success : function(label) { | ||
| 241 | + label.closest('.form-group').removeClass('has-error'); | ||
| 242 | + }, | ||
| 243 | + submitHandler : function(f) { | ||
| 244 | + var params = form.serializeJSON(); | ||
| 245 | + error.hide(); | ||
| 246 | + if(params.sectionrouteCode=='请选择...') { | ||
| 247 | + params.sectionrouteCode=''; | ||
| 248 | + } | ||
| 249 | + $post('/section/sectionCacheUpdate',params,function(resuntDate) { | ||
| 250 | + if(resuntDate.status=='SUCCESS') { | ||
| 251 | + // 弹出添加成功提示消息 | ||
| 252 | + layer.msg('修改成功...'); | ||
| 253 | + }else { | ||
| 254 | + // 弹出添加失败提示消息 | ||
| 255 | + layer.msg('修改失败...'); | ||
| 256 | + } | ||
| 257 | + $('#edit_section_mobal_cache').modal('hide'); | ||
| 258 | + closeMobleSetClean(); | ||
| 259 | + }); | ||
| 260 | + } | ||
| 261 | + }); | ||
| 262 | +}); | ||
| 263 | +</script> | ||
| 0 | \ No newline at end of file | 264 | \ No newline at end of file |
src/main/resources/static/pages/base/line/js/editRoute.js
0 → 100644
| 1 | +/** 生成路线类 */ | ||
| 2 | +var EditRoute = function(){ | ||
| 3 | + | ||
| 4 | + var line={}; | ||
| 5 | + | ||
| 6 | + /** 定义修改线路对象 */ | ||
| 7 | + | ||
| 8 | + var editRoute = { | ||
| 9 | + getLineObj : function() { | ||
| 10 | + return line; | ||
| 11 | + }, | ||
| 12 | + setLineId : function(id) { | ||
| 13 | + line.id = id; | ||
| 14 | + }, | ||
| 15 | + setLineDir : function(dir) { | ||
| 16 | + | ||
| 17 | + line.dir = dir; | ||
| 18 | + }, | ||
| 19 | + }; | ||
| 20 | + | ||
| 21 | + return editRoute; | ||
| 22 | +}(); |
src/main/resources/static/pages/base/line/js/line-add-form.js
| @@ -94,7 +94,7 @@ $(function(){ | @@ -94,7 +94,7 @@ $(function(){ | ||
| 94 | // 需要验证的表单元素 | 94 | // 需要验证的表单元素 |
| 95 | rules : { | 95 | rules : { |
| 96 | 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. | 96 | 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. |
| 97 | - 'lineCode' : {required : true,maxlength: 30},// 线路编码 必填项、最大长度. | 97 | + 'lineCode' : {required : true,maxlength: 6},// 线路编码 必填项、最大长度. |
| 98 | 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. | 98 | 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. |
| 99 | 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. | 99 | 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. |
| 100 | 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. | 100 | 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. |
| @@ -116,7 +116,6 @@ $(function(){ | @@ -116,7 +116,6 @@ $(function(){ | ||
| 116 | 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度. | 116 | 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度. |
| 117 | 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度. | 117 | 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度. |
| 118 | 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度. | 118 | 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度. |
| 119 | - 'warrantCar' : {number : true,digits : true,maxlength: 8}, | ||
| 120 | 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。 | 119 | 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 121 | 'descriptions' : {maxlength: 200}// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。 | 120 | 'descriptions' : {maxlength: 200}// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 122 | }, | 121 | }, |
src/main/resources/static/pages/base/line/js/line-edit-form.js
| @@ -149,7 +149,7 @@ | @@ -149,7 +149,7 @@ | ||
| 149 | // 需要验证的表单元素 | 149 | // 需要验证的表单元素 |
| 150 | rules : { | 150 | rules : { |
| 151 | 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. | 151 | 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. |
| 152 | - 'lineCode' : {required : true,maxlength: 30},// 线路编码 必填项、最大长度. | 152 | + 'lineCode' : {required : true,maxlength: 6},// 线路编码 必填项、最大长度. |
| 153 | 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. | 153 | 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. |
| 154 | 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. | 154 | 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. |
| 155 | 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. | 155 | 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. |
| @@ -171,7 +171,6 @@ | @@ -171,7 +171,6 @@ | ||
| 171 | 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度. | 171 | 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度. |
| 172 | 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度. | 172 | 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度. |
| 173 | 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度. | 173 | 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度. |
| 174 | - 'warrantCar' : {number : true,digits : true,maxlength: 8}, | ||
| 175 | 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。 | 174 | 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 176 | 'descriptions' : {maxlength: 200}// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。 | 175 | 'descriptions' : {maxlength: 200}// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 177 | }, | 176 | }, |
src/main/resources/static/pages/base/line/js/line-list-function.js
0 → 100644
| 1 | +var PublicFunctions = function () { | ||
| 2 | + var PubFun = { | ||
| 3 | + /** 初始化线路标题与ID */ | ||
| 4 | + setTiteText : function(lineId) { | ||
| 5 | + // 根据线路ID获取线路名称 | ||
| 6 | + GetAjaxData.getIdLineName(lineId,function(data) { | ||
| 7 | + // 定义线路名称 | ||
| 8 | + var lineNameV = data.name; | ||
| 9 | + $('.portlet-title .caption').text(lineNameV); | ||
| 10 | + }); | ||
| 11 | + }, | ||
| 12 | + setSectionFormValue : function(Section) { | ||
| 13 | + $('#isRoadeSpeedInput').val(Section.isRoadeSpeed); | ||
| 14 | + // 路段ID | ||
| 15 | + $('#sectionIdInput').val(Section.sectionId); | ||
| 16 | + // 路段路由ID | ||
| 17 | + $('#sectionRouteIdInput').val(Section.sectionrouteId); | ||
| 18 | + // 线路ID | ||
| 19 | + $('#sectionRouteLineInput').val(Section.sectionrouteLine); | ||
| 20 | + // 线路编码 | ||
| 21 | + $('#lineCodeInput').val(Section.sectionrouteLineCode); | ||
| 22 | + // 折线坐标集合 | ||
| 23 | + $('#bsectionVectorInput').val(Section.sectionBsectionVector); | ||
| 24 | + // 路段名称 | ||
| 25 | + $('#sectionNameInput').val(Section.sectionName); | ||
| 26 | + // 路段编码 | ||
| 27 | + $('#sectionCodeInput').val(Section.sectionCode); | ||
| 28 | + // 路段序号 | ||
| 29 | + $('#sectionrouteCodeSelect').val(Section.sectionrouteCode); | ||
| 30 | + // 路段方向 | ||
| 31 | + $('#directionsSection').val(Section.sectionrouteDirections); | ||
| 32 | + // 道路编码 | ||
| 33 | + $('#roadCodingCodInput').val(Section.sectionRoadCoding); | ||
| 34 | + // 道路限速 | ||
| 35 | + $('#speedLimitInput').val(Section.sectionSpeedLimet); | ||
| 36 | + // 路段长度 | ||
| 37 | + $('#sectionDistanceInput').val(Section.sectionDistance); | ||
| 38 | + // 时长 | ||
| 39 | + $('#sectionTimeInput').val(Section.sectionTime); | ||
| 40 | + // 版本号 | ||
| 41 | + $('#versionsInput').val(Section.versions); | ||
| 42 | + // 是否撤销 | ||
| 43 | + $('#destroySelect').val(Section.destroy); | ||
| 44 | + // 描述/说明 | ||
| 45 | + $('#descriptionsTextarea').val(Section.descriptions); | ||
| 46 | + }, | ||
| 47 | + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | ||
| 48 | + linePanlThree : function(lineId,data,direction) { | ||
| 49 | + /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */ | ||
| 50 | + $get('/stationroute/getStationRouteCacheCenterPoints',{lineId:lineId,direction:direction},function(resultdata) { | ||
| 51 | + WorldsBMapLine.clearMarkAndOverlays(); | ||
| 52 | + var polyline_center; | ||
| 53 | + // 如果站点路由数据不为空 | ||
| 54 | + if(resultdata.length>0) { | ||
| 55 | + var ceter_index = Math.floor(resultdata.length / 2); | ||
| 56 | + var ceterPointsStr = resultdata[ceter_index].bJwpoints; | ||
| 57 | + var ceterPointsArray = ceterPointsStr.split(' '); | ||
| 58 | + polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]); | ||
| 59 | + // 遍历站点路由数据 | ||
| 60 | + for(var s = 0 ; s<resultdata.length;s++) { | ||
| 61 | + // 中心点坐标字符串 | ||
| 62 | + var bJwpointsStr = resultdata[s].bJwpoints; | ||
| 63 | + var stationName = resultdata[s].stationName; | ||
| 64 | + // 起个中心点坐标字符串 | ||
| 65 | + var bJwpointsArray = bJwpointsStr.split(' '); | ||
| 66 | + // 设置中心点 | ||
| 67 | + var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]); | ||
| 68 | + /** 在地图上画点 @param:<point_center:中心坐标点> */ | ||
| 69 | + WorldsBMapLine.drawingUpStationPoint(point_center,stationName,s+1); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + } | ||
| 73 | + // 路段数据长度 | ||
| 74 | + var dataLen = data.length; | ||
| 75 | + //debugger; | ||
| 76 | + // 如果大于零 | ||
| 77 | + if(dataLen>0) { | ||
| 78 | + // 编辑路段数据 | ||
| 79 | + for(var d= 0; d<dataLen;d++){ | ||
| 80 | + // 地图折线坐标点集合 | ||
| 81 | + var polylineArray = []; | ||
| 82 | + // 获取路段折线坐标字符串 | ||
| 83 | + var sectionBsectionVectorStr = data[d].sectionBsectionVector; | ||
| 84 | + if(sectionBsectionVectorStr==null) | ||
| 85 | + continue; | ||
| 86 | + // 切割段折线坐标字符串 | ||
| 87 | + var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1); | ||
| 88 | + // 分割折线坐标字符串 | ||
| 89 | + var lineArray = tempStr.split(','); | ||
| 90 | + for(var i = 0;i<lineArray.length;i++) { | ||
| 91 | + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1])); | ||
| 92 | + } | ||
| 93 | + /** 在地图上画出线路走向 @param:<polylineArray:地图折线坐标点集合;resultdata:站点路由数据> */ | ||
| 94 | + WorldsBMapLine.drawingUpline01(polylineArray,polyline_center,data[d]); | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + }); | ||
| 98 | + }, | ||
| 99 | + // 方向代码转名称. | ||
| 100 | + dirdmToName : function(value){ | ||
| 101 | + var srStr = ''; | ||
| 102 | + if(value=='0') | ||
| 103 | + srStr = '上行'; | ||
| 104 | + else if(value=='1') | ||
| 105 | + srStr = '下行'; | ||
| 106 | + return srStr; | ||
| 107 | + }, | ||
| 108 | +// editAChangeCssRemoveDisabled : function() { | ||
| 109 | +// $('#downLine').removeClass('btn disabled'); | ||
| 110 | +// $('.btn-circle').removeClass('disabled'); | ||
| 111 | +// $('#upLine').removeClass('btn disabled'); | ||
| 112 | +// }, | ||
| 113 | + } | ||
| 114 | + return PubFun ; | ||
| 115 | +}(); | ||
| 0 | \ No newline at end of file | 116 | \ No newline at end of file |
src/main/resources/static/pages/base/line/js/line-list-map.js
0 → 100644
| 1 | +/** | ||
| 2 | + * 百度地图 | ||
| 3 | + * | ||
| 4 | + * - - - - - -》init:地图初始化 | ||
| 5 | + * | ||
| 6 | + * - - - - - -》getDistanceAndDuration:获取距离与时间 | ||
| 7 | + * | ||
| 8 | + * - - - - - -》drawingUpline:在地图上画出上行线路走向 | ||
| 9 | + * | ||
| 10 | + * - - - - - -》stationsPointsToLibraryPoint:根据站点坐标匹配库中的公交站点(手动规划) | ||
| 11 | + */ | ||
| 12 | + | ||
| 13 | +var WorldsBMapLine = function () { | ||
| 14 | + | ||
| 15 | + /** WorldsBMapLine 全局变量定义 mapBValue:地图对象;polyUpline:走向折线;sectionList:截取过的路段 ;pointIndex:计算路段被切的次数; | ||
| 16 | + * firstPoint:截取路段的第一个点;iseditStatus:路段是否在编辑状态;isCutSection : 获取路段是否在截取状态*/ | ||
| 17 | + var mapBValue = '', polyUpline='', sectionList = [], pointIndex = 0, iseditStatus = false, firstPoint = {}, isCutSection = false; | ||
| 18 | + | ||
| 19 | + var Bmap = { | ||
| 20 | + | ||
| 21 | + init : function() { | ||
| 22 | + | ||
| 23 | + // 设置中心点, | ||
| 24 | + var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | ||
| 25 | + | ||
| 26 | + // 百度API Key | ||
| 27 | + var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; | ||
| 28 | + | ||
| 29 | + // 初始化百度地图 | ||
| 30 | + mapBValue = new BMap.Map("bmap_basic"); | ||
| 31 | + | ||
| 32 | + //中心点和缩放级别 | ||
| 33 | + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | ||
| 34 | + | ||
| 35 | + //启用地图拖拽事件,默认启用(可不写) | ||
| 36 | + mapBValue.enableDragging(); | ||
| 37 | + | ||
| 38 | + //启用地图滚轮放大缩小 | ||
| 39 | + mapBValue.enableScrollWheelZoom(); | ||
| 40 | + | ||
| 41 | + //禁用鼠标双击放大 | ||
| 42 | + mapBValue.disableDoubleClickZoom(); | ||
| 43 | + | ||
| 44 | + //启用键盘上下左右键移动地图 | ||
| 45 | + mapBValue.enableKeyboard(); | ||
| 46 | + | ||
| 47 | + return mapBValue; | ||
| 48 | + }, | ||
| 49 | + /** 获取第一个切路段的点 @return Point*/ | ||
| 50 | + getFirstPoint : function() { | ||
| 51 | + return firstPoint; | ||
| 52 | + }, | ||
| 53 | + /** 获取地图对象 @return 地图对象map */ | ||
| 54 | + getmapBValue : function() { | ||
| 55 | + | ||
| 56 | + return mapBValue; | ||
| 57 | + | ||
| 58 | + }, | ||
| 59 | + | ||
| 60 | + getPolyUpline : function() { | ||
| 61 | + | ||
| 62 | + return polyUpline; | ||
| 63 | + }, | ||
| 64 | + | ||
| 65 | + /** 获取截取过的路段 @return 路段对象List */ | ||
| 66 | + getSectionList : function() { | ||
| 67 | + | ||
| 68 | + return sectionList; | ||
| 69 | + | ||
| 70 | + }, | ||
| 71 | + setSectionList : function(list) { | ||
| 72 | + | ||
| 73 | + sectionList = list; | ||
| 74 | + }, | ||
| 75 | + initCutSectionPoint : function() { | ||
| 76 | + sectionList = []; | ||
| 77 | + var tbodyHtml = template('section_list',{list : sectionList}); | ||
| 78 | + $('#section_table tbody').html(tbodyHtml); | ||
| 79 | + }, | ||
| 80 | + /** 获取切路段的点下标 @return int*/ | ||
| 81 | + setPointIndex : function(index) { | ||
| 82 | + pointIndex = index; | ||
| 83 | + }, | ||
| 84 | + getPointIndex : function() { | ||
| 85 | + | ||
| 86 | + return pointIndex; | ||
| 87 | + | ||
| 88 | + }, | ||
| 89 | + /** 获取路段是否在编辑状态 @return boolean*/ | ||
| 90 | + getIsEditStatus : function() { | ||
| 91 | + return iseditStatus; | ||
| 92 | + }, | ||
| 93 | + setIsEditStatus : function(v) { | ||
| 94 | + iseditStatus = v ; | ||
| 95 | + }, | ||
| 96 | + | ||
| 97 | + /** 获取路段是否在截取状态 @return boolean*/ | ||
| 98 | + getIsCutSection : function() { | ||
| 99 | + return isCutSection; | ||
| 100 | + }, | ||
| 101 | + setIsCutSection : function(v) { | ||
| 102 | + isCutSection = v ; | ||
| 103 | + }, | ||
| 104 | + | ||
| 105 | + /** 获取距离与时间 @param <points:坐标点集合> */ | ||
| 106 | + getDistanceAndDuration : function(points,callback){ | ||
| 107 | + | ||
| 108 | + // 获取长度 | ||
| 109 | + var len = points.length; | ||
| 110 | + (function(){ | ||
| 111 | + | ||
| 112 | + if (!arguments.callee.count) { | ||
| 113 | + | ||
| 114 | + arguments.callee.count = 0; | ||
| 115 | + | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + arguments.callee.count++; | ||
| 119 | + | ||
| 120 | + var index = parseInt(arguments.callee.count) - 1; | ||
| 121 | + | ||
| 122 | + if (index >= len-1) { | ||
| 123 | + | ||
| 124 | + callback && callback(points); | ||
| 125 | + | ||
| 126 | + return; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | ||
| 130 | + var f = arguments.callee; | ||
| 131 | + // 起点坐标 <坐标格式:40.056878,116.30815> | ||
| 132 | + var origin = points[index].potion.lat + ',' + points[index].potion.lng; | ||
| 133 | + | ||
| 134 | + // 终点坐标 <坐标格式:40.056878,116.30815> | ||
| 135 | + var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng; | ||
| 136 | + var region = '上海'; | ||
| 137 | + | ||
| 138 | + var origin_region = '上海'; | ||
| 139 | + | ||
| 140 | + var destination_region = '上海'; | ||
| 141 | + | ||
| 142 | + var output = 'json'; | ||
| 143 | + | ||
| 144 | + var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | ||
| 145 | + | ||
| 146 | + /** | ||
| 147 | + * origin:起点名称或经纬度; | ||
| 148 | + * | ||
| 149 | + * destination:终点名称或经纬度; | ||
| 150 | + * | ||
| 151 | + * origin_region:起始点所在城市,驾车导航时必填。 | ||
| 152 | + * | ||
| 153 | + * destination_region:终点所在城市,驾车导航时必填。 | ||
| 154 | + * | ||
| 155 | + * output :表示输出类型,可设置为xml或json,默认为xml。 | ||
| 156 | + * | ||
| 157 | + **/ | ||
| 158 | + var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My}; | ||
| 159 | + | ||
| 160 | + /** @description :未认证开发者默认配额为:2000次/天。 */ | ||
| 161 | + $.ajax({ | ||
| 162 | + | ||
| 163 | + // 百度地图根据坐标获取两点之间的时间与距离 | ||
| 164 | + url: 'http://api.map.baidu.com/direction/v1?mode=transit', | ||
| 165 | + | ||
| 166 | + data: paramsB, | ||
| 167 | + | ||
| 168 | + dataType: 'jsonp', | ||
| 169 | + | ||
| 170 | + success: function(r){ | ||
| 171 | + | ||
| 172 | + if(r) { | ||
| 173 | + | ||
| 174 | + if(r.message=='ok') { | ||
| 175 | + | ||
| 176 | + if(r.result.taxi==null) { | ||
| 177 | + | ||
| 178 | + // 获取距离(单位:米) | ||
| 179 | + points[index+1].distance = 0; | ||
| 180 | + | ||
| 181 | + // 获取时间(单位:秒) | ||
| 182 | + points[index+1].duration = 0; | ||
| 183 | + | ||
| 184 | + }else { | ||
| 185 | + | ||
| 186 | + // 获取距离(单位:米) | ||
| 187 | + points[index+1].distance = r.result.taxi.distance; | ||
| 188 | + | ||
| 189 | + // 获取时间(单位:秒) | ||
| 190 | + points[index+1].duration = r.result.taxi.duration; | ||
| 191 | + | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + f(); | ||
| 200 | + } | ||
| 201 | + }); | ||
| 202 | + | ||
| 203 | + })(); | ||
| 204 | + | ||
| 205 | + }, | ||
| 206 | + // 在地图上画出上行线路走向 | ||
| 207 | + drawingUpline01 : function (polylineArray,polyline_center,data) { | ||
| 208 | + var polyUpline01 = 'polyline' + '_' + data.sectionrouteId; | ||
| 209 | + // 创建线路走向 | ||
| 210 | + polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | ||
| 211 | + polyUpline01.data = data; | ||
| 212 | + // 把折线添加到地图上 | ||
| 213 | + mapBValue.addOverlay(polyUpline01); | ||
| 214 | + var sectionPoint = []; | ||
| 215 | + // 线路单击事件 | ||
| 216 | + polyUpline01.addEventListener('click',function(e) { | ||
| 217 | + if(WorldsBMapLine.getIsEditStatus()) { | ||
| 218 | + layer.msg('请先保存正在编辑的路段信息...'); | ||
| 219 | + return false; | ||
| 220 | + } | ||
| 221 | + if(WorldsBMapLine.getIsCutSection()) { | ||
| 222 | + layer.msg('请先撤销所有切路段的点...'); | ||
| 223 | + return false; | ||
| 224 | + } | ||
| 225 | + polyUpline01.enableEditing(); | ||
| 226 | + WorldsBMapLine.setIsEditStatus(true); | ||
| 227 | + }); | ||
| 228 | + | ||
| 229 | + // 添加路段双击事件 | ||
| 230 | + polyUpline01.addEventListener("dblclick",function(e){ | ||
| 231 | + if(WorldsBMapLine.getIsCutSection()) { | ||
| 232 | + layer.msg('请先撤销所有切路段的点...'); | ||
| 233 | + return false; | ||
| 234 | + } | ||
| 235 | + WorldsBMapLine.setIsEditStatus(false); | ||
| 236 | + // 关闭 | ||
| 237 | + layer.closeAll(); | ||
| 238 | + polyUpline01.disableEditing(); | ||
| 239 | + EditSectionObj.setEitdSection(polyUpline01.data); | ||
| 240 | + // 获取折线坐标集合 | ||
| 241 | + var editPloyLineArray = polyUpline01.getPath(); | ||
| 242 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | ||
| 243 | + sectionList = []; | ||
| 244 | + var tbodyHtml = template('section_list',{list : sectionList}); | ||
| 245 | + // 截取路段 | ||
| 246 | + $('#section_table tbody').html(tbodyHtml); | ||
| 247 | + // 加载修改路段弹出层mobal页面 | ||
| 248 | + $.get('editsection.html', function(m){ | ||
| 249 | + $(pjaxContainer).append(m); | ||
| 250 | + $('#edit_section_mobal_cache').trigger('editSectionMobalCache_show', [WorldsBMapLine,GetAjaxData,EditSectionObj,PublicFunctions]); | ||
| 251 | + }); | ||
| 252 | + }); | ||
| 253 | + | ||
| 254 | + // 路段右击事件 | ||
| 255 | + var editSection = function(e,ee,marker){ | ||
| 256 | + if(WorldsBMapLine.getIsEditStatus()) { | ||
| 257 | + layer.msg('请先保存正在编辑的路段信息...'); | ||
| 258 | + return false; | ||
| 259 | + } | ||
| 260 | + var lng = e.lng; | ||
| 261 | + var lat = e.lat; | ||
| 262 | + var sectionName = null; | ||
| 263 | + var marker = new BMap.Marker(new BMap.Point(lng, lat)); // 创建点 | ||
| 264 | + marker.isFlag = true; | ||
| 265 | + if(pointIndex == 0) { | ||
| 266 | + sectionPoint[pointIndex] = {lng:lng , lat:lat}; | ||
| 267 | + layer.msg('进入切路段状态,请选择本路段的终点!'); | ||
| 268 | + mapBValue.addOverlay(marker);// 添加覆盖物 | ||
| 269 | + firstPoint = {lng:lng, lat:lat}; | ||
| 270 | + pointIndex++; | ||
| 271 | + EditSectionObj.setEitdSection(polyUpline01.data); | ||
| 272 | + // 获取折线坐标集合 | ||
| 273 | + var editPloyLineArray = polyUpline01.getPath(); | ||
| 274 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | ||
| 275 | + } else if (pointIndex > 0) { | ||
| 276 | + layer.prompt({title: '请输入路段名!'}, function(sectionName, index){ | ||
| 277 | + pointList = []; | ||
| 278 | + sectionPoint[pointIndex] = {lng:lng , lat:lat}; | ||
| 279 | + pointList[0] = sectionPoint[pointIndex-1]; | ||
| 280 | + pointList[1] = sectionPoint[pointIndex]; | ||
| 281 | + sectionList.push({name:sectionName, section:pointList}); | ||
| 282 | + layer.close(index); | ||
| 283 | + layer.msg('路段截取成功,请选择下一个路段的终点'); | ||
| 284 | + mapBValue.addOverlay(marker);// 添加覆盖物 | ||
| 285 | + var tbodyHtml = template('section_list',{list : sectionList}); | ||
| 286 | + // 截取路段 | ||
| 287 | + $('#section_table tbody').html(tbodyHtml); | ||
| 288 | + pointIndex++; | ||
| 289 | + }); | ||
| 290 | + } | ||
| 291 | + WorldsBMapLine.setIsCutSection(true); | ||
| 292 | + } | ||
| 293 | + var markerMenu=new BMap.ContextMenu(); | ||
| 294 | + markerMenu.addItem(new BMap.MenuItem('切路段',editSection.bind(polyUpline01))); | ||
| 295 | + polyUpline01.addContextMenu(markerMenu); | ||
| 296 | + | ||
| 297 | + | ||
| 298 | + var PanOptions_ ={noAnimation :true}; | ||
| 299 | + mapBValue.reset(); | ||
| 300 | + mapBValue.panTo(polyline_center,PanOptions_); | ||
| 301 | + mapBValue.panBy(500,-510,PanOptions_); | ||
| 302 | + mapBValue.setZoom(14); | ||
| 303 | + }, | ||
| 304 | + // 删除点刷新cutSectionTable | ||
| 305 | + refreshCutSectionTable : function() { | ||
| 306 | + var tbodyHtml = template('section_list',{list : sectionList}); | ||
| 307 | + $('#section_table tbody').html(tbodyHtml); | ||
| 308 | + }, | ||
| 309 | + // 删除点刷新覆盖物 | ||
| 310 | + deleteCutSectionPoint : function(point) { | ||
| 311 | + var lng = point.lng; | ||
| 312 | + var lat = point.lat; | ||
| 313 | + var allOverlay = mapBValue.getOverlays(); | ||
| 314 | + // 删除最后一个点 | ||
| 315 | + for (var i = 0; i < allOverlay.length -1; i++){ | ||
| 316 | + if(allOverlay[i].isFlag) { | ||
| 317 | + if(allOverlay[i].point.lng == lng && allOverlay[i].point.lat == lat){ | ||
| 318 | + mapBValue.removeOverlay(allOverlay[i]); | ||
| 319 | + break; | ||
| 320 | + } | ||
| 321 | + } | ||
| 322 | + } | ||
| 323 | + }, | ||
| 324 | + /** 在地图上画点 @param:<point_center:中心坐标点> */ | ||
| 325 | + drawingUpStationPoint : function(point_center,stationName,s) { | ||
| 326 | + | ||
| 327 | + // 自定义标注物图片 | ||
| 328 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10)); | ||
| 329 | + | ||
| 330 | + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">' | ||
| 331 | + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | ||
| 332 | + + '</div>' | ||
| 333 | + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>'; | ||
| 334 | + | ||
| 335 | + | ||
| 336 | + var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{ | ||
| 337 | + "anchor" : new BMap.Size(-10,8), | ||
| 338 | + "enableDragging" : true}); | ||
| 339 | + | ||
| 340 | + | ||
| 341 | + myRichMarker1.disableDragging(); | ||
| 342 | + mapBValue.addOverlay(myRichMarker1); | ||
| 343 | + | ||
| 344 | + | ||
| 345 | + // 创建标注物 | ||
| 346 | + marker = new BMap.Marker(point_center,{icon : icon_target}); | ||
| 347 | + | ||
| 348 | + // 允许覆盖物在map.clearOverlays方法中被清除。 | ||
| 349 | + marker.enableMassClear(); | ||
| 350 | + | ||
| 351 | + mapBValue.addOverlay(marker); | ||
| 352 | + }, | ||
| 353 | + | ||
| 354 | + // 根据站点坐标匹配库中的公交站点(手动规划) | ||
| 355 | + stationsPointsToLibraryPoint : function(arra,callback) { | ||
| 356 | + // 获取长度 | ||
| 357 | + var len = arra.length; | ||
| 358 | + var station = {}; | ||
| 359 | + var stationList = []; | ||
| 360 | + (function(){ | ||
| 361 | + if (!arguments.callee.count) { | ||
| 362 | + arguments.callee.count = 0; | ||
| 363 | + } | ||
| 364 | + arguments.callee.count++; | ||
| 365 | + var index = parseInt(arguments.callee.count) - 1; | ||
| 366 | + if (index >= len) { | ||
| 367 | + callback && callback(stationList); | ||
| 368 | + return ; | ||
| 369 | + } | ||
| 370 | + var f = arguments.callee; | ||
| 371 | + station = arra[index]; | ||
| 372 | + if(arra[index].name!=''){ | ||
| 373 | + | ||
| 374 | + $.get('/station/matchStation',station,function(resultStation) { | ||
| 375 | + stationList.push({name:resultStation.name ,wgs:arra[index].wgs,potion:{lng:resultStation.potion_lng, lat:resultStation.potion_lat}, isHave:resultStation.isHave , id:resultStation.id}); | ||
| 376 | + f(); | ||
| 377 | + }); | ||
| 378 | + }else { | ||
| 379 | + f(); | ||
| 380 | + } | ||
| 381 | + })() | ||
| 382 | + }, | ||
| 383 | + clearMarkAndOverlays : function() { | ||
| 384 | + | ||
| 385 | + // 清楚地图覆盖物 | ||
| 386 | + mapBValue.clearOverlays(); | ||
| 387 | + | ||
| 388 | + mapBValue.removeOverlay(); | ||
| 389 | + | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | + return Bmap; | ||
| 395 | + | ||
| 396 | +}(); | ||
| 0 | \ No newline at end of file | 397 | \ No newline at end of file |
src/main/resources/static/pages/base/line/js/line-list-table.js
| @@ -116,7 +116,7 @@ | @@ -116,7 +116,7 @@ | ||
| 116 | } | 116 | } |
| 117 | function getComp(cb) { | 117 | function getComp(cb) { |
| 118 | $.get('/user/companyData',null,function(rs) { | 118 | $.get('/user/companyData',null,function(rs) { |
| 119 | - return cb && cb(rs); | 119 | + return cb && cb(rs); |
| 120 | }); | 120 | }); |
| 121 | } | 121 | } |
| 122 | function getParams() { | 122 | function getParams() { |
| @@ -330,4 +330,44 @@ | @@ -330,4 +330,44 @@ | ||
| 330 | }); | 330 | }); |
| 331 | } | 331 | } |
| 332 | }); | 332 | }); |
| 333 | + /** 生成路线(路段和站点) */ | ||
| 334 | + $('#datatable_ajax_tools #editRoute').on('click', function() { | ||
| 335 | + // 获取选中行. | ||
| 336 | + var arrChk = $("input[type='checkbox']:checked"); | ||
| 337 | + var len = arrChk.length; | ||
| 338 | + // 选中行ID与线路名称 | ||
| 339 | + var id = '', lineName = ''; | ||
| 340 | + if(len>1) { | ||
| 341 | + // 弹出添加成功提示消息 | ||
| 342 | + layer.msg('存在多选,请只选中一行!'); | ||
| 343 | + return ; | ||
| 344 | + }else if(len==0) { | ||
| 345 | + // 弹出添加成功提示消息 | ||
| 346 | + layer.msg('请选中一条线路!'); | ||
| 347 | + return ; | ||
| 348 | + }else { | ||
| 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; | ||
| 371 | + } | ||
| 372 | + }); | ||
| 333 | })(); | 373 | })(); |
| 334 | \ No newline at end of file | 374 | \ No newline at end of file |
src/main/resources/static/pages/base/line/js/transGPS.js
0 → 100644
| 1 | +/** 转换坐标点工具 */ | ||
| 2 | +var TransGPS = function () { | ||
| 3 | + | ||
| 4 | + var location = {lng:'', lat:''}; | ||
| 5 | + | ||
| 6 | + var pi = 3.14159265358979324; | ||
| 7 | + | ||
| 8 | + var a = 6378245.0; | ||
| 9 | + var ee = 0.00669342162296594323; | ||
| 10 | + | ||
| 11 | + var x_pi = 3.14159265358979324 * 3000.0 / 180.0; | ||
| 12 | + | ||
| 13 | + var transGPS = { | ||
| 14 | + getLocation : function(){ | ||
| 15 | + return location; | ||
| 16 | + }, | ||
| 17 | + locationMake : function(lng, lat) { | ||
| 18 | + var loc = transGPS.getLocation(); | ||
| 19 | + loc.lng = lng; | ||
| 20 | + loc.lat = lat; | ||
| 21 | + return loc; | ||
| 22 | + }, | ||
| 23 | + outOfChina : function(lat,lng) { | ||
| 24 | + if (lng < 72.004 || lng > 137.8347) | ||
| 25 | + return 1; | ||
| 26 | + if (lat < 0.8293 || lat > 55.8271) | ||
| 27 | + return 1; | ||
| 28 | + return 0; | ||
| 29 | + }, | ||
| 30 | + transformLat : function(x, y) { | ||
| 31 | + var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(x > 0 ? x : -x); | ||
| 32 | + ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0; | ||
| 33 | + ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0; | ||
| 34 | + ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0; | ||
| 35 | + return ret; | ||
| 36 | + }, | ||
| 37 | + transformlng : function(x, y) { | ||
| 38 | + var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(x > 0 ? x : -x); | ||
| 39 | + ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0; | ||
| 40 | + ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0; | ||
| 41 | + ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 * pi)) * 2.0 / 3.0; | ||
| 42 | + return ret; | ||
| 43 | + }, | ||
| 44 | + transformFromWGSToGCJ : function(wgLoc) { | ||
| 45 | + var mgLoc = {}; | ||
| 46 | + if (1 == transGPS.outOfChina(wgLoc.lat, wgLoc.lng)) { | ||
| 47 | + mgLoc = wgLoc; | ||
| 48 | + return mgLoc; | ||
| 49 | + } | ||
| 50 | + var dLat = transGPS.transformLat(wgLoc.lng - 105.0, wgLoc.lat - 35.0); | ||
| 51 | + var dlng = transGPS.transformlng(wgLoc.lng - 105.0, wgLoc.lat - 35.0); | ||
| 52 | + var radLat = wgLoc.lat / 180.0 * pi; | ||
| 53 | + var magic = Math.sin(radLat); | ||
| 54 | + magic = 1 - ee * magic * magic; | ||
| 55 | + var sqrtMagic = Math.sqrt(magic); | ||
| 56 | + dLat = parseFloat((dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi)); | ||
| 57 | + dlng = parseFloat((dlng * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi)) ; | ||
| 58 | + mgLoc.lat = parseFloat(wgLoc.lat) + dLat; | ||
| 59 | + mgLoc.lng = parseFloat(wgLoc.lng) + dlng; | ||
| 60 | + | ||
| 61 | + return mgLoc; | ||
| 62 | + }, | ||
| 63 | + bd_encrypt : function(gcLoc) { | ||
| 64 | + var x = gcLoc.lng, y = gcLoc.lat; | ||
| 65 | + var z = Math.sqrt((x*x)+(y*y)) + 0.00002 * Math.sin((y * x_pi)); | ||
| 66 | + var theta = Math.atan2(y, x) + 0.000003 * Math.cos((x * x_pi)); | ||
| 67 | + var lng = (z*Math.cos(theta)+0.0065); | ||
| 68 | + var lat = (z*Math.sin(theta)+0.006); | ||
| 69 | + return transGPS.locationMake(lng, lat); | ||
| 70 | + }, | ||
| 71 | + /*bd_decrypt : function(bdLoc) { | ||
| 72 | + var x = bdLoc.lng - 0.0065, y = bdLoc.lat - 0.006; | ||
| 73 | + var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); | ||
| 74 | + var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); | ||
| 75 | + return transGPS.locationMake(z * Math.cos(theta), z * Math.sin(theta)); | ||
| 76 | + }*/ | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + return transGPS; | ||
| 80 | + | ||
| 81 | +}(); |
src/main/resources/static/pages/base/line/list.html
| @@ -37,6 +37,9 @@ | @@ -37,6 +37,9 @@ | ||
| 37 | <li> | 37 | <li> |
| 38 | <a href="javascript:;" data-action="0" id="createUsingSingle" class="tool-action"> <i class="fa fa-file-zip-o"></i> 生成路单文件</a> | 38 | <a href="javascript:;" data-action="0" id="createUsingSingle" class="tool-action"> <i class="fa fa-file-zip-o"></i> 生成路单文件</a> |
| 39 | </li> | 39 | </li> |
| 40 | + <li> | ||
| 41 | + <a href="javascript:;" data-action="1" id="editRoute" class="tool-action"> <i class="fa fa-level-up"></i>上传GPS生成路线</a> | ||
| 42 | + </li> | ||
| 40 | <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印 | 43 | <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印 |
| 41 | </a></li> | 44 | </a></li> |
| 42 | <li><a href="javascript:;" data-action="1" class="tool-action"> <i class="fa fa-copy"></i> 复制 | 45 | <li><a href="javascript:;" data-action="1" class="tool-action"> <i class="fa fa-copy"></i> 复制 |
| @@ -353,6 +356,5 @@ | @@ -353,6 +356,5 @@ | ||
| 353 | </tr> | 356 | </tr> |
| 354 | {{/if}} | 357 | {{/if}} |
| 355 | </script> | 358 | </script> |
| 356 | -<!-- <script src="/pages/base/line/js/tipso.js"></script> --> | ||
| 357 | <!-- 线路信息片段JS模块 --> | 359 | <!-- 线路信息片段JS模块 --> |
| 358 | <script src="/pages/base/line/js/line-list-table.js"></script> | 360 | <script src="/pages/base/line/js/line-list-table.js"></script> |
| 359 | \ No newline at end of file | 361 | \ No newline at end of file |
src/main/resources/static/pages/base/line/map.html
0 → 100644
| 1 | +< <link href="/pages/base/stationroute/css/bmap_base.css" rel="stylesheet" type="text/css" /> | ||
| 2 | +<div class="portlet-body"> | ||
| 3 | + <!-- 地图 --> | ||
| 4 | + <div id="bmap_basic" class="bmaps"></div> | ||
| 5 | + <!-- 右边添加栏 --> | ||
| 6 | + <div class="portlet box protlet-box" style="top:20px;border-radius: 6px !important;box-shadow: 10px 10px 5px #888888;float:right;"> | ||
| 7 | + <div class="portlet-title" style="background-color:#12527f;"> | ||
| 8 | + <div class="caption"> | ||
| 9 | + <!-- 途径站点 --> | ||
| 10 | + </div> | ||
| 11 | + <div class="tools"> | ||
| 12 | + <a href="javascript:;" class="collapse" data-original-title="" title=""> </a> | ||
| 13 | + </div> | ||
| 14 | + </div> | ||
| 15 | + <!-- 左边栏 --> | ||
| 16 | + <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 300px"> | ||
| 17 | + <div class="row"> | ||
| 18 | + <div class="portlet-body"> | ||
| 19 | + <div class="table-toolbar" style="text-align:center;"> | ||
| 20 | + <button class="btn btn-circle blue" id="uploadRoute" ><i class="fa fa-plus"></i> 生成路线 </button> | ||
| 21 | + <button class="btn btn-circle blue hidden" id="cutSection"><i class="fa fa-level-up"></i> 提交路段</button> | ||
| 22 | + <button class="btn btn-circle blue hidden" id="Undo"><i class="fa fa-remove"></i> 撤销切点</button> | ||
| 23 | + </div> | ||
| 24 | + <div class="portlet-body" > | ||
| 25 | + <div class="defeat-scroll" style="height: auto;max-height: 400px;overflow-y:auto;"> | ||
| 26 | + <table class="table table-striped table-bordered table-hover table-checkable " id="section_table"> | ||
| 27 | + <thead> | ||
| 28 | + <tr role="row" class="heading"> | ||
| 29 | + <th >截取路段</th> | ||
| 30 | + </tr> | ||
| 31 | + </thead> | ||
| 32 | + <tbody ></tbody> | ||
| 33 | + </table> | ||
| 34 | + </div> | ||
| 35 | + </div> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + </div> | ||
| 39 | + </div> | ||
| 40 | +</div> | ||
| 41 | +<script type="text/html" id="section_list"> | ||
| 42 | + {{each list as obj i }} | ||
| 43 | + <tr> | ||
| 44 | + <td style="vertical-align: middle;"> | ||
| 45 | + {{obj.name}}:[{{obj.section[0].lng}},{{obj.section[0].lat}}],[{{obj.section[1].lng}},{{obj.section[1].lat}}] | ||
| 46 | + </td> | ||
| 47 | + {{/each}} | ||
| 48 | + {{if list.length == 0}} | ||
| 49 | + <tr> | ||
| 50 | + <td colspan=13><h6 class="muted">你还没有对路段进行截取</h6></td> | ||
| 51 | + </tr> | ||
| 52 | + {{/if}} | ||
| 53 | +</script> | ||
| 54 | +<!--上传GPS坐标生成路线监听事件 --> | ||
| 55 | +<<script type="text/javascript"> | ||
| 56 | +$(function(){ | ||
| 57 | + // 关闭左侧栏 | ||
| 58 | + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} | ||
| 59 | + // 线路id | ||
| 60 | + var id = $.url().param('no'); | ||
| 61 | + // 方向 (0:上行;1:下行)默认上行 | ||
| 62 | + var direction = 0; | ||
| 63 | + // 如果线路ID不为空 | ||
| 64 | + if(id) { | ||
| 65 | + var styleOptions = { | ||
| 66 | + strokeColor : "blue",//边线颜色。 | ||
| 67 | + fillColor : "blue",//填充颜色。当参数为空时,圆形将没有填充效果。 | ||
| 68 | + strokeWeight : 3,//边线的宽度,以像素为单位。 | ||
| 69 | + strokeOpacity : 0.8,//边线透明度,取值范围0 - 1。 | ||
| 70 | + fillOpacity : 0.6,//填充的透明度,取值范围0 - 1。 | ||
| 71 | + strokeStyle : 'solid' //边线的样式,solid或dashed。 | ||
| 72 | + }; | ||
| 73 | + | ||
| 74 | + // 等候500毫秒执行 | ||
| 75 | + setTimeout(function(){ | ||
| 76 | + | ||
| 77 | + /** 初始化线路标题 @param:<id:线路ID> */ | ||
| 78 | + PublicFunctions.setTiteText(id); | ||
| 79 | + | ||
| 80 | + /** 初始化地图对象map @return:Map对象 */ | ||
| 81 | + var map_ = WorldsBMapLine.init(); | ||
| 82 | + | ||
| 83 | + /** 初始化绘图工具类 @param:<map_:map对象;styleOptions:绘图样式对象> @return:DrawingManager对象 */ | ||
| 84 | + DrawingManagerObj.init(map_,styleOptions); | ||
| 85 | + | ||
| 86 | + layer.msg('请生成路线!!!'); | ||
| 87 | + | ||
| 88 | + },500); | ||
| 89 | + }else { | ||
| 90 | + | ||
| 91 | + // 缺少ID | ||
| 92 | + layer.confirm('【ID缺失,请点击返回,重新进行操作】', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){ | ||
| 93 | + | ||
| 94 | + // 关闭提示弹出层 | ||
| 95 | + layer.close(index); | ||
| 96 | + | ||
| 97 | + // 返回线路list页面 | ||
| 98 | + loadPage('/pages/base/line/list.html'); | ||
| 99 | + | ||
| 100 | + }); | ||
| 101 | + | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + // 上传GPS坐标生成路线事件 | ||
| 105 | + $('#uploadRoute').on('click', function() { | ||
| 106 | + EditRoute.setLineId(id); | ||
| 107 | + EditRoute.setLineDir(direction); | ||
| 108 | + $.get('editRoute.html', function(m){ | ||
| 109 | + $(pjaxContainer).append(m); | ||
| 110 | + $('#edit_route_mobal').trigger('editRouteMobal.show',[TransGPS,EditRoute,WorldsBMapLine,DrawingManagerObj,GetAjaxData,PublicFunctions]); | ||
| 111 | + }); | ||
| 112 | + // 更新section_table 和缓存中的一切过的点数 | ||
| 113 | + WorldsBMapLine.initCutSectionPoint(); | ||
| 114 | + WorldsBMapLine.setPointIndex(0); | ||
| 115 | + }); | ||
| 116 | + | ||
| 117 | + // 提交截取事件 | ||
| 118 | + $('#cutSection').on('click', function() { | ||
| 119 | + layer.confirm('提交会把原有的站点和路段覆盖,您确定要提交吗?', { | ||
| 120 | + btn: ['提交','取消'] //按钮 | ||
| 121 | + }, function(){ | ||
| 122 | + if(WorldsBMapLine.getPointIndex() > 0) { | ||
| 123 | + var sectionList = WorldsBMapLine.getSectionList(); | ||
| 124 | + var data = {}; | ||
| 125 | + var section = EditSectionObj.getEitdSection(); | ||
| 126 | + var josnSectionList = JSON.stringify(sectionList); | ||
| 127 | + section.cutSectionList = josnSectionList; | ||
| 128 | + $.post('/section/sectionCut', section, function(resuntDate){ | ||
| 129 | + if(resuntDate.status=='SUCCESS') { | ||
| 130 | + // 弹出添加成功提示消息 | ||
| 131 | + layer.msg('提交成功,跳转到线路详情页面!'); | ||
| 132 | + window.location.href = "/pages/base/stationroute/list.html?no="+id+","+EditRoute.getLineObj().dir; | ||
| 133 | + WorldsBMapLine.initCutSectionPoint(); | ||
| 134 | + WorldsBMapLine.setPointIndex(0); | ||
| 135 | + }else { | ||
| 136 | + // 弹出添加失败提示消息 | ||
| 137 | + layer.msg('提交失败...'); | ||
| 138 | + } | ||
| 139 | + }); | ||
| 140 | + } else { | ||
| 141 | + layer.msg("请截取路段!!!"); | ||
| 142 | + } | ||
| 143 | + }); | ||
| 144 | + }); | ||
| 145 | + | ||
| 146 | + // 删除最后一个路段 | ||
| 147 | + $('#Undo').on('click', function() { | ||
| 148 | + if(WorldsBMapLine.getPointIndex() > 1) { | ||
| 149 | + // 点总数-1 | ||
| 150 | + var pointIndex = WorldsBMapLine.getPointIndex() - 1; | ||
| 151 | + WorldsBMapLine.setPointIndex(pointIndex); | ||
| 152 | + // 截取的路段list | ||
| 153 | + var sectionList = WorldsBMapLine.getSectionList(); | ||
| 154 | + var sectionListLen = sectionList.length; | ||
| 155 | + // 要删除的点 | ||
| 156 | + var point = sectionList[sectionListLen-1].section[1]; | ||
| 157 | + sectionList.splice(sectionListLen-1,1); | ||
| 158 | + WorldsBMapLine.setSectionList(sectionList); | ||
| 159 | + WorldsBMapLine.deleteCutSectionPoint(point); | ||
| 160 | + WorldsBMapLine.refreshCutSectionTable(); | ||
| 161 | + } else if(WorldsBMapLine.getPointIndex() == 1 ) { | ||
| 162 | + // 点总数-1 | ||
| 163 | + var pointIndex = WorldsBMapLine.getPointIndex() - 1; | ||
| 164 | + WorldsBMapLine.setPointIndex(pointIndex); | ||
| 165 | + var firstPoint = WorldsBMapLine.getFirstPoint(); | ||
| 166 | + WorldsBMapLine.deleteCutSectionPoint(firstPoint); | ||
| 167 | + WorldsBMapLine.setIsCutSection(false); | ||
| 168 | + } else { | ||
| 169 | + layer.msg("没有截取路段,不可以删除!!!"); | ||
| 170 | + } | ||
| 171 | + }); | ||
| 172 | +}); | ||
| 173 | +</script> | ||
| 174 | +<!--编辑路线类 --> | ||
| 175 | +<script src="/pages/base/line/js/editRoute.js"></script> | ||
| 176 | + <!--坐标转换类 --> | ||
| 177 | +<script src="/pages/base/line/js/transGPS.js"></script> | ||
| 178 | +<!-- 地图类 --> | ||
| 179 | +<script src="/pages/base/line/js/line-list-map.js"></script> | ||
| 180 | +<!-- 函数与方法 --> | ||
| 181 | +<script src="/pages/base/line/js/line-list-function.js"></script> | ||
| 182 | +<!-- 修改路段对象类 --> | ||
| 183 | +<script src="/pages/base/stationroute/js/editsection.js"></script> | ||
| 184 | +<!-- 绘图类 --> | ||
| 185 | +<script src="/pages/base/stationroute/js/drawingManager.js"></script> | ||
| 186 | +<!-- ajax请求类 --> | ||
| 187 | +<script src="/pages/base/stationroute/js/stationroute-ajax-getdata.js"></script> | ||
| 0 | \ No newline at end of file | 188 | \ No newline at end of file |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
| @@ -9,7 +9,23 @@ $(function(){ | @@ -9,7 +9,23 @@ $(function(){ | ||
| 9 | // 关闭左侧栏 | 9 | // 关闭左侧栏 |
| 10 | if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} | 10 | if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} |
| 11 | // 获取参数线路ID | 11 | // 获取参数线路ID |
| 12 | - var id = $.url().param('no'); | 12 | + var idAndDir = $.url().param('no'); |
| 13 | + var param = idAndDir.split(","); | ||
| 14 | + var dir = 0, id; | ||
| 15 | + if(param.length == 1){ | ||
| 16 | + id = param[0]; | ||
| 17 | + } else { | ||
| 18 | + id = param[0]; | ||
| 19 | + dir = param[1]; | ||
| 20 | + } | ||
| 21 | + if(dir==1) { | ||
| 22 | + $('#stationUp').removeClass('active'); | ||
| 23 | + $('#stationUp').removeClass('in'); | ||
| 24 | + $('#stationUp').addClass('fade'); | ||
| 25 | + $('#stationDown').addClass('active in'); | ||
| 26 | + $('#upLine').parent().removeClass('active'); | ||
| 27 | + $('#downLine').parent().addClass('active'); | ||
| 28 | + } | ||
| 13 | // 如果线路ID不为空 | 29 | // 如果线路ID不为空 |
| 14 | if(id) { | 30 | if(id) { |
| 15 | var styleOptions = { | 31 | var styleOptions = { |
| @@ -39,13 +55,13 @@ $(function(){ | @@ -39,13 +55,13 @@ $(function(){ | ||
| 39 | /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ | 55 | /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ |
| 40 | PublicFunctions.TreeUpOrDown(Line.id,'0'); | 56 | PublicFunctions.TreeUpOrDown(Line.id,'0'); |
| 41 | 57 | ||
| 42 | - /** 初始化下行树 @param:<Line.id:线路Id;0:下行> */ | 58 | + /** 初始化下行树 @param:<Line.id:线路Id;1:下行> */ |
| 43 | PublicFunctions.TreeUpOrDown(Line.id,'1'); | 59 | PublicFunctions.TreeUpOrDown(Line.id,'1'); |
| 44 | 60 | ||
| 45 | - /** 查询路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | ||
| 46 | - GetAjaxData.getSectionRouteInfo(Line.id,'0',function(data) { | 61 | + /** 查询路段信息 @param:<Line.id:线路Id;dir:方向> @return:data:路段数据 */ |
| 62 | + GetAjaxData.getSectionRouteInfo(Line.id,dir,function(data) { | ||
| 47 | /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | 63 | /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ |
| 48 | - PublicFunctions.linePanlThree(Line.id,data,'0'); | 64 | + PublicFunctions.linePanlThree(Line.id,data,dir); |
| 49 | 65 | ||
| 50 | }); | 66 | }); |
| 51 | 67 |
src/main/resources/static/pages/excep/speedingListmh.html
| @@ -181,7 +181,7 @@ $(function(){ | @@ -181,7 +181,7 @@ $(function(){ | ||
| 181 | 181 | ||
| 182 | var endTime = dateTime-week*24*3600*1000;//上周末、格式为时间戳。 | 182 | var endTime = dateTime-week*24*3600*1000;//上周末、格式为时间戳。 |
| 183 | var startTime = endTime-6*24*3600*1000;//上周一、格式为时间戳。 | 183 | var startTime = endTime-6*24*3600*1000;//上周一、格式为时间戳。 |
| 184 | - | 184 | + debugger; |
| 185 | var endDate = timeToData(endTime); | 185 | var endDate = timeToData(endTime); |
| 186 | var startDate = timeToData(startTime); | 186 | var startDate = timeToData(startTime); |
| 187 | //表单默认选择上周一到上周日的超速信息。 | 187 | //表单默认选择上周一到上周日的超速信息。 |
| @@ -210,7 +210,7 @@ $(function(){ | @@ -210,7 +210,7 @@ $(function(){ | ||
| 210 | var date = new Date(time); | 210 | var date = new Date(time); |
| 211 | var year = date.getFullYear(); | 211 | var year = date.getFullYear(); |
| 212 | var Month = date.getMonth()+1>10?date.getMonth()+1:"0"+(date.getMonth()+1); | 212 | var Month = date.getMonth()+1>10?date.getMonth()+1:"0"+(date.getMonth()+1); |
| 213 | - var Day = date.getDate()>10?date.getDate():"0"+date.getDate(); | 213 | + var Day = date.getDate()>9?date.getDate():"0"+date.getDate(); |
| 214 | return year+"-"+Month+"-"+Day; | 214 | return year+"-"+Month+"-"+Day; |
| 215 | } | 215 | } |
| 216 | 216 |
src/main/resources/static/pages/report/countInterval/countInterval.html
0 → 100644
| 1 | +<style type="text/css"> | ||
| 2 | + .table-bordered { | ||
| 3 | + border: 1px solid; } | ||
| 4 | + .table-bordered > thead > tr > th, | ||
| 5 | + .table-bordered > thead > tr > td, | ||
| 6 | + .table-bordered > tbody > tr > th, | ||
| 7 | + .table-bordered > tbody > tr > td, | ||
| 8 | + .table-bordered > tfoot > tr > th, | ||
| 9 | + .table-bordered > tfoot > tr > td { | ||
| 10 | + border: 1px solid; } | ||
| 11 | + .table-bordered > thead > tr > th, | ||
| 12 | + .table-bordered > thead > tr > td { | ||
| 13 | + border-bottom-width: 2px; } | ||
| 14 | + | ||
| 15 | + .table > tbody + tbody { | ||
| 16 | + border-top: 1px solid; } | ||
| 17 | +</style> | ||
| 18 | + | ||
| 19 | +<div class="page-head"> | ||
| 20 | + <div class="page-title"> | ||
| 21 | + <h1>大间隔数据统计表</h1> | ||
| 22 | + </div> | ||
| 23 | +</div> | ||
| 24 | + | ||
| 25 | +<div class="row"> | ||
| 26 | + <div class="col-md-12"> | ||
| 27 | + <div class="portlet light porttlet-fit bordered"> | ||
| 28 | + <div class="portlet-title"> | ||
| 29 | + <form class="form-inline" action=""> | ||
| 30 | + <div style="display: inline-block;margin-left: 28px; " id="gsdmDiv"> | ||
| 31 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 32 | + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select> | ||
| 33 | + </div> | ||
| 34 | + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv"> | ||
| 35 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 36 | + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select> | ||
| 37 | + </div> | ||
| 38 | + <div style="display: inline-block;"> | ||
| 39 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 40 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 41 | + </div> | ||
| 42 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 43 | + <span class="item-label" style="width: 80px;">时间: </span> | ||
| 44 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 45 | + </div> | ||
| 46 | + <div class="form-group" style="display: inline-block;margin-left: 15px;"> | ||
| 47 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | ||
| 48 | +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> | ||
| 49 | + </div> | ||
| 50 | + </form> | ||
| 51 | + </div> | ||
| 52 | + <div class="portlet-body"> | ||
| 53 | + <div class="row" class="col-md-12"> | ||
| 54 | + <div class="col-md-5"> | ||
| 55 | + <div id="left_table" style="margin-top: 10px;overflow:auto;height: 860px"> | ||
| 56 | + <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info_inter"> | ||
| 57 | + <thead> | ||
| 58 | + <tr class="hidden"> | ||
| 59 | + <th>分公司</th> | ||
| 60 | + <th>线路</th> | ||
| 61 | + <th>等级</th> | ||
| 62 | + <th>班次数</th> | ||
| 63 | + <th>发生次数</th> | ||
| 64 | + <th>发生率</th> | ||
| 65 | + </tr> | ||
| 66 | + </thead> | ||
| 67 | + <tbody> | ||
| 68 | + | ||
| 69 | + </tbody> | ||
| 70 | + </table> | ||
| 71 | + </div> | ||
| 72 | + </div> | ||
| 73 | + <div class="col-md-7" id="printArea"> | ||
| 74 | + <div class="table-container" id="table" style="margin-top: 10px;overflow:auto;"> | ||
| 75 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 76 | + <thead class="hidden"> | ||
| 77 | + <tr > | ||
| 78 | + <th rowspan="2">分公司</th> | ||
| 79 | + <th rowspan="2">线路</th> | ||
| 80 | + <th rowspan="2">大间隔等级</th> | ||
| 81 | + <th colspan="4">发生大间隔班次</th> | ||
| 82 | + </tr> | ||
| 83 | + <tr> | ||
| 84 | + <th>计发</th> | ||
| 85 | + <th>实发</th> | ||
| 86 | + <th>计发</th> | ||
| 87 | + <th>实发</th> | ||
| 88 | + </tr> | ||
| 89 | + </thead> | ||
| 90 | + <tbody> | ||
| 91 | + | ||
| 92 | + </tbody> | ||
| 93 | + </table> | ||
| 94 | + </div> | ||
| 95 | + </div> | ||
| 96 | + </div> | ||
| 97 | + </div> | ||
| 98 | + </div> | ||
| 99 | + </div> | ||
| 100 | +</div> | ||
| 101 | + | ||
| 102 | +<script> | ||
| 103 | + $(function(){ | ||
| 104 | + // 关闭左侧栏 | ||
| 105 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 106 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 107 | + | ||
| 108 | + $("#date").datetimepicker({ | ||
| 109 | + format : 'YYYY-MM-DD', | ||
| 110 | + locale : 'zh-cn' | ||
| 111 | + }); | ||
| 112 | + | ||
| 113 | + | ||
| 114 | + var d = new Date(); | ||
| 115 | + var year = d.getFullYear(); | ||
| 116 | + var month = d.getMonth() + 1; | ||
| 117 | + var day = d.getDate(); | ||
| 118 | + if(month < 9) | ||
| 119 | + month = "0" + month; | ||
| 120 | + if(day < 9) | ||
| 121 | + day = "0" + day; | ||
| 122 | + $("#date").val(year + "-" + month + "-" + day); | ||
| 123 | + var fage=false; | ||
| 124 | + var obj = []; | ||
| 125 | + var xlList; | ||
| 126 | + $.get('/report/lineList',function(result){ | ||
| 127 | + xlList=result; | ||
| 128 | + $.get('/user/companyData', function(result){ | ||
| 129 | + obj = result; | ||
| 130 | + var options = ''; | ||
| 131 | + for(var i = 0; i < obj.length; i++){ | ||
| 132 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + if(obj.length ==0){ | ||
| 136 | + $("#gsdmDiv").css('display','none'); | ||
| 137 | + }else if(obj.length ==1){ | ||
| 138 | + $("#gsdmDiv").css('display','none'); | ||
| 139 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 140 | + $('#fgsdmDiv').css('display','none'); | ||
| 141 | + } | ||
| 142 | + $('#gsdm').html(options); | ||
| 143 | + updateCompany(); | ||
| 144 | + }); | ||
| 145 | + }) | ||
| 146 | + $("#gsdm").on("change",updateCompany); | ||
| 147 | + function updateCompany(){ | ||
| 148 | + var company = $('#gsdm').val(); | ||
| 149 | + var options = ''; | ||
| 150 | + for(var i = 0; i < obj.length; i++){ | ||
| 151 | + if(obj[i].companyCode == company){ | ||
| 152 | + var children = obj[i].children; | ||
| 153 | + for(var j = 0; j < children.length; j++){ | ||
| 154 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + $('#fgsdm').html(options); | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + | ||
| 162 | + var tempData = {}; | ||
| 163 | + $.get('/report/lineList',function(xlList){ | ||
| 164 | + var data = []; | ||
| 165 | + data.push({id: " ", text: "全部线路"}); | ||
| 166 | + $.get('/user/companyData', function(result){ | ||
| 167 | + for(var i = 0; i < result.length; i++){ | ||
| 168 | + var companyCode = result[i].companyCode; | ||
| 169 | + var children = result[i].children; | ||
| 170 | + for(var j = 0; j < children.length; j++){ | ||
| 171 | + var code = children[j].code; | ||
| 172 | + for(var k=0;k < xlList.length;k++ ){ | ||
| 173 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | ||
| 174 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 175 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | ||
| 176 | + } | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + initPinYinSelect2('#line',data,''); | ||
| 181 | + | ||
| 182 | + }); | ||
| 183 | + }); | ||
| 184 | + | ||
| 185 | + $("#line").on("change", function(){ | ||
| 186 | + if($("#line").val() == " "){ | ||
| 187 | + $("#gsdm").attr("disabled", false); | ||
| 188 | + $("#fgsdm").attr("disabled", false); | ||
| 189 | + } else { | ||
| 190 | + var temp = tempData[$("#line").val()].split(":"); | ||
| 191 | + $("#gsdm").val(temp[0]); | ||
| 192 | + updateCompany(); | ||
| 193 | + $("#fgsdm").val(temp[1]); | ||
| 194 | + $("#gsdm").attr("disabled", true); | ||
| 195 | + $("#fgsdm").attr("disabled", true); | ||
| 196 | + } | ||
| 197 | + }); | ||
| 198 | + | ||
| 199 | + var date = ''; | ||
| 200 | + var gsbm=""; | ||
| 201 | + var fgsbm=""; | ||
| 202 | + var listRe=null; | ||
| 203 | + var line = $("#line").val(); | ||
| 204 | + $("#query").on("click",function(){ | ||
| 205 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 206 | + layer.msg("请选择时间!"); | ||
| 207 | + return; | ||
| 208 | + } | ||
| 209 | +// $("#left_table").height($(window).height()-100); | ||
| 210 | + line = $("#line").val(); | ||
| 211 | + date = $("#date").val(); | ||
| 212 | + gsbm =$("#gsdm").val(); | ||
| 213 | + fgsbm=$("#fgsdm").val(); | ||
| 214 | + $(".hidden").removeClass("hidden"); | ||
| 215 | + $get('/report/countDjg',{line:line,date:date,gsbm:gsbm,fgsbm:fgsbm},function(result){ | ||
| 216 | + listRe=result; | ||
| 217 | + // 把数据填充到模版中 | ||
| 218 | + var tbodyHtml = template('list_inter_info',{list:result}); | ||
| 219 | + // 把渲染好的模版html文本追加到表格中 | ||
| 220 | + $('#info_inter tbody').html(tbodyHtml); | ||
| 221 | + | ||
| 222 | + $('.btn-intervalList').on('click', showIntervalList); | ||
| 223 | + | ||
| 224 | + | ||
| 225 | + }); | ||
| 226 | + }); | ||
| 227 | + | ||
| 228 | + function showIntervalList(){ | ||
| 229 | + | ||
| 230 | + $("#info_inter tbody tr td button").css('background-color', 'blue'); | ||
| 231 | + $(this).css('background-color', '#99CCFF'); | ||
| 232 | + var line_ = $(this).data('id'); | ||
| 233 | + var listXx; | ||
| 234 | + $.each(listRe, function (i, obj) { | ||
| 235 | + if(obj.line==line_){ | ||
| 236 | + listXx=obj.djgxx; | ||
| 237 | + } | ||
| 238 | + }); | ||
| 239 | +// if(listXx.length>0){ | ||
| 240 | + $(".hidden").removeClass("hidden"); | ||
| 241 | + var interList = template('list_inter_info_xx',{list:listXx}); | ||
| 242 | + $('#forms tbody').html(interList); | ||
| 243 | + $("html,body").animate({scrollTop:$("#forms_1").offset().top},1000); | ||
| 244 | +// } | ||
| 245 | + | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + /* $("#export").on("click",function(){ | ||
| 249 | + $get('/realSchedule/historyMessage',{line:line,date:date,code:jName,type:"export_msg"},function(result){ | ||
| 250 | + window.open("/downloadFile/download?fileName=调度消息分析"+moment(date).format("YYYYMMDD")); | ||
| 251 | + }); | ||
| 252 | + }); */ | ||
| 253 | + | ||
| 254 | + | ||
| 255 | + | ||
| 256 | + }); | ||
| 257 | +</script> | ||
| 258 | +<script type="text/html" id="list_inter_info"> | ||
| 259 | + {{each list as obj i}} | ||
| 260 | + <tr> | ||
| 261 | + <td width="20%">{{obj.fgsname}}</td> | ||
| 262 | + <td width="20%">{{obj.xlName}}</td> | ||
| 263 | + <td width="15%">{{obj.djgde}}</td> | ||
| 264 | + <td width="15%">{{obj.bcs}}</td> | ||
| 265 | + <td width="15%"><button type="button" class="btn btn-sm blue btn-intervalList" | ||
| 266 | + data-id="{{obj.line}}">{{obj.djgcs}}</button></td> | ||
| 267 | + <td width="15%" >{{obj.fsl}}</td> | ||
| 268 | + </tr> | ||
| 269 | + {{/each}} | ||
| 270 | + {{if list.length == 0}} | ||
| 271 | + <tr> | ||
| 272 | + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 273 | + </tr> | ||
| 274 | + {{/if}} | ||
| 275 | +</script> | ||
| 276 | + | ||
| 277 | +<script type="text/html" id="list_inter_info_xx"> | ||
| 278 | + {{each list as obj i}} | ||
| 279 | + <tr> | ||
| 280 | + <td width="20%">{{obj.fgsname}}</td> | ||
| 281 | + <td width="20%">{{obj.xlName}}</td> | ||
| 282 | + <td width="10%">{{obj.djgde}}</td> | ||
| 283 | + <td width="10%">{{obj.qJh}}</td> | ||
| 284 | + <td width="10%">{{obj.qSj}}</td> | ||
| 285 | + <td width="10%">{{obj.hJh}}</td> | ||
| 286 | + <td width="10%">{{obj.hSj}}</td> | ||
| 287 | + </tr> | ||
| 288 | + {{/each}} | ||
| 289 | + {{if list.length == 0}} | ||
| 290 | + <tr> | ||
| 291 | + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 292 | + </tr> | ||
| 293 | + {{/if}} | ||
| 294 | +</script> | ||
| 295 | + |
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteWarningValidation.js
| 1 | -/** | ||
| 2 | - * remoteWarn指令:远程验证警告,作为属性放在某个指令上。 | ||
| 3 | - * TODO:暂时没法整合到form上,类似$error这样 | ||
| 4 | - * 属性如下: | ||
| 5 | - * remotewtype(必须):验证类型(在service中有对应映射),如rvtype="xl" | ||
| 6 | - * remotewparam(必须):后端判定查询参数,如rvparam={{ {'xl.id_eq': '123'} | json }} | ||
| 7 | - * remotewmsgprop(必须):警告信息属性名 | ||
| 8 | - */ | ||
| 9 | -angular.module('ScheduleApp').directive('remoteWarn', [ | ||
| 10 | - '$$SearchInfoService_g', | ||
| 11 | - function($$SearchInfoService_g) { | ||
| 12 | - return { | ||
| 13 | - restrict: "A", // 属性 | ||
| 14 | - required: "^ngModel", // 依赖所属指令的ngModel | ||
| 15 | - compile: function(tElem, tAttrs) { | ||
| 16 | - // 验证属性 | ||
| 17 | - if (!tAttrs["remotewtype"]) { // 验证类型 | ||
| 18 | - throw {msg : "remotewtype属性必须填写"}; | ||
| 19 | - } | ||
| 20 | - if (!$$SearchInfoService_g.validate[tAttrs["remotewtype"]]) { | ||
| 21 | - throw {msg : tAttrs["remotevtype"] + "验证类型不存在"}; | ||
| 22 | - } | ||
| 23 | - if (!tAttrs["remotewparam"]) { // 查询参数 | ||
| 24 | - throw {msg : "remotevparam属性必须填写"}; | ||
| 25 | - } | ||
| 26 | - if (!tAttrs["remotewmsgprop"]) { // 警告信息属性名 | ||
| 27 | - throw {msg : "remotewmsgprop属性必须填写"} | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - // 监听获取的数据 | ||
| 31 | - var $watch_rvtype = undefined; | ||
| 32 | - var $watch_rvparam_obj = undefined; | ||
| 33 | - var $remotewmsgprop = undefined; | ||
| 34 | - | ||
| 35 | - // 验证数据 | ||
| 36 | - var $$internal_validate = function(ngModelCtrl, scope) { | ||
| 37 | - if ($watch_rvtype && $watch_rvparam_obj && $remotewmsgprop) { | ||
| 38 | - // 获取查询参数模版 | ||
| 39 | - var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template; | ||
| 40 | - if (!paramTemplate) { | ||
| 41 | - throw {msg : $watch_rvtype + "查询模版不存在"}; | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - // 判定如果参数对象不全,没有完全和模版参数里对应上,则不验证 | ||
| 45 | - var isParamAll = true; | ||
| 46 | - for (var key in paramTemplate) { | ||
| 47 | - if (key != "id" && !$watch_rvparam_obj[key]) { // id去掉 | ||
| 48 | - isParamAll = false; | ||
| 49 | - break; | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - if (!isParamAll) { | ||
| 54 | - scope["ctrl"][$remotewmsgprop] = undefined; | ||
| 55 | - } else { // 开始验证警告 | ||
| 56 | - $$SearchInfoService_g.validate[$watch_rvtype].remote.do( | ||
| 57 | - $watch_rvparam_obj, | ||
| 58 | - function(result) { | ||
| 59 | - if (result.status == "SUCCESS") { | ||
| 60 | - scope["ctrl"][$remotewmsgprop] = undefined; | ||
| 61 | - } else { | ||
| 62 | - scope["ctrl"][$remotewmsgprop] = result.msg; | ||
| 63 | - } | ||
| 64 | - }, | ||
| 65 | - function(result) { | ||
| 66 | - scope["ctrl"][$remotewmsgprop] = undefined; | ||
| 67 | - } | ||
| 68 | - ); | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - }; | ||
| 73 | - | ||
| 74 | - return { | ||
| 75 | - pre: function(scope, element, attr) { | ||
| 76 | - | ||
| 77 | - }, | ||
| 78 | - | ||
| 79 | - post: function(scope, element, attr, ngModelCtrl) { | ||
| 80 | - /** | ||
| 81 | - * 监控验证类型属性变化。 | ||
| 82 | - */ | ||
| 83 | - attr.$observe("remotewtype", function(value) { | ||
| 84 | - if (value && value != "") { | ||
| 85 | - $watch_rvtype = value; | ||
| 86 | - $$internal_validate(ngModelCtrl, scope); | ||
| 87 | - } | ||
| 88 | - }); | ||
| 89 | - | ||
| 90 | - /** | ||
| 91 | - * 监控查询结果属性变化。 | ||
| 92 | - */ | ||
| 93 | - attr.$observe("remotewparam", function(value) { | ||
| 94 | - if (value && value != "") { | ||
| 95 | - $watch_rvparam_obj = JSON.parse(value); | ||
| 96 | - $$internal_validate(ngModelCtrl, scope); | ||
| 97 | - } | ||
| 98 | - }); | ||
| 99 | - | ||
| 100 | - /** | ||
| 101 | - * 监控警告信息属性名变化。 | ||
| 102 | - */ | ||
| 103 | - attr.$observe("remotewmsgprop", function(value) { | ||
| 104 | - if (value && value != "") { | ||
| 105 | - $remotewmsgprop = value; | ||
| 106 | - $$internal_validate(ngModelCtrl, scope); | ||
| 107 | - } | ||
| 108 | - }); | ||
| 109 | - | ||
| 110 | - } | ||
| 111 | - }; | ||
| 112 | - } | ||
| 113 | - }; | ||
| 114 | - } | 1 | +/** |
| 2 | + * remoteWarn指令:远程验证警告,作为属性放在某个指令上。 | ||
| 3 | + * TODO:暂时没法整合到form上,类似$error这样 | ||
| 4 | + * 属性如下: | ||
| 5 | + * remotewtype(必须):验证类型(在service中有对应映射),如rvtype="xl" | ||
| 6 | + * remotewparam(必须):后端判定查询参数,如rvparam={{ {'xl.id_eq': '123'} | json }} | ||
| 7 | + * remotewmsgprop(必须):警告信息属性名 | ||
| 8 | + */ | ||
| 9 | +angular.module('ScheduleApp').directive('remoteWarn', [ | ||
| 10 | + '$$SearchInfoService_g', | ||
| 11 | + function($$SearchInfoService_g) { | ||
| 12 | + return { | ||
| 13 | + restrict: "A", // 属性 | ||
| 14 | + required: "^ngModel", // 依赖所属指令的ngModel | ||
| 15 | + compile: function(tElem, tAttrs) { | ||
| 16 | + // 验证属性 | ||
| 17 | + if (!tAttrs["remotewtype"]) { // 验证类型 | ||
| 18 | + throw {msg : "remotewtype属性必须填写"}; | ||
| 19 | + } | ||
| 20 | + if (!$$SearchInfoService_g.validate[tAttrs["remotewtype"]]) { | ||
| 21 | + throw {msg : tAttrs["remotevtype"] + "验证类型不存在"}; | ||
| 22 | + } | ||
| 23 | + if (!tAttrs["remotewparam"]) { // 查询参数 | ||
| 24 | + throw {msg : "remotevparam属性必须填写"}; | ||
| 25 | + } | ||
| 26 | + if (!tAttrs["remotewmsgprop"]) { // 警告信息属性名 | ||
| 27 | + throw {msg : "remotewmsgprop属性必须填写"} | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + // 监听获取的数据 | ||
| 31 | + var $watch_rvtype = undefined; | ||
| 32 | + var $watch_rvparam_obj = undefined; | ||
| 33 | + var $remotewmsgprop = undefined; | ||
| 34 | + | ||
| 35 | + // 验证数据 | ||
| 36 | + var $$internal_validate = function(ngModelCtrl, scope) { | ||
| 37 | + if ($watch_rvtype && $watch_rvparam_obj && $remotewmsgprop) { | ||
| 38 | + // 获取查询参数模版 | ||
| 39 | + var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template; | ||
| 40 | + if (!paramTemplate) { | ||
| 41 | + throw {msg : $watch_rvtype + "查询模版不存在"}; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + // 判定如果参数对象不全,没有完全和模版参数里对应上,则不验证 | ||
| 45 | + var isParamAll = true; | ||
| 46 | + for (var key in paramTemplate) { | ||
| 47 | + if (key != "id" && !$watch_rvparam_obj[key]) { // id去掉 | ||
| 48 | + isParamAll = false; | ||
| 49 | + break; | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + if (!isParamAll) { | ||
| 54 | + scope["ctrl"][$remotewmsgprop] = undefined; | ||
| 55 | + } else { // 开始验证警告 | ||
| 56 | + $$SearchInfoService_g.validate[$watch_rvtype].remote.do( | ||
| 57 | + $watch_rvparam_obj, | ||
| 58 | + function(result) { | ||
| 59 | + if (result.status == "SUCCESS") { | ||
| 60 | + scope["ctrl"][$remotewmsgprop] = undefined; | ||
| 61 | + } else { | ||
| 62 | + scope["ctrl"][$remotewmsgprop] = result.msg; | ||
| 63 | + } | ||
| 64 | + }, | ||
| 65 | + function(result) { | ||
| 66 | + scope["ctrl"][$remotewmsgprop] = undefined; | ||
| 67 | + } | ||
| 68 | + ); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + }; | ||
| 73 | + | ||
| 74 | + return { | ||
| 75 | + pre: function(scope, element, attr) { | ||
| 76 | + | ||
| 77 | + }, | ||
| 78 | + | ||
| 79 | + post: function(scope, element, attr, ngModelCtrl) { | ||
| 80 | + /** | ||
| 81 | + * 监控验证类型属性变化。 | ||
| 82 | + */ | ||
| 83 | + attr.$observe("remotewtype", function(value) { | ||
| 84 | + if (value && value != "") { | ||
| 85 | + $watch_rvtype = value; | ||
| 86 | + $$internal_validate(ngModelCtrl, scope); | ||
| 87 | + } | ||
| 88 | + }); | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * 监控查询结果属性变化。 | ||
| 92 | + */ | ||
| 93 | + attr.$observe("remotewparam", function(value) { | ||
| 94 | + if (value && value != "") { | ||
| 95 | + $watch_rvparam_obj = JSON.parse(value); | ||
| 96 | + $$internal_validate(ngModelCtrl, scope); | ||
| 97 | + } | ||
| 98 | + }); | ||
| 99 | + | ||
| 100 | + /** | ||
| 101 | + * 监控警告信息属性名变化。 | ||
| 102 | + */ | ||
| 103 | + attr.$observe("remotewmsgprop", function(value) { | ||
| 104 | + if (value && value != "") { | ||
| 105 | + $remotewmsgprop = value; | ||
| 106 | + $$internal_validate(ngModelCtrl, scope); | ||
| 107 | + } | ||
| 108 | + }); | ||
| 109 | + | ||
| 110 | + } | ||
| 111 | + }; | ||
| 112 | + } | ||
| 113 | + }; | ||
| 114 | + } | ||
| 115 | ]); | 115 | ]); |
| 116 | \ No newline at end of file | 116 | \ No newline at end of file |
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch_maintain.html
| @@ -142,9 +142,11 @@ | @@ -142,9 +142,11 @@ | ||
| 142 | }); | 142 | }); |
| 143 | 143 | ||
| 144 | $(modal).on('refresh', function (e, data) { | 144 | $(modal).on('refresh', function (e, data) { |
| 145 | - var lpName = data.lpName; | ||
| 146 | - if(is_new_temp_lp(lpName)){ | ||
| 147 | - $('[name=lpName_eq]', modal).append('<option value="'+lpName+'" selected>'+lpName+'</option>'); | 145 | + if(data){ |
| 146 | + var lpName = data.lpName; | ||
| 147 | + if(is_new_temp_lp(lpName)){ | ||
| 148 | + $('[name=lpName_eq]', modal).append('<option value="'+lpName+'" selected>'+lpName+'</option>'); | ||
| 149 | + } | ||
| 148 | } | 150 | } |
| 149 | jsQuery(); | 151 | jsQuery(); |
| 150 | }); | 152 | }); |
src/main/resources/static/real_control_v2/js/main.js
| @@ -47,7 +47,7 @@ var gb_main_ep = new EventProxy(), | @@ -47,7 +47,7 @@ var gb_main_ep = new EventProxy(), | ||
| 47 | $('li.map-panel', '#main-tab-content').load('/real_control_v2/mapmonitor/real.html'); | 47 | $('li.map-panel', '#main-tab-content').load('/real_control_v2/mapmonitor/real.html'); |
| 48 | }, 1000); | 48 | }, 1000); |
| 49 | //弹出更新说明 | 49 | //弹出更新说明 |
| 50 | - //showUpdateDescription(); | 50 | + showUpdateDescription(); |
| 51 | }); | 51 | }); |
| 52 | 52 | ||
| 53 | function g_emit(id) { | 53 | function g_emit(id) { |
| @@ -169,8 +169,8 @@ var disabled_submit_btn = function (form) { | @@ -169,8 +169,8 @@ var disabled_submit_btn = function (form) { | ||
| 169 | function showUpdateDescription() { | 169 | function showUpdateDescription() { |
| 170 | //更新说明 | 170 | //更新说明 |
| 171 | var updateDescription = { | 171 | var updateDescription = { |
| 172 | - date: '2017-07-14', | ||
| 173 | - text: '<h5></h5>' | 172 | + date: '2017-07-17', |
| 173 | + text: '<h5>1、修复了一个蛮蠢的bug,这个bug曾经导致在分班进场班次发出晚20分钟的时候,有一定几率实发时间跳到下午首班营运班次上。</h5>' | ||
| 174 | }; | 174 | }; |
| 175 | 175 | ||
| 176 | var storage = window.localStorage | 176 | var storage = window.localStorage |