Commit 9ddab783cf247eb42513bd5c9d9c7b69c431d2a5
Merge branch 'minhang' into pudong
Showing
56 changed files
with
3678 additions
and
281 deletions
Too many changes to show.
To preserve performance only 56 of 75 files are displayed.
pom.xml
| ... | ... | @@ -299,6 +299,11 @@ |
| 299 | 299 | <version>3.3.0</version> |
| 300 | 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 | 307 | </dependencies> |
| 303 | 308 | |
| 304 | 309 | <dependencyManagement> | ... | ... |
src/main/java/com/bsth/XDApplication.java
| ... | ... | @@ -129,7 +129,7 @@ public class XDApplication implements CommandLineRunner { |
| 129 | 129 | |
| 130 | 130 | //运管处静态数据提交 |
| 131 | 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 | 134 | sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); |
| 135 | 135 | ... | ... |
src/main/java/com/bsth/controller/PersonnelController.java
| 1 | 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 | 6 | import com.bsth.entity.Personnel; |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 4 | 8 | import com.bsth.service.PersonnelService; |
| 5 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
| ... | ... | @@ -8,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod; |
| 8 | 12 | import org.springframework.web.bind.annotation.RequestParam; |
| 9 | 13 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 14 | |
| 15 | +import javax.servlet.http.HttpServletRequest; | |
| 11 | 16 | import java.util.List; |
| 12 | 17 | import java.util.Map; |
| 13 | 18 | |
| ... | ... | @@ -21,8 +26,22 @@ public class PersonnelController extends BaseController<Personnel, Integer> { |
| 21 | 26 | @Autowired |
| 22 | 27 | private PersonnelService service; |
| 23 | 28 | |
| 29 | + @Autowired | |
| 30 | + PersionPinYinBuffer persionPinYinBuffer; | |
| 31 | + | |
| 24 | 32 | @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET) |
| 25 | 33 | public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) { |
| 26 | 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 | 60 | * |
| 61 | 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 | 83 | @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) |
| 64 | 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 | 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 | 113 | * @Description :TODO(查询路段编码) |
| 78 | 114 | * |
| 79 | 115 | * @return int <sectionCode路段编码> | ... | ... |
src/main/java/com/bsth/controller/SectionRouteController.java
| ... | ... | @@ -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 | 85 | * @Description : TODO(根据路段路由Id查询详情) |
| 74 | 86 | * |
| 75 | 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 | 8 | import org.springframework.web.bind.annotation.RequestParam; |
| 9 | 9 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 10 | |
| 11 | +import antlr.collections.List; | |
| 12 | + | |
| 11 | 13 | import com.bsth.entity.Station; |
| 12 | 14 | import com.bsth.service.StationService; |
| 13 | 15 | import com.bsth.util.GetUIDAndCode; |
| ... | ... | @@ -36,6 +38,17 @@ public class StationController extends BaseController<Station, Integer> { |
| 36 | 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 | 52 | * @Description :TODO(系统规划保存数据) |
| 40 | 53 | * |
| 41 | 54 | * @param map <stationJSON:站点信息; |
| ... | ... | @@ -68,6 +81,11 @@ public class StationController extends BaseController<Station, Integer> { |
| 68 | 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 | 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 | 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 | 114 | * @Description :TODO(撤销站点) |
| 103 | 115 | * |
| 104 | 116 | * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> | ... | ... |
src/main/java/com/bsth/controller/gps/GpsController.java
| ... | ... | @@ -195,12 +195,10 @@ public class GpsController { |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | @RequestMapping(value = "/pagequery",method = RequestMethod.GET) |
| 198 | - public PageObject<GpsSpeed> pagequery(@RequestParam Map<String, Object> map){ | |
| 199 | - PageObject<GpsSpeed> pageObject = null; | |
| 198 | + public Map<String, Object> pagequery(@RequestParam Map<String, Object> map){ | |
| 200 | 199 | map.put("curPage", map.get("page").toString()); |
| 201 | 200 | map.put("pageData","10"); |
| 202 | - pageObject=gpsService.Pagequery(map); | |
| 203 | - return pageObject; | |
| 201 | + return gpsService.Pagequery(map); | |
| 204 | 202 | } |
| 205 | 203 | |
| 206 | 204 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| 1 | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | 3 | import com.alibaba.fastjson.serializer.PropertyFilter; |
| 5 | 4 | import com.bsth.common.ResponseCode; |
| 6 | 5 | import com.bsth.data.BasicData; |
| ... | ... | @@ -60,16 +59,16 @@ public class BasicDataController { |
| 60 | 59 | return rs; |
| 61 | 60 | } |
| 62 | 61 | |
| 63 | - @RequestMapping("/personnel") | |
| 62 | + /*@RequestMapping("/personnel") | |
| 64 | 63 | public Map<String, Object> findPersonnelInfo(){ |
| 65 | 64 | Map<String, Object> rs = new HashMap<>(); |
| 66 | 65 | PersonnelFieldFilter filter=new PersonnelFieldFilter(); |
| 67 | 66 | //驾驶员 |
| 68 | 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 | 70 | return rs; |
| 72 | - } | |
| 71 | + }*/ | |
| 73 | 72 | |
| 74 | 73 | @RequestMapping("/all_personnel") |
| 75 | 74 | public Map<String, String> all_personnel(){ |
| ... | ... | @@ -179,15 +178,12 @@ public class BasicDataController { |
| 179 | 178 | map.put("lineCode", line.getLineCode()); |
| 180 | 179 | rs.add(map); |
| 181 | 180 | } |
| 182 | - //listMultimap.put(line.getName(), nbbm); | |
| 183 | 181 | } |
| 184 | - //return listMultimap.asMap(); | |
| 185 | - | |
| 186 | 182 | return rs; |
| 187 | 183 | } |
| 188 | 184 | |
| 189 | 185 | /** |
| 190 | - * 获取站点和停车场对照表 | |
| 186 | + * 获取站点和停车场历时公里对照表 | |
| 191 | 187 | * @param idx |
| 192 | 188 | * @return |
| 193 | 189 | */ | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -335,8 +335,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 335 | 335 | @RequestMapping(value = "/correctForm") |
| 336 | 336 | public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date, |
| 337 | 337 | @RequestParam String endDate, |
| 338 | - @RequestParam String lpName, @RequestParam String code, @RequestParam String type) { | |
| 339 | - return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type); | |
| 338 | + @RequestParam String lpName, @RequestParam String code, | |
| 339 | + @RequestParam String type,@RequestParam String changType) { | |
| 340 | + return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType); | |
| 340 | 341 | } |
| 341 | 342 | /** |
| 342 | 343 | * @Title queryListWaybill | ... | ... |
src/main/java/com/bsth/controller/report/ReportController.java
| ... | ... | @@ -6,12 +6,15 @@ import java.util.Iterator; |
| 6 | 6 | import java.util.List; |
| 7 | 7 | import java.util.Map; |
| 8 | 8 | |
| 9 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 9 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 11 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | 12 | import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | 13 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | 14 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 15 | |
| 16 | +import com.alibaba.fastjson.JSONArray; | |
| 17 | +import com.alibaba.fastjson.JSONObject; | |
| 15 | 18 | import com.bsth.entity.StationRoute; |
| 16 | 19 | import com.bsth.entity.excep.ArrivalInfo; |
| 17 | 20 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| ... | ... | @@ -276,4 +279,40 @@ public class ReportController { |
| 276 | 279 | public List<Map<String, Object>> countDjg(@RequestParam Map<String, Object> map){ |
| 277 | 280 | return service.countDjg(map); |
| 278 | 281 | } |
| 282 | + | |
| 283 | + | |
| 284 | + @RequestMapping(value="/countDjgXx") | |
| 285 | + public List<Map<String, Object>> countDjgXx(@RequestParam Map<String, Object> map){ | |
| 286 | + List<Map<String, Object>> lMap=new ArrayList<Map<String, Object>>(); | |
| 287 | + String json =StringEscapeUtils.unescapeHtml4(map.get("listXx").toString()); | |
| 288 | + JSONArray jsonArray=JSONArray.parseArray(json); | |
| 289 | + JSONObject jsonObject; | |
| 290 | + for (int x = 0; x < jsonArray.size(); x++) { | |
| 291 | + jsonObject=jsonArray.getJSONObject(x); | |
| 292 | + Map<String, Object> m_=new HashMap<String,Object>(); | |
| 293 | + m_.put("fgsname", jsonObject.getString("fgsname")); | |
| 294 | + m_.put("xlName", jsonObject.getString("xlName")); | |
| 295 | + m_.put("djgde", jsonObject.getString("djgde")); | |
| 296 | + m_.put("qJh", jsonObject.getString("qJh")); | |
| 297 | + m_.put("qSj", jsonObject.getString("qSj")); | |
| 298 | + m_.put("hJh", jsonObject.getString("hJh")); | |
| 299 | + m_.put("hSj", jsonObject.getString("hSj")); | |
| 300 | + lMap.add(m_); | |
| 301 | + } | |
| 302 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 303 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 304 | + m.put("date", map.get("date").toString()); | |
| 305 | + ReportUtils ee = new ReportUtils(); | |
| 306 | + try { | |
| 307 | + listI.add(lMap.iterator()); | |
| 308 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 309 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/countIntervalXx.xls", | |
| 310 | + path + "export/大间隔统计表详细.xls"); | |
| 311 | + } catch (Exception e) { | |
| 312 | + // TODO: handle exception | |
| 313 | + e.printStackTrace(); | |
| 314 | + } | |
| 315 | + | |
| 316 | + return lMap; | |
| 317 | + } | |
| 279 | 318 | } | ... | ... |
src/main/java/com/bsth/data/BasicData.java
| ... | ... | @@ -2,6 +2,7 @@ package com.bsth.data; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.Application; |
| 4 | 4 | import com.bsth.data.gpsdata.arrival.GeoCacheData; |
| 5 | +import com.bsth.data.pinyin.PersionPinYinBuffer; | |
| 5 | 6 | import com.bsth.entity.*; |
| 6 | 7 | import com.bsth.entity.schedule.CarConfigInfo; |
| 7 | 8 | import com.bsth.repository.*; |
| ... | ... | @@ -64,10 +65,10 @@ public class BasicData implements CommandLineRunner { |
| 64 | 65 | //线路Code和shangHaiLinecode 对照 |
| 65 | 66 | public static Map<String, String> lineCode2ShangHaiCodeMap; |
| 66 | 67 | |
| 67 | - //驾驶员工号 和 personnel 对象映射 | |
| 68 | + /*//驾驶员工号 和 personnel 对象映射 | |
| 68 | 69 | public static Map<String, Personnel> jsyMap; |
| 69 | 70 | //售票员工号 和 personnel 对象映射 |
| 70 | - public static Map<String, Personnel> spyMap; | |
| 71 | + public static Map<String, Personnel> spyMap;*/ | |
| 71 | 72 | //所以员工和personnerl 对象映射 |
| 72 | 73 | public static Map<String, Personnel> perMap; |
| 73 | 74 | //全量员工 工号和姓名对照 |
| ... | ... | @@ -137,6 +138,9 @@ public class BasicData implements CommandLineRunner { |
| 137 | 138 | @Autowired |
| 138 | 139 | Station2ParkBuffer station2ParkBuffer; |
| 139 | 140 | |
| 141 | + @Autowired | |
| 142 | + PersionPinYinBuffer persionPinYinBuffer; | |
| 143 | + | |
| 140 | 144 | |
| 141 | 145 | @Override |
| 142 | 146 | public void run() { |
| ... | ... | @@ -165,6 +169,8 @@ public class BasicData implements CommandLineRunner { |
| 165 | 169 | geoCacheData.loadData(); |
| 166 | 170 | station2ParkBuffer.saveAll(); |
| 167 | 171 | logger.info("加载基础数据成功!,"); |
| 172 | + //人员拼音转换 | |
| 173 | + persionPinYinBuffer.refresh(); | |
| 168 | 174 | } catch (Exception e) { |
| 169 | 175 | logger.error("加载基础数据时出现异常,", e); |
| 170 | 176 | } |
| ... | ... | @@ -321,7 +327,7 @@ public class BasicData implements CommandLineRunner { |
| 321 | 327 | public void loadPersonnelInfo() { |
| 322 | 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 | 331 | Map<String, String> allPersonMap = new HashMap<>(); |
| 326 | 332 | |
| 327 | 333 | Personnel p; |
| ... | ... | @@ -333,20 +339,20 @@ public class BasicData implements CommandLineRunner { |
| 333 | 339 | if (StringUtils.isEmpty(jobCode)) |
| 334 | 340 | continue; |
| 335 | 341 | |
| 336 | - if (p.getPosts() != null) { | |
| 342 | + /*if (p.getPosts() != null) { | |
| 337 | 343 | if (p.getPosts().equals("1")) |
| 338 | 344 | jsyTempMap.put(jobCode, p); |
| 339 | 345 | else if (p.getPosts().equals("2")) |
| 340 | 346 | spyTempMap.put(jobCode, p); |
| 341 | - } | |
| 347 | + }*/ | |
| 342 | 348 | |
| 343 | 349 | perTempMap.put(jobCode, p); |
| 344 | 350 | |
| 345 | 351 | allPersonMap.put(jobCode, p.getPersonnelName()); |
| 346 | 352 | } |
| 347 | 353 | |
| 348 | - jsyMap = jsyTempMap; | |
| 349 | - spyMap = spyTempMap; | |
| 354 | + //jsyMap = jsyTempMap; | |
| 355 | + //spyMap = spyTempMap; | |
| 350 | 356 | allPerson = allPersonMap; |
| 351 | 357 | perMap = perTempMap; |
| 352 | 358 | } | ... | ... |
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 | + * Id | |
| 13 | + */ | |
| 14 | + private Integer id; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 工号 | |
| 18 | + */ | |
| 19 | + private String workId; | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 姓名 | |
| 23 | + */ | |
| 24 | + private String name; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 全拼 | |
| 28 | + */ | |
| 29 | + private String fullChars; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 简便 | |
| 33 | + */ | |
| 34 | + private String camelChars; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 所属公司编码 | |
| 38 | + */ | |
| 39 | + @JsonIgnore | |
| 40 | + private String companyId; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 所属分公司编码 | |
| 44 | + */ | |
| 45 | + @JsonIgnore | |
| 46 | + private String fgsCompanyId; | |
| 47 | + | |
| 48 | + public String getWorkId() { | |
| 49 | + return workId; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void setWorkId(String workId) { | |
| 53 | + this.workId = workId; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public String getName() { | |
| 57 | + return name; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setName(String name) { | |
| 61 | + this.name = name; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public String getFullChars() { | |
| 65 | + return fullChars; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public void setFullChars(String fullChars) { | |
| 69 | + this.fullChars = fullChars; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public String getCamelChars() { | |
| 73 | + return camelChars; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void setCamelChars(String camelChars) { | |
| 77 | + this.camelChars = camelChars; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public String getCompanyId() { | |
| 81 | + return companyId; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public void setCompanyId(String companyId) { | |
| 85 | + this.companyId = companyId; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public String getFgsCompanyId() { | |
| 89 | + return fgsCompanyId; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public void setFgsCompanyId(String fgsCompanyId) { | |
| 93 | + this.fgsCompanyId = fgsCompanyId; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public Integer getId() { | |
| 97 | + return id; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public void setId(Integer id) { | |
| 101 | + this.id = id; | |
| 102 | + } | |
| 103 | +} | ... | ... |
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.setId(p.getId()); | |
| 40 | + ppy.setCompanyId(p.getCompanyCode()); | |
| 41 | + ppy.setFgsCompanyId(p.getBrancheCompanyCode()); | |
| 42 | + ppy.setName(p.getPersonnelName()); | |
| 43 | + ppy.setWorkId(p.getJobCode()); | |
| 44 | + try { | |
| 45 | + ppy.setFullChars(PinyinHelper.convertToPinyinString(ppy.getName(), "" , PinyinFormat.WITHOUT_TONE)); | |
| 46 | + ppy.setCamelChars(PinyinHelper.getShortPinyin(ppy.getName())); | |
| 47 | + }catch (PinyinException pye){ | |
| 48 | + log.error("拼音转换出现异常," + ppy.getName(), pye); | |
| 49 | + continue; | |
| 50 | + } | |
| 51 | + | |
| 52 | + listMultimapCopy.put(ppy.getCompanyId() + "_" + ppy.getFgsCompanyId(), ppy); | |
| 53 | + allCopy.add(ppy); | |
| 54 | + } | |
| 55 | + | |
| 56 | + if(allCopy.size() > 0){ | |
| 57 | + all = allCopy; | |
| 58 | + listMultimap = listMultimapCopy; | |
| 59 | + } | |
| 60 | + } | |
| 61 | + | |
| 62 | + public List<PersionPinYin> getAll(){ | |
| 63 | + return all; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public List<PersionPinYin> getAll(List<CompanyAuthority> auths){ | |
| 67 | + List<PersionPinYin> rs = new ArrayList<>(); | |
| 68 | + for(CompanyAuthority ca : auths){ | |
| 69 | + rs.addAll(listMultimap.get(ca.getCompanyCode() + "_" + ca.getSubCompanyCode())); | |
| 70 | + } | |
| 71 | + return rs; | |
| 72 | + } | |
| 73 | +} | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -7,6 +7,7 @@ import com.bsth.common.ResponseCode; |
| 7 | 7 | import com.bsth.data.LineConfigData; |
| 8 | 8 | import com.bsth.data.gpsdata.GpsRealData; |
| 9 | 9 | import com.bsth.data.gpsdata.recovery.GpsDataRecovery; |
| 10 | +import com.bsth.data.schedule.f_a_l.FirstAndLastHandler; | |
| 10 | 11 | import com.bsth.entity.realcontrol.LineConfig; |
| 11 | 12 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 12 | 13 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| ... | ... | @@ -176,6 +177,8 @@ public class DayOfSchedule { |
| 176 | 177 | //添加到缓存 |
| 177 | 178 | putAll(list); |
| 178 | 179 | |
| 180 | + //标记首末班 | |
| 181 | + FirstAndLastHandler.marks(list); | |
| 179 | 182 | |
| 180 | 183 | Set<String> lps = searchAllLP(list); |
| 181 | 184 | for (String lp : lps) { |
| ... | ... | @@ -794,6 +797,7 @@ public class DayOfSchedule { |
| 794 | 797 | |
| 795 | 798 | public void save(ScheduleRealInfo sch) { |
| 796 | 799 | //schRepository.save(sch); |
| 800 | + sch.setUpdateDate(new Date()); | |
| 797 | 801 | pstBuffer.add(sch); |
| 798 | 802 | } |
| 799 | 803 | ... | ... |
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/SchedulePstThread.java
| 1 | 1 | package com.bsth.data.schedule.thread; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 3 | 4 | import com.bsth.data.schedule.DayOfSchedule; |
| 4 | 5 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 5 | 6 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 6 | 7 | import org.slf4j.Logger; |
| 7 | 8 | import org.slf4j.LoggerFactory; |
| 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | -import org.springframework.orm.jpa.JpaObjectRetrievalFailureException; | |
| 10 | +import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource; | |
| 11 | +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; | |
| 10 | 12 | import org.springframework.stereotype.Component; |
| 11 | 13 | |
| 12 | -import javax.persistence.EntityNotFoundException; | |
| 13 | - | |
| 14 | 14 | /** |
| 15 | 15 | * @author PanZhao |
| 16 | 16 | * @ClassName: SchedulePstThread |
| ... | ... | @@ -23,36 +23,68 @@ public class SchedulePstThread extends Thread { |
| 23 | 23 | @Autowired |
| 24 | 24 | ScheduleRealInfoRepository scheduleRepository; |
| 25 | 25 | |
| 26 | + @Autowired | |
| 27 | + NamedParameterJdbcTemplate jdbcTemplate; | |
| 28 | + | |
| 29 | + @Autowired | |
| 30 | + DayOfSchedule dayOfSchedule; | |
| 31 | + | |
| 26 | 32 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 27 | 33 | |
| 28 | 34 | @Override |
| 29 | 35 | public void run() { |
| 30 | 36 | |
| 31 | - //LinkedList<ScheduleRealInfo> list = DayOfSchedule.pstBuffer; | |
| 32 | - | |
| 33 | 37 | ScheduleRealInfo schedule; |
| 34 | 38 | for (int i = 0; i < 1000; i++) { |
| 35 | 39 | schedule = DayOfSchedule.pstBuffer.poll(); |
| 36 | 40 | if (null == schedule) |
| 37 | 41 | break; |
| 38 | 42 | |
| 39 | - if(schedule.isDeleted()){ | |
| 43 | + if (schedule.isDeleted()) { | |
| 40 | 44 | logger.error("save 发现 deleted=true 的班次,id: " + schedule.getId()); |
| 41 | 45 | continue; |
| 42 | 46 | } |
| 43 | 47 | |
| 44 | - try { | |
| 45 | - scheduleRepository.save(schedule); | |
| 46 | - } | |
| 47 | - catch (JpaObjectRetrievalFailureException e1){ | |
| 48 | - logger.error("JpaObjectRetrievalFailureException error.... 可忽略"); | |
| 49 | - } | |
| 50 | - catch(EntityNotFoundException e2){ | |
| 51 | - logger.error("EntityNotFoundException error.... 可忽略"); | |
| 52 | - } | |
| 53 | - catch (Exception e) { | |
| 54 | - logger.error("班次入库的时候出现未知异常!!", e); | |
| 55 | - } | |
| 48 | + save(schedule); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 班次更新到数据库,不走jpa | |
| 54 | + * | |
| 55 | + * @param sch | |
| 56 | + */ | |
| 57 | + public void save(ScheduleRealInfo sch) { | |
| 58 | + if (sch.getId() == null) { | |
| 59 | + logger.error("入库的班次没有ID, " + JSON.toJSONString(sch)); | |
| 60 | + return; | |
| 61 | + } | |
| 62 | + | |
| 63 | + if(sch.getSaveFailCount() > 5){ | |
| 64 | + logger.error("入库失败上限, " + JSON.toJSONString(sch)); | |
| 65 | + return; | |
| 66 | + } | |
| 67 | + | |
| 68 | + try { | |
| 69 | + String sql = "UPDATE bsth_c_s_sp_info_real" + | |
| 70 | + " SET adjust_exps=:adjustExps, bc_type=:bcType, bcs=:bcs, bcsj=:bcsj, ccno=:ccno, cl_zbh=:clZbh, df_auto=:dfAuto," + | |
| 71 | + " dfsj=:dfsj, directive_state=:directiveState, fcno=:fcno, fcsj=:fcsj, fcsj_actual=:fcsjActual, fgs_bm=:fgsBm, fgs_name=:fgsName, gs_bm=:gsBm, gs_name=:gsName," + | |
| 72 | + " j_gh=:jGh, j_name=:jName, jhlc=:jhlc, jhlc_orig=:jhlcOrig, lp_name=:lpName, ONLINE=:online, qdz_code=:qdzCode, qdz_name=:qdzName," + | |
| 73 | + " real_exec_date=:realExecDate, reissue=:reissue, remarks=:remarks, s_gh=:sGh, s_name=:sName, schedule_date=:scheduleDate," + | |
| 74 | + " schedule_date_str=:scheduleDateStr, sflj=:sflj, sp_id=:spId, STATUS=:status, update_date=:updateDate, xl_bm=:xlBm, xl_dir=:xlDir, xl_name=:xlName," + | |
| 75 | + " zdsj=:zdsj, zdsj_actual=:zdsjActual, zdz_code=:zdzCode, zdz_name=:zdzName" + | |
| 76 | + " WHERE " + | |
| 77 | + " id=:id"; | |
| 78 | + | |
| 79 | + jdbcTemplate.update(sql, new BeanPropertySqlParameterSource(sch)); | |
| 80 | + sch.setSaveFailCount(0); | |
| 81 | + } catch (Exception e) { | |
| 82 | + //下次入库再试 | |
| 83 | + sch.setSaveFailCount(sch.getSaveFailCount()+1); | |
| 84 | + dayOfSchedule.save(sch); | |
| 85 | + | |
| 86 | + logger.error("班次 " + sch.getId() + "入库失败," + JSON.toJSONString(sch)); | |
| 87 | + logger.error("", e); | |
| 56 | 88 | } |
| 57 | 89 | } |
| 58 | 90 | } | ... | ... |
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| ... | ... | @@ -5,6 +5,7 @@ import com.bsth.data.LineConfigData; |
| 5 | 5 | import com.bsth.data.directive.DayOfDirectives; |
| 6 | 6 | import com.bsth.data.pilot80.PilotReport; |
| 7 | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| 8 | +import com.bsth.data.schedule.f_a_l.FirstAndLastHandler; | |
| 8 | 9 | import com.bsth.entity.realcontrol.LineConfig; |
| 9 | 10 | import org.slf4j.Logger; |
| 10 | 11 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -69,7 +70,9 @@ public class ScheduleRefreshThread extends Thread{ |
| 69 | 70 | logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size()); |
| 70 | 71 | } |
| 71 | 72 | } |
| 72 | - | |
| 73 | + | |
| 74 | + //首末班入库(给网关用的数据) | |
| 75 | + FirstAndLastHandler.saveAll(); | |
| 73 | 76 | } catch (Exception e) { |
| 74 | 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 | 279 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -30,8 +30,9 @@ public class ScheduleRealInfo { |
| 30 | 30 | /** 计划ID */ |
| 31 | 31 | private Long spId; |
| 32 | 32 | |
| 33 | - /** 排班计划日期 */ | |
| 33 | + /** 排班计划日期 --no webSocket */ | |
| 34 | 34 | private Date scheduleDate; |
| 35 | + /** 排班日期字符串 YYYY-MM-DD */ | |
| 35 | 36 | private String scheduleDateStr; |
| 36 | 37 | |
| 37 | 38 | /** 真实执行时间 yyyy-MM-dd */ |
| ... | ... | @@ -81,9 +82,9 @@ public class ScheduleRealInfo { |
| 81 | 82 | @Transient |
| 82 | 83 | private Long zdsjT; |
| 83 | 84 | |
| 84 | - /** 发车顺序号 */ | |
| 85 | + /** 发车顺序号 --no webSocket*/ | |
| 85 | 86 | private Integer fcno; |
| 86 | - /** 对应班次数 */ | |
| 87 | + /** 对应班次数 --no webSocket*/ | |
| 87 | 88 | private Integer bcs; |
| 88 | 89 | /** 计划里程 */ |
| 89 | 90 | private Double jhlc; |
| ... | ... | @@ -91,10 +92,12 @@ public class ScheduleRealInfo { |
| 91 | 92 | /** 原始计划里程 (原计调的数据) */ |
| 92 | 93 | private Double jhlcOrig; |
| 93 | 94 | |
| 94 | - /** 实际里程 这个字段被废弃*/ | |
| 95 | + /** 实际里程 --no webSocket*/ | |
| 96 | + @Transient | |
| 97 | + @JsonIgnore | |
| 95 | 98 | private Double realMileage; |
| 96 | 99 | |
| 97 | - /** 实际里程 */ | |
| 100 | + /** 实际里程 --no webSocket */ | |
| 98 | 101 | @Transient |
| 99 | 102 | private String sjlc; |
| 100 | 103 | /** 班次历时 */ |
| ... | ... | @@ -153,7 +156,8 @@ public class ScheduleRealInfo { |
| 153 | 156 | /** 备注*/ |
| 154 | 157 | private String remarks; |
| 155 | 158 | |
| 156 | - /** 原计划排班备注 */ | |
| 159 | + /** 原计划排班备注 --no webSocket */ | |
| 160 | + @Transient | |
| 157 | 161 | private String remark; |
| 158 | 162 | |
| 159 | 163 | /**待发时间(格式 HH:mm) */ |
| ... | ... | @@ -166,9 +170,6 @@ public class ScheduleRealInfo { |
| 166 | 170 | /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */ |
| 167 | 171 | private Integer directiveState = -1; |
| 168 | 172 | |
| 169 | - /** “运营状态” 指令下发状态 60: 已发送, 100: 设备确认收到 0:失败*/ | |
| 170 | - private Integer opDirectiveState; | |
| 171 | - | |
| 172 | 173 | /** 起点站计划到达时间 */ |
| 173 | 174 | @Transient |
| 174 | 175 | private String qdzArrDatejh; |
| ... | ... | @@ -200,7 +201,7 @@ public class ScheduleRealInfo { |
| 200 | 201 | /** 是否有补发GPS信号 */ |
| 201 | 202 | private boolean reissue; |
| 202 | 203 | |
| 203 | - /** 发车屏 发车顺序号,不持久化,会动态变化 */ | |
| 204 | + /** 发车屏 发车顺序号,不持久化,会动态变化 --no webSocket*/ | |
| 204 | 205 | @Transient |
| 205 | 206 | private int fcpSn; |
| 206 | 207 | |
| ... | ... | @@ -209,6 +210,10 @@ public class ScheduleRealInfo { |
| 209 | 210 | @JsonIgnore |
| 210 | 211 | private boolean deleted; |
| 211 | 212 | |
| 213 | + @Transient | |
| 214 | + @JsonIgnore | |
| 215 | + private int saveFailCount=0; | |
| 216 | + | |
| 212 | 217 | public boolean isDfAuto() { |
| 213 | 218 | return dfAuto; |
| 214 | 219 | } |
| ... | ... | @@ -486,7 +491,7 @@ public class ScheduleRealInfo { |
| 486 | 491 | if(this.isSflj()) |
| 487 | 492 | this.setJhlcOrig(this.getJhlc()); |
| 488 | 493 | } |
| 489 | - | |
| 494 | + | |
| 490 | 495 | public String getSjlc() { |
| 491 | 496 | return sjlc; |
| 492 | 497 | } |
| ... | ... | @@ -816,22 +821,6 @@ public class ScheduleRealInfo { |
| 816 | 821 | calcStatus(); |
| 817 | 822 | } |
| 818 | 823 | |
| 819 | - public Integer getOpDirectiveState() { | |
| 820 | - return opDirectiveState; | |
| 821 | - } | |
| 822 | - | |
| 823 | - public void setOpDirectiveState(Integer opDirectiveState) { | |
| 824 | - this.opDirectiveState = opDirectiveState; | |
| 825 | - } | |
| 826 | - | |
| 827 | -/* public ScheduleRealInfo getTwinsSch() { | |
| 828 | - return twinsSch; | |
| 829 | - } | |
| 830 | - | |
| 831 | - public void setTwinsSch(ScheduleRealInfo twinsSch) { | |
| 832 | - this.twinsSch = twinsSch; | |
| 833 | - }*/ | |
| 834 | - | |
| 835 | 824 | public boolean isLate() { |
| 836 | 825 | return late; |
| 837 | 826 | } |
| ... | ... | @@ -925,4 +914,12 @@ public class ScheduleRealInfo { |
| 925 | 914 | public void setDeleted(boolean deleted) { |
| 926 | 915 | this.deleted = deleted; |
| 927 | 916 | } |
| 917 | + | |
| 918 | + public int getSaveFailCount() { | |
| 919 | + return saveFailCount; | |
| 920 | + } | |
| 921 | + | |
| 922 | + public void setSaveFailCount(int saveFailCount) { | |
| 923 | + this.saveFailCount = saveFailCount; | |
| 924 | + } | |
| 928 | 925 | } | ... | ... |
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 | 177 | |
| 178 | 178 | @Modifying |
| 179 | 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 | 192 | @Modifying |
| 183 | 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 | 40 | /*@Query(value = "SELECT s.b_jwpoints,s.id FROM bsth_c_station s where s.station_name like ?1" |
| 41 | 41 | , nativeQuery=true) |
| 42 | 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 | 43 | @Query(value = " SELECT t.b_jwpoints,t.id FROM (" + |
| 49 | 44 | " SELECT b.id,b.b_jwpoints,b.station_name,a.directions FROM (" + |
| 50 | 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 | 47 | , nativeQuery=true) |
| 55 | 48 | List<Object[]> findStationName(Integer dir , String stationName); |
| 56 | 49 | |
| ... | ... | @@ -108,24 +101,18 @@ public interface StationRepository extends BaseRepository<Station, Integer> { |
| 108 | 101 | "y = ?9 , " + |
| 109 | 102 | "b_polygon_grid = ST_GeomFromText(?10) , " + |
| 110 | 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 | 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 | 112 | Float gLonx,Float gLaty,Float x,Float y, String bPolygonGrid,String gPolygonGrid, |
| 126 | 113 | |
| 127 | 114 | Integer destroy, Integer radius,String shapesType, Integer versions,String descriptions,Integer stationId); |
| 128 | - */ | |
| 115 | + | |
| 129 | 116 | |
| 130 | 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 | 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 | 266 | "StationRoute s " + |
| 267 | 267 | "WHERE " + |
| 268 | 268 | "s.destroy = 0 " + |
| 269 | + "and s.lineCode in(select lineCode from Line where inUse = 1) " + | |
| 269 | 270 | "ORDER BY " + |
| 270 | 271 | "lineCode,directions,stationRouteCode") |
| 271 | 272 | List<Map<String, String>> findAllLineWithYgc(); |
| ... | ... | @@ -282,7 +283,27 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int |
| 282 | 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 | 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 | 296 | @Modifying |
| 286 | 297 | @Query(value="UPDATE bsth_c_stationroute set destroy = 1 where id = ?1", nativeQuery=true) |
| 287 | 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/service/SectionRouteService.java
| ... | ... | @@ -32,6 +32,8 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> |
| 32 | 32 | |
| 33 | 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 | 38 | * @Description : TODO(根据路段路由Id批量撤销路段) |
| 37 | 39 | * |
| ... | ... | @@ -60,4 +62,5 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> |
| 60 | 62 | List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map); |
| 61 | 63 | |
| 62 | 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 | 31 | Map<String, Object> sectionUpdate(Map<String, Object> map); |
| 32 | 32 | |
| 33 | 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 | 77 | */ |
| 78 | 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 | 84 | * @Description : TODO(根据线路ID生成行单) |
| 82 | 85 | * |
| ... | ... | @@ -102,4 +105,5 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> |
| 102 | 105 | |
| 103 | 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 | 69 | */ |
| 70 | 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/gps/GpsService.java
| ... | ... | @@ -47,5 +47,5 @@ public interface GpsService { |
| 47 | 47 | List<GpsSpeed> findPosition(String deviceid, String startdate, |
| 48 | 48 | String enddate) throws ParseException; |
| 49 | 49 | |
| 50 | - PageObject<GpsSpeed> Pagequery(Map<String, Object> map); | |
| 50 | + Map<String, Object> Pagequery(Map<String, Object> map); | |
| 51 | 51 | } | ... | ... |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| ... | ... | @@ -1053,16 +1053,19 @@ public class GpsServiceImpl implements GpsService { |
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | @Override |
| 1056 | - public PageObject<GpsSpeed> Pagequery(Map<String, Object> map) { | |
| 1057 | - | |
| 1056 | + public Map<String, Object> Pagequery(Map<String, Object> map) { | |
| 1058 | 1057 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 1058 | + Integer totalDays = 0;//数据跨越天数 | |
| 1059 | + try { | |
| 1060 | + totalDays = (int) ((sdf.parse(map.get("endDate").toString()+" 23:59:59").getTime()-sdf.parse(map.get("startDate").toString()+" 00:00:00").getTime()+1)/(3600*24*1000))+1; | |
| 1061 | + } catch (ParseException e) { | |
| 1062 | + e.printStackTrace(); | |
| 1063 | + }//总页数 | |
| 1064 | + map.put("totalDays",totalDays); | |
| 1059 | 1065 | List<GpsSpeed> list=findAll(map); |
| 1060 | 1066 | List<GpsSpeed> listResult = new ArrayList<GpsSpeed>(); |
| 1061 | - int curPage;//页码 | |
| 1062 | - int pageData;//每页的记录条数 | |
| 1063 | - int start;//起始数据下标 | |
| 1064 | - int totalPage;//总页数 | |
| 1065 | - int totalData = 0; | |
| 1067 | + int curPage = 0;//页码 | |
| 1068 | + int pageData = 0;//每页的记录条数 | |
| 1066 | 1069 | if(list.size()>1){ |
| 1067 | 1070 | GpsSpeed GpsSpeedNow;//下标为i的车辆行驶记录 |
| 1068 | 1071 | GpsSpeed GpsSpeedLast;//下标为i-1的车辆行驶记录 |
| ... | ... | @@ -1099,49 +1102,35 @@ public class GpsServiceImpl implements GpsService { |
| 1099 | 1102 | } |
| 1100 | 1103 | } |
| 1101 | 1104 | } |
| 1102 | - Iterator<GpsSpeed> speedIt = listResult.iterator(); | |
| 1103 | - while(speedIt.hasNext()){ | |
| 1104 | - GpsSpeed GpsSpeed = speedIt.next(); | |
| 1105 | - if(GpsSpeed.getEndtimestamp()-GpsSpeed.getTimestamp()<=1000){ | |
| 1106 | - speedIt.remove(); | |
| 1107 | - } | |
| 1108 | - } | |
| 1109 | - | |
| 1110 | - totalData = listResult.size();//总记录条数。 | |
| 1111 | - if(map.get("curPage") == null || map.get("curPage").equals("0")){ | |
| 1112 | - curPage = 0; | |
| 1113 | - }else{ | |
| 1114 | - curPage = Integer.parseInt((String) map.get("curPage")); | |
| 1115 | - } | |
| 1116 | - pageData = Integer.parseInt((String) map.get("pageData"));//每页的记录条数 | |
| 1117 | - start = (curPage - 0) * pageData; //起始记录下标。 | |
| 1118 | - totalPage = totalData % pageData == 0 ? totalData / pageData : totalData / pageData +1;//总页数 | |
| 1119 | - if(curPage == totalPage-1){//如果当前页等于总页数。 | |
| 1120 | - listResult = listResult.subList(start, totalData); | |
| 1121 | - }else{ | |
| 1122 | - listResult = listResult.subList(start, start+pageData); | |
| 1105 | + if(listResult.size()>0){ | |
| 1106 | + Iterator<GpsSpeed> speedIt = listResult.iterator(); | |
| 1107 | + while(speedIt.hasNext()){ | |
| 1108 | + GpsSpeed GpsSpeed = speedIt.next(); | |
| 1109 | + if(GpsSpeed.getEndtimestamp()-GpsSpeed.getTimestamp()<=1000){ | |
| 1110 | + speedIt.remove(); | |
| 1111 | + } | |
| 1112 | + } | |
| 1123 | 1113 | } |
| 1124 | - }else{ | |
| 1125 | - curPage = 1; | |
| 1126 | - pageData = Integer.parseInt((String) map.get("pageData"));//每页的记录条数 | |
| 1127 | - totalPage =1; | |
| 1128 | 1114 | } |
| 1115 | + if(map.get("curPage") == null || map.get("curPage").equals("0")){ | |
| 1116 | + curPage = 0; | |
| 1117 | + }else{ | |
| 1118 | + curPage = Integer.parseInt((String) map.get("curPage")); | |
| 1119 | + } | |
| 1120 | + Integer totalPage = totalDays; | |
| 1121 | + pageData = listResult.size();//每页的记录条数就是当前页查出的全部数据。 | |
| 1129 | 1122 | Map<String,Object> paramMap = new HashMap<String,Object>(); |
| 1130 | 1123 | paramMap.put("totalPage", totalPage); |
| 1131 | - paramMap.put("curPage", curPage); | |
| 1124 | + paramMap.put("page", curPage); | |
| 1132 | 1125 | paramMap.put("pageData", pageData); |
| 1133 | - PageHelper pageHelper = new PageHelper(totalData, paramMap); | |
| 1134 | - pageHelper.getMap(); | |
| 1135 | - PageObject<GpsSpeed> pageObject = pageHelper.getPageObject(); | |
| 1136 | - pageObject.setDataList(listResult); | |
| 1137 | - return pageObject; | |
| 1126 | + paramMap.put("list", listResult); | |
| 1127 | + return paramMap; | |
| 1138 | 1128 | } |
| 1139 | 1129 | |
| 1140 | 1130 | static List<GpsSpeed> findAll(Map<String, Object> map) { |
| 1141 | 1131 | Connection conn = null; |
| 1142 | 1132 | PreparedStatement ps = null; |
| 1143 | 1133 | ResultSet rs = null; |
| 1144 | - int page=Integer.parseInt(map.get("page").toString()); | |
| 1145 | 1134 | List<GpsSpeed> list=new ArrayList<GpsSpeed>(); |
| 1146 | 1135 | String sql="select * from bsth_c_gps_info where 1=1 "; |
| 1147 | 1136 | Object line=map.get("line"); |
| ... | ... | @@ -1149,6 +1138,13 @@ public class GpsServiceImpl implements GpsService { |
| 1149 | 1138 | Object updown=map.get("updown"); |
| 1150 | 1139 | Object startDate=map.get("startDate"); |
| 1151 | 1140 | Object endDate=map.get("endDate"); |
| 1141 | + Integer totalDays = Integer.valueOf(map.get("totalDays").toString()); | |
| 1142 | + Integer curPage = 0;//页码 | |
| 1143 | + if(map.get("curPage") == null || map.get("curPage").equals("0")){ | |
| 1144 | + curPage = 0; | |
| 1145 | + }else{ | |
| 1146 | + curPage = Integer.parseInt((String) map.get("curPage")); | |
| 1147 | + } | |
| 1152 | 1148 | |
| 1153 | 1149 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 1154 | 1150 | if(line!=null){ |
| ... | ... | @@ -1167,7 +1163,7 @@ public class GpsServiceImpl implements GpsService { |
| 1167 | 1163 | if(startDate!=null){ |
| 1168 | 1164 | if (startDate.toString().length()>0) { |
| 1169 | 1165 | try { |
| 1170 | - Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime(); | |
| 1166 | + Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime()+curPage*3600*24*1000; | |
| 1171 | 1167 | sql += " and ts >="+t1; |
| 1172 | 1168 | } catch (ParseException e) { |
| 1173 | 1169 | e.printStackTrace(); |
| ... | ... | @@ -1178,7 +1174,7 @@ public class GpsServiceImpl implements GpsService { |
| 1178 | 1174 | if(endDate!=null){ |
| 1179 | 1175 | if (endDate.toString().length()>0) { |
| 1180 | 1176 | try { |
| 1181 | - Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime(); | |
| 1177 | + Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime()-(totalDays-1-curPage)*3600*24*1000; | |
| 1182 | 1178 | sql += " and ts <="+t2; |
| 1183 | 1179 | } catch (ParseException e) { |
| 1184 | 1180 | e.printStackTrace(); | ... | ... |
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
| ... | ... | @@ -22,6 +22,7 @@ import com.bsth.entity.SectionRoute; |
| 22 | 22 | import com.bsth.entity.search.CustomerSpecs; |
| 23 | 23 | import com.bsth.repository.LineRepository; |
| 24 | 24 | import com.bsth.repository.SectionRepository; |
| 25 | +import com.bsth.repository.SectionRouteCacheRepository; | |
| 25 | 26 | import com.bsth.repository.SectionRouteRepository; |
| 26 | 27 | import com.bsth.service.SectionRouteService; |
| 27 | 28 | import com.bsth.util.GetUIDAndCode; |
| ... | ... | @@ -49,6 +50,9 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 49 | 50 | SectionRouteRepository repository; |
| 50 | 51 | |
| 51 | 52 | @Autowired |
| 53 | + SectionRouteCacheRepository Cacherepository; | |
| 54 | + | |
| 55 | + @Autowired | |
| 52 | 56 | SectionRepository repository2; |
| 53 | 57 | |
| 54 | 58 | @Autowired |
| ... | ... | @@ -117,7 +121,55 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 117 | 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 | 291 | if(reslutList.get(0)!=null) { |
| 240 | 292 | for(int i = 0 ; i <reslutList.size() ;i++){ |
| 241 | 293 | Map<String, Object> tempM = new HashMap<String, Object>(); |
| 242 | - System.out.println(reslutList.get(i)); | |
| 243 | 294 | tempM.put("sectionrouteCode", reslutList.get(i)); |
| 244 | 295 | list.add(tempM); |
| 245 | 296 | } |
| ... | ... | @@ -325,13 +376,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 325 | 376 | //int i = 0; |
| 326 | 377 | String[] idsStr = map.get("ids").toString().split(",") ; |
| 327 | 378 | for (String id : idsStr) { |
| 328 | - /* entityManager.persist(Integer.parseInt(id));*/ | |
| 329 | 379 | repository.sectionRouteIsDestroyUpdBatch(Integer.parseInt(id)); |
| 330 | -/* i++; | |
| 331 | - if (i % batchSize == 0) { | |
| 332 | - entityManager.flush(); | |
| 333 | - entityManager.clear(); | |
| 334 | - }*/ | |
| 335 | 380 | } |
| 336 | 381 | resultMap.put("status", ResponseCode.SUCCESS); |
| 337 | 382 | } catch (Exception e) { | ... | ... |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| 1 | 1 | package com.bsth.service.impl; |
| 2 | 2 | |
| 3 | 3 | import java.text.SimpleDateFormat; |
| 4 | +import java.util.ArrayList; | |
| 4 | 5 | import java.util.Date; |
| 5 | 6 | import java.util.HashMap; |
| 7 | +import java.util.List; | |
| 6 | 8 | import java.util.Map; |
| 7 | 9 | |
| 10 | +import org.mozilla.javascript.ObjArray; | |
| 8 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | +import org.springframework.data.jpa.domain.Specification; | |
| 9 | 13 | import org.springframework.stereotype.Service; |
| 10 | 14 | import org.springframework.transaction.annotation.Transactional; |
| 11 | 15 | |
| 12 | 16 | import com.alibaba.fastjson.JSONArray; |
| 17 | +import com.alibaba.fastjson.JSONObject; | |
| 13 | 18 | import com.bsth.common.ResponseCode; |
| 14 | 19 | import com.bsth.entity.Line; |
| 15 | 20 | import com.bsth.entity.Section; |
| 16 | 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 | 25 | import com.bsth.repository.LineRepository; |
| 18 | 26 | import com.bsth.repository.SectionRepository; |
| 27 | +import com.bsth.repository.SectionRouteCacheRepository; | |
| 19 | 28 | import com.bsth.repository.SectionRouteRepository; |
| 29 | +import com.bsth.repository.StationRouteCacheRepository; | |
| 30 | +import com.bsth.repository.StationRouteRepository; | |
| 20 | 31 | import com.bsth.service.SectionService; |
| 32 | +import com.bsth.util.GetUIDAndCode; | |
| 21 | 33 | import com.bsth.util.TransGPS; |
| 22 | 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 | 64 | @Autowired |
| 50 | 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 | 327 | * @Description :TODO(编辑线路走向) |
| 54 | 328 | * |
| ... | ... | @@ -177,6 +451,130 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 177 | 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 | 578 | /** 百度坐标转WGS坐标 */ |
| 181 | 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 | 8 | import com.bsth.repository.LineRepository; |
| 9 | 9 | import com.bsth.repository.SectionRouteRepository; |
| 10 | 10 | import com.bsth.repository.StationRepository; |
| 11 | +import com.bsth.repository.StationRouteCacheRepository; | |
| 11 | 12 | import com.bsth.repository.StationRouteRepository; |
| 12 | 13 | import com.bsth.service.StationRouteService; |
| 13 | 14 | import com.bsth.util.FTPClientUtils; |
| ... | ... | @@ -51,6 +52,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 51 | 52 | private StationRouteRepository repository; |
| 52 | 53 | |
| 53 | 54 | @Autowired |
| 55 | + private StationRouteCacheRepository cacheRepository; | |
| 56 | + | |
| 57 | + @Autowired | |
| 54 | 58 | private SectionRouteRepository routeRepository; |
| 55 | 59 | |
| 56 | 60 | @Autowired |
| ... | ... | @@ -493,6 +497,46 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 493 | 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 | 541 | * @Description :TODO(撤销站点) |
| 498 | 542 | * |
| ... | ... | @@ -668,6 +712,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 668 | 712 | * @return String |
| 669 | 713 | */ |
| 670 | 714 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { |
| 715 | + | |
| 671 | 716 | // 返回值String |
| 672 | 717 | String stationRStr = ""; |
| 673 | 718 | // windows下的文本文件换行符 |
| ... | ... | @@ -771,6 +816,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 771 | 816 | |
| 772 | 817 | } |
| 773 | 818 | return stationRStr; |
| 819 | + | |
| 774 | 820 | } |
| 775 | 821 | |
| 776 | 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 | 2 | |
| 3 | 3 | import java.math.BigDecimal; |
| 4 | 4 | import java.util.HashMap; |
| 5 | +import java.util.Iterator; | |
| 5 | 6 | import java.util.List; |
| 6 | 7 | import java.util.Map; |
| 7 | 8 | |
| ... | ... | @@ -20,18 +21,23 @@ import com.bsth.entity.Line; |
| 20 | 21 | import com.bsth.entity.LineInformation; |
| 21 | 22 | import com.bsth.entity.Section; |
| 22 | 23 | import com.bsth.entity.SectionRoute; |
| 24 | +import com.bsth.entity.SectionRouteCache; | |
| 23 | 25 | import com.bsth.entity.Station; |
| 24 | 26 | import com.bsth.entity.StationRoute; |
| 27 | +import com.bsth.entity.StationRouteCache; | |
| 25 | 28 | import com.bsth.repository.LineInformationRepository; |
| 26 | 29 | import com.bsth.repository.LineRepository; |
| 27 | 30 | import com.bsth.repository.SectionRepository; |
| 31 | +import com.bsth.repository.SectionRouteCacheRepository; | |
| 28 | 32 | import com.bsth.repository.SectionRouteRepository; |
| 29 | 33 | import com.bsth.repository.StationRepository; |
| 34 | +import com.bsth.repository.StationRouteCacheRepository; | |
| 30 | 35 | import com.bsth.repository.StationRouteRepository; |
| 31 | 36 | import com.bsth.service.StationService; |
| 32 | 37 | import com.bsth.util.GetUIDAndCode; |
| 33 | 38 | import com.bsth.util.TransGPS; |
| 34 | 39 | import com.bsth.util.TransGPS.Location; |
| 40 | +import com.bsth.util.Geo.Circle; | |
| 35 | 41 | import com.bsth.util.Geo.GeoUtils; |
| 36 | 42 | import com.bsth.util.Geo.Point; |
| 37 | 43 | |
| ... | ... | @@ -61,6 +67,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 61 | 67 | private StationRouteRepository routeRepository; |
| 62 | 68 | |
| 63 | 69 | @Autowired |
| 70 | + private StationRouteCacheRepository routeCacheRepository; | |
| 71 | + | |
| 72 | + @Autowired | |
| 64 | 73 | private LineInformationRepository informationRepository; |
| 65 | 74 | |
| 66 | 75 | @Autowired |
| ... | ... | @@ -72,6 +81,11 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 72 | 81 | @Autowired |
| 73 | 82 | private SectionRouteRepository sectionRouteRepository; |
| 74 | 83 | |
| 84 | + @Autowired | |
| 85 | + private SectionRouteCacheRepository sectionRouteCacheRepository; | |
| 86 | + | |
| 87 | + private GeoUtils geoUtils; | |
| 88 | + | |
| 75 | 89 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 76 | 90 | |
| 77 | 91 | /** |
| ... | ... | @@ -118,6 +132,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 118 | 132 | Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); |
| 119 | 133 | String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); |
| 120 | 134 | if(!stationJSON.equals("")) { |
| 135 | + // 保存前先撤销原有站点 | |
| 136 | + | |
| 121 | 137 | // 保存站点与站点路由信息 |
| 122 | 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 | 946 | Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); |
| 931 | 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 | 950 | // 站点路由Id |
| 936 | 951 | Integer stationRouteId = map.get("stationRouteId").equals("") ? null : Integer.parseInt(map.get("stationRouteId").toString()); |
| 937 | 952 | StationRoute resultS = routeRepository.findOne(stationRouteId); |
| ... | ... | @@ -1000,7 +1015,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1000 | 1015 | |
| 1001 | 1016 | } |
| 1002 | 1017 | |
| 1003 | - | |
| 1018 | + @Transactional | |
| 1004 | 1019 | @Override |
| 1005 | 1020 | public Map<String, Object> manualSave(Map<String, Object> map) { |
| 1006 | 1021 | Map<String, Object> resultMap = new HashMap<String,Object>(); |
| ... | ... | @@ -1073,6 +1088,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1073 | 1088 | Integer destroy,Integer directions) { |
| 1074 | 1089 | // 转换成JSON数组 |
| 1075 | 1090 | JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); |
| 1091 | + // 更新路线前撤销线路原有路段 | |
| 1092 | + sectionRouteRepository.sectionRouteUpdDestroy(Integer.parseInt(resultLine.getLineCode()),directions); | |
| 1076 | 1093 | // 遍历 |
| 1077 | 1094 | for(int s = 0 ;s<sectionsArray.size();s++) { |
| 1078 | 1095 | // 站点名称 |
| ... | ... | @@ -1093,11 +1110,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1093 | 1110 | if(p==pointsArray.size()-1){ |
| 1094 | 1111 | sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr; |
| 1095 | 1112 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr; |
| 1096 | - // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat"); | |
| 1097 | 1113 | }else { |
| 1098 | 1114 | sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; |
| 1099 | 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 | 1165 | sectionRoute.setVersions(versions); |
| 1151 | 1166 | sectionRoute.setDestroy(destroy); |
| 1152 | 1167 | // 方向 |
| 1153 | - sectionRoute.setDirections(directions); | |
| 1168 | + sectionRoute.setDirections(directions); | |
| 1169 | + // 保存路段 | |
| 1154 | 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/realcontrol/ScheduleRealInfoService.java
| ... | ... | @@ -105,7 +105,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L |
| 105 | 105 | List<Map<String,Object>> accountPx(String line,String date,String code,String xlName, String px); |
| 106 | 106 | |
| 107 | 107 | |
| 108 | - List<SchEditInfoDto> correctForm(String line,String date,String endDate,String lpName,String code, String type); | |
| 108 | + List<SchEditInfoDto> correctForm(String line,String date,String endDate,String lpName,String code, String type,String changType); | |
| 109 | 109 | |
| 110 | 110 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line); |
| 111 | 111 | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -1810,7 +1810,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1810 | 1810 | |
| 1811 | 1811 | @Override |
| 1812 | 1812 | public List<SchEditInfoDto> correctForm(String line,String date,String endDate, |
| 1813 | - String lpName,String code, String type) { | |
| 1813 | + String lpName,String code, String type,String changType) { | |
| 1814 | 1814 | |
| 1815 | 1815 | // var types = {'DFTZ': '待发调整', 'FCXXWT':'发车信息微调', 'JHLB': '计划烂班', 'CXLB': '撤销烂班', |
| 1816 | 1816 | // 'CXZX': '撤销执行', 'CXSF': '撤销实发', 'SFTZ': '实发调整', 'TZRC': '调整人车'}; |
| ... | ... | @@ -1824,6 +1824,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1824 | 1824 | map.put("SFTZ", "实发调整"); |
| 1825 | 1825 | map.put("TZRC", "调整人车"); |
| 1826 | 1826 | |
| 1827 | + SimpleDateFormat sdf1=new SimpleDateFormat("HH:mm"); | |
| 1828 | + SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 1827 | 1829 | String cont = ""; |
| 1828 | 1830 | cont = " and xl_bm ='"+line +"'"; |
| 1829 | 1831 | if(!lpName.equals("")){ |
| ... | ... | @@ -1832,7 +1834,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1832 | 1834 | if(!code.equals("")){ |
| 1833 | 1835 | cont +=" and cl_zbh ='"+code+"'"; |
| 1834 | 1836 | } |
| 1835 | - String sql = "select t1.*, " | |
| 1837 | + String sql = "select t1.*, t2.real_exec_date," | |
| 1836 | 1838 | + "t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name," |
| 1837 | 1839 | + "t2.xl_dir,t2.real_exec_date from (select * from " |
| 1838 | 1840 | + "logger_sch_modify where rq BETWEEN ? and ? and line_code=? )" |
| ... | ... | @@ -1843,9 +1845,39 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1843 | 1845 | new BeanPropertyRowMapper(SchEditInfoDto.class),date,endDate, line); |
| 1844 | 1846 | List<SchEditInfoDto> lists=new ArrayList<SchEditInfoDto>(); |
| 1845 | 1847 | for (int i = 0; i < list.size(); i++) { |
| 1848 | + Long fcsjs=0l; | |
| 1849 | + Long updsj=0l; | |
| 1846 | 1850 | SchEditInfoDto t=list.get(i); |
| 1847 | 1851 | if(map.get(t.getType())!=null){ |
| 1848 | - t.setType2(t.getUser()+"于"+t.getTimeStr()+"进行"+map.get(t.getType()).toString()+";"); | |
| 1852 | + | |
| 1853 | + if(changType.equals("")){ | |
| 1854 | + t.setType2(t.getUser()+"于"+t.getTimeStr()+"进行"+map.get(t.getType()).toString()+";"); | |
| 1855 | + }else{ | |
| 1856 | + String fcsj=""; | |
| 1857 | + String updtime=""; | |
| 1858 | + try { | |
| 1859 | + fcsj= sdf1.format(sdf1.parse(t.getFcsj())); | |
| 1860 | + updtime=sdf1.format(sdf1.parse(t.getTimeStr())); | |
| 1861 | + fcsjs=sdf2.parse(t.getRealExecDate()+" "+fcsj).getTime(); | |
| 1862 | + updsj=sdf2.parse(t.getRq()+" "+updtime).getTime(); | |
| 1863 | + } catch (ParseException e) { | |
| 1864 | + // TODO Auto-generated catch block | |
| 1865 | + e.printStackTrace(); | |
| 1866 | + } | |
| 1867 | + if(changType.equals("1")){ | |
| 1868 | + if(fcsjs>updsj){ | |
| 1869 | + t.setType2(t.getUser()+"于"+t.getTimeStr()+"进行"+map.get(t.getType()).toString()+";"); | |
| 1870 | + }else{ | |
| 1871 | + t.setType2(""); | |
| 1872 | + } | |
| 1873 | + }else if(changType.equals("2")){ | |
| 1874 | + if(fcsjs<updsj){ | |
| 1875 | + t.setType2(t.getUser()+"于"+t.getTimeStr()+"进行"+map.get(t.getType()).toString()+";"); | |
| 1876 | + }else{ | |
| 1877 | + t.setType2(""); | |
| 1878 | + } | |
| 1879 | + } | |
| 1880 | + } | |
| 1849 | 1881 | }else{ |
| 1850 | 1882 | t.setType2(""); |
| 1851 | 1883 | } |
| ... | ... | @@ -1859,7 +1891,19 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1859 | 1891 | } |
| 1860 | 1892 | |
| 1861 | 1893 | if(fage){ |
| 1862 | - lists.add(t); | |
| 1894 | + if(changType.equals("")){ | |
| 1895 | + lists.add(t); | |
| 1896 | + } else { | |
| 1897 | + if (changType.equals("1")) { | |
| 1898 | + if (fcsjs > updsj) { | |
| 1899 | + lists.add(t); | |
| 1900 | + } | |
| 1901 | + } else if (changType.equals("2")) { | |
| 1902 | + if (fcsjs < updsj) { | |
| 1903 | + lists.add(t); | |
| 1904 | + } | |
| 1905 | + } | |
| 1906 | + } | |
| 1863 | 1907 | } |
| 1864 | 1908 | } |
| 1865 | 1909 | ... | ... |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| ... | ... | @@ -4,6 +4,7 @@ import com.bsth.entity.Line; |
| 4 | 4 | import com.bsth.entity.Personnel; |
| 5 | 5 | import com.bsth.entity.StationRoute; |
| 6 | 6 | import com.bsth.entity.excep.ArrivalInfo; |
| 7 | +import com.bsth.entity.mcy_forms.Daily; | |
| 7 | 8 | import com.bsth.entity.oil.Dlb; |
| 8 | 9 | import com.bsth.entity.oil.Ylb; |
| 9 | 10 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| ... | ... | @@ -2234,6 +2235,7 @@ public class ReportServiceImpl implements ReportService{ |
| 2234 | 2235 | String date=map.get("date").toString(); |
| 2235 | 2236 | String gsbm=map.get("gsbm").toString(); |
| 2236 | 2237 | String fgsbm=map.get("fgsbm").toString(); |
| 2238 | + String type=map.get("type").toString(); | |
| 2237 | 2239 | List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); |
| 2238 | 2240 | if(line.equals("")){ |
| 2239 | 2241 | list=scheduleRealInfoRepository.scheduleByDateAndLineByGs(gsbm, fgsbm, date); |
| ... | ... | @@ -2273,7 +2275,6 @@ public class ReportServiceImpl implements ReportService{ |
| 2273 | 2275 | } |
| 2274 | 2276 | }); |
| 2275 | 2277 | |
| 2276 | - | |
| 2277 | 2278 | for (int i = 0; i < xlList.size(); i++) { |
| 2278 | 2279 | String lineCode=xlList.get(i).get("line").toString(); |
| 2279 | 2280 | String grade =xlList.get(i).get("grade").toString(); |
| ... | ... | @@ -2309,6 +2310,7 @@ public class ReportServiceImpl implements ReportService{ |
| 2309 | 2310 | e.printStackTrace(); |
| 2310 | 2311 | } |
| 2311 | 2312 | } |
| 2313 | + | |
| 2312 | 2314 | if(listInfo.size()>0){ |
| 2313 | 2315 | int sjbcs=culateService.culateSjbc(list_, "")+culateService.culateLjbc(list_, ""); |
| 2314 | 2316 | Map<String, Object> m=listDjg(gsbm,fgsbm,lineCode,sjbcs,peak,trough,listInfo,grade); |
| ... | ... | @@ -2316,6 +2318,21 @@ public class ReportServiceImpl implements ReportService{ |
| 2316 | 2318 | } |
| 2317 | 2319 | |
| 2318 | 2320 | } |
| 2321 | + if(type.equals("export")){ | |
| 2322 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 2323 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 2324 | + m.put("date", date); | |
| 2325 | + ReportUtils ee = new ReportUtils(); | |
| 2326 | + try { | |
| 2327 | + listI.add(lMap.iterator()); | |
| 2328 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 2329 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/countInterval.xls", | |
| 2330 | + path + "export/大间隔统计表.xls"); | |
| 2331 | + } catch (Exception e) { | |
| 2332 | + // TODO: handle exception | |
| 2333 | + e.printStackTrace(); | |
| 2334 | + } | |
| 2335 | + } | |
| 2319 | 2336 | return lMap; |
| 2320 | 2337 | } |
| 2321 | 2338 | ... | ... |
src/main/java/com/bsth/service/schedule/impl/CarDeviceServiceImpl.java
| ... | ... | @@ -7,6 +7,8 @@ import com.bsth.service.schedule.CarDeviceService; |
| 7 | 7 | import com.bsth.service.schedule.exception.ScheduleException; |
| 8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.stereotype.Service; |
| 10 | +import org.springframework.transaction.annotation.Isolation; | |
| 11 | +import org.springframework.transaction.annotation.Propagation; | |
| 10 | 12 | import org.springframework.transaction.annotation.Transactional; |
| 11 | 13 | import org.springframework.util.CollectionUtils; |
| 12 | 14 | |
| ... | ... | @@ -21,7 +23,7 @@ public class CarDeviceServiceImpl extends BServiceImpl<CarDevice, Long> implemen |
| 21 | 23 | @Autowired |
| 22 | 24 | private CarsService carsService; |
| 23 | 25 | |
| 24 | - @Transactional | |
| 26 | + @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) | |
| 25 | 27 | @Override |
| 26 | 28 | public CarDevice save(CarDevice carDevice) { |
| 27 | 29 | // 查找对应的车辆基础信息,更新设备编号数据 | ... | ... |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| ... | ... | @@ -144,6 +144,11 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 144 | 144 | return ttInfoDetailForEdit.getEditInfo(xlid, ttid, maxfcno); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | + public static void main(String[] args) { | |
| 148 | + String test = "中1中111"; | |
| 149 | + System.out.println(test.replaceAll("(\\d+)$", "")); | |
| 150 | + } | |
| 151 | + | |
| 147 | 152 | @Override |
| 148 | 153 | public void validateExcelSheet(String filename, String sheetname, Integer lineid, String linename) throws ScheduleException { |
| 149 | 154 | try { |
| ... | ... | @@ -162,8 +167,9 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 162 | 167 | if (StringUtils.isEmpty(cell_con)) { |
| 163 | 168 | throw new Exception(String.format("第1行,第%d列数据不能为空", i + 1)); |
| 164 | 169 | } else { |
| 165 | - // 正则表达式去除数字 | |
| 166 | - cell_con = cell_con.replaceAll("[\\d+]", ""); | |
| 170 | + // 正则表达式去除右侧数字 | |
| 171 | +// cell_con = cell_con.replaceAll("[\\d+]", ""); | |
| 172 | + cell_con = cell_con.replaceAll("(\\d+)$", ""); | |
| 167 | 173 | |
| 168 | 174 | if (i == 0) { // 第一列必须是路牌2个字 |
| 169 | 175 | if (!"路牌".equals(cell_con.trim())) { | ... | ... |
src/main/resources/datatools/ktrs/ttinfodetailDataInput.ktr
| ... | ... | @@ -828,7 +828,7 @@ |
| 828 | 828 | <optimizationLevel>9</optimizationLevel> |
| 829 | 829 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 830 | 830 | <jsScript_name>Script 1</jsScript_name> |
| 831 | - <jsScript_script>//Script here

// 使用正则表达式去除站点名称中的数字
qdzname = qdzname.replace(/\d+/g,'');

// sendtime处理,hhmm,hh:mm,hh,mm
var sendtime_calcu;
if (sendtime.length == 5) { // 最长格式,包括分隔符,统一把分隔符替换成冒号
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(3, 2);
} else if (sendtime.length == 4) {
 if (sendtime.indexOf(":") > 0) { // 冒号分隔,无需修改
 sendtime_calcu = sendtime;
 } else if (sendtime.indexOf(",") > 0) { // 逗号分隔,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(2, 2);
 } else { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(2, 2);
 }
} else if (sendtime.length == 3) { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(1, 2);
}

// 设置分班
var isfb = 0;

// 设置停驶
var ists = 0;

// 设置isCanceled
var iscanceled = 0;</jsScript_script> | |
| 831 | + <jsScript_script>//Script here

// 使用正则表达式去除站点名称右侧多余的数字
qdzname = qdzname.replace(/(\d+$)/g,'');

// sendtime处理,hhmm,hh:mm,hh,mm
var sendtime_calcu;
if (sendtime.length == 5) { // 最长格式,包括分隔符,统一把分隔符替换成冒号
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(3, 2);
} else if (sendtime.length == 4) {
 if (sendtime.indexOf(":") > 0) { // 冒号分隔,无需修改
 sendtime_calcu = sendtime;
 } else if (sendtime.indexOf(",") > 0) { // 逗号分隔,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(2, 2);
 } else { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(2, 2);
 }
} else if (sendtime.length == 3) { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(1, 2);
}

// 设置分班
var isfb = 0;

// 设置停驶
var ists = 0;

// 设置isCanceled
var iscanceled = 0;</jsScript_script> | |
| 832 | 832 | </jsScript> </jsScripts> <fields> <field> <name>qdzname</name> |
| 833 | 833 | <rename>qdzname</rename> |
| 834 | 834 | <type>String</type> | ... | ... |
src/main/resources/datatools/ktrs/ttinfodetailDataInput2.ktr
| ... | ... | @@ -828,7 +828,7 @@ |
| 828 | 828 | <optimizationLevel>9</optimizationLevel> |
| 829 | 829 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 830 | 830 | <jsScript_name>Script 1</jsScript_name> |
| 831 | - <jsScript_script>//Script here

// 使用正则表达式去除站点名称中的数字
qdzname = qdzname.replace(/\d+/g,'');

// sendtime处理,hhmm,hh:mm,hh,mm
var sendtime_calcu;
if (sendtime.length == 5) { // 最长格式,包括分隔符,统一把分隔符替换成冒号
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(3, 2);
} else if (sendtime.length == 4) {
 if (sendtime.indexOf(":") > 0) { // 冒号分隔,无需修改
 sendtime_calcu = sendtime;
 } else if (sendtime.indexOf(",") > 0) { // 逗号分隔,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(2, 2);
 } else { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(2, 2);
 }
} else if (sendtime.length == 3) { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(1, 2);
}

// 设置分班
var isfb = 0;

// 设置停驶
var ists = 0;

// 设置isCanceled
var iscanceled = 0;</jsScript_script> | |
| 831 | + <jsScript_script>//Script here

// 使用正则表达式去除站点名称右侧多余的数字
qdzname = qdzname.replace(/(\d+$)/g,'');

// sendtime处理,hhmm,hh:mm,hh,mm
var sendtime_calcu;
if (sendtime.length == 5) { // 最长格式,包括分隔符,统一把分隔符替换成冒号
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(3, 2);
} else if (sendtime.length == 4) {
 if (sendtime.indexOf(":") > 0) { // 冒号分隔,无需修改
 sendtime_calcu = sendtime;
 } else if (sendtime.indexOf(",") > 0) { // 逗号分隔,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(2, 2);
 } else { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(2, 2);
 }
} else if (sendtime.length == 3) { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(1, 2);
}

// 设置分班
var isfb = 0;

// 设置停驶
var ists = 0;

// 设置isCanceled
var iscanceled = 0;</jsScript_script> | |
| 832 | 832 | </jsScript> </jsScripts> <fields> <field> <name>qdzname</name> |
| 833 | 833 | <rename>qdzname</rename> |
| 834 | 834 | <type>String</type> | ... | ... |
src/main/resources/static/pages/base/line/css/bmap_base.css
0 → 100644
| 1 | +#bmap_basic{ | |
| 2 | + min-width: 100%; | |
| 3 | + width: calc(100% + 26px); | |
| 4 | + margin-top: -28px; | |
| 5 | + border: 2px solid #fdfdfd; | |
| 6 | + min-height: 1200px; | |
| 7 | + height:100%; | |
| 8 | + overflow: hidden; | |
| 9 | +} | |
| 10 | + | |
| 11 | +html,body{ | |
| 12 | + overflow:hidden; | |
| 13 | +} | |
| 14 | + | |
| 15 | +.caption { | |
| 16 | + color: #B7B7B7; | |
| 17 | + font-size: 18px; | |
| 18 | + | |
| 19 | + position: relative; | |
| 20 | + margin: 15px; | |
| 21 | + | |
| 22 | + font-family: 微软; | |
| 23 | +} | |
| 24 | + | |
| 25 | +.cut-section{ position:absolute; right:40px; top:50px; background:#12527f; width:320px;max-height: 700px;min-height: 300px;} | |
| 26 | + | |
| 27 | +.rm3_image { | |
| 28 | + width: 120px; | |
| 29 | + height: 26px; | |
| 30 | + | |
| 31 | +} | |
| 32 | + | |
| 33 | +/* 隐藏百度地图logo */ | |
| 34 | +.anchorBL, | |
| 35 | +.anchorBL, | |
| 36 | +.amap-logo, | |
| 37 | +.amap-copyright{ | |
| 38 | + display: none; | |
| 39 | +} | |
| 40 | + | |
| 41 | + | |
| 42 | +.BMap_pop { | |
| 43 | + | |
| 44 | + box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33)!important; | |
| 45 | + | |
| 46 | +} | ... | ... |
src/main/resources/static/pages/base/line/details.html
| ... | ... | @@ -191,46 +191,7 @@ |
| 191 | 191 | <!-- 是否撤销 START --> |
| 192 | 192 | </div> |
| 193 | 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 | 195 | <!-- 表单分组组件 form-group START --> |
| 235 | 196 | <div class="form-group"> |
| 236 | 197 | <!-- 起始站名称 START (该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值) --> |
| ... | ... | @@ -321,20 +282,14 @@ |
| 321 | 282 | </div> |
| 322 | 283 | <!-- 线路规划类型 (* 必填项) END --> |
| 323 | 284 | |
| 324 | - <!--大间隔等级 START --> | |
| 285 | + <!-- 开辟日期 START --> | |
| 325 | 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 | 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 | 290 | </div> |
| 336 | 291 | </div> |
| 337 | - <!-- 大间隔等级END --> | |
| 292 | + <!-- 开辟日期 END --> | |
| 338 | 293 | </div> |
| 339 | 294 | <!-- 表单分组组件 form-group START --> |
| 340 | 295 | |
| ... | ... | @@ -436,15 +391,6 @@ |
| 436 | 391 | </div> |
| 437 | 392 | </div> |
| 438 | 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 | 394 | </div> |
| 449 | 395 | <!-- 表单分组组件 form-group END --> |
| 450 | 396 | ... | ... |
src/main/resources/static/pages/base/line/edit.html
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | <!-- 表单内容 START --> |
| 44 | 44 | <div class="form-body"> |
| 45 | 45 | <input type="hidden" name="id" id="lineId"> |
| 46 | - <input type="hidden" name="inUse" id="inUse"> | |
| 46 | + | |
| 47 | 47 | <!-- 表单分组组件 form-group START --> |
| 48 | 48 | <div class="form-group"> |
| 49 | 49 | <!-- 线路编码 (* 必填项) START --> |
| ... | ... | @@ -199,46 +199,7 @@ |
| 199 | 199 | <!-- 是否撤销 START --> |
| 200 | 200 | </div> |
| 201 | 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 | 203 | <!-- 表单分组组件 form-group START --> |
| 243 | 204 | <div class="form-group"> |
| 244 | 205 | <!-- 起始站名称 START (该字段值会在规划线路站点操作时会去验证是否有值。如果为空,则用线路规划站点的起点站。默认使用该字段填写值) --> |
| ... | ... | @@ -329,20 +290,14 @@ |
| 329 | 290 | </div> |
| 330 | 291 | <!-- 线路规划类型 (* 必填项) END --> |
| 331 | 292 | |
| 332 | - <!--大间隔等级 START --> | |
| 293 | + <!-- 开辟日期 START --> | |
| 333 | 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 | 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 | 298 | </div> |
| 344 | 299 | </div> |
| 345 | - <!-- 大间隔等级END --> | |
| 300 | + <!-- 开辟日期 END --> | |
| 346 | 301 | </div> |
| 347 | 302 | <!-- 表单分组组件 form-group START --> |
| 348 | 303 | |
| ... | ... | @@ -444,15 +399,6 @@ |
| 444 | 399 | </div> |
| 445 | 400 | </div> |
| 446 | 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 | 402 | </div> |
| 457 | 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 | + var stationD = rd.stationData,isNullStr = ''; | |
| 252 | + for(var t = 0 ;t<stationD.length;t++) { | |
| 253 | + if(stationD[t].potion.lat =='' || stationD[t].potion.lat ==null || | |
| 254 | + stationD[t].potion.lng =='' || stationD[t].potion.lng ==null) | |
| 255 | + isNullStr = isNullStr + stationD[t].name + ' , '; | |
| 256 | + } | |
| 257 | + if(isNullStr!='') { | |
| 258 | + layer.open({ | |
| 259 | + title: '提示', | |
| 260 | + content:'【' + isNullStr + '】' + '地址系统无法解析!,请手动调整位置!' | |
| 261 | + }); | |
| 262 | + } | |
| 263 | + // 清除地图覆盖物 | |
| 264 | + map.clearMarkAndOverlays(); | |
| 265 | + // 查询路段信息 | |
| 266 | + $get('/sectionroute/findSectionCache',{'line.id_eq' : lineid , 'directions_eq' : directionData},function(data) { | |
| 267 | + // 在地图上画出线路走向 | |
| 268 | + fun.linePanlThree(lineid,data,directionData); | |
| 269 | + }); | |
| 270 | + $('#upload_show').removeClass('hidden'); | |
| 271 | + //$('#Undo').removeClass('hidden'); | |
| 272 | + //$('#cut_section').removeClass('hidden'); | |
| 273 | + //$('#uploadRoute').addClass('hidden'); | |
| 274 | + $('#upload').addClass('hidden'); | |
| 275 | + layer.msg('请先编辑路段,并保存!!!'); | |
| 276 | + }else { | |
| 277 | + layer.msg('生成路线失败!'); | |
| 278 | + } | |
| 279 | + }); | |
| 280 | + } | |
| 281 | +}); | |
| 282 | +</script> | |
| 0 | 283 | \ 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 | 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 | 94 | // 需要验证的表单元素 |
| 95 | 95 | rules : { |
| 96 | 96 | 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. |
| 97 | - 'lineCode' : {required : true,maxlength: 30},// 线路编码 必填项、最大长度. | |
| 97 | + 'lineCode' : {required : true,maxlength: 6},// 线路编码 必填项、最大长度. | |
| 98 | 98 | 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. |
| 99 | 99 | 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. |
| 100 | 100 | 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. |
| ... | ... | @@ -116,7 +116,6 @@ $(function(){ |
| 116 | 116 | 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度. |
| 117 | 117 | 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度. |
| 118 | 118 | 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度. |
| 119 | - 'warrantCar' : {number : true,digits : true,maxlength: 8}, | |
| 120 | 119 | 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 121 | 120 | 'descriptions' : {maxlength: 200}// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 122 | 121 | }, | ... | ... |
src/main/resources/static/pages/base/line/js/line-edit-form.js
| ... | ... | @@ -149,7 +149,7 @@ |
| 149 | 149 | // 需要验证的表单元素 |
| 150 | 150 | rules : { |
| 151 | 151 | 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. |
| 152 | - 'lineCode' : {required : true,maxlength: 30},// 线路编码 必填项、最大长度. | |
| 152 | + 'lineCode' : {required : true,maxlength: 6},// 线路编码 必填项、最大长度. | |
| 153 | 153 | 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. |
| 154 | 154 | 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. |
| 155 | 155 | 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. |
| ... | ... | @@ -171,7 +171,6 @@ |
| 171 | 171 | 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度. |
| 172 | 172 | 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度. |
| 173 | 173 | 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度. |
| 174 | - 'warrantCar' : {number : true,digits : true,maxlength: 8}, | |
| 175 | 174 | 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 176 | 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 | 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 | 397 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/line/js/line-list-table.js
| ... | ... | @@ -116,7 +116,7 @@ |
| 116 | 116 | } |
| 117 | 117 | function getComp(cb) { |
| 118 | 118 | $.get('/user/companyData',null,function(rs) { |
| 119 | - return cb && cb(rs); | |
| 119 | + return cb && cb(rs); | |
| 120 | 120 | }); |
| 121 | 121 | } |
| 122 | 122 | function getParams() { |
| ... | ... | @@ -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 | 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 | +}(); | ... | ... |