Commit 295229a2fd0690bc47fce7077cf4ae2d542ed149
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control into pudong
Showing
28 changed files
with
2443 additions
and
680 deletions
Too many changes to show.
To preserve performance only 28 of 57 files are displayed.
src/main/java/com/bsth/controller/BusIntervalController.java
| @@ -52,5 +52,10 @@ public class BusIntervalController { | @@ -52,5 +52,10 @@ public class BusIntervalController { | ||
| 52 | public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){ | 52 | public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){ |
| 53 | return busIntervalService.correctStatis(map); | 53 | return busIntervalService.correctStatis(map); |
| 54 | } | 54 | } |
| 55 | - | 55 | + |
| 56 | + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET) | ||
| 57 | + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ | ||
| 58 | + return busIntervalService.exportWaybillMore(map); | ||
| 59 | + } | ||
| 60 | + | ||
| 56 | } | 61 | } |
src/main/java/com/bsth/controller/SectionController.java
| @@ -135,7 +135,16 @@ public class SectionController extends BaseController<Section, Integer> { | @@ -135,7 +135,16 @@ public class SectionController extends BaseController<Section, Integer> { | ||
| 135 | @RequestMapping(value="getSectionCode" , method = RequestMethod.GET) | 135 | @RequestMapping(value="getSectionCode" , method = RequestMethod.GET) |
| 136 | public long getSectionCode() { | 136 | public long getSectionCode() { |
| 137 | return GetUIDAndCode.getSectionId(); | 137 | return GetUIDAndCode.getSectionId(); |
| 138 | - | 138 | + } |
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * @Description :TODO(把路段截取位双路名路段) | ||
| 142 | + * | ||
| 143 | + * @return int <sectionCode路段编码> | ||
| 144 | + */ | ||
| 145 | + @RequestMapping(value="doubleName" , method = RequestMethod.GET) | ||
| 146 | + public Map<String, Object> doubleName(@RequestParam Map<String, Object> map) { | ||
| 147 | + return service.doubleName(map); | ||
| 139 | } | 148 | } |
| 140 | 149 | ||
| 141 | } | 150 | } |
src/main/java/com/bsth/controller/StationController.java
| @@ -148,14 +148,28 @@ public class StationController extends BaseController<Station, Integer> { | @@ -148,14 +148,28 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 148 | return service.stationCacheUpdate(map); | 148 | return service.stationCacheUpdate(map); |
| 149 | } | 149 | } |
| 150 | /** | 150 | /** |
| 151 | + * @Description :TODO(更新内部编码) | ||
| 152 | + * @param stationCount,sectionCount 更新数 | ||
| 153 | + */ | ||
| 154 | + @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET) | ||
| 155 | + public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { | ||
| 156 | + for(int i = 0; i < stationCount; i++) { | ||
| 157 | + GetUIDAndCode.getStationId(); | ||
| 158 | + } | ||
| 159 | + for(int i = 0; i < sectionCount; i++) { | ||
| 160 | + GetUIDAndCode.getSectionId(); | ||
| 161 | + } | ||
| 162 | + return 1; | ||
| 163 | + } | ||
| 164 | + /** | ||
| 151 | * @Description :TODO(查询站点编码) | 165 | * @Description :TODO(查询站点编码) |
| 152 | - * | 166 | + * |
| 153 | * @return int <stationCode站点编码> | 167 | * @return int <stationCode站点编码> |
| 154 | */ | 168 | */ |
| 155 | @RequestMapping(value="getStationCode" , method = RequestMethod.GET) | 169 | @RequestMapping(value="getStationCode" , method = RequestMethod.GET) |
| 156 | public long getStationCode() { | 170 | public long getStationCode() { |
| 157 | return GetUIDAndCode.getStationId(); | 171 | return GetUIDAndCode.getStationId(); |
| 158 | - | 172 | + |
| 159 | } | 173 | } |
| 160 | /** | 174 | /** |
| 161 | * @Description :TODO(查询站点编码) | 175 | * @Description :TODO(查询站点编码) |
src/main/java/com/bsth/controller/StationRouteController.java
| 1 | package com.bsth.controller; | 1 | package com.bsth.controller; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.Station; | ||
| 3 | import com.bsth.entity.StationRoute; | 4 | import com.bsth.entity.StationRoute; |
| 4 | import com.bsth.entity.StationRouteCache; | 5 | import com.bsth.entity.StationRouteCache; |
| 5 | import com.bsth.repository.StationRouteCacheRepository; | 6 | import com.bsth.repository.StationRouteCacheRepository; |
| @@ -110,12 +111,20 @@ public class StationRouteController extends BaseController<StationRoute, Integer | @@ -110,12 +111,20 @@ public class StationRouteController extends BaseController<StationRoute, Integer | ||
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | /** | 113 | /** |
| 113 | - * @Description :TODO(查询缓存站点的上一个缓存站点) | 114 | + * @Description :TODO(查询线路某方向下的站点序号与类型) |
| 114 | */ | 115 | */ |
| 115 | @RequestMapping(value = "/findCacheUpStationRouteCode" , method = RequestMethod.GET) | 116 | @RequestMapping(value = "/findCacheUpStationRouteCode" , method = RequestMethod.GET) |
| 116 | public List<Map<String, Object>> findCacheUpStationRouteCode(@RequestParam Map<String, Object> map) { | 117 | public List<Map<String, Object>> findCacheUpStationRouteCode(@RequestParam Map<String, Object> map) { |
| 117 | return service.findCacheUpStationRouteCode(map); | 118 | return service.findCacheUpStationRouteCode(map); |
| 118 | } | 119 | } |
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * @Description :TODO(查询站点的下一个缓存站点) | ||
| 123 | + */ | ||
| 124 | + @RequestMapping(value = "/findDownStationRoute" , method = RequestMethod.GET) | ||
| 125 | + public List<Map<String, Object>> findDownStationRoute(@RequestParam Map<String, Object> map) { | ||
| 126 | + return service.findDownStationRoute(map); | ||
| 127 | + } | ||
| 119 | 128 | ||
| 120 | /** | 129 | /** |
| 121 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | 130 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) |
src/main/java/com/bsth/entity/LonLatName.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | + | ||
| 3 | +public class LonLatName { | ||
| 4 | + public String first_name; | ||
| 5 | + public String second_name; | ||
| 6 | + public String way_name; | ||
| 7 | + public String location; | ||
| 8 | + | ||
| 9 | + public String getFirst_name() { | ||
| 10 | + return first_name; | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + public void setFirst_name(String first_name) { | ||
| 14 | + this.first_name = first_name; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public String getSecond_name() { | ||
| 18 | + return second_name; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public void setSecond_name(String second_name) { | ||
| 22 | + this.second_name = second_name; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public String getWay_name() { | ||
| 26 | + return way_name; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setWay_name(String way_name) { | ||
| 30 | + this.way_name = way_name; | ||
| 31 | + } | ||
| 32 | + public String getLocation() { | ||
| 33 | + return location; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setLocation(String location) { | ||
| 37 | + this.location = location; | ||
| 38 | + } | ||
| 39 | +} |
src/main/java/com/bsth/entity/oil/Dlb.java
| @@ -58,6 +58,8 @@ public class Dlb { | @@ -58,6 +58,8 @@ public class Dlb { | ||
| 58 | private int nylx; | 58 | private int nylx; |
| 59 | //进场顺序(根据最先出场和最后进场来关联车辆的存电量) | 59 | //进场顺序(根据最先出场和最后进场来关联车辆的存电量) |
| 60 | private int jcsx; | 60 | private int jcsx; |
| 61 | + | ||
| 62 | + private String jname; | ||
| 61 | @Transient | 63 | @Transient |
| 62 | private String name; | 64 | private String name; |
| 63 | @Transient | 65 | @Transient |
| @@ -73,6 +75,7 @@ public class Dlb { | @@ -73,6 +75,7 @@ public class Dlb { | ||
| 73 | private String fgsname; | 75 | private String fgsname; |
| 74 | 76 | ||
| 75 | 77 | ||
| 78 | + | ||
| 76 | private String lp; | 79 | private String lp; |
| 77 | 80 | ||
| 78 | public Integer getId() { | 81 | public Integer getId() { |
| @@ -391,6 +394,14 @@ public class Dlb { | @@ -391,6 +394,14 @@ public class Dlb { | ||
| 391 | public void setLp(String lp) { | 394 | public void setLp(String lp) { |
| 392 | this.lp = lp; | 395 | this.lp = lp; |
| 393 | } | 396 | } |
| 397 | + | ||
| 398 | + public String getJname() { | ||
| 399 | + return jname; | ||
| 400 | + } | ||
| 401 | + | ||
| 402 | + public void setJname(String jname) { | ||
| 403 | + this.jname = jname; | ||
| 404 | + } | ||
| 394 | 405 | ||
| 395 | 406 | ||
| 396 | 407 |
src/main/java/com/bsth/entity/oil/Ylb.java
| @@ -26,6 +26,7 @@ public class Ylb { | @@ -26,6 +26,7 @@ public class Ylb { | ||
| 26 | private String fgsdm; | 26 | private String fgsdm; |
| 27 | private String nbbm; | 27 | private String nbbm; |
| 28 | private String jsy; | 28 | private String jsy; |
| 29 | + private String jname; | ||
| 29 | private Double czlc=0.0; | 30 | private Double czlc=0.0; |
| 30 | private Double jzlc=0.0; | 31 | private Double jzlc=0.0; |
| 31 | private Double czyl=0.0; | 32 | private Double czyl=0.0; |
| @@ -339,6 +340,14 @@ public class Ylb { | @@ -339,6 +340,14 @@ public class Ylb { | ||
| 339 | public void setLp(String lp) { | 340 | public void setLp(String lp) { |
| 340 | this.lp = lp; | 341 | this.lp = lp; |
| 341 | } | 342 | } |
| 343 | + | ||
| 344 | + public String getJname() { | ||
| 345 | + return jname; | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + public void setJname(String jname) { | ||
| 349 | + this.jname = jname; | ||
| 350 | + } | ||
| 342 | 351 | ||
| 343 | 352 | ||
| 344 | } | 353 | } |
src/main/java/com/bsth/repository/CarsRepository.java
| @@ -15,4 +15,7 @@ public interface CarsRepository extends BaseRepository<Cars, Integer>{ | @@ -15,4 +15,7 @@ public interface CarsRepository extends BaseRepository<Cars, Integer>{ | ||
| 15 | 15 | ||
| 16 | @Query(value="select s from Cars s") | 16 | @Query(value="select s from Cars s") |
| 17 | List<Cars> findCars(); | 17 | List<Cars> findCars(); |
| 18 | + | ||
| 19 | + @Query(value="select s from Cars s where s.insideCode=?1") | ||
| 20 | + List<Cars> findCarsByCode(String insideCode); | ||
| 18 | } | 21 | } |
src/main/java/com/bsth/repository/SectionRouteRepository.java
| @@ -172,9 +172,13 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -172,9 +172,13 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 172 | void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); | 172 | void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); |
| 173 | 173 | ||
| 174 | @Modifying | 174 | @Modifying |
| 175 | - @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+10) where line = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true) | 175 | + @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+100) where line = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true) |
| 176 | public void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod); | 176 | public void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod); |
| 177 | - | 177 | + |
| 178 | + @Modifying | ||
| 179 | + @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+100) where line_code = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true) | ||
| 180 | + public void sectionUpdSectionRouteCode(String lineCode,Integer dir,int routeCod); | ||
| 181 | + | ||
| 178 | @Modifying | 182 | @Modifying |
| 179 | @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true) | 183 | @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true) |
| 180 | public void sectionRouteIsDestroyUpdBatch(Integer id); | 184 | public void sectionRouteIsDestroyUpdBatch(Integer id); |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -102,8 +102,79 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -102,8 +102,79 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 102 | "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " + | 102 | "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " + |
| 103 | "r.line=?1 and r.directions =?2 and station_route_code< ?3 and r.destroy = 0 ) and t.line=?1 and t.directions = ?2 AND t.destroy = 0", nativeQuery=true) | 103 | "r.line=?1 and r.directions =?2 and station_route_code< ?3 and r.destroy = 0 ) and t.line=?1 and t.directions = ?2 AND t.destroy = 0", nativeQuery=true) |
| 104 | List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); | 104 | List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); |
| 105 | - | ||
| 106 | - | 105 | + |
| 106 | + /** | ||
| 107 | + * @Description :TODO(查询下个站点) | ||
| 108 | + * | ||
| 109 | + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码> | ||
| 110 | + * | ||
| 111 | + * @return List<Map<String, Object>> | ||
| 112 | + */ | ||
| 113 | + @Query(value = "SELECT a.stationRouteLine," + | ||
| 114 | + " a.stationRouteStation," + | ||
| 115 | + " a.stationRouteCode," + | ||
| 116 | + " a.stationRouteLIneCode," + | ||
| 117 | + " a.stationRouteStationMark," + | ||
| 118 | + " a.stationOutStationNmber," + | ||
| 119 | + " a.stationRoutedirections," + | ||
| 120 | + " a.stationRouteDistances," + | ||
| 121 | + " a.stationRouteToTime," + | ||
| 122 | + " a.staitonRouteFirstTime," + | ||
| 123 | + " a.stationRouteEndTime," + | ||
| 124 | + " a.stationRouteDescriptions," + | ||
| 125 | + " a.stationRouteDestroy," + | ||
| 126 | + " a.stationRouteVersions," + | ||
| 127 | + " a.stationRouteCreateBy," + | ||
| 128 | + " a.stationRouteCreateDate," + | ||
| 129 | + " a.stationRouteUpdateBy," + | ||
| 130 | + " a.stationRouteUpdateDate," + | ||
| 131 | + " b.id AS stationId," + | ||
| 132 | + " b.station_cod AS stationCode," + | ||
| 133 | + " a.stationRouteName," + | ||
| 134 | + " b.road_coding AS stationRoadCoding," + | ||
| 135 | + " b.db_type AS stationDbType," + | ||
| 136 | + " b.b_jwpoints AS stationJwpoints," + | ||
| 137 | + " b.g_lonx AS stationGlonx," + | ||
| 138 | + " b.g_laty AS stationGlaty," + | ||
| 139 | + " b.x AS stationX," + | ||
| 140 | + " b.y AS stationY," + | ||
| 141 | + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | ||
| 142 | + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | ||
| 143 | + " b.destroy AS stationDestroy," + | ||
| 144 | + " b.radius AS stationRadius," + | ||
| 145 | + " b.shapes_type AS stationShapesType," + | ||
| 146 | + " b.versions AS stationVersions," + | ||
| 147 | + " b.descriptions AS sttationDescriptions," + | ||
| 148 | + " b.create_by AS stationCreateBy," + | ||
| 149 | + " b.create_date AS stationCreateDate," + | ||
| 150 | + " b.update_by AS stationUpdateBy," + | ||
| 151 | + " b.update_date AS stationUpdateDate," + | ||
| 152 | + " a.stationRouteId,b.station_name as zdmc "+ | ||
| 153 | + " FROM ( SELECT s.id AS stationRouteId," + | ||
| 154 | + " s.line AS stationRouteLine," + | ||
| 155 | + " s.station as stationRouteStation," + | ||
| 156 | + " s.station_name AS stationRouteName," + | ||
| 157 | + " s.station_route_code as stationRouteCode," + | ||
| 158 | + " s.line_code AS stationRouteLIneCode," + | ||
| 159 | + " s.station_mark AS stationRouteStationMark," + | ||
| 160 | + " s.out_station_nmber AS stationOutStationNmber," + | ||
| 161 | + " s.directions AS stationRoutedirections," + | ||
| 162 | + " s.distances AS stationRouteDistances," + | ||
| 163 | + " s.to_time AS stationRouteToTime," + | ||
| 164 | + " s.first_time AS staitonRouteFirstTime," + | ||
| 165 | + " s.end_time AS stationRouteEndTime," + | ||
| 166 | + " s.descriptions AS stationRouteDescriptions," + | ||
| 167 | + " s.destroy AS stationRouteDestroy," + | ||
| 168 | + " s.versions AS stationRouteVersions," + | ||
| 169 | + " s.create_by AS stationRouteCreateBy," + | ||
| 170 | + " s.create_date AS stationRouteCreateDate," + | ||
| 171 | + " s.update_by AS stationRouteUpdateBy," + | ||
| 172 | + " s.update_date AS stationRouteUpdateDate FROM bsth_c_stationroute s WHERE s.station_route_code =(" + | ||
| 173 | + "select MIN(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " + | ||
| 174 | + "r.line=?1 and r.directions =?2 and station_route_code > ?3 and r.destroy = 0 ) and s.line=?1 and s.directions = ?2 AND s.destroy = 0) a " + | ||
| 175 | + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true) | ||
| 176 | + List<Object[]> findDownStationRoute(Integer id,Integer direction,Integer stationRouteCode); | ||
| 177 | + | ||
| 107 | /** | 178 | /** |
| 108 | * @Description :TODO(站点中心点坐标查询) | 179 | * @Description :TODO(站点中心点坐标查询) |
| 109 | * | 180 | * |
src/main/java/com/bsth/repository/oil/DlbRepository.java
| @@ -95,4 +95,8 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ | @@ -95,4 +95,8 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ | ||
| 95 | 95 | ||
| 96 | @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true) | 96 | @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true) |
| 97 | List<Dlb> queryListDlb(String rq,String nbbm,String jgh,String xlbm); | 97 | List<Dlb> queryListDlb(String rq,String nbbm,String jgh,String xlbm); |
| 98 | + | ||
| 99 | + @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and xlbm=?2",nativeQuery=true) | ||
| 100 | + List<Dlb> queryDlbByRqXlbm(String rq, String xlbm); | ||
| 101 | + | ||
| 98 | } | 102 | } |
src/main/java/com/bsth/repository/oil/YlbRepository.java
| @@ -49,13 +49,13 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -49,13 +49,13 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 49 | @Query(value="select * from bsth_c_ylb where to_days(?1) -to_days(rq) <30 " | 49 | @Query(value="select * from bsth_c_ylb where to_days(?1) -to_days(rq) <30 " |
| 50 | + " and rq< ?1 and ssgsdm like %?2%" | 50 | + " and rq< ?1 and ssgsdm like %?2%" |
| 51 | + " and fgsdm like %?3% and xlbm like %?4% and nbbm like %?5% " | 51 | + " and fgsdm like %?3% and xlbm like %?4% and nbbm like %?5% " |
| 52 | - + " order by nbbm , rq desc,jcsx desc",nativeQuery=true) | 52 | + + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true) |
| 53 | List<Ylb> listByRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); | 53 | List<Ylb> listByRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); |
| 54 | 54 | ||
| 55 | @Query(value="select * from bsth_c_ylb where rq>=?1 " | 55 | @Query(value="select * from bsth_c_ylb where rq>=?1 " |
| 56 | + " and rq<= ?2 and ssgsdm =?3" | 56 | + " and rq<= ?2 and ssgsdm =?3" |
| 57 | + " and fgsdm =?4 and xlbm like %?5% " | 57 | + " and fgsdm =?4 and xlbm like %?5% " |
| 58 | - + " order by nbbm , rq desc,jcsx desc",nativeQuery=true) | 58 | + + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true) |
| 59 | List<Ylb> listByMonthJcsx(String rq,String rq2,String gsbm,String fgsbm,String xlbm); | 59 | List<Ylb> listByMonthJcsx(String rq,String rq2,String gsbm,String fgsbm,String xlbm); |
| 60 | 60 | ||
| 61 | /** | 61 | /** |
| @@ -81,6 +81,9 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -81,6 +81,9 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 81 | 81 | ||
| 82 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true) | 82 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true) |
| 83 | List<Ylb> queryListYlb(String rq,String nbbm,String jgh,String xlbm); | 83 | List<Ylb> queryListYlb(String rq,String nbbm,String jgh,String xlbm); |
| 84 | + | ||
| 85 | + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and xlbm=?2",nativeQuery=true) | ||
| 86 | + List<Ylb> queryYlbByRqXlbm(String rq,String xlbm); | ||
| 84 | 87 | ||
| 85 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4 order by ?5 asc",nativeQuery=true) | 88 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4 order by ?5 asc",nativeQuery=true) |
| 86 | List<Ylb> checkYlb(String rq,String nbbm,String jgh,String xlbm,String px); | 89 | List<Ylb> checkYlb(String rq,String nbbm,String jgh,String xlbm,String px); |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -193,10 +193,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -193,10 +193,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 193 | List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2); | 193 | List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2); |
| 194 | 194 | ||
| 195 | 195 | ||
| 196 | - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(s.fcsj) as fcsj,min(s.realExecDate) as realExecDate ) from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate,fcsj") | 196 | + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(s.fcsj) as fcsj,min(s.realExecDate) as realExecDate,s.jName as jName ) from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName,jName ORDER BY clZbh,realExecDate,fcsj") |
| 197 | List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm); | 197 | List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm); |
| 198 | 198 | ||
| 199 | - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(s.fcsj) as fcsj,min(s.realExecDate) as realExecDate ) from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate,fcsj") | 199 | + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(s.fcsj) as fcsj,min(s.realExecDate) as realExecDate,s.jName as jName ) from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName,jName ORDER BY clZbh,realExecDate,fcsj") |
| 200 | List<Map<String,Object>> yesterdayDataList_eq(String line,String date,String gsbm,String fgsbm,String nbbm); | 200 | List<Map<String,Object>> yesterdayDataList_eq(String line,String date,String gsbm,String fgsbm,String nbbm); |
| 201 | 201 | ||
| 202 | @Query(value="select s from ScheduleRealInfo s where s.scheduleDateStr = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") | 202 | @Query(value="select s from ScheduleRealInfo s where s.scheduleDateStr = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") |
src/main/java/com/bsth/service/BusIntervalService.java
| @@ -19,4 +19,6 @@ public interface BusIntervalService { | @@ -19,4 +19,6 @@ public interface BusIntervalService { | ||
| 19 | List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map); | 19 | List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map); |
| 20 | 20 | ||
| 21 | List<Map<String, Object>> correctStatis(Map<String, Object> map); | 21 | List<Map<String, Object>> correctStatis(Map<String, Object> map); |
| 22 | + | ||
| 23 | + Map<String, Object> exportWaybillMore(Map<String, Object> map); | ||
| 22 | } | 24 | } |
src/main/java/com/bsth/service/SectionService.java
| @@ -37,4 +37,6 @@ public interface SectionService extends BaseService<Section, Integer> { | @@ -37,4 +37,6 @@ public interface SectionService extends BaseService<Section, Integer> { | ||
| 37 | Map<String, Object> sectionCacheUpdate(Map<String, Object> map); | 37 | Map<String, Object> sectionCacheUpdate(Map<String, Object> map); |
| 38 | 38 | ||
| 39 | Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map); | 39 | Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map); |
| 40 | + | ||
| 41 | + Map<String,Object> doubleName(Map<String, Object> map); | ||
| 40 | } | 42 | } |
src/main/java/com/bsth/service/StationRouteService.java
| @@ -72,9 +72,18 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | @@ -72,9 +72,18 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | ||
| 72 | * @return List<Map<String, Object>> | 72 | * @return List<Map<String, Object>> |
| 73 | */ | 73 | */ |
| 74 | List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map); | 74 | List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map); |
| 75 | - | 75 | + |
| 76 | List<Map<String, Object>> findCacheUpStationRouteCode(Map<String, Object> map); | 76 | List<Map<String, Object>> findCacheUpStationRouteCode(Map<String, Object> map); |
| 77 | - | 77 | + |
| 78 | + /** | ||
| 79 | + * @Description :TODO(查询下一个站点) | ||
| 80 | + * | ||
| 81 | + * @param map <站点路由id; direction:方向;stationRouteCode:站点编码> | ||
| 82 | + * | ||
| 83 | + * @return List<Map<String, Object>> | ||
| 84 | + */ | ||
| 85 | + List<Map<String, Object>> findDownStationRoute(Map<String, Object> map); | ||
| 86 | + | ||
| 78 | /** | 87 | /** |
| 79 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | 88 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) |
| 80 | * | 89 | * |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| 1 | package com.bsth.service.impl; | 1 | package com.bsth.service.impl; |
| 2 | 2 | ||
| 3 | +import java.io.File; | ||
| 3 | import java.math.BigDecimal; | 4 | import java.math.BigDecimal; |
| 4 | import java.math.RoundingMode; | 5 | import java.math.RoundingMode; |
| 5 | import java.sql.ResultSet; | 6 | import java.sql.ResultSet; |
| 6 | import java.sql.SQLException; | 7 | import java.sql.SQLException; |
| 7 | import java.text.DecimalFormat; | 8 | import java.text.DecimalFormat; |
| 9 | +import java.text.ParseException; | ||
| 8 | import java.text.SimpleDateFormat; | 10 | import java.text.SimpleDateFormat; |
| 9 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
| 12 | +import java.util.Calendar; | ||
| 10 | import java.util.Collections; | 13 | import java.util.Collections; |
| 11 | import java.util.Comparator; | 14 | import java.util.Comparator; |
| 12 | import java.util.Date; | 15 | import java.util.Date; |
| 16 | +import java.util.GregorianCalendar; | ||
| 13 | import java.util.HashMap; | 17 | import java.util.HashMap; |
| 14 | import java.util.HashSet; | 18 | import java.util.HashSet; |
| 15 | import java.util.Iterator; | 19 | import java.util.Iterator; |
| @@ -23,27 +27,62 @@ import org.springframework.jdbc.core.JdbcTemplate; | @@ -23,27 +27,62 @@ import org.springframework.jdbc.core.JdbcTemplate; | ||
| 23 | import org.springframework.jdbc.core.RowMapper; | 27 | import org.springframework.jdbc.core.RowMapper; |
| 24 | import org.springframework.stereotype.Service; | 28 | import org.springframework.stereotype.Service; |
| 25 | 29 | ||
| 30 | +import com.alibaba.fastjson.JSON; | ||
| 26 | import com.alibaba.fastjson.JSONArray; | 31 | import com.alibaba.fastjson.JSONArray; |
| 27 | import com.bsth.data.BasicData; | 32 | import com.bsth.data.BasicData; |
| 28 | import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | 33 | import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; |
| 34 | +import com.bsth.entity.Cars; | ||
| 35 | +import com.bsth.entity.Line; | ||
| 36 | +import com.bsth.entity.oil.Dlb; | ||
| 37 | +import com.bsth.entity.oil.Ylb; | ||
| 29 | import com.bsth.entity.realcontrol.ChildTaskPlan; | 38 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 30 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 39 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 40 | +import com.bsth.entity.sys.DutyEmployee; | ||
| 41 | +import com.bsth.repository.CarsRepository; | ||
| 42 | +import com.bsth.repository.LineRepository; | ||
| 43 | +import com.bsth.repository.oil.DlbRepository; | ||
| 44 | +import com.bsth.repository.oil.YlbRepository; | ||
| 31 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | 45 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 32 | import com.bsth.service.BusIntervalService; | 46 | import com.bsth.service.BusIntervalService; |
| 47 | +import com.bsth.service.report.CulateMileageService; | ||
| 33 | import com.bsth.service.schedule.PeopleCarPlanService; | 48 | import com.bsth.service.schedule.PeopleCarPlanService; |
| 49 | +import com.bsth.service.sys.DutyEmployeeService; | ||
| 50 | +import com.bsth.util.Arith; | ||
| 51 | +import com.bsth.util.ComparableChild; | ||
| 52 | +import com.bsth.util.ComparableReal; | ||
| 53 | +import com.bsth.util.ReportRelatedUtils; | ||
| 34 | import com.bsth.util.ReportUtils; | 54 | import com.bsth.util.ReportUtils; |
| 55 | +import com.bsth.util.TimeUtils; | ||
| 35 | import com.google.gson.Gson; | 56 | import com.google.gson.Gson; |
| 36 | 57 | ||
| 37 | 58 | ||
| 38 | @Service | 59 | @Service |
| 39 | public class BusIntervalServiceImpl implements BusIntervalService { | 60 | public class BusIntervalServiceImpl implements BusIntervalService { |
| 40 | 61 | ||
| 62 | + @Autowired | ||
| 63 | + CulateMileageService culateService; | ||
| 64 | + | ||
| 41 | @Autowired | 65 | @Autowired |
| 42 | private PeopleCarPlanService peopleCarPlanService; | 66 | private PeopleCarPlanService peopleCarPlanService; |
| 43 | 67 | ||
| 44 | @Autowired | 68 | @Autowired |
| 45 | private ScheduleRealInfoRepository scheduleRealInfoRepository; | 69 | private ScheduleRealInfoRepository scheduleRealInfoRepository; |
| 46 | - | 70 | + |
| 71 | + @Autowired | ||
| 72 | + DutyEmployeeService dutyEmployeeService; | ||
| 73 | + | ||
| 74 | + @Autowired | ||
| 75 | + LineRepository lineRepository; | ||
| 76 | + | ||
| 77 | + @Autowired | ||
| 78 | + YlbRepository ylbRepository; | ||
| 79 | + | ||
| 80 | + @Autowired | ||
| 81 | + DlbRepository dlbRepository; | ||
| 82 | + | ||
| 83 | + @Autowired | ||
| 84 | + CarsRepository carsRepository; | ||
| 85 | + | ||
| 47 | @Autowired | 86 | @Autowired |
| 48 | private JdbcTemplate jdbcTemplate; | 87 | private JdbcTemplate jdbcTemplate; |
| 49 | 88 | ||
| @@ -241,7 +280,55 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -241,7 +280,55 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 241 | 280 | ||
| 242 | return list; | 281 | return list; |
| 243 | } | 282 | } |
| 244 | - | 283 | + |
| 284 | + public Map<Long, Set<ChildTaskPlan>> getChildTaskPlans(Long schedule1, Long schedule2){ | ||
| 285 | + | ||
| 286 | + Map<Long, Set<ChildTaskPlan>> schMap = new HashMap<Long, Set<ChildTaskPlan>>(); | ||
| 287 | + List<ChildTaskPlan> list = new ArrayList<ChildTaskPlan>(); | ||
| 288 | + | ||
| 289 | + String sql = "select id,cc_id,mileage_type,destroy,destroy_reason," + | ||
| 290 | + " mileage,type1,type2,schedule from bsth_c_s_child_task" + | ||
| 291 | + " where 1=1"; | ||
| 292 | + if(schedule1 != null && schedule1 > 0){ | ||
| 293 | + sql += " and schedule >= '"+schedule1+"'"; | ||
| 294 | + } | ||
| 295 | + if(schedule2 != null && schedule2 > 0){ | ||
| 296 | + sql += " and schedule <= '"+schedule2+"'"; | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + list = jdbcTemplate.query(sql, | ||
| 300 | + new RowMapper<ChildTaskPlan>(){ | ||
| 301 | + @Override | ||
| 302 | + public ChildTaskPlan mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 303 | + ChildTaskPlan ct = new ChildTaskPlan(); | ||
| 304 | + ct.setId(rs.getLong("id")); | ||
| 305 | + ct.setCcId(rs.getLong("cc_id")); | ||
| 306 | + ct.setMileageType(rs.getString("mileage_type")); | ||
| 307 | + ct.setDestroy(rs.getBoolean("destroy")); | ||
| 308 | + ct.setDestroyReason(rs.getString("destroy_reason")); | ||
| 309 | + ct.setMileage(rs.getFloat("mileage")); | ||
| 310 | + ct.setType1(rs.getString("type1")); | ||
| 311 | + ct.setType2(rs.getString("type2")); | ||
| 312 | + ScheduleRealInfo schedule = new ScheduleRealInfo(); | ||
| 313 | + schedule.setId(rs.getLong("schedule")); | ||
| 314 | + ct.setSchedule(schedule); | ||
| 315 | + if(ct.getCcId() == 0l){ | ||
| 316 | + ct.setCcId(null); | ||
| 317 | + } | ||
| 318 | + return ct; | ||
| 319 | + } | ||
| 320 | + }); | ||
| 321 | + | ||
| 322 | + for(ChildTaskPlan ct : list){ | ||
| 323 | + Long id = ct.getSchedule().getId(); | ||
| 324 | + if(!schMap.containsKey(id)) | ||
| 325 | + schMap.put(id, new HashSet<ChildTaskPlan>()); | ||
| 326 | + schMap.get(id).add(ct); | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + return schMap; | ||
| 330 | + } | ||
| 331 | + | ||
| 245 | @Override | 332 | @Override |
| 246 | public List<Map<String, Object>> getDir(Map<String, Object> map) { | 333 | public List<Map<String, Object>> getDir(Map<String, Object> map) { |
| 247 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 334 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| @@ -1630,6 +1717,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1630,6 +1717,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1630 | } | 1717 | } |
| 1631 | 1718 | ||
| 1632 | list = getSchedule(company, subCompany, line, startDate, endDate, model, sfqr==1?times:"", true); | 1719 | list = getSchedule(company, subCompany, line, startDate, endDate, model, sfqr==1?times:"", true); |
| 1720 | + long schedule1 = 0l, schedule2 = 0l; | ||
| 1721 | + for(ScheduleRealInfo schedule : list){ | ||
| 1722 | + long id = schedule.getId(); | ||
| 1723 | + if(schedule1 == 0l || schedule1 > id) | ||
| 1724 | + schedule1 = id; | ||
| 1725 | + if(schedule2 == 0l || schedule1 < id) | ||
| 1726 | + schedule2 = id; | ||
| 1727 | + } | ||
| 1728 | + Map<Long, Set<ChildTaskPlan>> cts = getChildTaskPlans(schedule1, schedule2); | ||
| 1633 | 1729 | ||
| 1634 | String[] date1 = startDate.split("-"); | 1730 | String[] date1 = startDate.split("-"); |
| 1635 | String[] date2 = endDate.split("-"); | 1731 | String[] date2 = endDate.split("-"); |
| @@ -1702,46 +1798,67 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1702,46 +1798,67 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1702 | jhlc = jhlc.add(lc); | 1798 | jhlc = jhlc.add(lc); |
| 1703 | } | 1799 | } |
| 1704 | if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null | 1800 | if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null |
| 1705 | - && schedule.getStatus() != -1 && !schedule.isCcService()){ | ||
| 1706 | - sjbc++; | ||
| 1707 | - sjlc = sjlc.add(lc); | ||
| 1708 | - } else if(schedule.getStatus() == -1 && !schedule.isCcService()){ | 1801 | + && schedule.getStatus() != -1){ |
| 1802 | + if(!schedule.isCcService()) | ||
| 1803 | + sjbc++; | ||
| 1804 | +// sjlc = sjlc.add(lc); | ||
| 1805 | + } else if(schedule.getStatus() == -1){ | ||
| 1709 | if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("路阻") != -1){ | 1806 | if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("路阻") != -1){ |
| 1710 | lzbc++; | 1807 | lzbc++; |
| 1711 | - lzlc = lzlc.add(lc); | 1808 | +// lzlc = lzlc.add(lc); |
| 1712 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("吊慢") != -1){ | 1809 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("吊慢") != -1){ |
| 1713 | dmbc++; | 1810 | dmbc++; |
| 1714 | - dmlc = dmlc.add(lc); | 1811 | +// dmlc = dmlc.add(lc); |
| 1715 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("故障") != -1){ | 1812 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("故障") != -1){ |
| 1716 | gzbc++; | 1813 | gzbc++; |
| 1717 | - gzlc = gzlc.add(lc); | 1814 | +// gzlc = gzlc.add(lc); |
| 1718 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("纠纷") != -1){ | 1815 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("纠纷") != -1){ |
| 1719 | jfbc++; | 1816 | jfbc++; |
| 1720 | - jflc = jflc.add(lc); | 1817 | +// jflc = jflc.add(lc); |
| 1721 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("肇事") != -1){ | 1818 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("肇事") != -1){ |
| 1722 | zsbc++; | 1819 | zsbc++; |
| 1723 | - zslc = zslc.add(lc); | 1820 | +// zslc = zslc.add(lc); |
| 1724 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("缺人") != -1){ | 1821 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("缺人") != -1){ |
| 1725 | qrbc++; | 1822 | qrbc++; |
| 1726 | - qrlc = qrlc.add(lc); | 1823 | +// qrlc = qrlc.add(lc); |
| 1727 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("缺车") != -1){ | 1824 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("缺车") != -1){ |
| 1728 | qcbc++; | 1825 | qcbc++; |
| 1729 | - qclc = qclc.add(lc); | 1826 | +// qclc = qclc.add(lc); |
| 1730 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("客稀") != -1){ | 1827 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("客稀") != -1){ |
| 1731 | kxbc++; | 1828 | kxbc++; |
| 1732 | - kxlc = kxlc.add(lc); | 1829 | +// kxlc = kxlc.add(lc); |
| 1733 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("气候") != -1){ | 1830 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("气候") != -1){ |
| 1734 | qhbc++; | 1831 | qhbc++; |
| 1735 | - qhlc = qhlc.add(lc); | 1832 | +// qhlc = qhlc.add(lc); |
| 1736 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("外援") != -1){ | 1833 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("外援") != -1){ |
| 1737 | wybc++; | 1834 | wybc++; |
| 1738 | - wylc = wylc.add(lc); | 1835 | +// wylc = wylc.add(lc); |
| 1739 | } else { | 1836 | } else { |
| 1740 | qtbc++; | 1837 | qtbc++; |
| 1741 | - qtlc = qtlc.add(lc); | 1838 | +// qtlc = qtlc.add(lc); |
| 1742 | } | 1839 | } |
| 1743 | } | 1840 | } |
| 1841 | + if(cts.containsKey(schedule.getId())){ | ||
| 1842 | + schedule.setcTasks(cts.get(schedule.getId())); | ||
| 1843 | + } | ||
| 1744 | } | 1844 | } |
| 1845 | + | ||
| 1846 | + sjlc = new BigDecimal(culateService.culateSjgl(keyMap.get(key)) + culateService.culateLjgl(keyMap.get(key))); | ||
| 1847 | + lzlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "路阻")); | ||
| 1848 | + dmlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "吊慢")); | ||
| 1849 | + gzlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "故障")); | ||
| 1850 | + jflc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "纠纷")); | ||
| 1851 | + zslc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "肇事")); | ||
| 1852 | + qrlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "缺人")); | ||
| 1853 | + qclc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "缺车")); | ||
| 1854 | + kxlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "客稀")); | ||
| 1855 | + qhlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "气候")); | ||
| 1856 | + wylc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "援外")); | ||
| 1857 | + qtlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "配车")).add( | ||
| 1858 | + new BigDecimal(culateService.culateCJLC(keyMap.get(key), "保养"))).add( | ||
| 1859 | + new BigDecimal(culateService.culateCJLC(keyMap.get(key), "抽减"))).add( | ||
| 1860 | + new BigDecimal(culateService.culateCJLC(keyMap.get(key), "其他"))); | ||
| 1861 | + | ||
| 1745 | boolean flag = true; | 1862 | boolean flag = true; |
| 1746 | if(jhlc.doubleValue() == 0d){ | 1863 | if(jhlc.doubleValue() == 0d){ |
| 1747 | flag = false; | 1864 | flag = false; |
| @@ -1754,42 +1871,42 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1754,42 +1871,42 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1754 | tempMap.put("jhbc", jhbc); | 1871 | tempMap.put("jhbc", jhbc); |
| 1755 | tempMap.put("sjbc", sjbc); | 1872 | tempMap.put("sjbc", sjbc); |
| 1756 | tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%"); | 1873 | tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%"); |
| 1757 | - tempMap.put("jhlc", jhlc.doubleValue()); | ||
| 1758 | - tempMap.put("sjlc", sjlc.doubleValue()); | 1874 | + tempMap.put("jhlc", df.format(jhlc.doubleValue())); |
| 1875 | + tempMap.put("sjlc", df.format(sjlc.doubleValue())); | ||
| 1759 | // tempMap.put("lcbfb", df.format(flag?(double)sjlc/jhlc*100:0)+"%"); | 1876 | // tempMap.put("lcbfb", df.format(flag?(double)sjlc/jhlc*100:0)+"%"); |
| 1760 | tempMap.put("lcbfb", df.format(flag?sjlc.divide(jhlc, 4, BigDecimal.ROUND_HALF_UP).doubleValue()*100:0)+"%"); | 1877 | tempMap.put("lcbfb", df.format(flag?sjlc.divide(jhlc, 4, BigDecimal.ROUND_HALF_UP).doubleValue()*100:0)+"%"); |
| 1761 | tempMap.put("lzbc", lzbc); | 1878 | tempMap.put("lzbc", lzbc); |
| 1762 | - tempMap.put("lzlc", lzlc.doubleValue()); | 1879 | + tempMap.put("lzlc", df.format(lzlc.doubleValue())); |
| 1763 | tempMap.put("lzbfb", df.format(jhbc>0?(double)lzbc/jhbc*100:0)+"%"); | 1880 | tempMap.put("lzbfb", df.format(jhbc>0?(double)lzbc/jhbc*100:0)+"%"); |
| 1764 | tempMap.put("dmbc", dmbc); | 1881 | tempMap.put("dmbc", dmbc); |
| 1765 | - tempMap.put("dmlc", dmlc.doubleValue()); | 1882 | + tempMap.put("dmlc", df.format(dmlc.doubleValue())); |
| 1766 | tempMap.put("dmbfb", df.format(jhbc>0?(double)dmbc/jhbc*100:0)+"%"); | 1883 | tempMap.put("dmbfb", df.format(jhbc>0?(double)dmbc/jhbc*100:0)+"%"); |
| 1767 | tempMap.put("gzbc", gzbc); | 1884 | tempMap.put("gzbc", gzbc); |
| 1768 | - tempMap.put("gzlc", gzlc.doubleValue()); | 1885 | + tempMap.put("gzlc", df.format(gzlc.doubleValue())); |
| 1769 | tempMap.put("gzbfb", df.format(jhbc>0?(double)gzbc/jhbc*100:0)+"%"); | 1886 | tempMap.put("gzbfb", df.format(jhbc>0?(double)gzbc/jhbc*100:0)+"%"); |
| 1770 | tempMap.put("jfbc", jfbc); | 1887 | tempMap.put("jfbc", jfbc); |
| 1771 | - tempMap.put("jflc", jflc.doubleValue()); | 1888 | + tempMap.put("jflc", df.format(jflc.doubleValue())); |
| 1772 | tempMap.put("jfbfb", df.format(jhbc>0?(double)jfbc/jhbc*100:0)+"%"); | 1889 | tempMap.put("jfbfb", df.format(jhbc>0?(double)jfbc/jhbc*100:0)+"%"); |
| 1773 | tempMap.put("zsbc", zsbc); | 1890 | tempMap.put("zsbc", zsbc); |
| 1774 | - tempMap.put("zslc", zslc.doubleValue()); | 1891 | + tempMap.put("zslc", df.format(zslc.doubleValue())); |
| 1775 | tempMap.put("zsbfb", df.format(jhbc>0?(double)zsbc/jhbc*100:0)+"%"); | 1892 | tempMap.put("zsbfb", df.format(jhbc>0?(double)zsbc/jhbc*100:0)+"%"); |
| 1776 | tempMap.put("qrbc", qrbc); | 1893 | tempMap.put("qrbc", qrbc); |
| 1777 | - tempMap.put("qrlc", qrlc.doubleValue()); | 1894 | + tempMap.put("qrlc", df.format(qrlc.doubleValue())); |
| 1778 | tempMap.put("qrbfb", df.format(jhbc>0?(double)qrbc/jhbc*100:0)+"%"); | 1895 | tempMap.put("qrbfb", df.format(jhbc>0?(double)qrbc/jhbc*100:0)+"%"); |
| 1779 | tempMap.put("qcbc", qcbc); | 1896 | tempMap.put("qcbc", qcbc); |
| 1780 | - tempMap.put("qclc", qclc.doubleValue()); | 1897 | + tempMap.put("qclc", df.format(qclc.doubleValue())); |
| 1781 | tempMap.put("qcbfb", df.format(jhbc>0?(double)qcbc/jhbc*100:0)+"%"); | 1898 | tempMap.put("qcbfb", df.format(jhbc>0?(double)qcbc/jhbc*100:0)+"%"); |
| 1782 | tempMap.put("kxbc", kxbc); | 1899 | tempMap.put("kxbc", kxbc); |
| 1783 | - tempMap.put("kxlc", kxlc.doubleValue()); | 1900 | + tempMap.put("kxlc", df.format(kxlc.doubleValue())); |
| 1784 | tempMap.put("kxbfb", df.format(jhbc>0?(double)kxbc/jhbc*100:0)+"%"); | 1901 | tempMap.put("kxbfb", df.format(jhbc>0?(double)kxbc/jhbc*100:0)+"%"); |
| 1785 | tempMap.put("qhbc", qhbc); | 1902 | tempMap.put("qhbc", qhbc); |
| 1786 | - tempMap.put("qhlc", qhlc.doubleValue()); | 1903 | + tempMap.put("qhlc", df.format(qhlc.doubleValue())); |
| 1787 | tempMap.put("qhbfb", df.format(jhbc>0?(double)qhbc/jhbc*100:0)+"%"); | 1904 | tempMap.put("qhbfb", df.format(jhbc>0?(double)qhbc/jhbc*100:0)+"%"); |
| 1788 | tempMap.put("wybc", wybc); | 1905 | tempMap.put("wybc", wybc); |
| 1789 | - tempMap.put("wylc", wylc.doubleValue()); | 1906 | + tempMap.put("wylc", df.format(wylc.doubleValue())); |
| 1790 | tempMap.put("wybfb", df.format(jhbc>0?(double)wybc/jhbc*100:0)+"%"); | 1907 | tempMap.put("wybfb", df.format(jhbc>0?(double)wybc/jhbc*100:0)+"%"); |
| 1791 | tempMap.put("qtbc", qtbc); | 1908 | tempMap.put("qtbc", qtbc); |
| 1792 | - tempMap.put("qtlc", qtlc.doubleValue()); | 1909 | + tempMap.put("qtlc", df.format(qtlc.doubleValue())); |
| 1793 | tempMap.put("qtbfb", df.format(jhbc>0?(double)qtbc/jhbc*100:0)+"%"); | 1910 | tempMap.put("qtbfb", df.format(jhbc>0?(double)qtbc/jhbc*100:0)+"%"); |
| 1794 | 1911 | ||
| 1795 | resList.add(tempMap); | 1912 | resList.add(tempMap); |
| @@ -1822,41 +1939,41 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1822,41 +1939,41 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1822 | temp.put("jhbc", jhbc_); | 1939 | temp.put("jhbc", jhbc_); |
| 1823 | temp.put("sjbc", sjbc_); | 1940 | temp.put("sjbc", sjbc_); |
| 1824 | temp.put("bcbfb", df.format(jhbc_>0?(double)sjbc_/jhbc_*100:0)+"%"); | 1941 | temp.put("bcbfb", df.format(jhbc_>0?(double)sjbc_/jhbc_*100:0)+"%"); |
| 1825 | - temp.put("jhlc", jhlc_.doubleValue()); | ||
| 1826 | - temp.put("sjlc", sjlc_.doubleValue()); | 1942 | + temp.put("jhlc", df.format(jhlc_.doubleValue())); |
| 1943 | + temp.put("sjlc", df.format(sjlc_.doubleValue())); | ||
| 1827 | temp.put("lcbfb", df.format(flag?sjlc_.divide(jhlc_, 4, BigDecimal.ROUND_HALF_UP).doubleValue()*100:0)+"%"); | 1944 | temp.put("lcbfb", df.format(flag?sjlc_.divide(jhlc_, 4, BigDecimal.ROUND_HALF_UP).doubleValue()*100:0)+"%"); |
| 1828 | temp.put("lzbc", lzbc_); | 1945 | temp.put("lzbc", lzbc_); |
| 1829 | - temp.put("lzlc", lzlc_.doubleValue()); | 1946 | + temp.put("lzlc", df.format(lzlc_.doubleValue())); |
| 1830 | temp.put("lzbfb", df.format(jhbc_>0?(double)lzbc_/jhbc_*100:0)+"%"); | 1947 | temp.put("lzbfb", df.format(jhbc_>0?(double)lzbc_/jhbc_*100:0)+"%"); |
| 1831 | temp.put("dmbc", dmbc_); | 1948 | temp.put("dmbc", dmbc_); |
| 1832 | - temp.put("dmlc", dmlc_.doubleValue()); | 1949 | + temp.put("dmlc", df.format(dmlc_.doubleValue())); |
| 1833 | temp.put("dmbfb", df.format(jhbc_>0?(double)dmbc_/jhbc_*100:0)+"%"); | 1950 | temp.put("dmbfb", df.format(jhbc_>0?(double)dmbc_/jhbc_*100:0)+"%"); |
| 1834 | temp.put("gzbc", gzbc_); | 1951 | temp.put("gzbc", gzbc_); |
| 1835 | - temp.put("gzlc", gzlc_.doubleValue()); | 1952 | + temp.put("gzlc", df.format(gzlc_.doubleValue())); |
| 1836 | temp.put("gzbfb", df.format(jhbc_>0?(double)gzbc_/jhbc_*100:0)+"%"); | 1953 | temp.put("gzbfb", df.format(jhbc_>0?(double)gzbc_/jhbc_*100:0)+"%"); |
| 1837 | temp.put("jfbc", jfbc_); | 1954 | temp.put("jfbc", jfbc_); |
| 1838 | - temp.put("jflc", jflc_.doubleValue()); | 1955 | + temp.put("jflc", df.format(jflc_.doubleValue())); |
| 1839 | temp.put("jfbfb", df.format(jhbc_>0?(double)jfbc_/jhbc_*100:0)+"%"); | 1956 | temp.put("jfbfb", df.format(jhbc_>0?(double)jfbc_/jhbc_*100:0)+"%"); |
| 1840 | temp.put("zsbc", zsbc_); | 1957 | temp.put("zsbc", zsbc_); |
| 1841 | - temp.put("zslc", zslc_.doubleValue()); | 1958 | + temp.put("zslc", df.format(zslc_.doubleValue())); |
| 1842 | temp.put("zsbfb", df.format(jhbc_>0?(double)zsbc_/jhbc_*100:0)+"%"); | 1959 | temp.put("zsbfb", df.format(jhbc_>0?(double)zsbc_/jhbc_*100:0)+"%"); |
| 1843 | temp.put("qrbc", qrbc_); | 1960 | temp.put("qrbc", qrbc_); |
| 1844 | - temp.put("qrlc", qrlc_.doubleValue()); | 1961 | + temp.put("qrlc", df.format(qrlc_.doubleValue())); |
| 1845 | temp.put("qrbfb", df.format(jhbc_>0?(double)qrbc_/jhbc_*100:0)+"%"); | 1962 | temp.put("qrbfb", df.format(jhbc_>0?(double)qrbc_/jhbc_*100:0)+"%"); |
| 1846 | temp.put("qcbc", qcbc_); | 1963 | temp.put("qcbc", qcbc_); |
| 1847 | - temp.put("qclc", qclc_.doubleValue()); | 1964 | + temp.put("qclc", df.format(qclc_.doubleValue())); |
| 1848 | temp.put("qcbfb", df.format(jhbc_>0?(double)qcbc_/jhbc_*100:0)+"%"); | 1965 | temp.put("qcbfb", df.format(jhbc_>0?(double)qcbc_/jhbc_*100:0)+"%"); |
| 1849 | temp.put("kxbc", kxbc_); | 1966 | temp.put("kxbc", kxbc_); |
| 1850 | - temp.put("kxlc", kxlc_.doubleValue()); | 1967 | + temp.put("kxlc", df.format(kxlc_.doubleValue())); |
| 1851 | temp.put("kxbfb", df.format(jhbc_>0?(double)kxbc_/jhbc_*100:0)+"%"); | 1968 | temp.put("kxbfb", df.format(jhbc_>0?(double)kxbc_/jhbc_*100:0)+"%"); |
| 1852 | temp.put("qhbc", qhbc_); | 1969 | temp.put("qhbc", qhbc_); |
| 1853 | - temp.put("qhlc", qhlc_.doubleValue()); | 1970 | + temp.put("qhlc", df.format(qhlc_.doubleValue())); |
| 1854 | temp.put("qhbfb", df.format(jhbc_>0?(double)qhbc_/jhbc_*100:0)+"%"); | 1971 | temp.put("qhbfb", df.format(jhbc_>0?(double)qhbc_/jhbc_*100:0)+"%"); |
| 1855 | temp.put("wybc", wybc_); | 1972 | temp.put("wybc", wybc_); |
| 1856 | - temp.put("wylc", wylc_.doubleValue()); | 1973 | + temp.put("wylc", df.format(wylc_.doubleValue())); |
| 1857 | temp.put("wybfb", df.format(jhbc_>0?(double)wybc_/jhbc_*100:0)+"%"); | 1974 | temp.put("wybfb", df.format(jhbc_>0?(double)wybc_/jhbc_*100:0)+"%"); |
| 1858 | temp.put("qtbc", qtbc_); | 1975 | temp.put("qtbc", qtbc_); |
| 1859 | - temp.put("qtlc", qtlc_.doubleValue()); | 1976 | + temp.put("qtlc", df.format(qtlc_.doubleValue())); |
| 1860 | temp.put("qtbfb", df.format(jhbc_>0?(double)qtbc_/jhbc_*100:0)+"%"); | 1977 | temp.put("qtbfb", df.format(jhbc_>0?(double)qtbc_/jhbc_*100:0)+"%"); |
| 1861 | 1978 | ||
| 1862 | resList.add(temp); | 1979 | resList.add(temp); |
| @@ -2257,10 +2374,422 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2257,10 +2374,422 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2257 | resMap.put("xlname",BasicData.lineCode2NameMap.get(xlbm)); | 2374 | resMap.put("xlname",BasicData.lineCode2NameMap.get(xlbm)); |
| 2258 | } | 2375 | } |
| 2259 | } | 2376 | } |
| 2260 | - | 2377 | + |
| 2261 | return resList; | 2378 | return resList; |
| 2262 | } | 2379 | } |
| 2263 | 2380 | ||
| 2264 | - | ||
| 2265 | - | 2381 | + @Override |
| 2382 | + public Map<String, Object> exportWaybillMore(Map<String, Object> map) { | ||
| 2383 | + String date = map.get("date").toString(); | ||
| 2384 | + String line = map.get("line").toString(); | ||
| 2385 | + ReportUtils ee = new ReportUtils(); | ||
| 2386 | + List<List> strs = JSON.parseArray(map.get("strs").toString(), List.class); | ||
| 2387 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/"; | ||
| 2388 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 2389 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 2390 | + int num = 0; | ||
| 2391 | + File file = null; | ||
| 2392 | + try { | ||
| 2393 | + while (true) { | ||
| 2394 | + String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date)); | ||
| 2395 | +// file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹 | ||
| 2396 | + file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件 | ||
| 2397 | + if (file.exists()) { //判断是否已存在重名 | ||
| 2398 | + num++; | ||
| 2399 | + } else { | ||
| 2400 | + break; | ||
| 2401 | + } | ||
| 2402 | + } | ||
| 2403 | +// file.mkdirs(); //创建 | ||
| 2404 | + | ||
| 2405 | + Map<String, List<Ylb>> ylbMap = new HashMap<String, List<Ylb>>(); | ||
| 2406 | + Map<String, List<Dlb>> dlbMap = new HashMap<String, List<Dlb>>(); | ||
| 2407 | + Map<String, List<Cars>> carMap = new HashMap<String, List<Cars>>(); | ||
| 2408 | + List<ScheduleRealInfo> lists_line=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); | ||
| 2409 | + List<DutyEmployee> list2 = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59"); | ||
| 2410 | + List<Ylb> queryYlbByRqXlbm = ylbRepository.queryYlbByRqXlbm(date, line); | ||
| 2411 | + List<Dlb> queryDlbByRqXlbm = dlbRepository.queryDlbByRqXlbm(date, line); | ||
| 2412 | + List<Cars> findCars = carsRepository.findCars(); | ||
| 2413 | + String minfcsj="02:00"; | ||
| 2414 | + List<Line> lineList=lineRepository.findLineByCode(line); | ||
| 2415 | + if(lineList.size()>0){ | ||
| 2416 | + String sqlMinYysj="select start_opt from bsth_c_line_config where " | ||
| 2417 | + + " id = (" | ||
| 2418 | + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'" | ||
| 2419 | + + ")"; | ||
| 2420 | + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); | ||
| 2421 | + } | ||
| 2422 | + | ||
| 2423 | + for(Ylb ylb : queryYlbByRqXlbm){ | ||
| 2424 | + String key = sdfMonth.format(ylb.getRq()) + ylb.getXlbm(); | ||
| 2425 | + if(!ylbMap.containsKey(key)) | ||
| 2426 | + ylbMap.put(key, new ArrayList<Ylb>()); | ||
| 2427 | + ylbMap.get(key).add(ylb); | ||
| 2428 | + } | ||
| 2429 | + for(Dlb dlb : queryDlbByRqXlbm){ | ||
| 2430 | + String key = sdfMonth.format(dlb.getRq()) + dlb.getXlbm(); | ||
| 2431 | + if(!dlbMap.containsKey(key)) | ||
| 2432 | + dlbMap.put(key, new ArrayList<Dlb>()); | ||
| 2433 | + dlbMap.get(key).add(dlb); | ||
| 2434 | + } | ||
| 2435 | + for(Cars car : findCars){ | ||
| 2436 | + String key = car.getInsideCode(); | ||
| 2437 | + if(!carMap.containsKey(key)) | ||
| 2438 | + carMap.put(key, new ArrayList<Cars>()); | ||
| 2439 | + carMap.get(key).add(car); | ||
| 2440 | + } | ||
| 2441 | + | ||
| 2442 | + List<File> files = new ArrayList<File>(); | ||
| 2443 | + for (List<String> list : strs){ | ||
| 2444 | + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | ||
| 2445 | + String jName = list.get(0); | ||
| 2446 | + String clZbh = list.get(1); | ||
| 2447 | + String lpName = list.get(2); | ||
| 2448 | + String jGh =list.get(3); | ||
| 2449 | + for (int i = 0; i < lists_line.size(); i++) { | ||
| 2450 | + ScheduleRealInfo s=lists_line.get(i); | ||
| 2451 | + if(s.getjGh().equals(jGh) && s.getClZbh().equals(clZbh) && s.getLpName().equals(lpName)){ | ||
| 2452 | + newList.add(s); | ||
| 2453 | + } | ||
| 2454 | + } | ||
| 2455 | + //—————————————————————————————————————————————————————— | ||
| 2456 | + | ||
| 2457 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | ||
| 2458 | + List<Iterator<?>> list1 = new ArrayList<Iterator<?>>(); | ||
| 2459 | + List<ScheduleRealInfo> scheduleRealInfos = newList; | ||
| 2460 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | ||
| 2461 | +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line); | ||
| 2462 | + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>(); | ||
| 2463 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | ||
| 2464 | + ScheduleRealInfo s=scheduleRealInfos.get(i); | ||
| 2465 | + Set<ChildTaskPlan> cts = s.getcTasks(); | ||
| 2466 | + if(cts != null && cts.size() > 0){ | ||
| 2467 | + lists.add(s); | ||
| 2468 | + }else{ | ||
| 2469 | + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){ | ||
| 2470 | + lists.add(s); | ||
| 2471 | + } | ||
| 2472 | + } | ||
| 2473 | + } | ||
| 2474 | + DecimalFormat format = new DecimalFormat("0.00"); | ||
| 2475 | + //计算里程和班次数,并放入Map里 | ||
| 2476 | +// Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); | ||
| 2477 | + | ||
| 2478 | + //----------------------------------------------------- | ||
| 2479 | + Map<String, Object> Map = new HashMap<String, Object>(); | ||
| 2480 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 2481 | +// ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(scheduleRealInfos.get(0).getId()); | ||
| 2482 | + ScheduleRealInfo s = scheduleRealInfos.get(0); | ||
| 2483 | + String xlbm = s.getXlBm(); | ||
| 2484 | + String fcrq = s.getScheduleDateStr(); | ||
| 2485 | + | ||
| 2486 | + int type = 0; | ||
| 2487 | + Double ccyl = 0.0; | ||
| 2488 | + Double jcyl = 0.0; | ||
| 2489 | + Double yh = 0.0; | ||
| 2490 | + Double jzl = 0.0; | ||
| 2491 | + Double zlc = 0.0; | ||
| 2492 | +// List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | ||
| 2493 | +// List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | ||
| 2494 | + List<Ylb> listYlb = ylbMap.get(fcrq + xlbm); | ||
| 2495 | + List<Dlb> listDlb = dlbMap.get(fcrq + xlbm); | ||
| 2496 | + | ||
| 2497 | +// List<Cars> listCars = carsRepository.findCarsByCode(s.getClZbh()); | ||
| 2498 | + List<Cars> listCars = carMap.get(s.getClZbh()); | ||
| 2499 | + if (listCars != null && listCars.size() > 0) { | ||
| 2500 | + if(listCars.get(0).getSfdc()!=null){ | ||
| 2501 | + if (listCars.get(0).getSfdc()) { | ||
| 2502 | + type = 1; | ||
| 2503 | + if(listDlb != null) | ||
| 2504 | + for (int i = 0; i < listDlb.size(); i++) { | ||
| 2505 | + Dlb d = listDlb.get(i); | ||
| 2506 | + if (d.getLp() == null) { | ||
| 2507 | + ccyl = Arith.add(ccyl, d.getCzcd()); | ||
| 2508 | + jcyl = Arith.add(jcyl, d.getJzcd()); | ||
| 2509 | + yh = Arith.add(yh, d.getHd()); | ||
| 2510 | + jzl = Arith.add(jzl, d.getCdl()); | ||
| 2511 | + zlc = Arith.add(zlc, d.getZlc()); | ||
| 2512 | + } else { | ||
| 2513 | + if (d.getLp().equals(s.getLpName())) { | ||
| 2514 | + ccyl = Arith.add(ccyl, d.getCzcd()); | ||
| 2515 | + jcyl = Arith.add(jcyl, d.getJzcd()); | ||
| 2516 | + yh = Arith.add(yh, d.getHd()); | ||
| 2517 | + jzl = Arith.add(jzl, d.getCdl()); | ||
| 2518 | + zlc = Arith.add(zlc, d.getZlc()); | ||
| 2519 | + } | ||
| 2520 | + } | ||
| 2521 | + | ||
| 2522 | + } | ||
| 2523 | + } else { | ||
| 2524 | + type = 0; | ||
| 2525 | + if(listYlb != null) | ||
| 2526 | + for (int i = 0; i < listYlb.size(); i++) { | ||
| 2527 | + Ylb y = listYlb.get(i); | ||
| 2528 | + if (y.getLp() == null) { | ||
| 2529 | + ccyl = Arith.add(ccyl, y.getCzyl()); | ||
| 2530 | + jcyl = Arith.add(jcyl, y.getJzyl()); | ||
| 2531 | + yh = Arith.add(yh, y.getYh()); | ||
| 2532 | + jzl = Arith.add(jzl, y.getJzl()); | ||
| 2533 | + zlc = Arith.add(zlc, y.getZlc()); | ||
| 2534 | + } else { | ||
| 2535 | + if (y.getLp().equals(s.getLpName())) { | ||
| 2536 | + ccyl = Arith.add(ccyl, y.getCzyl()); | ||
| 2537 | + jcyl = Arith.add(jcyl, y.getJzyl()); | ||
| 2538 | + yh = Arith.add(yh, y.getYh()); | ||
| 2539 | + jzl = Arith.add(jzl, y.getJzl()); | ||
| 2540 | + zlc = Arith.add(zlc, y.getZlc()); | ||
| 2541 | + } | ||
| 2542 | + } | ||
| 2543 | + } | ||
| 2544 | + } | ||
| 2545 | + } | ||
| 2546 | + } | ||
| 2547 | + | ||
| 2548 | + Map.put("jzl", jzl); | ||
| 2549 | + Map.put("yh", yh); | ||
| 2550 | + Map.put("ccyl", ccyl); | ||
| 2551 | + Map.put("jcyl", jcyl); | ||
| 2552 | + Map.put("type", type); | ||
| 2553 | + Map.put("zlc", zlc); | ||
| 2554 | + Map.put("xlName", s.getXlName()); | ||
| 2555 | + Map.put("clZbh", s.getClZbh()); | ||
| 2556 | + Map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | ||
| 2557 | + Map.put("fcsjActual", s.getFcsjActual()); | ||
| 2558 | + Map.put("zdzName", s.getZdzName()); | ||
| 2559 | + Map.put("scheduleDate", s.getScheduleDateStr()); | ||
| 2560 | + Map.put("lpName", s.getLpName()); | ||
| 2561 | + String zdp = "", zwdp = "", wdp = ""; | ||
| 2562 | + String zdpT = "", zwdpT = "", wdpT = ""; | ||
| 2563 | + String dbdp=""; | ||
| 2564 | +// List<DutyEmployee> list2 = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59"); | ||
| 2565 | + try { | ||
| 2566 | + Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime(); | ||
| 2567 | + Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime(); | ||
| 2568 | + Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime(); | ||
| 2569 | + for (int i = 0; i < list2.size(); i++) { | ||
| 2570 | + DutyEmployee t = list2.get(i); | ||
| 2571 | + if(dbdp.indexOf(t.getuName()) == -1){ | ||
| 2572 | + if(!(dbdp.length()>0)){ | ||
| 2573 | + dbdp =t.getuName(); | ||
| 2574 | + }else{ | ||
| 2575 | + dbdp +=","+t.getuName(); | ||
| 2576 | + } | ||
| 2577 | + } | ||
| 2578 | + Long ts = t.getTs(); | ||
| 2579 | + if (ts > fcsj1 && ts < fcsj2) { | ||
| 2580 | + if (zdp.indexOf(t.getuName()) == -1) { | ||
| 2581 | + if (!(zdp.length() > 0)) { | ||
| 2582 | + zdpT = t.getuName() + "..."; | ||
| 2583 | + } | ||
| 2584 | + zdp += t.getuName() + ","; | ||
| 2585 | + | ||
| 2586 | + } | ||
| 2587 | + } else if (ts > fcsj2 && ts < fcsj3) { | ||
| 2588 | + if (zwdp.indexOf(t.getuName()) == -1) { | ||
| 2589 | + if (!(zwdp.length() > 0)) { | ||
| 2590 | + zwdpT = t.getuName() + "..."; | ||
| 2591 | + } | ||
| 2592 | + zwdp += t.getuName() + ","; | ||
| 2593 | + } | ||
| 2594 | + } else { | ||
| 2595 | + if (wdp.indexOf(t.getuName()) == -1) { | ||
| 2596 | + if (!(wdp.length() > 0)) { | ||
| 2597 | + wdpT = t.getuName() + "..."; | ||
| 2598 | + } | ||
| 2599 | + wdp += t.getuName() + ","; | ||
| 2600 | + } | ||
| 2601 | + } | ||
| 2602 | + } | ||
| 2603 | + } catch (ParseException e) { | ||
| 2604 | + // TODO Auto-generated catch block | ||
| 2605 | + e.printStackTrace(); | ||
| 2606 | + } | ||
| 2607 | + Map.put("zdp", zdp); | ||
| 2608 | + Map.put("zwdp", zwdp); | ||
| 2609 | + Map.put("wdp", wdp); | ||
| 2610 | + Map.put("zdpT", zdpT); | ||
| 2611 | + Map.put("zwdpT", zwdpT); | ||
| 2612 | + Map.put("wdpT", wdpT); | ||
| 2613 | + Map.put("dbdp", dbdp); | ||
| 2614 | + //----------------------------------------------------- | ||
| 2615 | + | ||
| 2616 | + Map.put("jhlc",Arith.add(culateService.culateJhgl(scheduleRealInfos),culateService.culateJhJccgl(scheduleRealInfos))); | ||
| 2617 | + Map.put("remMileage",culateService.culateLbgl(scheduleRealInfos)); | ||
| 2618 | + Map.put("addMileage", culateService.culateLjgl(lists)); | ||
| 2619 | + double yygl=Arith.add(culateService.culateSjgl(lists),culateService.culateLjgl(lists)); | ||
| 2620 | + Map.put("yygl", yygl); | ||
| 2621 | + double ksgl=Arith.add(culateService.culateKsgl(scheduleRealInfos),culateService.culateJccgl(lists)); | ||
| 2622 | + Map.put("ksgl",ksgl); | ||
| 2623 | + Map.put("realMileage", Arith.add(yygl ,ksgl)); | ||
| 2624 | + Map.put("jhbc", culateService.culateJhbc(scheduleRealInfos,"")); | ||
| 2625 | + Map.put("cjbc", culateService.culateLbbc(scheduleRealInfos)); | ||
| 2626 | + Map.put("ljbc", culateService.culateLjbc(lists, "")); | ||
| 2627 | + int sjbc =culateService.culateLjbc(lists, "")+culateService.culateSjbc(lists, ""); | ||
| 2628 | + Map.put("sjbc", sjbc); | ||
| 2629 | +// map=new HashMap<String,Object>(); | ||
| 2630 | + | ||
| 2631 | + SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 2632 | +// String minfcsj="02:00"; | ||
| 2633 | +// List<Line> lineList=lineRepository.findLineByCode(newList.get(0).getXlBm()); | ||
| 2634 | +// if(lineList.size()>0){ | ||
| 2635 | +// String sqlMinYysj="select start_opt from bsth_c_line_config where " | ||
| 2636 | +// + " id = (" | ||
| 2637 | +// + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'" | ||
| 2638 | +// + ")"; | ||
| 2639 | +// minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); | ||
| 2640 | +// } | ||
| 2641 | + String[] minSjs = minfcsj.split(":"); | ||
| 2642 | + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]); | ||
| 2643 | + | ||
| 2644 | + | ||
| 2645 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | ||
| 2646 | + ScheduleRealInfo ss=scheduleRealInfos.get(i); | ||
| 2647 | + String[] fcsj= ss.getFcsj().split(":"); | ||
| 2648 | + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]); | ||
| 2649 | + | ||
| 2650 | + Long fscjT=0L; | ||
| 2651 | + if(fcsjL<minSj){ | ||
| 2652 | + Calendar calendar = new GregorianCalendar(); | ||
| 2653 | + calendar.setTime(ss.getScheduleDate()); | ||
| 2654 | + calendar.add(calendar.DATE,1); | ||
| 2655 | + ss.setScheduleDate(calendar.getTime()); | ||
| 2656 | + try { | ||
| 2657 | + fscjT = sdf2.parse(sdf2.format(ss.getScheduleDate())+" "+ss.getFcsj()).getTime(); | ||
| 2658 | + } catch (ParseException e) { | ||
| 2659 | + // TODO Auto-generated catch block | ||
| 2660 | + e.printStackTrace(); | ||
| 2661 | + } | ||
| 2662 | + | ||
| 2663 | + }else{ | ||
| 2664 | + try { | ||
| 2665 | + fscjT =sdf2.parse(ss.getScheduleDateStr()+" "+ss.getFcsj()).getTime(); | ||
| 2666 | + } catch (ParseException e) { | ||
| 2667 | + // TODO Auto-generated catch block | ||
| 2668 | + e.printStackTrace(); | ||
| 2669 | + }; | ||
| 2670 | + } | ||
| 2671 | + ss.setFcsjT(fscjT); | ||
| 2672 | + } | ||
| 2673 | + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | ||
| 2674 | + Collections.sort(scheduleRealInfos, new ComparableReal()); | ||
| 2675 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | ||
| 2676 | + ScheduleRealInfo ss = scheduleRealInfos.get(i); | ||
| 2677 | + ss.setAdjustExps(i + 1 + ""); | ||
| 2678 | + String remarks = ""; | ||
| 2679 | + if (ss.getRemarks() != null) { | ||
| 2680 | + remarks += ss.getRemarks(); | ||
| 2681 | + } | ||
| 2682 | + | ||
| 2683 | + Set<ChildTaskPlan> childTaskPlans = ss.getcTasks(); | ||
| 2684 | + if (!childTaskPlans.isEmpty()) { | ||
| 2685 | + ss.setFcsjActual(""); | ||
| 2686 | + ss.setZdsjActual(""); | ||
| 2687 | + ss.setJhlc(0.0); | ||
| 2688 | + } | ||
| 2689 | + | ||
| 2690 | + if (ss.isDestroy()) { | ||
| 2691 | + ss.setFcsjActual(""); | ||
| 2692 | + ss.setZdsjActual(""); | ||
| 2693 | + ss.setJhlc(0.0); | ||
| 2694 | + remarks += "(烂班)"; | ||
| 2695 | + ss.setRemarks(remarks); | ||
| 2696 | + } | ||
| 2697 | + | ||
| 2698 | + listSchedule.add(ss); | ||
| 2699 | + //计算营运里程,空驶里程 | ||
| 2700 | + if (!childTaskPlans.isEmpty()) { | ||
| 2701 | +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 2702 | + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans); | ||
| 2703 | + Collections.sort(listit, new ComparableChild()); | ||
| 2704 | + for (int j = 0; j < listit.size(); j++) { | ||
| 2705 | + ScheduleRealInfo t = new ScheduleRealInfo(); | ||
| 2706 | + ChildTaskPlan childTaskPlan = listit.get(j); | ||
| 2707 | + if (childTaskPlan.isDestroy()) { | ||
| 2708 | + t.setFcsjActual(""); | ||
| 2709 | + t.setZdsjActual(""); | ||
| 2710 | + t.setJhlc(0.0); | ||
| 2711 | + } else { | ||
| 2712 | + t.setFcsjActual(childTaskPlan.getStartDate()); | ||
| 2713 | + t.setZdsjActual(childTaskPlan.getEndDate()); | ||
| 2714 | + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | ||
| 2715 | + } | ||
| 2716 | + t.setQdzName(childTaskPlan.getStartStationName()); | ||
| 2717 | + t.setZdzName(childTaskPlan.getEndStationName()); | ||
| 2718 | + t.setRemarks(childTaskPlan.getRemarks()); | ||
| 2719 | + t.setAdjustExps("子"); | ||
| 2720 | + t.setjGh(""); | ||
| 2721 | + t.setjName(""); | ||
| 2722 | + t.setsGh(""); | ||
| 2723 | + t.setsName(""); | ||
| 2724 | + listSchedule.add(t); | ||
| 2725 | + } | ||
| 2726 | + } | ||
| 2727 | + } | ||
| 2728 | + Map<String, Object> maps; | ||
| 2729 | + for (ScheduleRealInfo scheduleRealInfo : listSchedule) { | ||
| 2730 | + maps = new HashMap<String, Object>(); | ||
| 2731 | + try { | ||
| 2732 | + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | ||
| 2733 | + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | ||
| 2734 | + maps = rru.getMapValue(scheduleRealInfo); | ||
| 2735 | + maps.put("bcs", scheduleRealInfo.getAdjustExps()); | ||
| 2736 | + String zdsj = scheduleRealInfo.getZdsj(); | ||
| 2737 | + String zdsjActual = scheduleRealInfo.getZdsjActual(); | ||
| 2738 | + if (zdsj != null && zdsjActual != null && | ||
| 2739 | + !zdsj.equals(zdsjActual) && | ||
| 2740 | + !zdsj.equals("")&& | ||
| 2741 | + !zdsjActual.equals("")) { | ||
| 2742 | + if (zdsj.compareTo(zdsjActual) > 0) { | ||
| 2743 | + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | ||
| 2744 | + maps.put("slow", ""); | ||
| 2745 | + } else { | ||
| 2746 | + maps.put("fast", ""); | ||
| 2747 | + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | ||
| 2748 | + } | ||
| 2749 | + } else { | ||
| 2750 | + maps.put("fast", ""); | ||
| 2751 | + maps.put("slow", ""); | ||
| 2752 | + } | ||
| 2753 | + listMap.add(maps); | ||
| 2754 | + } catch (Exception e) { | ||
| 2755 | + e.printStackTrace(); | ||
| 2756 | + } | ||
| 2757 | + } | ||
| 2758 | + | ||
| 2759 | + String path1 = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 2760 | + list1.add(listMap.iterator()); | ||
| 2761 | + String xls=""; | ||
| 2762 | + if(Map.get("type").toString().equals("0")){ | ||
| 2763 | + xls="waybill_minhang.xls"; | ||
| 2764 | + }else{ | ||
| 2765 | + xls="waybill_minhang_dl.xls"; | ||
| 2766 | + } | ||
| 2767 | + Map.put("sheetName", jName + "-" + clZbh + "-" + lpName); | ||
| 2768 | + ee.excelReplace(list1, new Object[]{Map}, path1 + "mould/"+xls, | ||
| 2769 | + path1 + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | ||
| 2770 | + | ||
| 2771 | + | ||
| 2772 | + //———————————————————————————————————————————————— | ||
| 2773 | + | ||
| 2774 | + File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | ||
| 2775 | + String fileName = file.getName(); | ||
| 2776 | + files.add(temp); | ||
| 2777 | + } | ||
| 2778 | + for(int i = 1; i < files.size(); i++){ | ||
| 2779 | + File file1 = files.get(0); | ||
| 2780 | + File file2 = files.get(i); | ||
| 2781 | + ee.copySheetByFile(file2, file1, 0, 145); | ||
| 2782 | + } | ||
| 2783 | + File newFile = files.get(0); | ||
| 2784 | + newFile.renameTo(file); | ||
| 2785 | + | ||
| 2786 | + } catch (Exception e) { | ||
| 2787 | + // TODO: handle exception | ||
| 2788 | + e.printStackTrace(); | ||
| 2789 | + } | ||
| 2790 | + | ||
| 2791 | + map.put("fileName", file.getName()); | ||
| 2792 | + return map; | ||
| 2793 | + } | ||
| 2794 | + | ||
| 2266 | } | 2795 | } |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| @@ -7,6 +7,7 @@ import java.util.HashMap; | @@ -7,6 +7,7 @@ import java.util.HashMap; | ||
| 7 | import java.util.List; | 7 | import java.util.List; |
| 8 | import java.util.Map; | 8 | import java.util.Map; |
| 9 | 9 | ||
| 10 | +import com.bsth.util.RoadCutDoubleName; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 12 | import org.springframework.transaction.annotation.Transactional; | 13 | import org.springframework.transaction.annotation.Transactional; |
| @@ -360,6 +361,129 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -360,6 +361,129 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 360 | return resultMap; | 361 | return resultMap; |
| 361 | } | 362 | } |
| 362 | 363 | ||
| 364 | + /** | ||
| 365 | + * @Description :TODO(生成双路名路段) | ||
| 366 | + * @param map <lineId:线路ID; route:路段信息> | ||
| 367 | + * @return | ||
| 368 | + */ | ||
| 369 | + @Override | ||
| 370 | + @Transactional | ||
| 371 | + public Map<String, Object> doubleName(Map<String, Object> map) { | ||
| 372 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 373 | + try { | ||
| 374 | + // 路段点List | ||
| 375 | + List<Point> bPointsList = new ArrayList<>(); | ||
| 376 | + // 截取后的路段 | ||
| 377 | + List<Map<String, String>> sectionArrayList = new ArrayList<>(); | ||
| 378 | + Integer lineId = Integer.parseInt(map.get("lineId").equals("") ? "" :map.get("lineId").toString()); | ||
| 379 | + String lineCode = map.get("lineCode").equals("") ? "" :map.get("lineCode").toString(); | ||
| 380 | + Integer directions = Integer.parseInt(map.get("directions").equals("") ? "" :map.get("directions").toString()); | ||
| 381 | + String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" :map.get("sectionrouteCode").toString(); | ||
| 382 | + Integer versions = Integer.parseInt(map.get("versions").equals("") ? "" :map.get("versions").toString()); | ||
| 383 | + String stationRouteBegin = map.get("stationRouteBegin").equals("") ? "" :map.get("stationRouteBegin").toString(); | ||
| 384 | + String stationRouteFinish = map.get("stationRouteFinish").equals("") ? "" :map.get("stationRouteFinish").toString(); | ||
| 385 | + String routes = map.get("route").equals("") ? "" :map.get("route").toString(); | ||
| 386 | + if(!routes.equals("")) { | ||
| 387 | + String sectionStr = ""; | ||
| 388 | + // 转换成JSON数组 | ||
| 389 | + JSONArray sectionsArray = JSONArray.parseArray(routes); | ||
| 390 | + // 遍历 | ||
| 391 | + for(int s = 0 ;s<sectionsArray.size();s++) { | ||
| 392 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | ||
| 393 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | ||
| 394 | + if(s == sectionsArray.size()-1){ | ||
| 395 | + sectionStr += pointsLngStr+","+pointsLatStr; | ||
| 396 | + } else { | ||
| 397 | + sectionStr += pointsLngStr+","+pointsLatStr+";"; | ||
| 398 | + } | ||
| 399 | + } | ||
| 400 | + Map<String, Object> roads = RoadCutDoubleName.start(sectionStr); | ||
| 401 | + if (!roads.isEmpty()) { | ||
| 402 | + List bSectionList = (List) roads.get("bSections"); | ||
| 403 | + List roadName = (List) roads.get("roadName"); | ||
| 404 | + // 路段序号 | ||
| 405 | + Integer routeCode = 0; | ||
| 406 | + if(!sectionrouteCode.equals("")){ | ||
| 407 | + String sectionrouteCodeArray[] = sectionrouteCode.split("_"); | ||
| 408 | + routeCode = Integer.valueOf(sectionrouteCodeArray[0])+100; | ||
| 409 | + }else { | ||
| 410 | + routeCode = 100; | ||
| 411 | + } | ||
| 412 | + // 增加路段序号 | ||
| 413 | + | ||
| 414 | + for(int i = 0; i < bSectionList.size(); i++){ | ||
| 415 | + List<Location> bSection = new ArrayList<>(); | ||
| 416 | + bSectionList.get(i); | ||
| 417 | + bSection = (List<Location>) bSectionList.get(i); | ||
| 418 | + | ||
| 419 | + String sectionsBpoints = ""; | ||
| 420 | + // WGS线状图形坐标集合 | ||
| 421 | + String sectionsWJPpoints = ""; | ||
| 422 | + for (int j = 0; j < bSection.size(); j++) { | ||
| 423 | + bSection.get(j); | ||
| 424 | + Location point = bSection.get(j); | ||
| 425 | + String pointsLngStr = String.valueOf(point.getLng()); | ||
| 426 | + String pointsLatStr = String.valueOf(point.getLat()); | ||
| 427 | + /** to WGS坐标 */ | ||
| 428 | + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | ||
| 429 | + String WGSLngStr = String.valueOf(resultPoint.getLng()); | ||
| 430 | + String WGSLatStr = String.valueOf(resultPoint.getLat()); | ||
| 431 | + if(j == 0) { | ||
| 432 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | ||
| 433 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | ||
| 434 | + }else { | ||
| 435 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | ||
| 436 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | ||
| 437 | + } | ||
| 438 | + } | ||
| 439 | + // 获取当前最大Id | ||
| 440 | + long sectionMaxId = GetUIDAndCode.getSectionId(); | ||
| 441 | + // 路段编码 | ||
| 442 | + String sectionCode = String.valueOf(sectionMaxId); | ||
| 443 | + // 路段ID | ||
| 444 | + int sectionId = (int)sectionMaxId; | ||
| 445 | + String sectionName = roadName.get(i).toString(); | ||
| 446 | + // WGS坐标点集合 | ||
| 447 | + String gsectionVector = null; | ||
| 448 | + if(!sectionsWJPpoints.equals("")) { | ||
| 449 | + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | ||
| 450 | + } | ||
| 451 | + // 原坐标点集合 | ||
| 452 | + String bsectionVectorS = null; | ||
| 453 | + if(!sectionsBpoints.equals("")) { | ||
| 454 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 455 | + } | ||
| 456 | + repository.systemSave(sectionCode, sectionName, "", "", "", "", gsectionVector, bsectionVectorS, "", "", "", 0, 0, "", 0, "", 1, sectionId); | ||
| 457 | + | ||
| 458 | + routeRepository.sectionUpdSectionRouteCode(lineId, directions,routeCode+i*100); | ||
| 459 | + SectionRoute route = new SectionRoute(); | ||
| 460 | + Line line = lineRepository.findOne(lineId); | ||
| 461 | + Section section = repository.findOne(sectionId); | ||
| 462 | + route.setSectionrouteCode(routeCode+i*100); | ||
| 463 | + route.setLineCode(lineCode); | ||
| 464 | + route.setSectionCode(sectionCode); | ||
| 465 | + route.setDirections(directions); | ||
| 466 | + route.setVersions(versions); | ||
| 467 | + route.setDestroy(0); | ||
| 468 | + route.setLine(line); | ||
| 469 | + route.setSection(section); | ||
| 470 | + route.setIsRoadeSpeed(0); | ||
| 471 | + routeRepository.save(route); | ||
| 472 | + } | ||
| 473 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 474 | + return resultMap; | ||
| 475 | + } else { | ||
| 476 | + resultMap.put("status", "Failure"); | ||
| 477 | + return resultMap; | ||
| 478 | + } | ||
| 479 | + } | ||
| 480 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 481 | + } catch (Exception e) { | ||
| 482 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 483 | + } | ||
| 484 | + return resultMap; | ||
| 485 | + } | ||
| 486 | + | ||
| 363 | private void sectionListCut(List<Point> bPointsList, List<Map<String, String>> sectionArrayList, | 487 | private void sectionListCut(List<Point> bPointsList, List<Map<String, String>> sectionArrayList, |
| 364 | String bsectionVector, String bsectionVectorCutList) { | 488 | String bsectionVector, String bsectionVectorCutList) { |
| 365 | if(!bsectionVector.equals("")) { | 489 | if(!bsectionVector.equals("")) { |
| @@ -480,6 +604,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -480,6 +604,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 480 | * @return Map<String, Object> <SUCCESS ; ERROR> | 604 | * @return Map<String, Object> <SUCCESS ; ERROR> |
| 481 | */ | 605 | */ |
| 482 | @Override | 606 | @Override |
| 607 | + @Transactional | ||
| 483 | public Map<String, Object> sectionUpdate(Map<String, Object> map) { | 608 | public Map<String, Object> sectionUpdate(Map<String, Object> map) { |
| 484 | Map<String, Object> resultMap = new HashMap<String, Object>(); | 609 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 485 | try { | 610 | try { |
| @@ -539,32 +664,30 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -539,32 +664,30 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 539 | SectionRoute resultS = routeRepository.findOne(sectionRouteId); | 664 | SectionRoute resultS = routeRepository.findOne(sectionRouteId); |
| 540 | int old_code = resultS.getSectionrouteCode(); | 665 | int old_code = resultS.getSectionrouteCode(); |
| 541 | if(sectionrouteCode!=null) { | 666 | if(sectionrouteCode!=null) { |
| 542 | - int new_code = sectionrouteCode+100; | ||
| 543 | - if(new_code==old_code){ | ||
| 544 | - sectionrouteCode = new_code; | ||
| 545 | - }else { | ||
| 546 | - sectionrouteCode = new_code-100+1; | ||
| 547 | - } | ||
| 548 | - }else { | ||
| 549 | - sectionrouteCode = old_code; | ||
| 550 | - } | 667 | + sectionrouteCode += 100; |
| 668 | + }else { | ||
| 669 | + sectionrouteCode = old_code; | ||
| 670 | + } | ||
| 671 | + routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode); | ||
| 551 | // 限速 | 672 | // 限速 |
| 552 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | 673 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); |
| 553 | // 版本 | 674 | // 版本 |
| 554 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | 675 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); |
| 555 | // WGS坐标点集合 | 676 | // WGS坐标点集合 |
| 556 | String gsectionVector = null; | 677 | String gsectionVector = null; |
| 557 | - if(!sectionsWJPpoints.equals("")) | 678 | + if(!sectionsWJPpoints.equals("")) { |
| 558 | gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | 679 | gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; |
| 680 | + } | ||
| 559 | // 原坐标点集合 | 681 | // 原坐标点集合 |
| 560 | String bsectionVectorS = null; | 682 | String bsectionVectorS = null; |
| 561 | - if(!sectionsBpoints.equals("")) | ||
| 562 | - bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | 683 | + if(!sectionsBpoints.equals("")) { |
| 684 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 685 | + } | ||
| 563 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | 686 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); |
| 564 | String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | 687 | String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); |
| 565 | Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | 688 | Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); |
| 566 | Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); | 689 | Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); |
| 567 | - SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | 690 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); |
| 568 | Date date = new Date(); | 691 | Date date = new Date(); |
| 569 | // 修改日期 | 692 | // 修改日期 |
| 570 | String updateDate = formatter.format(date); | 693 | String updateDate = formatter.format(date); |
| @@ -604,6 +727,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -604,6 +727,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 604 | * @Description :TODO(编辑缓存线路走向) | 727 | * @Description :TODO(编辑缓存线路走向) |
| 605 | */ | 728 | */ |
| 606 | @Override | 729 | @Override |
| 730 | + @Transactional | ||
| 607 | public Map<String, Object> sectionCacheUpdate(Map<String, Object> map) { | 731 | public Map<String, Object> sectionCacheUpdate(Map<String, Object> map) { |
| 608 | Map<String, Object> resultMap = new HashMap<String, Object>(); | 732 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 609 | try { | 733 | try { |
| @@ -670,26 +794,29 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -670,26 +794,29 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 670 | }else { | 794 | }else { |
| 671 | sectionrouteCode = new_code-100+1; | 795 | sectionrouteCode = new_code-100+1; |
| 672 | } | 796 | } |
| 673 | - }else { | ||
| 674 | - sectionrouteCode = old_code; | ||
| 675 | - } | 797 | + }else { |
| 798 | + sectionrouteCode = old_code; | ||
| 799 | + } | ||
| 800 | + routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode); | ||
| 676 | // 限速 | 801 | // 限速 |
| 677 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | 802 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); |
| 678 | // 版本 | 803 | // 版本 |
| 679 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | 804 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); |
| 680 | // WGS坐标点集合 | 805 | // WGS坐标点集合 |
| 681 | String gsectionVector = null; | 806 | String gsectionVector = null; |
| 682 | - if(!sectionsWJPpoints.equals("")) | 807 | + if(!sectionsWJPpoints.equals("")) { |
| 683 | gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | 808 | gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; |
| 809 | + } | ||
| 684 | // 原坐标点集合 | 810 | // 原坐标点集合 |
| 685 | String bsectionVectorS = null; | 811 | String bsectionVectorS = null; |
| 686 | - if(!sectionsBpoints.equals("")) | ||
| 687 | - bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | 812 | + if(!sectionsBpoints.equals("")) { |
| 813 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 814 | + } | ||
| 688 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | 815 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); |
| 689 | String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | 816 | String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); |
| 690 | Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | 817 | Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); |
| 691 | Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); | 818 | Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); |
| 692 | - SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | 819 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); |
| 693 | Date date = new Date(); | 820 | Date date = new Date(); |
| 694 | // 修改日期 | 821 | // 修改日期 |
| 695 | String updateDate = formatter.format(date); | 822 | String updateDate = formatter.format(date); |
| @@ -742,7 +869,6 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -742,7 +869,6 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 742 | 869 | ||
| 743 | } | 870 | } |
| 744 | 871 | ||
| 745 | - | ||
| 746 | /** | 872 | /** |
| 747 | * 新增路段信息 | 873 | * 新增路段信息 |
| 748 | * | 874 | * |
| @@ -833,11 +959,11 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -833,11 +959,11 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 833 | Integer routeCode = null; | 959 | Integer routeCode = null; |
| 834 | if(!sectionrouteCode.equals("")){ | 960 | if(!sectionrouteCode.equals("")){ |
| 835 | String sectionrouteCodeArray[] = sectionrouteCode.split("_"); | 961 | String sectionrouteCodeArray[] = sectionrouteCode.split("_"); |
| 836 | - routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1; | 962 | + routeCode = Integer.valueOf(sectionrouteCodeArray[0])+100; |
| 837 | }else { | 963 | }else { |
| 838 | routeCode = 100; | 964 | routeCode = 100; |
| 839 | } | 965 | } |
| 840 | - routeRepository.sectionUpdSectionRouteCode(lineId, directions,routeCode); | 966 | + routeRepository.sectionUpdSectionRouteCode(lineId, directions, routeCode); |
| 841 | sectionRoute.setSectionrouteCode(routeCode); | 967 | sectionRoute.setSectionrouteCode(routeCode); |
| 842 | sectionRoute.setLineCode(lineCode); | 968 | sectionRoute.setLineCode(lineCode); |
| 843 | sectionRoute.setSection(section); | 969 | sectionRoute.setSection(section); |
| @@ -856,4 +982,5 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -856,4 +982,5 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 856 | } | 982 | } |
| 857 | return resultMap; | 983 | return resultMap; |
| 858 | } | 984 | } |
| 985 | + | ||
| 859 | } | 986 | } |
| 860 | \ No newline at end of file | 987 | \ No newline at end of file |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| @@ -544,7 +544,116 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -544,7 +544,116 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 544 | } | 544 | } |
| 545 | return list; | 545 | return list; |
| 546 | } | 546 | } |
| 547 | - | 547 | + |
| 548 | + /** | ||
| 549 | + * @Description :TODO(查询下一个站点) | ||
| 550 | + * | ||
| 551 | + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码> | ||
| 552 | + * | ||
| 553 | + * @return List<Map<String, Object>> | ||
| 554 | + */ | ||
| 555 | + @Override | ||
| 556 | + public List<Map<String, Object>> findDownStationRoute(Map<String, Object> map) { | ||
| 557 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 558 | + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); | ||
| 559 | + Integer stationRouteCode = map.get("stationRouteCode").equals("") ? null : Integer.parseInt(map.get("stationRouteCode").toString()); | ||
| 560 | + List<Object[]> objects = repository.findDownStationRoute(lineId, direction, stationRouteCode); | ||
| 561 | + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | ||
| 562 | + | ||
| 563 | + int len = objects.size(); | ||
| 564 | + | ||
| 565 | + if(objects.size()>0) { | ||
| 566 | + | ||
| 567 | + for(int i = 0 ; i < len; i++) { | ||
| 568 | + Map<String, Object> tempM = new HashMap<String,Object>(); | ||
| 569 | + | ||
| 570 | + tempM.put("stationRouteLine", objects.get(i)[0]); | ||
| 571 | + | ||
| 572 | + tempM.put("stationRouteStation", objects.get(i)[1]); | ||
| 573 | + | ||
| 574 | + tempM.put("stationRouteCode", objects.get(i)[2]); | ||
| 575 | + | ||
| 576 | + tempM.put("stationRouteLIneCode", objects.get(i)[3]); | ||
| 577 | + | ||
| 578 | + tempM.put("stationRouteStationMark", objects.get(i)[4]); | ||
| 579 | + | ||
| 580 | + tempM.put("stationOutStationNmber", objects.get(i)[5]); | ||
| 581 | + | ||
| 582 | + tempM.put("stationRoutedirections", objects.get(i)[6]); | ||
| 583 | + | ||
| 584 | + tempM.put("stationRouteDistances", objects.get(i)[7]); | ||
| 585 | + | ||
| 586 | + tempM.put("stationRouteToTime", objects.get(i)[8]); | ||
| 587 | + | ||
| 588 | + tempM.put("staitonRouteFirstTime", objects.get(i)[9]); | ||
| 589 | + | ||
| 590 | + tempM.put("stationRouteEndTime", objects.get(i)[10]); | ||
| 591 | + | ||
| 592 | + tempM.put("stationRouteDescriptions", objects.get(i)[11]); | ||
| 593 | + | ||
| 594 | + tempM.put("stationRouteDestroy", objects.get(i)[12]); | ||
| 595 | + | ||
| 596 | + tempM.put("stationRouteVersions", objects.get(i)[13]); | ||
| 597 | + | ||
| 598 | + tempM.put("stationRouteCreateBy", objects.get(i)[14]); | ||
| 599 | + | ||
| 600 | + tempM.put("stationRouteCreateDate", objects.get(i)[15]); | ||
| 601 | + | ||
| 602 | + tempM.put("stationRouteUpdateBy", objects.get(i)[16]); | ||
| 603 | + | ||
| 604 | + tempM.put("stationRouteUpdateDate", objects.get(i)[17]); | ||
| 605 | + | ||
| 606 | + tempM.put("stationId", objects.get(i)[18]); | ||
| 607 | + | ||
| 608 | + tempM.put("stationCode", objects.get(i)[19]); | ||
| 609 | + | ||
| 610 | + tempM.put("stationRouteName", objects.get(i)[20]); | ||
| 611 | + | ||
| 612 | + tempM.put("stationRoadCoding", objects.get(i)[21]); | ||
| 613 | + | ||
| 614 | + tempM.put("stationDbType", objects.get(i)[22]); | ||
| 615 | + | ||
| 616 | + tempM.put("stationJwpoints", objects.get(i)[23]); | ||
| 617 | + | ||
| 618 | + tempM.put("stationGlonx", objects.get(i)[24]); | ||
| 619 | + | ||
| 620 | + tempM.put("stationGlaty", objects.get(i)[25]); | ||
| 621 | + | ||
| 622 | + tempM.put("stationX", objects.get(i)[26]); | ||
| 623 | + | ||
| 624 | + tempM.put("stationY", objects.get(i)[27]); | ||
| 625 | + | ||
| 626 | + tempM.put("stationBPolyonGrid", objects.get(i)[28]); | ||
| 627 | + | ||
| 628 | + tempM.put("stationGPloyonGrid", objects.get(i)[29]); | ||
| 629 | + | ||
| 630 | + tempM.put("stationDestroy", objects.get(i)[30]); | ||
| 631 | + | ||
| 632 | + tempM.put("stationRadius", objects.get(i)[31]); | ||
| 633 | + | ||
| 634 | + tempM.put("stationShapesType", objects.get(i)[32]); | ||
| 635 | + | ||
| 636 | + tempM.put("stationVersions", objects.get(i)[33]); | ||
| 637 | + | ||
| 638 | + tempM.put("sttationDescriptions", objects.get(i)[34]); | ||
| 639 | + | ||
| 640 | + tempM.put("stationCreateBy", objects.get(i)[35]); | ||
| 641 | + | ||
| 642 | + tempM.put("stationCreateDate", objects.get(i)[36]); | ||
| 643 | + | ||
| 644 | + tempM.put("stationUpdateBy", objects.get(i)[37]); | ||
| 645 | + | ||
| 646 | + tempM.put("stationUpdateDate", objects.get(i)[38]); | ||
| 647 | + | ||
| 648 | + tempM.put("stationRouteId", objects.get(i)[39]); | ||
| 649 | + tempM.put("zdmc", objects.get(i)[40]); | ||
| 650 | + | ||
| 651 | + resultList.add(tempM); | ||
| 652 | + } | ||
| 653 | + } | ||
| 654 | + return resultList; | ||
| 655 | + } | ||
| 656 | + | ||
| 548 | /** | 657 | /** |
| 549 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | 658 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) |
| 550 | * | 659 | * |
| @@ -742,10 +851,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -742,10 +851,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 742 | 851 | ||
| 743 | // 将txt文件打包 | 852 | // 将txt文件打包 |
| 744 | File targetFile = PackTarGZUtils.compress(textFile, target); | 853 | File targetFile = PackTarGZUtils.compress(textFile, target); |
| 745 | - | 854 | + |
| 746 | /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ | 855 | /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ |
| 747 | - | 856 | + |
| 748 | clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath); | 857 | clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath); |
| 858 | + | ||
| 859 | + // 删除文件 | ||
| 860 | + textFile.delete(); | ||
| 861 | + targetFile.delete(); | ||
| 749 | 862 | ||
| 750 | resultMap.put("status", ResponseCode.SUCCESS); | 863 | resultMap.put("status", ResponseCode.SUCCESS); |
| 751 | 864 | ||
| @@ -1313,7 +1426,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -1313,7 +1426,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 1313 | /** | 1426 | /** |
| 1314 | * @Description :TODO(查询缓存路由) | 1427 | * @Description :TODO(查询缓存路由) |
| 1315 | * | 1428 | * |
| 1316 | - * @param map <line.id_eq:线路ID; directions_eq:方向> | 1429 | + * @param map (line.id_eq:线路ID; directions_eq:方向) |
| 1317 | * | 1430 | * |
| 1318 | * @return List<Map<String, Object>> | 1431 | * @return List<Map<String, Object>> |
| 1319 | */ | 1432 | */ |
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| @@ -203,6 +203,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -203,6 +203,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 203 | t.setLp(map.get("lpName").toString()); | 203 | t.setLp(map.get("lpName").toString()); |
| 204 | t.setRq(sdf.parse(rq)); | 204 | t.setRq(sdf.parse(rq)); |
| 205 | t.setCreatetime(new Date()); | 205 | t.setCreatetime(new Date()); |
| 206 | + t.setJname(map.get("jName").toString()); | ||
| 206 | /*if(type.equals("add")){ | 207 | /*if(type.equals("add")){ |
| 207 | addList.add(t); | 208 | addList.add(t); |
| 208 | }else{ | 209 | }else{ |
| @@ -257,13 +258,13 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -257,13 +258,13 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 257 | // 保留两位小数 | 258 | // 保留两位小数 |
| 258 | DecimalFormat df = new DecimalFormat("#.00"); | 259 | DecimalFormat df = new DecimalFormat("#.00"); |
| 259 | // TODO Auto-generated method stub | 260 | // TODO Auto-generated method stub |
| 260 | - // 当天YLB信息 | ||
| 261 | - List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,line,nbbm,"nbbm"); | 261 | + // 当天DLB信息 |
| 262 | + List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); | ||
| 262 | // 当天YLXXB信息 | 263 | // 当天YLXXB信息 |
| 263 | List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); | 264 | List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); |
| 264 | // 从排班表中计算出行驶的总里程 | 265 | // 从排班表中计算出行驶的总里程 |
| 265 | List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); | 266 | List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); |
| 266 | - List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm); | 267 | + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); |
| 267 | Map<String, Double> lcMap=new HashMap<String,Double>(); | 268 | Map<String, Double> lcMap=new HashMap<String,Double>(); |
| 268 | for (int i = 0; i < listpbs.size(); i++) { | 269 | for (int i = 0; i < listpbs.size(); i++) { |
| 269 | String cl=listpbs.get(i).get("clZbh").toString(); | 270 | String cl=listpbs.get(i).get("clZbh").toString(); |
| @@ -295,7 +296,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -295,7 +296,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 295 | if(sxtj.equals("0")){ | 296 | if(sxtj.equals("0")){ |
| 296 | listpb=listpbs; | 297 | listpb=listpbs; |
| 297 | }else{ | 298 | }else{ |
| 298 | - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, line,nbbm); | 299 | + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm); |
| 299 | List<String> stringList=new ArrayList<String>(); | 300 | List<String> stringList=new ArrayList<String>(); |
| 300 | for (int i = 0; i < objectLists.size(); i++) { | 301 | for (int i = 0; i < objectLists.size(); i++) { |
| 301 | String clbm=objectLists.get(i)[0].toString(); | 302 | String clbm=objectLists.get(i)[0].toString(); |
| @@ -406,12 +407,12 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -406,12 +407,12 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 406 | } | 407 | } |
| 407 | nextJzyl =Arith.sub(zjzl,dh); | 408 | nextJzyl =Arith.sub(zjzl,dh); |
| 408 | if(zlc>0){ | 409 | if(zlc>0){ |
| 409 | - long l=Math.round(nextJzyl); | ||
| 410 | - double ylxs=l*100/100; | 410 | +// long l=Math.round(nextJzyl); |
| 411 | + double ylxs=nextJzyl; | ||
| 411 | dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | 412 | dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); |
| 412 | if(dh<0){ | 413 | if(dh<0){ |
| 413 | - t.setHd(dh); | ||
| 414 | - t.setCdl(dh); | 414 | + t.setHd(0.0); |
| 415 | + t.setCdl(0.0); | ||
| 415 | nextJzyl=Arith.add(ylxs, dh); | 416 | nextJzyl=Arith.add(ylxs, dh); |
| 416 | }else{ | 417 | }else{ |
| 417 | t.setHd(dh); | 418 | t.setHd(dh); |
| @@ -429,21 +430,21 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -429,21 +430,21 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 429 | } | 430 | } |
| 430 | nextJzyl =Arith.sub( nextJzyl,dh); | 431 | nextJzyl =Arith.sub( nextJzyl,dh); |
| 431 | if(zlc>0){ | 432 | if(zlc>0){ |
| 432 | - long l=0l; | 433 | +// long l=0l; |
| 433 | double ylxs=0.0; | 434 | double ylxs=0.0; |
| 434 | if(i==listpb.size()-1){ | 435 | if(i==listpb.size()-1){ |
| 435 | // ylxs=czyl; | 436 | // ylxs=czyl; |
| 436 | }else{ | 437 | }else{ |
| 437 | if(listpb.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){ | 438 | if(listpb.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){ |
| 438 | - l=Math.round(nextJzyl); | ||
| 439 | - ylxs=l*100/100; | 439 | +// l=Math.round(nextJzyl); |
| 440 | + ylxs=nextJzyl; | ||
| 440 | } | 441 | } |
| 441 | 442 | ||
| 442 | } | 443 | } |
| 443 | dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | 444 | dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); |
| 444 | if(dh<0){ | 445 | if(dh<0){ |
| 445 | - t.setHd(dh); | ||
| 446 | - t.setCdl(dh); | 446 | + t.setHd(0.0); |
| 447 | + t.setCdl(0.0); | ||
| 447 | nextJzyl=Arith.add(ylxs, dh); | 448 | nextJzyl=Arith.add(ylxs, dh); |
| 448 | }else{ | 449 | }else{ |
| 449 | t.setHd(dh); | 450 | t.setHd(dh); |
| @@ -468,15 +469,22 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -468,15 +469,22 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 468 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | 469 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); |
| 469 | t.setRq(sdf.parse(rq)); | 470 | t.setRq(sdf.parse(rq)); |
| 470 | t.setLp(map.get("lpName").toString()); | 471 | t.setLp(map.get("lpName").toString()); |
| 471 | - if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 472 | - if(type.equals("add")){ | ||
| 473 | - t.setCreatetime(date); | ||
| 474 | - addList.add(t); | ||
| 475 | - }else{ | ||
| 476 | - t.setUpdatetime(date); | ||
| 477 | - updateList.add(t); | ||
| 478 | - } | ||
| 479 | - } | 472 | + t.setJname(map.get("jName").toString()); |
| 473 | + if (!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))) { | ||
| 474 | + if (t.getHd() < 0) { | ||
| 475 | + t.setHd(0.0); | ||
| 476 | + } | ||
| 477 | + if (t.getCdl() < 0) { | ||
| 478 | + t.setCdl(0.0); | ||
| 479 | + } | ||
| 480 | + if (type.equals("add")) { | ||
| 481 | + t.setCreatetime(date); | ||
| 482 | + addList.add(t); | ||
| 483 | + } else { | ||
| 484 | + t.setUpdatetime(date); | ||
| 485 | + updateList.add(t); | ||
| 486 | + } | ||
| 487 | + } | ||
| 480 | newMap.put("status", ResponseCode.SUCCESS); | 488 | newMap.put("status", ResponseCode.SUCCESS); |
| 481 | } | 489 | } |
| 482 | } | 490 | } |
| @@ -1017,7 +1025,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1017,7 +1025,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1017 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | 1025 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); |
| 1018 | // 保留两位小数 | 1026 | // 保留两位小数 |
| 1019 | DecimalFormat df = new DecimalFormat("#.00"); | 1027 | DecimalFormat df = new DecimalFormat("#.00"); |
| 1020 | - List<Dlb> dlbList=this.listOrderBy(date,gsdm,fgsdm,line,"","nbbm"); | 1028 | + List<Dlb> dlbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm"); |
| 1021 | List<Dlb> dlbList_upd=new ArrayList<Dlb>(); | 1029 | List<Dlb> dlbList_upd=new ArrayList<Dlb>(); |
| 1022 | List<Dlb> dlbList_del=new ArrayList<Dlb>(); | 1030 | List<Dlb> dlbList_del=new ArrayList<Dlb>(); |
| 1023 | try{ | 1031 | try{ |
| @@ -1041,7 +1049,9 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1041,7 +1049,9 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1041 | } | 1049 | } |
| 1042 | 1050 | ||
| 1043 | if(fage){ | 1051 | if(fage){ |
| 1044 | - dlbList_del.add(t); | 1052 | + if(t.getXlbm().equals(line)){ |
| 1053 | + dlbList_del.add(t); | ||
| 1054 | + } | ||
| 1045 | } | 1055 | } |
| 1046 | } | 1056 | } |
| 1047 | mapList.put("delList", dlbList_del); | 1057 | mapList.put("delList", dlbList_del); |
| @@ -1134,12 +1144,12 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1134,12 +1144,12 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1134 | } | 1144 | } |
| 1135 | nextJzyl =Arith.sub(zjzl,dh); | 1145 | nextJzyl =Arith.sub(zjzl,dh); |
| 1136 | if(zlc>0){ | 1146 | if(zlc>0){ |
| 1137 | - long l=Math.round(nextJzyl); | ||
| 1138 | - double ylxs=l*100/100; | 1147 | +// long l=Math.round(nextJzyl); |
| 1148 | + double ylxs=nextJzyl; | ||
| 1139 | dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | 1149 | dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); |
| 1140 | if(dh<0){ | 1150 | if(dh<0){ |
| 1141 | - t.setHd(dh); | ||
| 1142 | - t.setCdl(dh); | 1151 | + t.setHd(0.0); |
| 1152 | + t.setCdl(0.0); | ||
| 1143 | nextJzyl=Arith.add(ylxs, dh); | 1153 | nextJzyl=Arith.add(ylxs, dh); |
| 1144 | }else{ | 1154 | }else{ |
| 1145 | t.setHd(dh); | 1155 | t.setHd(dh); |
| @@ -1157,21 +1167,21 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1157,21 +1167,21 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1157 | } | 1167 | } |
| 1158 | nextJzyl =Arith.sub( nextJzyl,dh); | 1168 | nextJzyl =Arith.sub( nextJzyl,dh); |
| 1159 | if(zlc>0){ | 1169 | if(zlc>0){ |
| 1160 | - long l=0l; | 1170 | +// long l=0l; |
| 1161 | double ylxs=0.0; | 1171 | double ylxs=0.0; |
| 1162 | if(i==listpbDc.size()-1){ | 1172 | if(i==listpbDc.size()-1){ |
| 1163 | // ylxs=czyl; | 1173 | // ylxs=czyl; |
| 1164 | }else{ | 1174 | }else{ |
| 1165 | if(listpbDc.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){ | 1175 | if(listpbDc.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){ |
| 1166 | - l=Math.round(nextJzyl); | ||
| 1167 | - ylxs=l*100/100; | 1176 | +// l=Math.round(nextJzyl); |
| 1177 | + ylxs=nextJzyl; | ||
| 1168 | } | 1178 | } |
| 1169 | 1179 | ||
| 1170 | } | 1180 | } |
| 1171 | dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | 1181 | dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); |
| 1172 | if(dh<0){ | 1182 | if(dh<0){ |
| 1173 | - t.setHd(dh); | ||
| 1174 | - t.setCdl(dh); | 1183 | + t.setHd(0.0); |
| 1184 | + t.setCdl(0.0); | ||
| 1175 | nextJzyl=Arith.add(ylxs, dh); | 1185 | nextJzyl=Arith.add(ylxs, dh); |
| 1176 | }else{ | 1186 | }else{ |
| 1177 | t.setHd(dh); | 1187 | t.setHd(dh); |
| @@ -1204,6 +1214,13 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1204,6 +1214,13 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1204 | t.setUpdatetime(new Date()); | 1214 | t.setUpdatetime(new Date()); |
| 1205 | } | 1215 | } |
| 1206 | } | 1216 | } |
| 1217 | + | ||
| 1218 | + if(t.getHd()<0){ | ||
| 1219 | + t.setHd(0.0); | ||
| 1220 | + } | ||
| 1221 | + if(t.getCdl()<0){ | ||
| 1222 | + t.setCdl(0.0); | ||
| 1223 | + } | ||
| 1207 | updateDlb.add(t); | 1224 | updateDlb.add(t); |
| 1208 | } | 1225 | } |
| 1209 | } | 1226 | } |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| @@ -198,6 +198,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -198,6 +198,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 198 | t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | 198 | t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); |
| 199 | t.setLp(map.get("lpName")==null?"":map.get("lpName").toString()); | 199 | t.setLp(map.get("lpName")==null?"":map.get("lpName").toString()); |
| 200 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | 200 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); |
| 201 | + t.setJname(map.get("jName").toString()); | ||
| 201 | t.setRq(sdf.parse(rq)); | 202 | t.setRq(sdf.parse(rq)); |
| 202 | t.setCreatetime(dNow); | 203 | t.setCreatetime(dNow); |
| 203 | if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | 204 | if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ |
| @@ -272,24 +273,24 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -272,24 +273,24 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 272 | DecimalFormat df = new DecimalFormat("#.00"); | 273 | DecimalFormat df = new DecimalFormat("#.00"); |
| 273 | // TODO Auto-generated method stub | 274 | // TODO Auto-generated method stub |
| 274 | // 当天YLB信息 | 275 | // 当天YLB信息 |
| 275 | - List<Ylb> ylList = this.listOrderBy(rq,gsbm,fgsbm,line,nbbm,"nbbm"); | 276 | + List<Ylb> ylList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); |
| 276 | 277 | ||
| 277 | // 当天YLXXB信息 | 278 | // 当天YLXXB信息 |
| 278 | List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); | 279 | List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); |
| 279 | 280 | ||
| 280 | // 前一天所有车辆最后进场班次信息 | 281 | // 前一天所有车辆最后进场班次信息 |
| 281 | - List<Ylb> ylListBe = this.listByRqJcsx(rq, gsbm, fgsbm, line, nbbm); | 282 | + List<Ylb> ylListBe = this.listByRqJcsx(rq, gsbm, fgsbm, "", nbbm); |
| 282 | List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); | 283 | List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); |
| 283 | 284 | ||
| 284 | // 从排班表中计算出行驶的总里程 | 285 | // 从排班表中计算出行驶的总里程 |
| 285 | List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); | 286 | List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); |
| 286 | - List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm); | 287 | + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); |
| 287 | 288 | ||
| 288 | String sxtj=map2.get("sxtj").toString(); | 289 | String sxtj=map2.get("sxtj").toString(); |
| 289 | if(sxtj.equals("0")){ | 290 | if(sxtj.equals("0")){ |
| 290 | listpb=listpbs; | 291 | listpb=listpbs; |
| 291 | }else{ | 292 | }else{ |
| 292 | - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, line,nbbm); | 293 | + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm); |
| 293 | List<String> stringList=new ArrayList<String>(); | 294 | List<String> stringList=new ArrayList<String>(); |
| 294 | for (int i = 0; i < objectLists.size(); i++) { | 295 | for (int i = 0; i < objectLists.size(); i++) { |
| 295 | String clbm=objectLists.get(i)[0].toString(); | 296 | String clbm=objectLists.get(i)[0].toString(); |
| @@ -363,49 +364,90 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -363,49 +364,90 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 363 | // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | 364 | // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 |
| 364 | if (map.get("seqNumber").toString().equals("1")) { | 365 | if (map.get("seqNumber").toString().equals("1")) { |
| 365 | boolean fage = true; | 366 | boolean fage = true; |
| 366 | - for (int i = 0; i < ylListBe.size(); i++) { | ||
| 367 | - Ylb ylb = ylListBe.get(i); | ||
| 368 | - if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 369 | - if(ylb.getJzyl()>0){ | ||
| 370 | - t.setCzyl(ylb.getJzyl()); | ||
| 371 | - fage = false; | ||
| 372 | - break; | 367 | + if(line.equals("")){ |
| 368 | + for (int i = 0; i < ylListBe.size(); i++) { | ||
| 369 | + Ylb ylb = ylListBe.get(i); | ||
| 370 | + if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 371 | + if(ylb.getJzyl()>0){ | ||
| 372 | + t.setCzyl(ylb.getJzyl()); | ||
| 373 | + fage = false; | ||
| 374 | + break; | ||
| 375 | + } | ||
| 376 | + | ||
| 373 | } | 377 | } |
| 374 | - | ||
| 375 | } | 378 | } |
| 376 | - } | ||
| 377 | - if (fage) { | ||
| 378 | - for (int y = 0; y < clyList.size(); y++) { | ||
| 379 | - Cyl cyl = clyList.get(y); | ||
| 380 | - if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 381 | - if(cyl!=null){ | ||
| 382 | - if(cyl.getCyl()>=0){ | ||
| 383 | - t.setCzyl(cyl.getCyl()); | 379 | + if (fage) { |
| 380 | + for (int y = 0; y < clyList.size(); y++) { | ||
| 381 | + Cyl cyl = clyList.get(y); | ||
| 382 | + if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 383 | + if(cyl!=null){ | ||
| 384 | + if(cyl.getCyl()>=0){ | ||
| 385 | + t.setCzyl(cyl.getCyl()); | ||
| 386 | + fage = false; | ||
| 387 | + break; | ||
| 388 | + }else { | ||
| 389 | + if(cyl.getCxrl()!=null){ | ||
| 390 | + if(cyl.getCxrl()>0){ | ||
| 391 | + t.setCzyl(cyl.getCxrl()); | ||
| 392 | + fage = false; | ||
| 393 | + break; | ||
| 394 | + } | ||
| 395 | + } | ||
| 396 | + } | ||
| 397 | + } | ||
| 398 | + } | ||
| 399 | + } | ||
| 400 | + } | ||
| 401 | + if (fage) { | ||
| 402 | + t.setCzyl(0.0); | ||
| 403 | + } | ||
| 404 | + }else{ | ||
| 405 | + if (line.equals(map.get("xlBm").toString())) { | ||
| 406 | + for (int i = 0; i < ylListBe.size(); i++) { | ||
| 407 | + Ylb ylb = ylListBe.get(i); | ||
| 408 | + if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 409 | + if(ylb.getJzyl()>0){ | ||
| 410 | + t.setCzyl(ylb.getJzyl()); | ||
| 384 | fage = false; | 411 | fage = false; |
| 385 | break; | 412 | break; |
| 386 | - }else { | ||
| 387 | - if(cyl.getCxrl()!=null){ | ||
| 388 | - if(cyl.getCxrl()>0){ | ||
| 389 | - t.setCzyl(cyl.getCxrl()); | 413 | + } |
| 414 | + | ||
| 415 | + } | ||
| 416 | + } | ||
| 417 | + if (fage) { | ||
| 418 | + for (int y = 0; y < clyList.size(); y++) { | ||
| 419 | + Cyl cyl = clyList.get(y); | ||
| 420 | + if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 421 | + if(cyl!=null){ | ||
| 422 | + if(cyl.getCyl()>=0){ | ||
| 423 | + t.setCzyl(cyl.getCyl()); | ||
| 390 | fage = false; | 424 | fage = false; |
| 391 | break; | 425 | break; |
| 426 | + }else { | ||
| 427 | + if(cyl.getCxrl()!=null){ | ||
| 428 | + if(cyl.getCxrl()>0){ | ||
| 429 | + t.setCzyl(cyl.getCxrl()); | ||
| 430 | + fage = false; | ||
| 431 | + break; | ||
| 432 | + } | ||
| 433 | + } | ||
| 392 | } | 434 | } |
| 393 | } | 435 | } |
| 394 | } | 436 | } |
| 395 | } | 437 | } |
| 396 | } | 438 | } |
| 439 | + if (fage) { | ||
| 440 | + t.setCzyl(0.0); | ||
| 441 | + } | ||
| 397 | } | 442 | } |
| 398 | } | 443 | } |
| 399 | - if (fage) { | ||
| 400 | - t.setCzyl(0.0); | ||
| 401 | - } | 444 | + |
| 402 | } | 445 | } |
| 403 | 446 | ||
| 404 | Double jzl = 0.0; | 447 | Double jzl = 0.0; |
| 405 | //一人一车加注量只匹配一次 | 448 | //一人一车加注量只匹配一次 |
| 406 | - if(ylMap.get(map.get("clZbh").toString()+"_"+ map.get("jGh").toString())!=null){ | 449 | + if(ylMap.get(map.get("clZbh").toString()+"_"+ map.get("jGh").toString())==null){ |
| 407 | 450 | ||
| 408 | - }else{ | ||
| 409 | boolean fage2=false; | 451 | boolean fage2=false; |
| 410 | for (int i = 0; i < ylxxList.size(); i++) { | 452 | for (int i = 0; i < ylxxList.size(); i++) { |
| 411 | Ylxxb ylxxb = ylxxList.get(i); | 453 | Ylxxb ylxxb = ylxxList.get(i); |
| @@ -455,6 +497,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -455,6 +497,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 455 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | 497 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); |
| 456 | t.setRq(sdf.parse(rq)); | 498 | t.setRq(sdf.parse(rq)); |
| 457 | t.setLp(map.get("lpName")==null?"":map.get("lpName").toString()); | 499 | t.setLp(map.get("lpName")==null?"":map.get("lpName").toString()); |
| 500 | + t.setJname(map.get("jName").toString()); | ||
| 458 | if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | 501 | if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ |
| 459 | if(type.equals("add")){ | 502 | if(type.equals("add")){ |
| 460 | t.setCreatetime(date); | 503 | t.setCreatetime(date); |
| @@ -679,6 +722,18 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -679,6 +722,18 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 679 | t.setJzyl(nextJzyl); | 722 | t.setJzyl(nextJzyl); |
| 680 | } | 723 | } |
| 681 | } | 724 | } |
| 725 | + if(t.getJzyl()<0){ | ||
| 726 | + t.setJzyl(0.0); | ||
| 727 | + } | ||
| 728 | + if(t.getCzyl()<0){ | ||
| 729 | + t.setCzyl(0.0); | ||
| 730 | + } | ||
| 731 | + if(t.getYh()<0){ | ||
| 732 | + t.setYh(0.0); | ||
| 733 | + } | ||
| 734 | + if(t.getSh()<0){ | ||
| 735 | + t.setSh(0.0); | ||
| 736 | + } | ||
| 682 | repository.save(t); | 737 | repository.save(t); |
| 683 | } | 738 | } |
| 684 | map2.put("status", ResponseCode.SUCCESS); | 739 | map2.put("status", ResponseCode.SUCCESS); |
| @@ -748,7 +803,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -748,7 +803,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 748 | nbbm=map.get("nbbm_eq").toString(); | 803 | nbbm=map.get("nbbm_eq").toString(); |
| 749 | } | 804 | } |
| 750 | // List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); | 805 | // List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); |
| 751 | - List<Ylb> ylListBe=this.listByRqJcsx(rq, gsbm, fgsbm, xlbm, nbbm); | 806 | + List<Ylb> ylListBe=this.listByRqJcsx(rq, gsbm, fgsbm, "", nbbm); |
| 752 | List<Ylb> ylbList=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | 807 | List<Ylb> ylbList=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); |
| 753 | // repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | 808 | // repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); |
| 754 | // List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); | 809 | // List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); |
| @@ -803,6 +858,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -803,6 +858,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 803 | t.setNbbm(y1.getNbbm()); | 858 | t.setNbbm(y1.getNbbm()); |
| 804 | t.setRq(y1.getYyrq()); | 859 | t.setRq(y1.getYyrq()); |
| 805 | t.setJsy(y1.getJsy()); | 860 | t.setJsy(y1.getJsy()); |
| 861 | + t.setJname(BasicData.allPerson.get(y1.getGsdm()+"-"+y1.getJsy())); | ||
| 806 | t.setJzl(y1.getJzl()); | 862 | t.setJzl(y1.getJzl()); |
| 807 | t.setSsgsdm(y1.getGsdm()); | 863 | t.setSsgsdm(y1.getGsdm()); |
| 808 | String fgsdm=""; | 864 | String fgsdm=""; |
| @@ -1404,6 +1460,18 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1404,6 +1460,18 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1404 | t.setJzyl(nextJzyl); | 1460 | t.setJzyl(nextJzyl); |
| 1405 | } | 1461 | } |
| 1406 | } | 1462 | } |
| 1463 | + if(t.getJzyl()<0){ | ||
| 1464 | + t.setJzyl(0.0); | ||
| 1465 | + } | ||
| 1466 | + if(t.getCzyl()<0){ | ||
| 1467 | + t.setCzyl(0.0); | ||
| 1468 | + } | ||
| 1469 | + if(t.getYh()<0){ | ||
| 1470 | + t.setYh(0.0); | ||
| 1471 | + } | ||
| 1472 | + if(t.getSh()<0){ | ||
| 1473 | + t.setSh(0.0); | ||
| 1474 | + } | ||
| 1407 | repository.save(t); | 1475 | repository.save(t); |
| 1408 | } | 1476 | } |
| 1409 | newMap.put("status", ResponseCode.SUCCESS); | 1477 | newMap.put("status", ResponseCode.SUCCESS); |
| @@ -1611,9 +1679,15 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1611,9 +1679,15 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1611 | fgsdm=l.getBrancheCompany(); | 1679 | fgsdm=l.getBrancheCompany(); |
| 1612 | } | 1680 | } |
| 1613 | 1681 | ||
| 1682 | + String nbbmstr=""; | ||
| 1614 | List<Map<String, Object>> listpbYc=new ArrayList<Map<String, Object>>();//油车数据 | 1683 | List<Map<String, Object>> listpbYc=new ArrayList<Map<String, Object>>();//油车数据 |
| 1615 | List<Map<String, Object>> listpbDc=new ArrayList<Map<String, Object>>();//电车数据 | 1684 | List<Map<String, Object>> listpbDc=new ArrayList<Map<String, Object>>();//电车数据 |
| 1616 | - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line, date,gsdm, fgsdm, "", ""); | 1685 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", date,gsdm, fgsdm, "", ""); |
| 1686 | + for (int i = 0; i < listpb.size(); i++) { | ||
| 1687 | + if(listpb.get(i).get("xlBm").toString().equals(line)){ | ||
| 1688 | + nbbmstr +=listpb.get(i).get("clZbh").toString(); | ||
| 1689 | + } | ||
| 1690 | + } | ||
| 1617 | for (int i = 0; i < listpb.size(); i++) { | 1691 | for (int i = 0; i < listpb.size(); i++) { |
| 1618 | boolean sfdc=true; | 1692 | boolean sfdc=true; |
| 1619 | Map<String, Object> m = listpb.get(i); | 1693 | Map<String, Object> m = listpb.get(i); |
| @@ -1622,10 +1696,12 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1622,10 +1696,12 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1622 | } else { | 1696 | } else { |
| 1623 | sfdc = true; | 1697 | sfdc = true; |
| 1624 | } | 1698 | } |
| 1625 | - if(sfdc){ | ||
| 1626 | - listpbDc.add(m); | ||
| 1627 | - }else{ | ||
| 1628 | - listpbYc.add(m); | 1699 | + if(nbbmstr.indexOf(m.get("clZbh").toString())>-1){ |
| 1700 | + if(sfdc){ | ||
| 1701 | + listpbDc.add(m); | ||
| 1702 | + }else{ | ||
| 1703 | + listpbYc.add(m); | ||
| 1704 | + } | ||
| 1629 | } | 1705 | } |
| 1630 | } | 1706 | } |
| 1631 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1707 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| @@ -1633,8 +1709,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1633,8 +1709,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1633 | List<Cyl> clyList = cylRepository.obtainCyl("",gsdm); | 1709 | List<Cyl> clyList = cylRepository.obtainCyl("",gsdm); |
| 1634 | List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm); | 1710 | List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm); |
| 1635 | //重新统计油车数据开始 | 1711 | //重新统计油车数据开始 |
| 1636 | - List<Ylb> ylListBe =repository.listMaxRqJcsx(date, gsdm, fgsdm, line, ""); | ||
| 1637 | - List<Ylb> ylbList=this.listOrderBy(date,gsdm,fgsdm,line,"","nbbm"); | 1712 | + List<Ylb> ylListBe =repository.listByRqJcsx(date, gsdm, fgsdm, "", ""); |
| 1713 | + List<Ylb> ylbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm"); | ||
| 1638 | List<Ylb> ylbList_upd=new ArrayList<Ylb>(); | 1714 | List<Ylb> ylbList_upd=new ArrayList<Ylb>(); |
| 1639 | List<Ylb> ylbList_del=new ArrayList<Ylb>(); | 1715 | List<Ylb> ylbList_del=new ArrayList<Ylb>(); |
| 1640 | 1716 | ||
| @@ -1657,7 +1733,9 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1657,7 +1733,9 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1657 | } | 1733 | } |
| 1658 | } | 1734 | } |
| 1659 | if(fage){ | 1735 | if(fage){ |
| 1660 | - ylbList_del.add(t); | 1736 | + if(t.getXlbm().equals(line)){ |
| 1737 | + ylbList_del.add(t); | ||
| 1738 | + } | ||
| 1661 | } | 1739 | } |
| 1662 | 1740 | ||
| 1663 | } | 1741 | } |
| @@ -1766,6 +1844,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1766,6 +1844,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1766 | t.setJzl(jzl); | 1844 | t.setJzl(jzl); |
| 1767 | t.setNbbm(maps.get("clZbh").toString()); | 1845 | t.setNbbm(maps.get("clZbh").toString()); |
| 1768 | t.setJsy(maps.get("jGh") == null ? "" : maps.get("jGh").toString()); | 1846 | t.setJsy(maps.get("jGh") == null ? "" : maps.get("jGh").toString()); |
| 1847 | + t.setJname(maps.get("jName").toString()); | ||
| 1769 | t.setZlc(maps.get("totalKilometers") == null ? 0.0 | 1848 | t.setZlc(maps.get("totalKilometers") == null ? 0.0 |
| 1770 | : Double.parseDouble(maps.get("totalKilometers").toString())); | 1849 | : Double.parseDouble(maps.get("totalKilometers").toString())); |
| 1771 | t.setXlbm(maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | 1850 | t.setXlbm(maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); |
| @@ -1796,7 +1875,6 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1796,7 +1875,6 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1796 | } | 1875 | } |
| 1797 | 1876 | ||
| 1798 | } | 1877 | } |
| 1799 | - | ||
| 1800 | for (int i = 0; i < ylbList_del.size(); i++) { | 1878 | for (int i = 0; i < ylbList_del.size(); i++) { |
| 1801 | Ylb y=ylbList_del.get(i); | 1879 | Ylb y=ylbList_del.get(i); |
| 1802 | if(nbbmStr.indexOf(y.getNbbm())<0){ | 1880 | if(nbbmStr.indexOf(y.getNbbm())<0){ |
| @@ -1807,7 +1885,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1807,7 +1885,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1807 | 1885 | ||
| 1808 | //重新计算删除了的或者新增了的车的车的油耗信息(考虑车辆可能跨线路,从分公司赛选计算) | 1886 | //重新计算删除了的或者新增了的车的车的油耗信息(考虑车辆可能跨线路,从分公司赛选计算) |
| 1809 | double czyl=0.0; | 1887 | double czyl=0.0; |
| 1810 | - List<Ylb> iterator2=this.listOrderBy(date,gsdm,fgsdm,line,"","nbbm,jcsx"); | 1888 | + List<Ylb> iterator2=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm,jcsx"); |
| 1811 | String[] nbbms=nbbmStr.split(","); | 1889 | String[] nbbms=nbbmStr.split(","); |
| 1812 | for (int i = 0; i < nbbms.length; i++) { | 1890 | for (int i = 0; i < nbbms.length; i++) { |
| 1813 | String clzbm=nbbms[i]; | 1891 | String clzbm=nbbms[i]; |
| @@ -1879,6 +1957,18 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1879,6 +1957,18 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1879 | t.setJzyl(nextJzyl); | 1957 | t.setJzyl(nextJzyl); |
| 1880 | } | 1958 | } |
| 1881 | } | 1959 | } |
| 1960 | + if(t.getJzyl()<0){ | ||
| 1961 | + t.setJzyl(0.0); | ||
| 1962 | + } | ||
| 1963 | + if(t.getCzyl()<0){ | ||
| 1964 | + t.setCzyl(0.0); | ||
| 1965 | + } | ||
| 1966 | + if(t.getYh()<0){ | ||
| 1967 | + t.setYh(0.0); | ||
| 1968 | + } | ||
| 1969 | + if(t.getSh()<0){ | ||
| 1970 | + t.setSh(0.0); | ||
| 1971 | + } | ||
| 1882 | repository.save(t); | 1972 | repository.save(t); |
| 1883 | } | 1973 | } |
| 1884 | } | 1974 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -41,6 +41,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo; | @@ -41,6 +41,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 41 | import com.bsth.entity.sys.DutyEmployee; | 41 | import com.bsth.entity.sys.DutyEmployee; |
| 42 | import com.bsth.entity.sys.SysUser; | 42 | import com.bsth.entity.sys.SysUser; |
| 43 | import com.bsth.repository.CarDeviceRepository; | 43 | import com.bsth.repository.CarDeviceRepository; |
| 44 | +import com.bsth.repository.CarsRepository; | ||
| 44 | import com.bsth.repository.LineRepository; | 45 | import com.bsth.repository.LineRepository; |
| 45 | import com.bsth.repository.oil.DlbRepository; | 46 | import com.bsth.repository.oil.DlbRepository; |
| 46 | import com.bsth.repository.oil.YlbRepository; | 47 | import com.bsth.repository.oil.YlbRepository; |
| @@ -159,6 +160,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -159,6 +160,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 159 | @Autowired | 160 | @Autowired |
| 160 | CarDeviceRepository carDeviceRepository; | 161 | CarDeviceRepository carDeviceRepository; |
| 161 | 162 | ||
| 163 | + @Autowired | ||
| 164 | + CarsRepository carsRepository; | ||
| 162 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 165 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 163 | 166 | ||
| 164 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | 167 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), |
| @@ -3879,134 +3882,138 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -3879,134 +3882,138 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 3879 | } | 3882 | } |
| 3880 | 3883 | ||
| 3881 | @Override | 3884 | @Override |
| 3882 | - public Map<String, Object> MapById(Long id) { | ||
| 3883 | - // TODO Auto-generated method stub | ||
| 3884 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 3885 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 3886 | - ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(id); | ||
| 3887 | - String xlbm = s.getXlBm(); | ||
| 3888 | - String fcrq = s.getScheduleDateStr(); | ||
| 3889 | - | ||
| 3890 | - int type=0; | ||
| 3891 | - Double ccyl = 0.0; | ||
| 3892 | - Double jcyl = 0.0; | ||
| 3893 | - Double yh = 0.0; | ||
| 3894 | - Double jzl = 0.0; | ||
| 3895 | - Double zlc=0.0; | ||
| 3896 | - List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | ||
| 3897 | - List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | ||
| 3898 | - if(listYlb.size()>0){ | ||
| 3899 | - type=0; | ||
| 3900 | - for (int i = 0; i < listYlb.size(); i++) { | ||
| 3901 | - Ylb y = listYlb.get(i); | ||
| 3902 | - if(y.getLp()==null){ | ||
| 3903 | - ccyl=Arith.add(ccyl, y.getCzyl()); | ||
| 3904 | - jcyl=Arith.add(jcyl, y.getJzyl()); | ||
| 3905 | - yh =Arith.add(yh ,y.getYh()); | ||
| 3906 | - jzl =Arith.add(jzl, y.getJzl()); | ||
| 3907 | - zlc =Arith.add(zlc, y.getZlc()); | ||
| 3908 | - }else{ | ||
| 3909 | - if(y.getLp().equals(s.getLpName())){ | ||
| 3910 | - ccyl=Arith.add(ccyl, y.getCzyl()); | ||
| 3911 | - jcyl=Arith.add(jcyl, y.getJzyl()); | ||
| 3912 | - yh =Arith.add(yh ,y.getYh()); | ||
| 3913 | - jzl =Arith.add(jzl, y.getJzl()); | ||
| 3914 | - zlc =Arith.add(zlc, y.getZlc()); | ||
| 3915 | - } | ||
| 3916 | - } | ||
| 3917 | - | ||
| 3918 | - } | ||
| 3919 | - }else{ | ||
| 3920 | - type=1; | ||
| 3921 | - for (int i = 0; i < listDlb.size(); i++) { | ||
| 3922 | - Dlb d=listDlb.get(i); | ||
| 3923 | - if(d.getLp()==null){ | ||
| 3924 | - ccyl=Arith.add(ccyl, d.getCzcd()); | ||
| 3925 | - jcyl=Arith.add(jcyl, d.getJzcd()); | ||
| 3926 | - yh =Arith.add(yh ,d.getHd()); | ||
| 3927 | - jzl =Arith.add(jzl, d.getCdl()); | ||
| 3928 | - zlc =Arith.add(zlc, d.getZlc()); | ||
| 3929 | - }else{ | ||
| 3930 | - if(d.getLp().equals(s.getLpName())){ | ||
| 3931 | - ccyl=Arith.add(ccyl, d.getCzcd()); | ||
| 3932 | - jcyl=Arith.add(jcyl, d.getJzcd()); | ||
| 3933 | - yh =Arith.add(yh ,d.getHd()); | ||
| 3934 | - jzl =Arith.add(jzl, d.getCdl()); | ||
| 3935 | - zlc =Arith.add(zlc, d.getZlc()); | 3885 | + public Map<String, Object> MapById(Long id) { |
| 3886 | + // TODO Auto-generated method stub | ||
| 3887 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 3888 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 3889 | + ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(id); | ||
| 3890 | + String xlbm = s.getXlBm(); | ||
| 3891 | + String fcrq = s.getScheduleDateStr(); | ||
| 3892 | + | ||
| 3893 | + int type = 2; | ||
| 3894 | + Double ccyl = 0.0; | ||
| 3895 | + Double jcyl = 0.0; | ||
| 3896 | + Double yh = 0.0; | ||
| 3897 | + Double jzl = 0.0; | ||
| 3898 | + Double zlc = 0.0; | ||
| 3899 | + List<Cars> listCars = carsRepository.findCarsByCode(s.getClZbh()); | ||
| 3900 | + if (listCars.size() > 0) { | ||
| 3901 | + if(listCars.get(0).getSfdc()!=null){ | ||
| 3902 | + if (listCars.get(0).getSfdc()) { | ||
| 3903 | + List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | ||
| 3904 | + type = 1; | ||
| 3905 | + for (int i = 0; i < listDlb.size(); i++) { | ||
| 3906 | + Dlb d = listDlb.get(i); | ||
| 3907 | + if (d.getLp() == null) { | ||
| 3908 | + ccyl = Arith.add(ccyl, d.getCzcd()); | ||
| 3909 | + jcyl = Arith.add(jcyl, d.getJzcd()); | ||
| 3910 | + yh = Arith.add(yh, d.getHd()); | ||
| 3911 | + jzl = Arith.add(jzl, d.getCdl()); | ||
| 3912 | + zlc = Arith.add(zlc, d.getZlc()); | ||
| 3913 | + } else { | ||
| 3914 | + if (d.getLp().equals(s.getLpName())) { | ||
| 3915 | + ccyl = Arith.add(ccyl, d.getCzcd()); | ||
| 3916 | + jcyl = Arith.add(jcyl, d.getJzcd()); | ||
| 3917 | + yh = Arith.add(yh, d.getHd()); | ||
| 3918 | + jzl = Arith.add(jzl, d.getCdl()); | ||
| 3919 | + zlc = Arith.add(zlc, d.getZlc()); | ||
| 3920 | + } | ||
| 3921 | + } | ||
| 3922 | + | ||
| 3923 | + } | ||
| 3924 | + } else { | ||
| 3925 | + List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | ||
| 3926 | + type = 0; | ||
| 3927 | + for (int i = 0; i < listYlb.size(); i++) { | ||
| 3928 | + Ylb y = listYlb.get(i); | ||
| 3929 | + if (y.getLp() == null) { | ||
| 3930 | + ccyl = Arith.add(ccyl, y.getCzyl()); | ||
| 3931 | + jcyl = Arith.add(jcyl, y.getJzyl()); | ||
| 3932 | + yh = Arith.add(yh, y.getYh()); | ||
| 3933 | + jzl = Arith.add(jzl, y.getJzl()); | ||
| 3934 | + zlc = Arith.add(zlc, y.getZlc()); | ||
| 3935 | + } else { | ||
| 3936 | + if (y.getLp().equals(s.getLpName())) { | ||
| 3937 | + ccyl = Arith.add(ccyl, y.getCzyl()); | ||
| 3938 | + jcyl = Arith.add(jcyl, y.getJzyl()); | ||
| 3939 | + yh = Arith.add(yh, y.getYh()); | ||
| 3940 | + jzl = Arith.add(jzl, y.getJzl()); | ||
| 3941 | + zlc = Arith.add(zlc, y.getZlc()); | ||
| 3942 | + } | ||
| 3943 | + } | ||
| 3936 | } | 3944 | } |
| 3937 | } | 3945 | } |
| 3938 | - | ||
| 3939 | } | 3946 | } |
| 3940 | - } | ||
| 3941 | - | ||
| 3942 | - map.put("jzl", jzl); | ||
| 3943 | - map.put("yh", yh); | ||
| 3944 | - map.put("ccyl", ccyl); | ||
| 3945 | - map.put("jcyl", jcyl); | ||
| 3946 | - map.put("type", type); | ||
| 3947 | - map.put("zlc", zlc); | ||
| 3948 | - map.put("xlName", s.getXlName()); | ||
| 3949 | - map.put("clZbh", s.getClZbh()); | ||
| 3950 | - map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | ||
| 3951 | - map.put("fcsjActual", s.getFcsjActual()); | ||
| 3952 | - map.put("zdzName", s.getZdzName()); | ||
| 3953 | - map.put("scheduleDate", s.getScheduleDateStr()); | ||
| 3954 | - map.put("lpName", s.getLpName()); | ||
| 3955 | - String zdp = "", zwdp = "", wdp = ""; | ||
| 3956 | - String zdpT = "", zwdpT = "", wdpT = ""; | ||
| 3957 | - String dbdp=""; | ||
| 3958 | - List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59"); | ||
| 3959 | - try { | ||
| 3960 | - Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime(); | ||
| 3961 | - Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime(); | ||
| 3962 | - Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime(); | ||
| 3963 | - for (int i = 0; i < list.size(); i++) { | ||
| 3964 | - DutyEmployee t = list.get(i); | ||
| 3965 | - if(dbdp.indexOf(t.getuName()) == -1){ | ||
| 3966 | - if(!(dbdp.length()>0)){ | ||
| 3967 | - dbdp =t.getuName(); | ||
| 3968 | - }else{ | ||
| 3969 | - dbdp +=","+t.getuName(); | ||
| 3970 | - } | ||
| 3971 | - } | ||
| 3972 | - Long ts = t.getTs(); | ||
| 3973 | - if (ts > fcsj1 && ts < fcsj2) { | ||
| 3974 | - if (zdp.indexOf(t.getuName()) == -1) { | ||
| 3975 | - if (!(zdp.length() > 0)) { | ||
| 3976 | - zdpT = t.getuName() + "..."; | ||
| 3977 | - } | ||
| 3978 | - zdp += t.getuName() + ","; | 3947 | + } |
| 3979 | 3948 | ||
| 3980 | - } | ||
| 3981 | - } else if (ts > fcsj2 && ts < fcsj3) { | ||
| 3982 | - if (zwdp.indexOf(t.getuName()) == -1) { | ||
| 3983 | - if (!(zwdp.length() > 0)) { | ||
| 3984 | - zwdpT = t.getuName() + "..."; | ||
| 3985 | - } | ||
| 3986 | - zwdp += t.getuName() + ","; | ||
| 3987 | - } | ||
| 3988 | - } else { | ||
| 3989 | - if (wdp.indexOf(t.getuName()) == -1) { | ||
| 3990 | - if (!(wdp.length() > 0)) { | ||
| 3991 | - wdpT = t.getuName() + "..."; | ||
| 3992 | - } | ||
| 3993 | - wdp += t.getuName() + ","; | ||
| 3994 | - } | ||
| 3995 | - } | ||
| 3996 | - } | ||
| 3997 | - } catch (ParseException e) { | ||
| 3998 | - // TODO Auto-generated catch block | ||
| 3999 | - e.printStackTrace(); | ||
| 4000 | - } | ||
| 4001 | - map.put("zdp", zdp); | ||
| 4002 | - map.put("zwdp", zwdp); | ||
| 4003 | - map.put("wdp", wdp); | ||
| 4004 | - map.put("zdpT", zdpT); | ||
| 4005 | - map.put("zwdpT", zwdpT); | ||
| 4006 | - map.put("wdpT", wdpT); | ||
| 4007 | - map.put("dbdp", dbdp); | ||
| 4008 | - return map; | ||
| 4009 | - } | 3949 | + map.put("jzl", jzl); |
| 3950 | + map.put("yh", yh); | ||
| 3951 | + map.put("ccyl", ccyl); | ||
| 3952 | + map.put("jcyl", jcyl); | ||
| 3953 | + map.put("type", type); | ||
| 3954 | + map.put("zlc", zlc); | ||
| 3955 | + map.put("xlName", s.getXlName()); | ||
| 3956 | + map.put("clZbh", s.getClZbh()); | ||
| 3957 | + map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | ||
| 3958 | + map.put("fcsjActual", s.getFcsjActual()); | ||
| 3959 | + map.put("zdzName", s.getZdzName()); | ||
| 3960 | + map.put("scheduleDate", s.getScheduleDateStr()); | ||
| 3961 | + map.put("lpName", s.getLpName()); | ||
| 3962 | + String zdp = "", zwdp = "", wdp = ""; | ||
| 3963 | + String zdpT = "", zwdpT = "", wdpT = ""; | ||
| 3964 | + String dbdp = ""; | ||
| 3965 | + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59"); | ||
| 3966 | + try { | ||
| 3967 | + Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime(); | ||
| 3968 | + Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime(); | ||
| 3969 | + Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime(); | ||
| 3970 | + for (int i = 0; i < list.size(); i++) { | ||
| 3971 | + DutyEmployee t = list.get(i); | ||
| 3972 | + if (dbdp.indexOf(t.getuName()) == -1) { | ||
| 3973 | + if (!(dbdp.length() > 0)) { | ||
| 3974 | + dbdp = t.getuName(); | ||
| 3975 | + } else { | ||
| 3976 | + dbdp += "," + t.getuName(); | ||
| 3977 | + } | ||
| 3978 | + } | ||
| 3979 | + Long ts = t.getTs(); | ||
| 3980 | + if (ts > fcsj1 && ts < fcsj2) { | ||
| 3981 | + if (zdp.indexOf(t.getuName()) == -1) { | ||
| 3982 | + if (!(zdp.length() > 0)) { | ||
| 3983 | + zdpT = t.getuName() + "..."; | ||
| 3984 | + } | ||
| 3985 | + zdp += t.getuName() + ","; | ||
| 3986 | + | ||
| 3987 | + } | ||
| 3988 | + } else if (ts > fcsj2 && ts < fcsj3) { | ||
| 3989 | + if (zwdp.indexOf(t.getuName()) == -1) { | ||
| 3990 | + if (!(zwdp.length() > 0)) { | ||
| 3991 | + zwdpT = t.getuName() + "..."; | ||
| 3992 | + } | ||
| 3993 | + zwdp += t.getuName() + ","; | ||
| 3994 | + } | ||
| 3995 | + } else { | ||
| 3996 | + if (wdp.indexOf(t.getuName()) == -1) { | ||
| 3997 | + if (!(wdp.length() > 0)) { | ||
| 3998 | + wdpT = t.getuName() + "..."; | ||
| 3999 | + } | ||
| 4000 | + wdp += t.getuName() + ","; | ||
| 4001 | + } | ||
| 4002 | + } | ||
| 4003 | + } | ||
| 4004 | + } catch (ParseException e) { | ||
| 4005 | + // TODO Auto-generated catch block | ||
| 4006 | + e.printStackTrace(); | ||
| 4007 | + } | ||
| 4008 | + map.put("zdp", zdp); | ||
| 4009 | + map.put("zwdp", zwdp); | ||
| 4010 | + map.put("wdp", wdp); | ||
| 4011 | + map.put("zdpT", zdpT); | ||
| 4012 | + map.put("zwdpT", zwdpT); | ||
| 4013 | + map.put("wdpT", wdpT); | ||
| 4014 | + map.put("dbdp", dbdp); | ||
| 4015 | + return map; | ||
| 4016 | + } | ||
| 4010 | 4017 | ||
| 4011 | @Override | 4018 | @Override |
| 4012 | public Map<String, Object> MapByIdQp(Long id) { | 4019 | public Map<String, Object> MapByIdQp(Long id) { |
| @@ -4744,7 +4751,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -4744,7 +4751,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 4744 | } | 4751 | } |
| 4745 | // file.mkdirs(); //创建 | 4752 | // file.mkdirs(); //创建 |
| 4746 | List<ScheduleRealInfo> lists_line=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); | 4753 | List<ScheduleRealInfo> lists_line=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); |
| 4747 | - | ||
| 4748 | List<File> files = new ArrayList<File>(); | 4754 | List<File> files = new ArrayList<File>(); |
| 4749 | for (List<String> list : lists){ | 4755 | for (List<String> list : lists){ |
| 4750 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | 4756 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); |
| @@ -4770,7 +4776,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -4770,7 +4776,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 4770 | } | 4776 | } |
| 4771 | File newFile = files.get(0); | 4777 | File newFile = files.get(0); |
| 4772 | newFile.renameTo(file); | 4778 | newFile.renameTo(file); |
| 4773 | - | ||
| 4774 | // temp.renameTo(new File(path + fileName + "/" + temp.getName())); | 4779 | // temp.renameTo(new File(path + fileName + "/" + temp.getName())); |
| 4775 | // File[] listFiles = file.listFiles(); | 4780 | // File[] listFiles = file.listFiles(); |
| 4776 | // ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip"))); | 4781 | // ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip"))); |
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
| @@ -378,119 +378,194 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -378,119 +378,194 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 378 | } | 378 | } |
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | - @Override | ||
| 382 | - public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException { | ||
| 383 | - try { | ||
| 384 | - // 使用POI,创建xlsx文件 | ||
| 385 | - XSSFWorkbook wb = new XSSFWorkbook(); | ||
| 386 | - XSSFSheet sheet = wb.createSheet(WorkbookUtil.createSafeSheetName("时刻表信息")); | 381 | + private void createDynamicTTinfoStatSheet(XSSFWorkbook wb, DTInfos dtInfos) { |
| 382 | + XSSFSheet sheet = wb.createSheet(WorkbookUtil.createSafeSheetName("时刻表信息_统计")); | ||
| 387 | 383 | ||
| 388 | - //-------------------------------- 1、路牌班次数据 -------------------------------// | ||
| 389 | - List<LpObj> lpObjList = dtInfos.getLpObjList(); | 384 | + //-------------------------------- 1、路牌班次数据 -------------------------------// |
| 385 | + List<LpObj> lpObjList = dtInfos.getLpObjList(); | ||
| 390 | 386 | ||
| 391 | - // 构建第一行数据 | ||
| 392 | - XSSFRow lpHeadRow = sheet.createRow((short) 0); | ||
| 393 | - if (lpObjList.size() == 0) { | ||
| 394 | - throw new RuntimeException("没有班次数据!"); | ||
| 395 | - } | ||
| 396 | - int groupCount = lpObjList.get(0).getGroupCount(); // 获取总圈数 | ||
| 397 | - if (groupCount == 0) { | ||
| 398 | - throw new RuntimeException("总圈数为0,有问题!"); | ||
| 399 | - } | 387 | + // 构建第一行数据 |
| 388 | + XSSFRow lpHeadRow = sheet.createRow((short) 0); | ||
| 389 | + if (lpObjList.size() == 0) { | ||
| 390 | + throw new RuntimeException("没有班次数据!"); | ||
| 391 | + } | ||
| 392 | + int groupCount = lpObjList.get(0).getGroupCount(); // 获取总圈数 | ||
| 393 | + if (groupCount == 0) { | ||
| 394 | + throw new RuntimeException("总圈数为0,有问题!"); | ||
| 395 | + } | ||
| 400 | 396 | ||
| 401 | - // 构造表头 | ||
| 402 | - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short)0, "路牌", new Color(0x96b9d7)); | ||
| 403 | - Station station1 = stationService.findById(lpObjList.get(0).getStationRouteId1()); | ||
| 404 | - Station station2 = stationService.findById(lpObjList.get(1).getStationRouteId2()); | ||
| 405 | - for (int i = 0; i < groupCount; i++) { | ||
| 406 | - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 1), | ||
| 407 | - station1.getStationName(), new Color(0x96b9d7)); | ||
| 408 | - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 2), | ||
| 409 | - station2.getStationName(), new Color(0x96b9d7)); | 397 | + // 构造表头 |
| 398 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short)0, "路牌", new Color(0x96b9d7)); | ||
| 399 | + Station station1 = stationService.findById(lpObjList.get(0).getStationRouteId1()); | ||
| 400 | + Station station2 = stationService.findById(lpObjList.get(1).getStationRouteId2()); | ||
| 401 | + for (int i = 0; i < groupCount; i++) { | ||
| 402 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 1), | ||
| 403 | + station1.getStationName(), new Color(0x96b9d7)); | ||
| 404 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 2), | ||
| 405 | + station2.getStationName(), new Color(0x96b9d7)); | ||
| 406 | + } | ||
| 407 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 1), | ||
| 408 | + "路牌工时", new Color(0x96b9d7)); | ||
| 409 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 2), | ||
| 410 | + "营运班次数", new Color(0x96b9d7)); | ||
| 411 | + | ||
| 412 | + // 构建每个路牌的班次数据 | ||
| 413 | + for (int i = 0; i < lpObjList.size(); i++) { | ||
| 414 | + LpObj lpObj = lpObjList.get(i); | ||
| 415 | + XSSFRow lpRow = sheet.createRow((short) (i + 1)); | ||
| 416 | + PoiUtils.createStringXSSFCell(wb, lpRow, (short) 0, lpObj.getLpname()); | ||
| 417 | + for (int j = 0; j < groupCount; j++) { | ||
| 418 | + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 1)); | ||
| 419 | + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 2)); | ||
| 410 | } | 420 | } |
| 411 | - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 1), | ||
| 412 | - "路牌工时", new Color(0x96b9d7)); | ||
| 413 | - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 2), | ||
| 414 | - "营运班次数", new Color(0x96b9d7)); | ||
| 415 | - | ||
| 416 | - // 构建每个路牌的班次数据 | ||
| 417 | - for (int i = 0; i < lpObjList.size(); i++) { | ||
| 418 | - LpObj lpObj = lpObjList.get(i); | ||
| 419 | - XSSFRow lpRow = sheet.createRow((short) (i + 1)); | ||
| 420 | - PoiUtils.createStringXSSFCell(wb, lpRow, (short) 0, lpObj.getLpname()); | ||
| 421 | - for (int j = 0; j < groupCount; j++) { | ||
| 422 | - PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 1)); | ||
| 423 | - PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 2)); | ||
| 424 | - } | ||
| 425 | - for (BcObj bcObj : lpObj.getBcObjList()) { | 421 | + for (BcObj bcObj : lpObj.getBcObjList()) { |
| 422 | + if (bcObj.getBcType() == BcType.NORMAL) { | ||
| 426 | Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 1)); | 423 | Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 1)); |
| 427 | - cell.setCellValue(bcObj.getFcsj()); | 424 | + cell.setCellValue(bcObj.getFcsjDesc()); |
| 428 | } | 425 | } |
| 429 | - // 路牌工时/班次数 | ||
| 430 | - PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 1), | ||
| 431 | - lpObj.getZgs() / 60); | ||
| 432 | - // 营运班次数 | ||
| 433 | - PoiUtils.createIntegerXSSFCell(wb, lpRow, (short) (groupCount * 2 + 2), | ||
| 434 | - lpObj.getZbc()); | ||
| 435 | } | 426 | } |
| 427 | + // 路牌工时/班次数 | ||
| 428 | + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 1), | ||
| 429 | + lpObj.getZgs() / 60); | ||
| 430 | + // 营运班次数 | ||
| 431 | + PoiUtils.createIntegerXSSFCell(wb, lpRow, (short) (groupCount * 2 + 2), | ||
| 432 | + lpObj.getZbc()); | ||
| 433 | + } | ||
| 436 | 434 | ||
| 437 | - // 自适应单元格长宽 | ||
| 438 | - sheet.autoSizeColumn(0); | ||
| 439 | - for (int i = 0; i < groupCount; i++) { | ||
| 440 | - sheet.autoSizeColumn(i * 2 + 1); | ||
| 441 | - sheet.autoSizeColumn(i * 2 + 2); | ||
| 442 | - } | ||
| 443 | - sheet.autoSizeColumn(groupCount * 2 + 1); | ||
| 444 | - sheet.autoSizeColumn(groupCount * 2 + 2); | 435 | + // 自适应单元格长宽 |
| 436 | + sheet.autoSizeColumn(0); | ||
| 437 | + for (int i = 0; i < groupCount; i++) { | ||
| 438 | + sheet.autoSizeColumn(i * 2 + 1); | ||
| 439 | + sheet.autoSizeColumn(i * 2 + 2); | ||
| 440 | + } | ||
| 441 | + sheet.autoSizeColumn(groupCount * 2 + 1); | ||
| 442 | + sheet.autoSizeColumn(groupCount * 2 + 2); | ||
| 445 | 443 | ||
| 446 | - // 锁定行首,列首 | ||
| 447 | - sheet.createFreezePane(1, 1); | 444 | + // 锁定行首,列首 |
| 445 | + sheet.createFreezePane(1, 1); | ||
| 448 | 446 | ||
| 449 | - //-------------------------------- 2、统计数据 -------------------------------// | ||
| 450 | - List<StatInfo> statInfos = dtInfos.getStatInfoList(); | 447 | + //-------------------------------- 2、统计数据 -------------------------------// |
| 448 | + List<StatInfo> statInfos = dtInfos.getStatInfoList(); | ||
| 451 | 449 | ||
| 452 | - // 创建总的统计数据格式 | ||
| 453 | - // 第一行 统计数据 | ||
| 454 | - // 第二行 序号,统计项目(8个单元格合并),统计数值 | ||
| 455 | - // 第三行开始数据,一共20行 | 450 | + // 创建总的统计数据格式 |
| 451 | + // 第一行 统计数据 | ||
| 452 | + // 第二行 序号,统计项目(8个单元格合并),统计数值 | ||
| 453 | + // 第三行开始数据,一共20行 | ||
| 456 | 454 | ||
| 457 | - int startrow = lpObjList.size() + 3; | ||
| 458 | - for (int i = startrow; i <= startrow + 22; i++) { | ||
| 459 | - XSSFRow xssfRow = sheet.createRow(i); | ||
| 460 | - for (int j = 0; j < 10; j++) { | ||
| 461 | - PoiUtils.createStringXSSFCell(wb, xssfRow, (short) j, ""); | 455 | + int startrow = lpObjList.size() + 3; |
| 456 | + for (int i = startrow; i <= startrow + 22; i++) { | ||
| 457 | + XSSFRow xssfRow = sheet.createRow(i); | ||
| 458 | + for (int j = 0; j < 10; j++) { | ||
| 459 | + PoiUtils.createStringXSSFCell(wb, xssfRow, (short) j, ""); | ||
| 462 | 460 | ||
| 463 | - } | ||
| 464 | - } | ||
| 465 | - // 合并第一行 | ||
| 466 | - sheet.addMergedRegion(new CellRangeAddress(startrow, startrow, 0, 9)); | ||
| 467 | - sheet.getRow(startrow).getCell(0).setCellValue("统计数据"); | ||
| 468 | - // 合并第二行 | ||
| 469 | - sheet.getRow(startrow + 1).getCell(0).setCellValue("序号"); | ||
| 470 | - sheet.getRow(startrow + 1).getCell(1).setCellValue("统计项目"); | ||
| 471 | - sheet.getRow(startrow + 1).getCell(9).setCellValue("统计数值"); | ||
| 472 | - sheet.addMergedRegion(new CellRangeAddress(startrow + 1, startrow + 1, 1, 8)); | ||
| 473 | - // 处理后面具体统计行 | ||
| 474 | - for (int row = startrow + 2; row <= startrow + 2 + statInfos.size(); row++) { | ||
| 475 | - sheet.addMergedRegion(new CellRangeAddress(row, row, 1, 8)); | ||
| 476 | } | 461 | } |
| 462 | + } | ||
| 463 | + // 合并第一行 | ||
| 464 | + sheet.addMergedRegion(new CellRangeAddress(startrow, startrow, 0, 9)); | ||
| 465 | + sheet.getRow(startrow).getCell(0).setCellValue("统计数据"); | ||
| 466 | + // 合并第二行 | ||
| 467 | + sheet.getRow(startrow + 1).getCell(0).setCellValue("序号"); | ||
| 468 | + sheet.getRow(startrow + 1).getCell(1).setCellValue("统计项目"); | ||
| 469 | + sheet.getRow(startrow + 1).getCell(9).setCellValue("统计数值"); | ||
| 470 | + sheet.addMergedRegion(new CellRangeAddress(startrow + 1, startrow + 1, 1, 8)); | ||
| 471 | + // 处理后面具体统计行 | ||
| 472 | + for (int row = startrow + 2; row <= startrow + 2 + statInfos.size(); row++) { | ||
| 473 | + sheet.addMergedRegion(new CellRangeAddress(row, row, 1, 8)); | ||
| 474 | + } | ||
| 475 | + | ||
| 476 | + for (int i = 0; i < statInfos.size(); i++) { | ||
| 477 | + StatInfo statInfo = statInfos.get(i); | ||
| 478 | + | ||
| 479 | + // 1、统计序号 | ||
| 480 | + PoiUtils.setIntegerStyleXSSFCellStyle(wb, sheet.getRow(startrow + 2 + i).getCell(0)); | ||
| 481 | + sheet.getRow(startrow + 2 + i).getCell(0).setCellValue(i); | ||
| 482 | + | ||
| 483 | + // 2、统计项目 | ||
| 484 | + sheet.getRow(startrow + 2 + i).getCell(1).setCellValue(statInfo.getStatItem()); | ||
| 485 | + | ||
| 486 | + // 3、统计数值 | ||
| 487 | + PoiUtils.setDoubleStyleXSSFCellStyle(wb, sheet.getRow(startrow + 2 + i).getCell(9)); | ||
| 488 | + sheet.getRow(startrow + 2 + i).getCell(9).setCellValue(statInfo.getStatValue()); | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + } | ||
| 477 | 492 | ||
| 478 | - for (int i = 0; i < statInfos.size(); i++) { | ||
| 479 | - StatInfo statInfo = statInfos.get(i); | 493 | + private void createDynamicTTinfoSheet(XSSFWorkbook wb, DTInfos dtInfos) { |
| 494 | + XSSFSheet sheet = wb.createSheet(WorkbookUtil.createSafeSheetName("时刻表信息")); | ||
| 480 | 495 | ||
| 481 | - // 1、统计序号 | ||
| 482 | - PoiUtils.setIntegerStyleXSSFCellStyle(wb, sheet.getRow(startrow + 2 + i).getCell(0)); | ||
| 483 | - sheet.getRow(startrow + 2 + i).getCell(0).setCellValue(i); | 496 | + //-------------------------------- 1、路牌班次数据 -------------------------------// |
| 497 | + List<LpObj> lpObjList = dtInfos.getLpObjList(); | ||
| 498 | + | ||
| 499 | + // 构建第一行数据 | ||
| 500 | + XSSFRow lpHeadRow = sheet.createRow((short) 0); | ||
| 501 | + if (lpObjList.size() == 0) { | ||
| 502 | + throw new RuntimeException("没有班次数据!"); | ||
| 503 | + } | ||
| 504 | + int groupCount = lpObjList.get(0).getGroupCount(); // 获取总圈数 | ||
| 505 | + if (groupCount == 0) { | ||
| 506 | + throw new RuntimeException("总圈数为0,有问题!"); | ||
| 507 | + } | ||
| 484 | 508 | ||
| 485 | - // 2、统计项目 | ||
| 486 | - sheet.getRow(startrow + 2 + i).getCell(1).setCellValue(statInfo.getStatItem()); | 509 | + // 构造表头,添加一个进场,添加一个出场 |
| 510 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short)0, "路牌", new Color(0x96b9d7)); | ||
| 511 | + Station station1 = stationService.findById(lpObjList.get(0).getStationRouteId1()); | ||
| 512 | + Station station2 = stationService.findById(lpObjList.get(1).getStationRouteId2()); | ||
| 513 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (1), | ||
| 514 | + "出场", new Color(0x96b9d7)); | ||
| 515 | + for (int i = 1; i <= groupCount; i++) { | ||
| 516 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2), | ||
| 517 | + station1.getStationName(), new Color(0x96b9d7)); | ||
| 518 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 1), | ||
| 519 | + station2.getStationName(), new Color(0x96b9d7)); | ||
| 520 | + } | ||
| 521 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 2), | ||
| 522 | + "进场", new Color(0x96b9d7)); | ||
| 523 | + | ||
| 524 | + // 构建每个路牌的班次数据 | ||
| 525 | + for (int i = 0; i < lpObjList.size(); i++) { | ||
| 526 | + LpObj lpObj = lpObjList.get(i); | ||
| 527 | + XSSFRow lpRow = sheet.createRow((short) (i + 1)); | ||
| 528 | + PoiUtils.createStringXSSFCell(wb, lpRow, (short) 0, lpObj.getLpname()); | ||
| 529 | + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (1)); | ||
| 530 | + for (int j = 1; j <= groupCount; j++) { | ||
| 531 | + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2)); | ||
| 532 | + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 1)); | ||
| 533 | + } | ||
| 534 | + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 2)); | ||
| 487 | 535 | ||
| 488 | - // 3、统计数值 | ||
| 489 | - PoiUtils.setDoubleStyleXSSFCellStyle(wb, sheet.getRow(startrow + 2 + i).getCell(9)); | ||
| 490 | - sheet.getRow(startrow + 2 + i).getCell(9).setCellValue(statInfo.getStatValue()); | 536 | + for (BcObj bcObj : lpObj.getBcObjList()) { |
| 537 | + if (bcObj.getBcType() == BcType.NORMAL) { | ||
| 538 | + Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 2)); | ||
| 539 | + cell.setCellValue(bcObj.getFcsj()); | ||
| 540 | + } else if (bcObj.getBcType() == BcType.OUT) { | ||
| 541 | + Cell cell = lpRow.getCell((short) (1)); | ||
| 542 | + cell.setCellValue(bcObj.getFcsj()); | ||
| 543 | + } else if (bcObj.getBcType() == BcType.IN) { | ||
| 544 | + Cell cell = lpRow.getCell((short) (groupCount * 2 + 2)); | ||
| 545 | + cell.setCellValue(bcObj.getFcsj()); | ||
| 546 | + } | ||
| 491 | } | 547 | } |
| 548 | + } | ||
| 549 | + | ||
| 550 | + // 自适应单元格长宽 | ||
| 551 | + sheet.autoSizeColumn(0); | ||
| 552 | + sheet.autoSizeColumn(1); | ||
| 553 | + for (int i = 1; i <= groupCount; i++) { | ||
| 554 | + sheet.autoSizeColumn(i * 2); | ||
| 555 | + sheet.autoSizeColumn(i * 2 + 1); | ||
| 556 | + } | ||
| 557 | + | ||
| 558 | + } | ||
| 559 | + | ||
| 560 | + @Override | ||
| 561 | + public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException { | ||
| 562 | + try { | ||
| 563 | + // 使用POI,创建xlsx文件 | ||
| 564 | + XSSFWorkbook wb = new XSSFWorkbook(); | ||
| 565 | + this.createDynamicTTinfoSheet(wb, dtInfos); | ||
| 566 | + this.createDynamicTTinfoStatSheet(wb, dtInfos); | ||
| 492 | 567 | ||
| 493 | - // 最后内存写入文件 | 568 | + // wb内存写入文件 |
| 494 | String filepath = dataToolsProperties.getFileoutputDir() + | 569 | String filepath = dataToolsProperties.getFileoutputDir() + |
| 495 | File.separator + | 570 | File.separator + |
| 496 | "动态时刻表-" + | 571 | "动态时刻表-" + |
src/main/java/com/bsth/service/schedule/datatools/TTinfoDetailDynamicData.java
| 1 | -package com.bsth.service.schedule.datatools; | ||
| 2 | - | ||
| 3 | -import com.bsth.service.schedule.exception.ScheduleException; | ||
| 4 | -import com.bsth.service.schedule.utils.DataToolsFile; | ||
| 5 | -import com.fasterxml.jackson.annotation.JsonCreator; | ||
| 6 | -import com.fasterxml.jackson.annotation.JsonValue; | ||
| 7 | - | ||
| 8 | -import java.util.List; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * 动态时刻表数据。 | ||
| 12 | - */ | ||
| 13 | -public interface TTinfoDetailDynamicData { | ||
| 14 | - | ||
| 15 | - //---------------------- 生成时刻表用对象(以下) ---------------------// | ||
| 16 | - public static enum BcType { // 班次类型枚举 | ||
| 17 | - IN("in"), // 进场 | ||
| 18 | - OUT("out"), // 出场 | ||
| 19 | - BD("bd"), // 早例保 | ||
| 20 | - LC("lc"), // 晚例保 | ||
| 21 | - NORMAL("normal"); // 正常 | ||
| 22 | - private String flag; | ||
| 23 | - | ||
| 24 | - @JsonCreator | ||
| 25 | - private BcType(String flag) { | ||
| 26 | - this.flag = flag; | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - @JsonValue | ||
| 30 | - public String getFlag() { | ||
| 31 | - return flag; | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - public void setFlag(String flag) { | ||
| 35 | - this.flag = flag; | ||
| 36 | - } | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - public static class BcObj { // 班次对象 | ||
| 40 | - /** 班次时间 */ | ||
| 41 | - private Integer bcsj; | ||
| 42 | - /** 停站时间 */ | ||
| 43 | - private Integer ssj; | ||
| 44 | - /** 吃饭时间 */ | ||
| 45 | - private Integer eatsj; | ||
| 46 | - | ||
| 47 | - /** 停车场id */ | ||
| 48 | - private Integer tccid; | ||
| 49 | - /** 起点站id */ | ||
| 50 | - private Integer qdzid; | ||
| 51 | - /** 终点站id */ | ||
| 52 | - private Integer zdzid; | ||
| 53 | - | ||
| 54 | - /** 是否上行 */ | ||
| 55 | - private Boolean isUp; | ||
| 56 | - | ||
| 57 | - /** 班次类型 */ | ||
| 58 | - private BcType bcType; | ||
| 59 | - /** 发车时刻 */ | ||
| 60 | - private String fcsj; | ||
| 61 | - | ||
| 62 | - /** 第几圈(从1开始) */ | ||
| 63 | - private Integer groupNo; | ||
| 64 | - /** 圈里第几个班次(1或者2) */ | ||
| 65 | - private Integer groupBcNo; | ||
| 66 | - | ||
| 67 | - public Integer getBcsj() { | ||
| 68 | - return bcsj; | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - public void setBcsj(Integer bcsj) { | ||
| 72 | - this.bcsj = bcsj; | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - public Integer getSsj() { | ||
| 76 | - return ssj; | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - public void setSsj(Integer ssj) { | ||
| 80 | - this.ssj = ssj; | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - public Integer getEatsj() { | ||
| 84 | - return eatsj; | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - public void setEatsj(Integer eatsj) { | ||
| 88 | - this.eatsj = eatsj; | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - public Integer getTccid() { | ||
| 92 | - return tccid; | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - public void setTccid(Integer tccid) { | ||
| 96 | - this.tccid = tccid; | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - public Integer getQdzid() { | ||
| 100 | - return qdzid; | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - public void setQdzid(Integer qdzid) { | ||
| 104 | - this.qdzid = qdzid; | ||
| 105 | - } | ||
| 106 | - | ||
| 107 | - public Integer getZdzid() { | ||
| 108 | - return zdzid; | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - public void setZdzid(Integer zdzid) { | ||
| 112 | - this.zdzid = zdzid; | ||
| 113 | - } | ||
| 114 | - | ||
| 115 | - public BcType getBcType() { | ||
| 116 | - return bcType; | ||
| 117 | - } | ||
| 118 | - | ||
| 119 | - public void setBcType(BcType bcType) { | ||
| 120 | - this.bcType = bcType; | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - public String getFcsj() { | ||
| 124 | - return fcsj; | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - public void setFcsj(String fcsj) { | ||
| 128 | - this.fcsj = fcsj; | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - public Boolean getIsUp() { | ||
| 132 | - return isUp; | ||
| 133 | - } | ||
| 134 | - | ||
| 135 | - public void setIsUp(Boolean isUp) { | ||
| 136 | - this.isUp = isUp; | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - public Integer getGroupNo() { | ||
| 140 | - return groupNo; | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | - public void setGroupNo(Integer groupNo) { | ||
| 144 | - this.groupNo = groupNo; | ||
| 145 | - } | ||
| 146 | - | ||
| 147 | - public Integer getGroupBcNo() { | ||
| 148 | - return groupBcNo; | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - public void setGroupBcNo(Integer groupBcNo) { | ||
| 152 | - this.groupBcNo = groupBcNo; | ||
| 153 | - } | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - public static class LpObj { // 路牌对象 | ||
| 157 | - /** 路牌名字 */ | ||
| 158 | - private String lpname; | ||
| 159 | - /** 每圈的第一个班次是否上行 */ | ||
| 160 | - private Boolean isUp; | ||
| 161 | - | ||
| 162 | - /** 第一个班次起点站路由id */ | ||
| 163 | - private Integer stationRouteId1; | ||
| 164 | - /** 第二个班次起点站路由id */ | ||
| 165 | - private Integer stationRouteId2; | ||
| 166 | - | ||
| 167 | - /** 班次列表 */ | ||
| 168 | - private List<BcObj> bcObjList; | ||
| 169 | - /** 总圈数 */ | ||
| 170 | - private Integer groupCount; | ||
| 171 | - | ||
| 172 | - /** 总工时 */ | ||
| 173 | - private Double zgs; | ||
| 174 | - /** 总班次 */ | ||
| 175 | - private Integer zbc; | ||
| 176 | - | ||
| 177 | - | ||
| 178 | - public String getLpname() { | ||
| 179 | - return lpname; | ||
| 180 | - } | ||
| 181 | - | ||
| 182 | - public void setLpname(String lpname) { | ||
| 183 | - this.lpname = lpname; | ||
| 184 | - } | ||
| 185 | - | ||
| 186 | - public Boolean getIsUp() { | ||
| 187 | - return isUp; | ||
| 188 | - } | ||
| 189 | - | ||
| 190 | - public void setIsUp(Boolean isUp) { | ||
| 191 | - this.isUp = isUp; | ||
| 192 | - } | ||
| 193 | - | ||
| 194 | - public List<BcObj> getBcObjList() { | ||
| 195 | - return bcObjList; | ||
| 196 | - } | ||
| 197 | - | ||
| 198 | - public void setBcObjList(List<BcObj> bcObjList) { | ||
| 199 | - this.bcObjList = bcObjList; | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - public Integer getGroupCount() { | ||
| 203 | - return groupCount; | ||
| 204 | - } | ||
| 205 | - | ||
| 206 | - public void setGroupCount(Integer groupCount) { | ||
| 207 | - this.groupCount = groupCount; | ||
| 208 | - } | ||
| 209 | - | ||
| 210 | - public Double getZgs() { | ||
| 211 | - return zgs; | ||
| 212 | - } | ||
| 213 | - | ||
| 214 | - public void setZgs(Double zgs) { | ||
| 215 | - this.zgs = zgs; | ||
| 216 | - } | ||
| 217 | - | ||
| 218 | - public Integer getZbc() { | ||
| 219 | - return zbc; | ||
| 220 | - } | ||
| 221 | - | ||
| 222 | - public void setZbc(Integer zbc) { | ||
| 223 | - this.zbc = zbc; | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - public Integer getStationRouteId1() { | ||
| 227 | - return stationRouteId1; | ||
| 228 | - } | ||
| 229 | - | ||
| 230 | - public void setStationRouteId1(Integer stationRouteId1) { | ||
| 231 | - this.stationRouteId1 = stationRouteId1; | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - public Integer getStationRouteId2() { | ||
| 235 | - return stationRouteId2; | ||
| 236 | - } | ||
| 237 | - | ||
| 238 | - public void setStationRouteId2(Integer stationRouteId2) { | ||
| 239 | - this.stationRouteId2 = stationRouteId2; | ||
| 240 | - } | ||
| 241 | - } | ||
| 242 | - | ||
| 243 | - public static class StatInfo { // 统计数据对象 | ||
| 244 | - /** 统计项目 */ | ||
| 245 | - private String statItem; | ||
| 246 | - /** 统计值 */ | ||
| 247 | - private Double statValue; | ||
| 248 | - | ||
| 249 | - public String getStatItem() { | ||
| 250 | - return statItem; | ||
| 251 | - } | ||
| 252 | - | ||
| 253 | - public void setStatItem(String statItem) { | ||
| 254 | - this.statItem = statItem; | ||
| 255 | - } | ||
| 256 | - | ||
| 257 | - public Double getStatValue() { | ||
| 258 | - return statValue; | ||
| 259 | - } | ||
| 260 | - | ||
| 261 | - public void setStatValue(Double statValue) { | ||
| 262 | - this.statValue = statValue; | ||
| 263 | - } | ||
| 264 | - } | ||
| 265 | - | ||
| 266 | - public static class DTInfos { // 所有数据信息 | ||
| 267 | - /** 路牌班次数据列表 */ | ||
| 268 | - private List<LpObj> lpObjList; | ||
| 269 | - /** 统计数据列表 */ | ||
| 270 | - private List<StatInfo> statInfoList; | ||
| 271 | - | ||
| 272 | - public List<LpObj> getLpObjList() { | ||
| 273 | - return lpObjList; | ||
| 274 | - } | ||
| 275 | - | ||
| 276 | - public void setLpObjList(List<LpObj> lpObjList) { | ||
| 277 | - this.lpObjList = lpObjList; | ||
| 278 | - } | ||
| 279 | - | ||
| 280 | - public List<StatInfo> getStatInfoList() { | ||
| 281 | - return statInfoList; | ||
| 282 | - } | ||
| 283 | - | ||
| 284 | - public void setStatInfoList(List<StatInfo> statInfoList) { | ||
| 285 | - this.statInfoList = statInfoList; | ||
| 286 | - } | ||
| 287 | - } | ||
| 288 | - | ||
| 289 | - //---------------------- 生成时刻表用对象(以上) ---------------------// | ||
| 290 | - | ||
| 291 | - /** | ||
| 292 | - * 导出动态时刻表数据。 | ||
| 293 | - * @param dtInfos | ||
| 294 | - * @return | ||
| 295 | - * @throws ScheduleException | ||
| 296 | - */ | ||
| 297 | - public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException; | ||
| 298 | -} | 1 | +package com.bsth.service.schedule.datatools; |
| 2 | + | ||
| 3 | +import com.bsth.service.schedule.exception.ScheduleException; | ||
| 4 | +import com.bsth.service.schedule.utils.DataToolsFile; | ||
| 5 | +import com.fasterxml.jackson.annotation.JsonCreator; | ||
| 6 | +import com.fasterxml.jackson.annotation.JsonValue; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 动态时刻表数据。 | ||
| 12 | + */ | ||
| 13 | +public interface TTinfoDetailDynamicData { | ||
| 14 | + | ||
| 15 | + //---------------------- 生成时刻表用对象(以下) ---------------------// | ||
| 16 | + public static enum BcType { // 班次类型枚举 | ||
| 17 | + IN("in"), // 进场 | ||
| 18 | + OUT("out"), // 出场 | ||
| 19 | + BD("bd"), // 早例保 | ||
| 20 | + LC("lc"), // 晚例保 | ||
| 21 | + NORMAL("normal"); // 正常 | ||
| 22 | + private String flag; | ||
| 23 | + | ||
| 24 | + @JsonCreator | ||
| 25 | + private BcType(String flag) { | ||
| 26 | + this.flag = flag; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @JsonValue | ||
| 30 | + public String getFlag() { | ||
| 31 | + return flag; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public void setFlag(String flag) { | ||
| 35 | + this.flag = flag; | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public static class BcObj { // 班次对象 | ||
| 40 | + /** 班次时间 */ | ||
| 41 | + private Integer bcsj; | ||
| 42 | + /** 停站时间 */ | ||
| 43 | + private Integer ssj; | ||
| 44 | + /** 吃饭时间 */ | ||
| 45 | + private Integer eatsj; | ||
| 46 | + | ||
| 47 | + /** 停车场id */ | ||
| 48 | + private Integer tccid; | ||
| 49 | + /** 起点站id */ | ||
| 50 | + private Integer qdzid; | ||
| 51 | + /** 终点站id */ | ||
| 52 | + private Integer zdzid; | ||
| 53 | + | ||
| 54 | + /** 是否上行 */ | ||
| 55 | + private Boolean isUp; | ||
| 56 | + | ||
| 57 | + /** 班次类型 */ | ||
| 58 | + private BcType bcType; | ||
| 59 | + /** 发车时刻 */ | ||
| 60 | + private String fcsj; | ||
| 61 | + /** 用于统计的发车时间描述(把进出场,保养,吃饭时间写在一起) */ | ||
| 62 | + private String fcsjDesc; | ||
| 63 | + | ||
| 64 | + /** 第几圈(从1开始) */ | ||
| 65 | + private Integer groupNo; | ||
| 66 | + /** 圈里第几个班次(1或者2) */ | ||
| 67 | + private Integer groupBcNo; | ||
| 68 | + | ||
| 69 | + public Integer getBcsj() { | ||
| 70 | + return bcsj; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public void setBcsj(Integer bcsj) { | ||
| 74 | + this.bcsj = bcsj; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public Integer getSsj() { | ||
| 78 | + return ssj; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public void setSsj(Integer ssj) { | ||
| 82 | + this.ssj = ssj; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public Integer getEatsj() { | ||
| 86 | + return eatsj; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public void setEatsj(Integer eatsj) { | ||
| 90 | + this.eatsj = eatsj; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public Integer getTccid() { | ||
| 94 | + return tccid; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public void setTccid(Integer tccid) { | ||
| 98 | + this.tccid = tccid; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public Integer getQdzid() { | ||
| 102 | + return qdzid; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public void setQdzid(Integer qdzid) { | ||
| 106 | + this.qdzid = qdzid; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public Integer getZdzid() { | ||
| 110 | + return zdzid; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public void setZdzid(Integer zdzid) { | ||
| 114 | + this.zdzid = zdzid; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public BcType getBcType() { | ||
| 118 | + return bcType; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public void setBcType(BcType bcType) { | ||
| 122 | + this.bcType = bcType; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public String getFcsj() { | ||
| 126 | + return fcsj; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public void setFcsj(String fcsj) { | ||
| 130 | + this.fcsj = fcsj; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public Boolean getIsUp() { | ||
| 134 | + return isUp; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public void setIsUp(Boolean isUp) { | ||
| 138 | + this.isUp = isUp; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public Integer getGroupNo() { | ||
| 142 | + return groupNo; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public void setGroupNo(Integer groupNo) { | ||
| 146 | + this.groupNo = groupNo; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public Integer getGroupBcNo() { | ||
| 150 | + return groupBcNo; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public void setGroupBcNo(Integer groupBcNo) { | ||
| 154 | + this.groupBcNo = groupBcNo; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + public Boolean getUp() { | ||
| 158 | + return isUp; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public void setUp(Boolean up) { | ||
| 162 | + isUp = up; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + public String getFcsjDesc() { | ||
| 166 | + return fcsjDesc; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public void setFcsjDesc(String fcsjDesc) { | ||
| 170 | + this.fcsjDesc = fcsjDesc; | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + public static class LpObj { // 路牌对象 | ||
| 175 | + /** 路牌名字 */ | ||
| 176 | + private String lpname; | ||
| 177 | + /** 每圈的第一个班次是否上行 */ | ||
| 178 | + private Boolean isUp; | ||
| 179 | + | ||
| 180 | + /** 第一个班次起点站路由id */ | ||
| 181 | + private Integer stationRouteId1; | ||
| 182 | + /** 第二个班次起点站路由id */ | ||
| 183 | + private Integer stationRouteId2; | ||
| 184 | + | ||
| 185 | + /** 班次列表 */ | ||
| 186 | + private List<BcObj> bcObjList; | ||
| 187 | + /** 总圈数 */ | ||
| 188 | + private Integer groupCount; | ||
| 189 | + | ||
| 190 | + /** 总工时 */ | ||
| 191 | + private Double zgs; | ||
| 192 | + /** 总班次 */ | ||
| 193 | + private Integer zbc; | ||
| 194 | + | ||
| 195 | + | ||
| 196 | + public String getLpname() { | ||
| 197 | + return lpname; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + public void setLpname(String lpname) { | ||
| 201 | + this.lpname = lpname; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + public Boolean getIsUp() { | ||
| 205 | + return isUp; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + public void setIsUp(Boolean isUp) { | ||
| 209 | + this.isUp = isUp; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + public List<BcObj> getBcObjList() { | ||
| 213 | + return bcObjList; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + public void setBcObjList(List<BcObj> bcObjList) { | ||
| 217 | + this.bcObjList = bcObjList; | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + public Integer getGroupCount() { | ||
| 221 | + return groupCount; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + public void setGroupCount(Integer groupCount) { | ||
| 225 | + this.groupCount = groupCount; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + public Double getZgs() { | ||
| 229 | + return zgs; | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + public void setZgs(Double zgs) { | ||
| 233 | + this.zgs = zgs; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + public Integer getZbc() { | ||
| 237 | + return zbc; | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + public void setZbc(Integer zbc) { | ||
| 241 | + this.zbc = zbc; | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + public Integer getStationRouteId1() { | ||
| 245 | + return stationRouteId1; | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + public void setStationRouteId1(Integer stationRouteId1) { | ||
| 249 | + this.stationRouteId1 = stationRouteId1; | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + public Integer getStationRouteId2() { | ||
| 253 | + return stationRouteId2; | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + public void setStationRouteId2(Integer stationRouteId2) { | ||
| 257 | + this.stationRouteId2 = stationRouteId2; | ||
| 258 | + } | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + public static class StatInfo { // 统计数据对象 | ||
| 262 | + /** 统计项目 */ | ||
| 263 | + private String statItem; | ||
| 264 | + /** 统计值 */ | ||
| 265 | + private Double statValue; | ||
| 266 | + | ||
| 267 | + public String getStatItem() { | ||
| 268 | + return statItem; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + public void setStatItem(String statItem) { | ||
| 272 | + this.statItem = statItem; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + public Double getStatValue() { | ||
| 276 | + return statValue; | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + public void setStatValue(Double statValue) { | ||
| 280 | + this.statValue = statValue; | ||
| 281 | + } | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + public static class DTInfos { // 所有数据信息 | ||
| 285 | + /** 路牌班次数据列表 */ | ||
| 286 | + private List<LpObj> lpObjList; | ||
| 287 | + /** 统计数据列表 */ | ||
| 288 | + private List<StatInfo> statInfoList; | ||
| 289 | + | ||
| 290 | + public List<LpObj> getLpObjList() { | ||
| 291 | + return lpObjList; | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + public void setLpObjList(List<LpObj> lpObjList) { | ||
| 295 | + this.lpObjList = lpObjList; | ||
| 296 | + } | ||
| 297 | + | ||
| 298 | + public List<StatInfo> getStatInfoList() { | ||
| 299 | + return statInfoList; | ||
| 300 | + } | ||
| 301 | + | ||
| 302 | + public void setStatInfoList(List<StatInfo> statInfoList) { | ||
| 303 | + this.statInfoList = statInfoList; | ||
| 304 | + } | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + //---------------------- 生成时刻表用对象(以上) ---------------------// | ||
| 308 | + | ||
| 309 | + /** | ||
| 310 | + * 导出动态时刻表数据。 | ||
| 311 | + * @param dtInfos | ||
| 312 | + * @return | ||
| 313 | + * @throws ScheduleException | ||
| 314 | + */ | ||
| 315 | + public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException; | ||
| 316 | +} |
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
| @@ -1746,7 +1746,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1746,7 +1746,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1746 | tempMap.put("line", xlName); | 1746 | tempMap.put("line", xlName); |
| 1747 | tempMap.put("jhbc", jhbc); | 1747 | tempMap.put("jhbc", jhbc); |
| 1748 | tempMap.put("sjbc", sjbc); | 1748 | tempMap.put("sjbc", sjbc); |
| 1749 | - tempMap.put("zdl", nf.format((float) sjbc / jhbc *100) + "%"); | 1749 | + tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc *100)) + "%"); |
| 1750 | + | ||
| 1750 | resList.add(tempMap); | 1751 | resList.add(tempMap); |
| 1751 | } | 1752 | } |
| 1752 | 1753 | ||
| @@ -1760,7 +1761,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1760,7 +1761,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1760 | } | 1761 | } |
| 1761 | tempMap.put("jhbc", jhbc); | 1762 | tempMap.put("jhbc", jhbc); |
| 1762 | tempMap.put("sjbc", sjbc); | 1763 | tempMap.put("sjbc", sjbc); |
| 1763 | - tempMap.put("zdl", nf.format((float) sjbc / jhbc * 100) + "%"); | 1764 | + tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc * 100)) + "%"); |
| 1764 | for(Map<String, Object> m : mapList){ | 1765 | for(Map<String, Object> m : mapList){ |
| 1765 | m.put("no", ++i); | 1766 | m.put("no", ++i); |
| 1766 | m.put("company", companyName); | 1767 | m.put("company", companyName); |
src/main/java/com/bsth/util/ClosestPoint.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import java.util.ArrayList; | ||
| 4 | +import java.util.HashMap; | ||
| 5 | +import java.util.List; | ||
| 6 | +import java.util.Map; | ||
| 7 | +import com.bsth.util.TransGPS.Location; | ||
| 8 | + | ||
| 9 | +public class ClosestPoint { | ||
| 10 | + | ||
| 11 | + public static Location getVerticalPoint(Location loc1, Location loc2, Location loc3) { | ||
| 12 | + // 第一步:求得直线方程相关参数y=kx+b | kx-y+b=0 | ||
| 13 | + double k = (loc1.getLat() - loc2.getLat()) * 1.0 / (loc1.getLng() - loc2.getLng());// 坐标直线斜率k | ||
| 14 | + double b = loc1.getLat() - k * loc1.getLng();// 坐标直线b | ||
| 15 | + // 第一种: 设直线方程为ax+by+c=0,点坐标为(m,n) | ||
| 16 | + // 则垂足为((b*b*m-a*b*n-a*c)/(a*a+b*b),(a*a*n-a*b*m-b*c)/(a*a+b*b)) | ||
| 17 | + Location loc4 = TransGPS.LocationMake(((-1) * (-1) * loc3.getLng() - k * (-1) * loc3.getLat() - k * b) / (k * k + (-1) * (-1)), | ||
| 18 | + (k * k * loc3.getLat() - k * (-1) * loc3.getLng() - (-1) * b) / (k * k + (-1) * (-1))); | ||
| 19 | + return loc4; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + // 获取两点间距离 | ||
| 23 | + static double GetPointDistance(Location p1, Location p2) { | ||
| 24 | + return Math.sqrt((p1.getLng() - p2.getLng()) * (p1.getLng() - p2.getLng()) + (p1.getLat() - p2.getLat()) * (p1.getLat() - p2.getLat())); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + // 求点到线段距离的最近点 | ||
| 28 | + static Map<Double, List<Location>> GetNearestDistance(Location PA, Location PB, Location P3) { | ||
| 29 | + Map<Double, List<Location>> point = new HashMap<>(); | ||
| 30 | + List<Location> locations = new ArrayList<>(); | ||
| 31 | + locations.add(PA); | ||
| 32 | + locations.add(PB); | ||
| 33 | + // 点在线段上 | ||
| 34 | + double a, b, c; | ||
| 35 | + a = GetPointDistance(PB, P3); | ||
| 36 | + if (a <= 0.000000001) { | ||
| 37 | + locations.add(P3); | ||
| 38 | + point.put(a, locations); | ||
| 39 | + return point; | ||
| 40 | + } | ||
| 41 | + b = GetPointDistance(PA, P3); | ||
| 42 | + if (b <= 0.000000001) { | ||
| 43 | + locations.add(P3); | ||
| 44 | + point.put(b, locations); | ||
| 45 | + return point; | ||
| 46 | + } | ||
| 47 | + c = GetPointDistance(PA, PB); | ||
| 48 | + if (c <= 0.000000001) { | ||
| 49 | + locations.add(PA); | ||
| 50 | + point.put(b, locations);// 如果PA和PB坐标相同,则退出函数,并返回距离 | ||
| 51 | + return point; | ||
| 52 | + } | ||
| 53 | + // 点和线段组成钝角三角形 | ||
| 54 | + if (a * a >= b * b + c * c) { | ||
| 55 | + locations.add(PA); | ||
| 56 | + point.put(b, locations); | ||
| 57 | + return point;// 如果是钝角返回b | ||
| 58 | + } | ||
| 59 | + if (b * b >= a * a + c * c) { | ||
| 60 | + locations.add(PB); | ||
| 61 | + point.put(a, locations);// 如果是钝角返回a | ||
| 62 | + return point; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + // 点和线段组成锐角三角形 | ||
| 66 | + double l = (a + b + c) / 2; // 周长的一半 | ||
| 67 | + double s = Math.sqrt(l * (l - a) * (l - b) * (l - c)); // 海伦公式求面积,也可以用矢量求 | ||
| 68 | + Location location = getVerticalPoint(PA, PB, P3); | ||
| 69 | + locations.add(location); | ||
| 70 | + point.put(2 * s / c, locations); | ||
| 71 | + return point; | ||
| 72 | + } | ||
| 73 | +} |
src/main/java/com/bsth/util/HttpClientUtils.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import org.apache.http.HttpEntity; | ||
| 4 | +import org.apache.http.client.config.RequestConfig; | ||
| 5 | +import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 6 | +import org.apache.http.client.methods.HttpGet; | ||
| 7 | +import org.apache.http.client.methods.HttpPost; | ||
| 8 | +import org.apache.http.entity.StringEntity; | ||
| 9 | +import org.apache.http.impl.client.CloseableHttpClient; | ||
| 10 | +import org.apache.http.impl.client.HttpClients; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | + | ||
| 14 | +import java.io.BufferedReader; | ||
| 15 | +import java.io.IOException; | ||
| 16 | +import java.io.InputStreamReader; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Created by panzhao on 2017/8/2. | ||
| 20 | + */ | ||
| 21 | +public class HttpClientUtils { | ||
| 22 | + | ||
| 23 | + static Logger logger = LoggerFactory.getLogger(HttpClientUtils.class); | ||
| 24 | + public static StringBuilder get(String url) throws Exception { | ||
| 25 | + | ||
| 26 | + CloseableHttpClient httpClient = null; | ||
| 27 | + CloseableHttpResponse response = null; | ||
| 28 | + StringBuilder stringBuffer = null; | ||
| 29 | + try { | ||
| 30 | + httpClient = HttpClients.createDefault(); | ||
| 31 | + HttpGet get = new HttpGet(url); | ||
| 32 | + //超时时间 | ||
| 33 | + RequestConfig requestConfig = RequestConfig.custom() | ||
| 34 | + .setConnectTimeout(10500).setConnectionRequestTimeout(7000) | ||
| 35 | + .setSocketTimeout(10500).build(); | ||
| 36 | + get.setConfig(requestConfig); | ||
| 37 | + get.addHeader("Content-Encoding", "gzip"); | ||
| 38 | + response = httpClient.execute(get); | ||
| 39 | + stringBuffer = getResult(response.getEntity()); | ||
| 40 | + } catch (Exception e) { | ||
| 41 | + logger.error("", e); | ||
| 42 | + } finally { | ||
| 43 | + if (null != httpClient) | ||
| 44 | + httpClient.close(); | ||
| 45 | + if (null != response) | ||
| 46 | + response.close(); | ||
| 47 | + } | ||
| 48 | + return stringBuffer; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * raw post data | ||
| 53 | + * @param url | ||
| 54 | + * @param data | ||
| 55 | + * @return | ||
| 56 | + */ | ||
| 57 | + public static StringBuilder post(String url, String data) throws Exception { | ||
| 58 | + CloseableHttpClient httpClient = null; | ||
| 59 | + CloseableHttpResponse response = null; | ||
| 60 | + StringBuilder stringBuffer = null; | ||
| 61 | + try { | ||
| 62 | + httpClient = HttpClients.createDefault(); | ||
| 63 | + HttpPost post = new HttpPost(url); | ||
| 64 | + | ||
| 65 | + post.setHeader("Accept", "application/json"); | ||
| 66 | + post.setHeader("Content-Type", "application/json"); | ||
| 67 | + //超时时间 | ||
| 68 | + RequestConfig requestConfig = RequestConfig.custom() | ||
| 69 | + .setConnectTimeout(2500).setConnectionRequestTimeout(2000) | ||
| 70 | + .setSocketTimeout(3500).build(); | ||
| 71 | + post.setConfig(requestConfig); | ||
| 72 | + post.setEntity((new StringEntity(data, "UTF-8"))); | ||
| 73 | + | ||
| 74 | + response = httpClient.execute(post); | ||
| 75 | + stringBuffer = getResult(response.getEntity()); | ||
| 76 | + } catch (Exception e) { | ||
| 77 | + logger.error("", e); | ||
| 78 | + } finally { | ||
| 79 | + if (null != httpClient) | ||
| 80 | + httpClient.close(); | ||
| 81 | + if (null != response) | ||
| 82 | + response.close(); | ||
| 83 | + } | ||
| 84 | + return stringBuffer; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + private static StringBuilder getResult(HttpEntity entity) throws IOException { | ||
| 88 | + StringBuilder stringBuffer = null; | ||
| 89 | + if (null != entity) { | ||
| 90 | + BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); | ||
| 91 | + stringBuffer = new StringBuilder(); | ||
| 92 | + String str = ""; | ||
| 93 | + while ((str = br.readLine()) != null) | ||
| 94 | + stringBuffer.append(str); | ||
| 95 | + } | ||
| 96 | + return stringBuffer; | ||
| 97 | + } | ||
| 98 | +} |
src/main/java/com/bsth/util/RoadCutDoubleName.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONArray; | ||
| 5 | +import com.alibaba.fastjson.JSONObject; | ||
| 6 | +import com.bsth.entity.LonLatName; | ||
| 7 | +import com.bsth.util.TransGPS.Location; | ||
| 8 | +import com.bsth.util.TransGPS; | ||
| 9 | + | ||
| 10 | +import java.net.URLEncoder; | ||
| 11 | +import java.util.*; | ||
| 12 | + | ||
| 13 | +public class RoadCutDoubleName { | ||
| 14 | + | ||
| 15 | + // 存放获取交点的经纬度,路段名字 | ||
| 16 | + static ArrayList<LonLatName> al = new ArrayList<LonLatName>(); | ||
| 17 | + | ||
| 18 | + public static Map<String, Object> start(String sectionStr) throws Exception { | ||
| 19 | + | ||
| 20 | + al.clear(); | ||
| 21 | + // 存放过滤后返还会来的list集合 | ||
| 22 | + ArrayList dl = new ArrayList(); | ||
| 23 | + | ||
| 24 | + String fy = URLEncoder.encode("|", "utf-8"); | ||
| 25 | + String lL = baiduToGoogle(sectionStr); | ||
| 26 | + String[] lonLat = lL.split(";"); | ||
| 27 | + | ||
| 28 | + int number = 0; | ||
| 29 | + if (lonLat.length % 20 == 0) { | ||
| 30 | + number = lonLat.length / 20; | ||
| 31 | + } else { | ||
| 32 | + number = lonLat.length / 20 + 1; | ||
| 33 | + } | ||
| 34 | + int middle = 0; | ||
| 35 | + int max = 20; | ||
| 36 | + if (lonLat.length >= 20) { | ||
| 37 | + for (int NOT = 1; NOT <= number; NOT++) { | ||
| 38 | + String Ol = ""; | ||
| 39 | + if (NOT < number) { | ||
| 40 | + for (int min = middle; min < max; min++) { | ||
| 41 | + if (min < max - 1) { | ||
| 42 | + Ol += lonLat[min] + fy; | ||
| 43 | + } else { | ||
| 44 | + Ol += lonLat[min]; | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + dl = getData(Ol,al); | ||
| 48 | + middle = max; | ||
| 49 | + max += 20; | ||
| 50 | + } else { | ||
| 51 | + for (int min = middle; min < lonLat.length; min++) { | ||
| 52 | + if (min < lonLat.length - 1) { | ||
| 53 | + Ol += lonLat[min] + fy; | ||
| 54 | + } else { | ||
| 55 | + Ol += lonLat[min]; | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + dl = getData(Ol,al); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + } else { | ||
| 62 | + String Ol = ""; | ||
| 63 | + for (int min = middle; min < lonLat.length; min++) { | ||
| 64 | + if (min < lonLat.length - 1) { | ||
| 65 | + Ol += lonLat[min] + fy; | ||
| 66 | + } else { | ||
| 67 | + Ol += lonLat[min]; | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + dl = getData(Ol,al); | ||
| 71 | + } | ||
| 72 | + // 将原有的经纬度数组转换为list集合 | ||
| 73 | + ArrayList<Location> el = new ArrayList<>(); | ||
| 74 | + for (int j = 0; j < lonLat.length; j++) { | ||
| 75 | + String lon[] = lonLat[j].split(","); | ||
| 76 | + Location point = new Location(); | ||
| 77 | + point.setLng(Double.valueOf(lon[0])); | ||
| 78 | + point.setLat(Double.valueOf(lon[1])); | ||
| 79 | + el.add(point); | ||
| 80 | + } | ||
| 81 | + ArrayList<Location> gl = new ArrayList<>(); | ||
| 82 | + for (int k = 0; k < dl.size(); k += 4) { | ||
| 83 | + Location point = new Location(); | ||
| 84 | + String object = (String) dl.get(k); | ||
| 85 | + String[] split = object.split(","); | ||
| 86 | + point.setLng(Double.valueOf(split[0])); | ||
| 87 | + point.setLat(Double.valueOf(split[1])); | ||
| 88 | + gl.add(point); | ||
| 89 | + } | ||
| 90 | + // 将做过处理的百度坐标与过滤后的交点坐标存入,传给垂足获取方法 | ||
| 91 | + ArrayList fl = new ArrayList(); | ||
| 92 | + // 路的坐标点 | ||
| 93 | + fl.add(0, el); | ||
| 94 | + // 路的交点 | ||
| 95 | + fl.add(1, gl); | ||
| 96 | + List returnData = returnData(fl); | ||
| 97 | + ArrayList<Location> pointList = new ArrayList<>(); | ||
| 98 | + for (int x = 0; x < returnData.size(); x++) { | ||
| 99 | + List<Location> aList = new ArrayList<>(); | ||
| 100 | + aList = (List<Location>) returnData.get(x); | ||
| 101 | + for (int z = 0; z < aList.size(); z++) { | ||
| 102 | + Location point = new Location(); | ||
| 103 | + Location location = aList.get(z); | ||
| 104 | + point.setLng(location.getLng()); | ||
| 105 | + point.setLat(location.getLat()); | ||
| 106 | + pointList.add(point); | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + /* | ||
| 110 | + * 垂足返还的数据中每三条为一个交点,第一经纬度为前,第二为后,第三为原交点的垂足 | ||
| 111 | + * 下面循环会将返还的数据按前经纬度与返还数据的第一经纬度相匹配 将返还数据的第三个经纬度按顺序插入进去 | ||
| 112 | + */ | ||
| 113 | + // lonLat:转换为高德的坐标点数组 | ||
| 114 | + for (int t = 0; t < pointList.size(); t += 3) { | ||
| 115 | + Location pl = (Location) pointList.get(t); | ||
| 116 | + Location newPl = (Location) pointList.get(t + 1); | ||
| 117 | + // 判断切点是否添加成功 | ||
| 118 | + boolean type = false; | ||
| 119 | + // pointList:包含前后垂足的集合,每三个一个轮回 | ||
| 120 | + for (int o = 0; o < el.size() - 1; o++) { | ||
| 121 | + Location location1 = el.get(o); | ||
| 122 | + Location location2 = el.get(o + 1); | ||
| 123 | + if (location1.getLng() == pl.getLng() && location1.getLat() == pl.getLat() | ||
| 124 | + && location2.getLng() == newPl.getLng() && location2.getLat() == newPl.getLat()) { | ||
| 125 | + if (o < el.size() - 1) { | ||
| 126 | + // el:存放原始坐标Location对象的集合 | ||
| 127 | + el.add(o + 1, (Location) pointList.get(t + 2)); | ||
| 128 | + type = true; | ||
| 129 | + break; | ||
| 130 | + } else { | ||
| 131 | + el.add(o, (Location) pointList.get(t + 2)); | ||
| 132 | + type = true; | ||
| 133 | + break; | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + // 防止在同一线段下的两个切点会只添加一个 | ||
| 138 | + if (!type) { | ||
| 139 | + for (int o = 0; o < el.size(); o++) { | ||
| 140 | + Location location = el.get(o); | ||
| 141 | + if (location.getLng() == newPl.getLng() && location.getLat() == newPl.getLat()) { | ||
| 142 | + el.add(o, (Location) pointList.get(t + 2)); | ||
| 143 | + type = true; | ||
| 144 | + break; | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + // 通过返还的垂足数据,将原有的中间点给替换掉 | ||
| 150 | + int w = 0; | ||
| 151 | + for (int q = 2; q < pointList.size(); q += 3) { | ||
| 152 | + Location pL = (Location) pointList.get(q); | ||
| 153 | + dl.set(w, pL.getLng() + "," + pL.getLat()); | ||
| 154 | + w += 4; | ||
| 155 | + } | ||
| 156 | + // 对替换后的location进行路名拼接,十个点则应拼接出九个路段路名 | ||
| 157 | + // 若location获取的路名不符合规则,则返还“(-)” | ||
| 158 | + int maxOne = 2; | ||
| 159 | + int maxTwo = 6; | ||
| 160 | + int minOne = 1; | ||
| 161 | + int minTwo = 5; | ||
| 162 | + String theMainRoad = ""; | ||
| 163 | + String theFirstRoad = ""; | ||
| 164 | + String theSecondRoad = ""; | ||
| 165 | + List<String> roadName = new ArrayList<>(); | ||
| 166 | + for (int d = maxTwo; d < dl.size();) { | ||
| 167 | + boolean buff = false; | ||
| 168 | + // 若两段路名中含有相同的路名,则此路名作为主路名 | ||
| 169 | + for (int h = minOne; h <= maxOne; h++) { | ||
| 170 | + for (int f = minTwo; f <= maxTwo; f++) { | ||
| 171 | + if (dl.get(h).equals(dl.get(f))) { | ||
| 172 | + theMainRoad = dl.get(h).toString(); | ||
| 173 | + buff = true; | ||
| 174 | + break; | ||
| 175 | + } else { | ||
| 176 | + theMainRoad = ""; | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + if (buff) { | ||
| 180 | + break; | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + // 获取主路名后,将主路名不为空的进行拼接 | ||
| 184 | + // 规则为:两段路名的firstName和secondName不与主路名相同 | ||
| 185 | + // 存入roadName列表且按数序包含无法进行拼接的路名返回值为“(-)” | ||
| 186 | + for (int h = minOne; h <= maxOne; h++) { | ||
| 187 | + for (int f = minTwo; f <= maxTwo; f++) { | ||
| 188 | + if (!theMainRoad.equals("")) { | ||
| 189 | + if (!dl.get(h).equals(theMainRoad)) { | ||
| 190 | + theFirstRoad = dl.get(h).toString(); | ||
| 191 | + if (!dl.get(f).equals(theMainRoad)) { | ||
| 192 | + theSecondRoad = dl.get(f).toString(); | ||
| 193 | + } | ||
| 194 | + } | ||
| 195 | + } else { | ||
| 196 | + theFirstRoad = ""; | ||
| 197 | + theSecondRoad = ""; | ||
| 198 | + } | ||
| 199 | + } | ||
| 200 | + } | ||
| 201 | + minOne += 4; | ||
| 202 | + minTwo += 4; | ||
| 203 | + maxOne += 4; | ||
| 204 | + maxTwo += 4; | ||
| 205 | + d = maxTwo; | ||
| 206 | + roadName.add(theMainRoad + "(" + theFirstRoad + "-" + theSecondRoad + ")"); | ||
| 207 | + } | ||
| 208 | + // 将所有经纬度列表进行重复过滤 | ||
| 209 | + for (int i = 0; i < el.size() - 1; i++) { | ||
| 210 | + Location location = el.get(i); | ||
| 211 | + for (int j = i + 1; j < el.size(); j++) { | ||
| 212 | + Location location2 = el.get(j); | ||
| 213 | + if (location.getLng() == location2.getLng() && location.getLat() == location2.getLat()) { | ||
| 214 | + el.remove(j); | ||
| 215 | + break; | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + // 用来区分此线路的开始是否等于location的第一个点 | ||
| 220 | + boolean buff = false; | ||
| 221 | + //将路名roadName与路段roadNumber添加进theFrontDesk返还给前台 | ||
| 222 | + Map<String, Object> theFrontDesk = new HashMap<>(); | ||
| 223 | + // 若坐标组的第一个坐标与交点的第一个不相同,就说明实际规划出的线路条数+1 | ||
| 224 | + // 此方法的作用就是用来避免线路名称与线路不对称 | ||
| 225 | + if(dl.size() != 0) { | ||
| 226 | + String firstLocation = (String) dl.get(0); | ||
| 227 | + String[] firstLocationSplit = firstLocation.split(","); | ||
| 228 | + Location firstOfAll = el.get(0); | ||
| 229 | + if (firstOfAll.getLng() != Double.valueOf(firstLocationSplit[0]) | ||
| 230 | + && firstOfAll.getLat() != Double.valueOf(firstLocationSplit[1])) { | ||
| 231 | + roadName.add(0, "(-)"); | ||
| 232 | + buff = true; | ||
| 233 | + } | ||
| 234 | + String lastLocation = (String) dl.get(dl.size() - 4); | ||
| 235 | + String[] lastLocationSplit = lastLocation.split(","); | ||
| 236 | + Location lastOfAll = el.get(el.size() - 1); | ||
| 237 | + if (lastOfAll.getLng() != Double.valueOf(lastLocationSplit[0]) | ||
| 238 | + && lastOfAll.getLat() != Double.valueOf(lastLocationSplit[1])) { | ||
| 239 | + roadName.add(roadName.size(), "(-)"); | ||
| 240 | + } | ||
| 241 | + //切分路段,有两种情况,路段的第一个经纬度既是切点,则从第二个点开始计算 | ||
| 242 | + //路段的前几个点是多余的点 则将其保留,并且上面的方法就是用来防止第一个路段路名错误 | ||
| 243 | + List roadNumber = new ArrayList(); | ||
| 244 | + if (buff) { | ||
| 245 | + int logo = 0; | ||
| 246 | + for (int j = 0; j < dl.size(); j += 4) { | ||
| 247 | + List wayNumber = new ArrayList(); | ||
| 248 | + String object = (String) dl.get(j); | ||
| 249 | + String[] split = object.split(","); | ||
| 250 | + for (int i = logo; i < el.size(); i++) { | ||
| 251 | + Location location = el.get(i); | ||
| 252 | + wayNumber.add(el.get(i)); | ||
| 253 | + if (location.getLng() == Double.valueOf(split[0]) | ||
| 254 | + && location.getLat() == Double.valueOf(split[1])) { | ||
| 255 | + logo = i; | ||
| 256 | + roadNumber.add(wayNumber); | ||
| 257 | + break; | ||
| 258 | + } | ||
| 259 | + if(i == el.size()-1){ | ||
| 260 | + logo = i; | ||
| 261 | + roadNumber.add(wayNumber); | ||
| 262 | + } | ||
| 263 | + } | ||
| 264 | + } | ||
| 265 | + }else{ | ||
| 266 | + int logo = 0; | ||
| 267 | + for (int j = 4; j < dl.size(); j += 4) { | ||
| 268 | + List wayNumber = new ArrayList(); | ||
| 269 | + String object = (String) dl.get(j); | ||
| 270 | + String[] split = object.split(","); | ||
| 271 | + for (int i = logo; i < el.size(); i++) { | ||
| 272 | + Location location = el.get(i); | ||
| 273 | + wayNumber.add(el.get(i)); | ||
| 274 | + if (location.getLng() == Double.valueOf(split[0]) | ||
| 275 | + && location.getLat() == Double.valueOf(split[1])) { | ||
| 276 | + logo = i; | ||
| 277 | + roadNumber.add(wayNumber); | ||
| 278 | + break; | ||
| 279 | + } | ||
| 280 | + if(i == el.size()-1){ | ||
| 281 | + logo = i; | ||
| 282 | + roadNumber.add(wayNumber); | ||
| 283 | + } | ||
| 284 | + } | ||
| 285 | + } | ||
| 286 | + } | ||
| 287 | + List bSections = googleToBaidu(roadNumber); | ||
| 288 | + //将路名roadName与路段roadNumber添加进theFrontDesk返还给前台 | ||
| 289 | +// List theFrontDesk = new ArrayList(); | ||
| 290 | + theFrontDesk.put("roadName",roadName); | ||
| 291 | + theFrontDesk.put("bSections",bSections); | ||
| 292 | + for(int i =0;i<bSections.size();i++){ | ||
| 293 | + List<Location> rn = new ArrayList<>(); | ||
| 294 | + rn = (List<Location>) bSections.get(i); | ||
| 295 | + System.out.println("第"+(i+1)+"条路"); | ||
| 296 | + System.out.println(roadName.get(i)); | ||
| 297 | + for(int j=0;j<rn.size();j++){ | ||
| 298 | + Location object = (Location) rn.get(j); | ||
| 299 | + System.out.println(object.getLng()+" "+object.getLat()+";"); | ||
| 300 | + } | ||
| 301 | + } | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + return theFrontDesk; | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + public static ArrayList<LonLatName> getData(String Ol,ArrayList<LonLatName> al) throws Exception { | ||
| 308 | + // 将去重后的list列表添加进来 | ||
| 309 | + ArrayList cl = new ArrayList(); | ||
| 310 | + StringBuilder sb = HttpClientUtils.get("http://restapi.amap.com/v3/geocode/regeo?output=json&location=" + Ol | ||
| 311 | + + "&key=ae7b43460cab274a8702b55640f9a5a7&radius=0&extensions=all&batch=true&roadlevel=1"); | ||
| 312 | + JSONObject jsonarr = JSON.parseObject(sb.toString()); | ||
| 313 | + JSONArray regeocodes = jsonarr.getJSONArray("regeocodes"); | ||
| 314 | + | ||
| 315 | + for (int a = 0; a < regeocodes.size(); a++) { | ||
| 316 | + LonLatName lln = new LonLatName(); | ||
| 317 | + JSONObject json = (JSONObject) regeocodes.get(a); | ||
| 318 | + JSONArray roadinters = json.getJSONArray("roadinters"); | ||
| 319 | + JSONArray roads = json.getJSONArray("roads"); | ||
| 320 | + JSONObject jsonObject = roadinters.getJSONObject(0); | ||
| 321 | + JSONObject roadsObject = roads.getJSONObject(0); | ||
| 322 | + lln.setFirst_name(jsonObject.getString("first_name")); | ||
| 323 | + lln.setSecond_name(jsonObject.getString("second_name")); | ||
| 324 | + lln.setLocation(jsonObject.getString("location")); | ||
| 325 | + lln.setWay_name(roadsObject.getString("name")); | ||
| 326 | + al.add(lln); | ||
| 327 | + } | ||
| 328 | + int a = 0; | ||
| 329 | + for (int b = 1; b < al.size(); b++) { | ||
| 330 | + if (al.get(b).getWay_name().equals(al.get(b).getFirst_name()) | ||
| 331 | + || al.get(b).getWay_name().equals(al.get(b).getSecond_name())) { | ||
| 332 | + if (b == 1) { | ||
| 333 | + cl.add(al.get(a).getLocation()); | ||
| 334 | + cl.add(al.get(a).getFirst_name()); | ||
| 335 | + cl.add(al.get(a).getSecond_name()); | ||
| 336 | + cl.add(al.get(a).getWay_name()); | ||
| 337 | + } | ||
| 338 | + if (!al.get(a).getLocation().equals(al.get(b).getLocation())) { | ||
| 339 | + | ||
| 340 | + cl.add(al.get(b).getLocation()); | ||
| 341 | + cl.add(al.get(b).getFirst_name()); | ||
| 342 | + cl.add(al.get(b).getSecond_name()); | ||
| 343 | + cl.add(al.get(b).getWay_name()); | ||
| 344 | + a = b; | ||
| 345 | + } | ||
| 346 | + } | ||
| 347 | + } | ||
| 348 | + return cl; | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + // 处理所有的切点(用每个切点去匹配到整条路段上最近的点) | ||
| 352 | + public static List returnData(ArrayList twoList) { | ||
| 353 | +// List<Location> aList = new ArrayList<>(); | ||
| 354 | +// List<Location> wip = new ArrayList<>(); | ||
| 355 | + // 路的坐标点 | ||
| 356 | + List<Location> aList = (List<Location>) twoList.get(0); | ||
| 357 | + // 路的交点 | ||
| 358 | + List<Location> wip = (List<Location>) twoList.get(1); | ||
| 359 | + List<List<Location>> list = new ArrayList<>(); | ||
| 360 | + for (int j = 0; j < wip.size(); j++) { | ||
| 361 | + Map<Double, List<Location>> points = new HashMap<>(); | ||
| 362 | + for (int i = 1; i < aList.size(); i++) { | ||
| 363 | + // 获取最近点为切点 | ||
| 364 | + points.putAll(ClosestPoint.GetNearestDistance(aList.get(i - 1), aList.get(i), wip.get(j))); | ||
| 365 | + } | ||
| 366 | + // points 为返回的所有切点的集合 | ||
| 367 | + Object[] obj = points.keySet().toArray(); | ||
| 368 | + Arrays.sort(obj); | ||
| 369 | + list.add(j,points.get(obj[0])); | ||
| 370 | + } | ||
| 371 | + return list; | ||
| 372 | + } | ||
| 373 | + | ||
| 374 | + // 百度坐标解密位高德 | ||
| 375 | + public static String baiduToGoogle(String sectionStr) { | ||
| 376 | + String gdLL=""; | ||
| 377 | +// String lL = "121.531301,31.211823;121.532438,31.213784;121.532438,31.213784;121.535025,31.213764;121.535095,31.213765;121.535702,31.213757;121.536388,31.21375;121.537383,31.213699;121.53802,31.213711;121.538408,31.213709;121.538478,31.21371;121.538955,31.213699;121.540289,31.213714;121.540826,31.213724;121.541543,31.213718;121.542867,31.213552;121.542976,31.213534;121.543245,31.213489;121.544787,31.213256;121.546102,31.213059;121.546221,31.213041;121.546898,31.212892;121.547445,31.212691;121.547724,31.212566;121.54855,31.212099;121.549466,31.211432;121.550113,31.210802;121.550402,31.210576;121.551437,31.20911;121.551486,31.209031;121.551795,31.208585;121.552282,31.207861;121.552641,31.207316;121.5528,31.207088;121.552959,31.20685;121.553009,31.20678;121.553357,31.206235;121.553626,31.205898;121.553696,31.205939;121.553696,31.205936;121.554105,31.206171;121.555941,31.207121;121.555941,31.207121;121.556021,31.207202;121.556719,31.207589;121.557458,31.208006;121.557538,31.208116;121.557538,31.208116;121.558047,31.208401;121.559076,31.208909;121.559625,31.209182;121.559865,31.209304;121.560744,31.209599;121.560904,31.20966;121.562362,31.209967;121.563621,31.210132;121.563951,31.210132;121.56675,31.210135;121.569371,31.210191;121.570593,31.210377;121.573087,31.211114;121.573437,31.211241;121.57461,31.211763;121.577197,31.21297;121.577458,31.213077;121.577458,31.213077;121.57805,31.213351;121.57805,31.213351;121.58085,31.214638;121.58097,31.214686;121.58097,31.214686;121.583581,31.21581;121.584605,31.216194;121.584967,31.216339;121.585961,31.216703;121.586393,31.216806;121.587398,31.217059;121.588342,31.217293;121.588744,31.217386;121.58998,31.217694;121.590814,31.217889;121.590915,31.217918;121.591548,31.218056;121.591648,31.218084;121.593065,31.218388;121.593517,31.21854;121.59393,31.218762;121.594704,31.219287;121.596986,31.220814;121.59766,31.221212;121.598001,31.221375;121.600474,31.222169;121.600544,31.222198;121.600574,31.222207;121.600685,31.222245;121.603348,31.223057;121.605639,31.223607;121.605638,31.223607;121.605648,31.223537;121.605698,31.222176;121.605787,31.221004;121.606055,31.216939;121.606324,31.213734;121.606373,31.212813;121.606522,31.21086;121.606611,31.210048;121.606621,31.209968;121.606772,31.209986;121.606772,31.209985;121.608479,31.210248;121.60864,31.210265;121.60864,31.210265;121.60871,31.210014"; | ||
| 378 | + System.out.println(sectionStr); | ||
| 379 | + String lonLat[] = sectionStr.split(";"); | ||
| 380 | + for (int a = 0; a < lonLat.length; a++) { | ||
| 381 | + String[] split = lonLat[a].split(","); | ||
| 382 | + Location locationMake = TransGPS.LocationMake(Double.valueOf(split[0]), Double.valueOf(split[1])); | ||
| 383 | + Location gd_decrypt = TransGPS.bd_decrypt(locationMake); | ||
| 384 | + if (a < lonLat.length - 1) { | ||
| 385 | + gdLL += gd_decrypt.getLng() + "," + gd_decrypt.getLat() + ";"; | ||
| 386 | + } else { | ||
| 387 | + gdLL += gd_decrypt.getLng() + "," + gd_decrypt.getLat(); | ||
| 388 | + } | ||
| 389 | + | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + return gdLL; | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + // 高德坐标加密位百度 | ||
| 396 | + public static List googleToBaidu(List list) { | ||
| 397 | + List roadNumber = new ArrayList(); | ||
| 398 | + for(int i =0;i<list.size();i++){ | ||
| 399 | + String lL = ""; | ||
| 400 | + List wayNumber = new ArrayList(); | ||
| 401 | + List<Location> rn = new ArrayList<>(); | ||
| 402 | + rn = (List<Location>) list.get(i); | ||
| 403 | + for(int j=0;j<rn.size();j++){ | ||
| 404 | + Location object = (Location) rn.get(j); | ||
| 405 | + if(j<rn.size()-1){ | ||
| 406 | + lL += object.getLng()+","+object.getLat()+";"; | ||
| 407 | + }else{ | ||
| 408 | + lL += object.getLng()+","+object.getLat(); | ||
| 409 | + } | ||
| 410 | + } | ||
| 411 | + String lonLat[] = lL.split(";"); | ||
| 412 | + for (int a = 0; a < lonLat.length; a++) { | ||
| 413 | + String[] split = lonLat[a].split(","); | ||
| 414 | + Location locationMake = TransGPS.LocationMake(Double.valueOf(split[0]), Double.valueOf(split[1])); | ||
| 415 | + Location bd_encrypt = TransGPS.bd_encrypt(locationMake); | ||
| 416 | + wayNumber.add(bd_encrypt); | ||
| 417 | + } | ||
| 418 | + roadNumber.add(wayNumber); | ||
| 419 | + } | ||
| 420 | + | ||
| 421 | + return roadNumber; | ||
| 422 | + } | ||
| 423 | +} | ||
| 0 | \ No newline at end of file | 424 | \ No newline at end of file |