Commit cd110d9c4454cc9d9c341ee9d9844961dca038ba
1 parent
03284b4a
选择历史版本,在线路里查看历史版本修改当前和待更新版本
Showing
37 changed files
with
8416 additions
and
507 deletions
src/main/java/com/bsth/controller/LineVersionsController.java
| ... | ... | @@ -43,6 +43,11 @@ public class LineVersionsController extends BaseController<LineVersions, Integer |
| 43 | 43 | return service.findLineVersionsMax(lineId); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | + @RequestMapping(value = "findAllHistroyLineVersionsById", method = RequestMethod.GET) | |
| 47 | + public List<LineVersions> findAllHistroyLineVersionsById(@RequestParam(defaultValue = "lineId") int lineId) { | |
| 48 | + return service.findAllHistroyLineVersionsById(lineId); | |
| 49 | + } | |
| 50 | + | |
| 46 | 51 | /** |
| 47 | 52 | * 获取线路所有版本 |
| 48 | 53 | * | ... | ... |
src/main/java/com/bsth/controller/SectionRouteController.java
| ... | ... | @@ -36,6 +36,13 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer |
| 36 | 36 | @Autowired |
| 37 | 37 | SectionRouteService routeService; |
| 38 | 38 | |
| 39 | + @RequestMapping(value = "/allls", method = RequestMethod.GET) | |
| 40 | + public Map allls(@RequestParam Map<String, Object> map) { | |
| 41 | + | |
| 42 | + return routeService.pageLs(map); | |
| 43 | + } | |
| 44 | + | |
| 45 | + | |
| 39 | 46 | /** |
| 40 | 47 | * @param map |
| 41 | 48 | * @throws |
| ... | ... | @@ -50,8 +57,17 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer |
| 50 | 57 | * @Description: TODO(撤销路段) |
| 51 | 58 | */ |
| 52 | 59 | @RequestMapping(value = "/destroy", method = RequestMethod.POST) |
| 53 | - public Map<String, Object> destroy(@RequestParam Integer id) { | |
| 54 | - return routeService.destroy(id); | |
| 60 | + public Map<String, Object> destroy(@RequestParam Map<String, Object> map) { | |
| 61 | + | |
| 62 | + int id = Integer.parseInt(map.get("id").toString()); | |
| 63 | + | |
| 64 | + if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) == 1) { | |
| 65 | + return routeService.destroy(id); | |
| 66 | + }else if(Integer.parseInt(map.get("status").toString()) == 2){ | |
| 67 | + return routeService.destroyHistory(id); | |
| 68 | + }else { | |
| 69 | + return map; | |
| 70 | + } | |
| 55 | 71 | } |
| 56 | 72 | |
| 57 | 73 | /** | ... | ... |
src/main/java/com/bsth/controller/StationController.java
| ... | ... | @@ -127,7 +127,7 @@ public class StationController extends BaseController<Station, Integer> { |
| 127 | 127 | */ |
| 128 | 128 | @RequestMapping(value="stationUpdate" , method = RequestMethod.POST) |
| 129 | 129 | public Map<String, Object> stationUpdate(@RequestParam Map<String, Object> map) { |
| 130 | - map.put("updateBy", ""); | |
| 130 | + map.put("updateBy", ""); //?? | |
| 131 | 131 | return service.stationUpdate(map); |
| 132 | 132 | } |
| 133 | 133 | |
| ... | ... | @@ -159,11 +159,11 @@ public class StationController extends BaseController<Station, Integer> { |
| 159 | 159 | public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { |
| 160 | 160 | System.out.println(stationCount+" _ "+ sectionCount ); |
| 161 | 161 | for(int i = 0; i < stationCount; i++) { |
| 162 | - System.out.println(i); | |
| 162 | +// System.out.println(i); | |
| 163 | 163 | GetUIDAndCode.getStationId(); |
| 164 | 164 | } |
| 165 | 165 | for(int j = 0; j < sectionCount; j++) { |
| 166 | - System.out.println(j); | |
| 166 | +// System.out.println(j); | |
| 167 | 167 | GetUIDAndCode.getSectionId(); |
| 168 | 168 | } |
| 169 | 169 | return 1; | ... | ... |
src/main/java/com/bsth/controller/StationRouteController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | -import com.bsth.entity.StationRoute; | |
| 4 | -import com.bsth.entity.StationRouteCache; | |
| 5 | -import com.bsth.repository.StationRouteCacheRepository; | |
| 6 | -import com.bsth.repository.StationRouteRepository; | |
| 7 | -import com.bsth.service.StationRouteService; | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import javax.servlet.http.HttpServletResponse; | |
| 7 | + | |
| 8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
| 11 | 11 | import org.springframework.web.bind.annotation.RequestParam; |
| 12 | 12 | import org.springframework.web.bind.annotation.RestController; |
| 13 | 13 | |
| 14 | -import javax.servlet.http.HttpServletResponse; | |
| 15 | -import java.util.List; | |
| 16 | -import java.util.Map; | |
| 14 | +import com.bsth.entity.LsStationRoute; | |
| 15 | +import com.bsth.entity.StationRoute; | |
| 16 | +import com.bsth.entity.StationRouteCache; | |
| 17 | +import com.bsth.repository.StationRouteCacheRepository; | |
| 18 | +import com.bsth.repository.StationRouteRepository; | |
| 19 | +import com.bsth.service.StationRouteService; | |
| 17 | 20 | |
| 18 | 21 | /** |
| 19 | 22 | * |
| ... | ... | @@ -40,13 +43,20 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 40 | 43 | StationRouteRepository stationRouteRepository; |
| 41 | 44 | @Autowired |
| 42 | 45 | StationRouteCacheRepository stationRouteCacheRepository; |
| 43 | - | |
| 44 | - /** | |
| 45 | - * @param @param map | |
| 46 | - * @throws | |
| 47 | - * @Title: list | |
| 48 | - * @Description: TODO(多条件查询) | |
| 49 | - */ | |
| 46 | + | |
| 47 | + | |
| 48 | + @RequestMapping(value = "/allls", method = RequestMethod.GET) | |
| 49 | + public Map allls(@RequestParam Map<String, Object> map) { | |
| 50 | + | |
| 51 | + return service.pageLs(map); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @RequestMapping(value = "/all_ls", method = RequestMethod.GET) | |
| 55 | + public Iterable<LsStationRoute> list_ls(@RequestParam Map<String, Object> map) { | |
| 56 | + return service.list_ls(map); | |
| 57 | + } | |
| 58 | + | |
| 59 | + | |
| 50 | 60 | @RequestMapping(value = "/all", method = RequestMethod.GET) |
| 51 | 61 | public Iterable<StationRoute> list(@RequestParam Map<String, Object> map) { |
| 52 | 62 | return service.list(map); |
| ... | ... | @@ -218,8 +228,8 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 218 | 228 | * @Description: TODO(上下行切换) |
| 219 | 229 | */ |
| 220 | 230 | @RequestMapping(value = "/updSwitchDir", method = RequestMethod.POST) |
| 221 | - public Map<String, Object> updSwitchDir(@RequestParam String lineIds){ | |
| 222 | - return service.updSwitchDir(lineIds); | |
| 231 | + public Map<String, Object> updSwitchDir(@RequestParam String lineIds, @RequestParam(value = "status", required = false)int status){ | |
| 232 | + return service.updSwitchDir(lineIds,status); | |
| 223 | 233 | } |
| 224 | 234 | |
| 225 | 235 | /** | ... | ... |
src/main/java/com/bsth/controller/realcontrol/.gitignore
0 → 100644
| 1 | +/ScheduleRealInfoController.java | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/.gitignore
0 → 100644
src/main/java/com/bsth/filter/.gitignore
0 → 100644
| 1 | +/AccessLogFilter.java | ... | ... |
src/main/java/com/bsth/repository/LineVersionsRepository.java
| ... | ... | @@ -66,8 +66,16 @@ public interface LineVersionsRepository extends BaseRepository<LineVersions, Int |
| 66 | 66 | */ |
| 67 | 67 | @Query(value = "select lv2 from LineVersions lv2 where lv2.line.id =?1 and lv2.versions=(SELECT max(lv.versions) FROM LineVersions lv where lv.line.id = ?1) ") |
| 68 | 68 | public LineVersions findLineVersionsMax(int lineId); |
| 69 | + | |
| 69 | 70 | |
| 70 | 71 | /** |
| 72 | + * 查询线路最大线路版本 | |
| 73 | + */ | |
| 74 | + @Query(value = "select lv2 from LineVersions lv2 where lv2.line.id =?1") | |
| 75 | + public List<LineVersions> findAllHistroyLineVersionsById(int lineId); | |
| 76 | + | |
| 77 | + | |
| 78 | + /** | |
| 71 | 79 | * 获取线路版本的上一个版本 |
| 72 | 80 | */ |
| 73 | 81 | @Query(value = " SELECT lv FROM LineVersions lv where lv.line.id = ?1 and lv.versions = (SELECT MAX(v.versions) FROM LineVersions v where v.line.id = ?1 and v.versions < ?2)") | ... | ... |
src/main/java/com/bsth/repository/LsSectionRouteRepository.java
| ... | ... | @@ -6,7 +6,9 @@ import org.springframework.data.jpa.repository.Modifying; |
| 6 | 6 | import org.springframework.data.jpa.repository.Query; |
| 7 | 7 | import org.springframework.stereotype.Repository; |
| 8 | 8 | |
| 9 | +import com.bsth.entity.Line; | |
| 9 | 10 | import com.bsth.entity.LsSectionRoute; |
| 11 | +import com.bsth.entity.LsStationRoute; | |
| 10 | 12 | |
| 11 | 13 | /** |
| 12 | 14 | * |
| ... | ... | @@ -31,6 +33,100 @@ public interface LsSectionRouteRepository extends BaseRepository<LsSectionRoute, |
| 31 | 33 | @Query(value = "SELECT sr FROM LsSectionRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3 and sr.destroy=0") |
| 32 | 34 | public List<LsSectionRoute> findupdated(Integer lineId,String lineCode,Integer versions); |
| 33 | 35 | |
| 36 | + @Query(value ="SELECT a.sectionrouteId," + | |
| 37 | + "a.sectionrouteLine," + | |
| 38 | + " a.sectionrouteLineCode," + | |
| 39 | + " a.sectionrouteSection," + | |
| 40 | + " a.sectionrouteSectionCode," + | |
| 41 | + " a.sectionrouteCode," + | |
| 42 | + " a.sectionrouteDirections," + | |
| 43 | + " b.id AS sectionId," + | |
| 44 | + " b.section_code AS sectionCode," + | |
| 45 | + " b.section_name AS sectionName," + | |
| 46 | + " b.croses_road AS sectionRoad," + | |
| 47 | + " b.end_node AS sectionEndNode," + | |
| 48 | + " b.start_node AS sectionStartNode," + | |
| 49 | + " b.middle_node AS sectionMiddleNode," + | |
| 50 | + " b.section_type AS sectionType," + | |
| 51 | + " b.csection_vector AS sectionCsectionVector," + | |
| 52 | + " ST_AsText(b.bsection_vector) AS sectionBsectionVector," + | |
| 53 | + " ST_AsText(b.gsection_vector) AS sectionGsectionVector," + | |
| 54 | + " b.road_coding AS sectionRoadCoding," + | |
| 55 | + " b.section_distance AS sectionDistance," + | |
| 56 | + " b.section_time AS sectionTime," + | |
| 57 | + " b.db_type AS sectiondbType," + | |
| 58 | + " b.speed_limit AS sectionSpeedLimet ,a.destroy,a.versions,a.descriptions,a.isRoadeSpeed FROM (" + | |
| 59 | + "SELECT r.id AS sectionrouteId," + | |
| 60 | + "r.line AS sectionrouteLine," + | |
| 61 | + "r.line_code AS sectionrouteLineCode," + | |
| 62 | + "r.section AS sectionrouteSection," + | |
| 63 | + "r.section_code AS sectionrouteSectionCode," + | |
| 64 | + "r.sectionroute_code AS sectionrouteCode," + | |
| 65 | + "r.directions AS sectionrouteDirections," + | |
| 66 | + "r.destroy AS destroy," + | |
| 67 | + "r.versions AS versions," + | |
| 68 | + "r.descriptions AS descriptions, r.is_roade_speed AS isRoadeSpeed" + | |
| 69 | + " FROM bsth_c_ls_sectionroute r where r.line = ?1 and r.directions = ?2 and r.versions=?3 and r.destroy=0 ) a " + | |
| 70 | + " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true) | |
| 71 | + List<Object[]> getSectionRoute(int lineId, int directions,int version); | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * @Description :TODO(查询路段信息) | |
| 75 | + * | |
| 76 | + * @param map <id:路段路由ID> | |
| 77 | + * | |
| 78 | + * @return List<Object[]> | |
| 79 | + */ | |
| 80 | + @Query(value ="SELECT a.sectionRouteId," + | |
| 81 | + "a.sectionRouteLineCode," + | |
| 82 | + "a.sectionRouteCode," + | |
| 83 | + "a.sectionRouteDirections," + | |
| 84 | + "a.sectionRouteLine," + | |
| 85 | + "a.sectionRouteSection," + | |
| 86 | + "a.sectionRouteDescriptions," + | |
| 87 | + "a.sectionRouteCreateBy," + | |
| 88 | + "a.sectionRouteCreateDate," + | |
| 89 | + "a.sectionRouteUpdateBy," + | |
| 90 | + "a.sectionRouteUpdateDate," + | |
| 91 | + "a.sectionRouteVersions," + | |
| 92 | + "a.sectionRouteDestroy," + | |
| 93 | + "b.id AS sectionId," + | |
| 94 | + "b.section_code AS sectionCode," + | |
| 95 | + "b.section_name AS sectionName," + | |
| 96 | + "b.road_coding AS sectionRoadCoding," + | |
| 97 | + "b.end_node AS sectionEndCode," + | |
| 98 | + "b.start_node AS sectionStartNode," + | |
| 99 | + "b.middle_node AS sectionMiddleNode," + | |
| 100 | + "b.section_type AS sectionType," + | |
| 101 | + "ST_AsText(b.csection_vector) AS sectionCsectionVector," + | |
| 102 | + "ST_AsText(b.bsection_vector) AS sectionBsectionVector," + | |
| 103 | + "ST_AsText(b.gsection_vector) AS sectionGsectionVector," + | |
| 104 | + "b.section_distance AS sectionDistance," + | |
| 105 | + "b.section_time AS sectionTime," + | |
| 106 | + "b.db_type AS sectionDbtype," + | |
| 107 | + "b.speed_limit AS sectionSpeedLimit," + | |
| 108 | + "b.descriptions AS sectionDescriptions," + | |
| 109 | + "b.create_by AS sectionCreateBy," + | |
| 110 | + "b.create_date AS sectionCreateDate," + | |
| 111 | + "b.update_by AS sectionUpdateBy," + | |
| 112 | + "b.update_date AS sectionUpdateDate," + | |
| 113 | + "b.versions AS sectionVersion , a.isRoadeSpeed FROM (" + | |
| 114 | + " SELECT s.id AS sectionRouteId," + | |
| 115 | + "s.line_code AS sectionRouteLineCode," + | |
| 116 | + "s.sectionroute_code AS sectionRouteCode," + | |
| 117 | + "s.directions AS sectionRouteDirections," + | |
| 118 | + "s.line AS sectionRouteLine," + | |
| 119 | + "s.section AS sectionRouteSection," + | |
| 120 | + "s.descriptions AS sectionRouteDescriptions," + | |
| 121 | + "s.create_by AS sectionRouteCreateBy," + | |
| 122 | + "s.create_date AS sectionRouteCreateDate," + | |
| 123 | + "s.update_by AS sectionRouteUpdateBy," + | |
| 124 | + "s.update_date AS sectionRouteUpdateDate," + | |
| 125 | + "s.versions AS sectionRouteVersions," + | |
| 126 | + "s.destroy AS sectionRouteDestroy, s.is_roade_speed AS isRoadeSpeed " + | |
| 127 | + " FROM bsth_c_ls_sectionroute s where s.id =?1) a " + | |
| 128 | + " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true) | |
| 129 | + List<Object[]> findSectionRouteInfoFormId(int id); | |
| 34 | 130 | /** |
| 35 | 131 | * 更新路线前删除线路版本下历史原有路段路由 |
| 36 | 132 | */ |
| ... | ... | @@ -44,4 +140,68 @@ public interface LsSectionRouteRepository extends BaseRepository<LsSectionRoute, |
| 44 | 140 | @Modifying |
| 45 | 141 | @Query(value="UPDATE bsth_c_ls_sectionroute set destroy = 1 where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true) |
| 46 | 142 | public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions); |
| 143 | + | |
| 144 | + @Modifying | |
| 145 | + @Query(value="UPDATE bsth_c_ls_sectionroute set sectionroute_code = (sectionroute_code+1) where line_code = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true) | |
| 146 | + public void sectionUpdSectionRouteCode(String lineCode, Integer directions, Integer sectionrouteCode); | |
| 147 | + | |
| 148 | + @Modifying | |
| 149 | + @Query(value="update bsth_c_ls_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) | |
| 150 | + public void sectionRouteDir(Integer line); | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * @Description :TODO(查询路段信息) | |
| 154 | + * | |
| 155 | + * @param map <lineId:线路ID; directions:方向> | |
| 156 | + * | |
| 157 | + * @return List<Object[]> | |
| 158 | + */ | |
| 159 | + @Query(value ="SELECT a.sectionrouteId," + | |
| 160 | + "a.sectionrouteLine," + | |
| 161 | + " a.sectionrouteLineCode," + | |
| 162 | + " a.sectionrouteSection," + | |
| 163 | + " a.sectionrouteSectionCode," + | |
| 164 | + " a.sectionrouteCode," + | |
| 165 | + " a.sectionrouteDirections," + | |
| 166 | + " b.id AS sectionId," + | |
| 167 | + " b.section_code AS sectionCode," + | |
| 168 | + " b.section_name AS sectionName," + | |
| 169 | + " b.croses_road AS sectionRoad," + | |
| 170 | + " b.end_node AS sectionEndNode," + | |
| 171 | + " b.start_node AS sectionStartNode," + | |
| 172 | + " b.middle_node AS sectionMiddleNode," + | |
| 173 | + " b.section_type AS sectionType," + | |
| 174 | + " b.csection_vector AS sectionCsectionVector," + | |
| 175 | + " ST_AsText(b.bsection_vector) AS sectionBsectionVector," + | |
| 176 | + " ST_AsText(b.gsection_vector) AS sectionGsectionVector," + | |
| 177 | + " b.road_coding AS sectionRoadCoding," + | |
| 178 | + " b.section_distance AS sectionDistance," + | |
| 179 | + " b.section_time AS sectionTime," + | |
| 180 | + " b.db_type AS sectiondbType," + | |
| 181 | + " b.speed_limit AS sectionSpeedLimet ,a.destroy,a.versions,a.descriptions,a.isRoadeSpeed FROM (" + | |
| 182 | + "SELECT r.id AS sectionrouteId," + | |
| 183 | + "r.line AS sectionrouteLine," + | |
| 184 | + "r.line_code AS sectionrouteLineCode," + | |
| 185 | + "r.section AS sectionrouteSection," + | |
| 186 | + "r.section_code AS sectionrouteSectionCode," + | |
| 187 | + "r.sectionroute_code AS sectionrouteCode," + | |
| 188 | + "r.directions AS sectionrouteDirections," + | |
| 189 | + "r.destroy AS destroy," + | |
| 190 | + "r.versions AS versions," + | |
| 191 | + "r.descriptions AS descriptions, r.is_roade_speed AS isRoadeSpeed" + | |
| 192 | + " FROM bsth_c_ls_sectionroute r where r.line = ?1 and r.directions = ?2 and r.destroy=0 ) a " + | |
| 193 | + " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true) | |
| 194 | + List<Object[]> getSectionRoute(int lineId, int directions); | |
| 195 | + | |
| 196 | + // 查询最大ID | |
| 197 | + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(sectionroute_code) as num FROM bsth_c_ls_sectionroute where line_code = 601010 and directions = 1 and destroy = 0) k" , nativeQuery=true) | |
| 198 | + public int sectionRouteCodeMaxId(); | |
| 199 | + | |
| 200 | + | |
| 201 | + @Query(value="select * from bsth_c_ls_sectionroute where line_code = ?3 and directions = ?4 and destroy = 0 and versions = ?5 limit ?1,?2", nativeQuery=true) | |
| 202 | + public Iterable<LsSectionRoute> page(int i, int pageSize, int line, int dir, int version); | |
| 203 | + | |
| 204 | + @Query(value="select count(*) from bsth_c_ls_sectionroute where line_code = ?1 and directions = ?2 and destroy = 0 and versions = ?3 ", nativeQuery=true) | |
| 205 | + int count(int line, int dir, int version); | |
| 206 | + | |
| 47 | 207 | } | ... | ... |
src/main/java/com/bsth/repository/LsStationRouteRepository.java
| ... | ... | @@ -3,12 +3,14 @@ package com.bsth.repository; |
| 3 | 3 | import java.util.List; |
| 4 | 4 | import java.util.Map; |
| 5 | 5 | |
| 6 | +import org.springframework.data.domain.Sort; | |
| 6 | 7 | import org.springframework.data.jpa.repository.EntityGraph; |
| 7 | 8 | import org.springframework.data.jpa.repository.Modifying; |
| 8 | 9 | import org.springframework.data.jpa.repository.Query; |
| 9 | 10 | import org.springframework.stereotype.Repository; |
| 10 | 11 | |
| 11 | 12 | import com.bsth.entity.LsStationRoute; |
| 13 | +import com.bsth.entity.StationRoute; | |
| 12 | 14 | |
| 13 | 15 | /** |
| 14 | 16 | * |
| ... | ... | @@ -34,6 +36,127 @@ public interface LsStationRouteRepository extends BaseRepository<LsStationRoute, |
| 34 | 36 | @Query(value = "SELECT DISTINCT sr FROM LsStationRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3 and sr.destroy=0") |
| 35 | 37 | List<LsStationRoute> findupdated(Integer lineId, String lineCode, Integer versions); |
| 36 | 38 | |
| 39 | + @Query(value = "SELECT a.`stationRoute.id`," + | |
| 40 | + "a.`stationRoute.line`," + | |
| 41 | + "a.`stationRoute.station`," + | |
| 42 | + "a.`stationRoute.stationName`," + | |
| 43 | + "a.`stationRoute.stationRouteCode`," + | |
| 44 | + "a.`stationRoute.lineCode`," + | |
| 45 | + "a.`stationRoute.stationMark`," + | |
| 46 | + "a.`stationRoute.outStationNmber`," + | |
| 47 | + "a.`stationRoute.directions`," + | |
| 48 | + "a.`stationRoute.distances`," + | |
| 49 | + "a.`stationRoute.toTime`," + | |
| 50 | + "a.`stationRoute.firstTime`," + | |
| 51 | + "a.`stationRoute.endTime`," + | |
| 52 | + "a.`stationRoute.descriptions`," + | |
| 53 | + "a.`stationRoute.versions`," + | |
| 54 | + "b.id AS 'station.id'," + | |
| 55 | + "b.station_cod AS 'station.stationCod'," + | |
| 56 | + "b.station_name AS 'station.stationName'," + | |
| 57 | + "b.road_coding AS 'station.roadCoding'," + | |
| 58 | + "b.db_type AS 'station.dbType'," + | |
| 59 | + "b.b_jwpoints AS 'station.bJwpoints'," + | |
| 60 | + "b.g_lonx AS 'station.gLonx'," + | |
| 61 | + "b.g_lonx AS 'station.gLaty'," + | |
| 62 | + "b.x AS 'station.x'," + | |
| 63 | + "b.y AS 'station.y'," + | |
| 64 | + "b.shapes_type AS 'station.shapesType'," + | |
| 65 | + "b.radius AS 'station.radius'," + | |
| 66 | + "ST_AsText(b.g_polygon_grid) AS 'station.gPolygonGrid'," + | |
| 67 | + "ST_AsText(b.b_polygon_grid) AS 'station.bPolygonGrid'," + | |
| 68 | + "b.destroy AS 'station.destroy'," + | |
| 69 | + "b.versions AS 'station.versions'," + | |
| 70 | + "b.descriptions AS 'station.descriptions', " + | |
| 71 | + "a.`stationRoute.industryCode` " + | |
| 72 | + " FROM (" + | |
| 73 | + "SELECT r.id AS 'stationRoute.id'," + | |
| 74 | + " r.line AS 'stationRoute.line'," + | |
| 75 | + "r.station AS 'stationRoute.station'," + | |
| 76 | + "r.station_name AS 'stationRoute.stationName'," + | |
| 77 | + "r.station_route_code as 'stationRoute.stationRouteCode'," + | |
| 78 | + "r.line_code AS 'stationRoute.lineCode'," + | |
| 79 | + "r.station_mark AS 'stationRoute.stationMark'," + | |
| 80 | + "r.out_station_nmber AS 'stationRoute.outStationNmber'," + | |
| 81 | + "r.directions AS 'stationRoute.directions'," + | |
| 82 | + "r.distances AS 'stationRoute.distances'," + | |
| 83 | + "r.to_time AS 'stationRoute.toTime'," + | |
| 84 | + "r.first_time AS 'stationRoute.firstTime'," + | |
| 85 | + "r.end_time AS 'stationRoute.endTime'," + | |
| 86 | + "r.descriptions AS 'stationRoute.descriptions'," + | |
| 87 | + "r.versions AS 'stationRoute.versions', " + | |
| 88 | + "r.industry_code AS 'stationRoute.industryCode' " + | |
| 89 | + " FROM bsth_c_ls_stationroute r WHERE r.line = ?1 and r.directions = ?2 and r.versions=?3 and r.destroy=0) a " + | |
| 90 | + "LEFT JOIN bsth_c_station b " + | |
| 91 | + "ON a.`stationRoute.station` = b.id ORDER BY a.`stationRoute.stationRouteCode` ASC", nativeQuery=true) | |
| 92 | + List<Object[]> findPoints(Integer lineId, Integer direction, Integer versions); | |
| 93 | + | |
| 94 | + | |
| 95 | + @Query(value = "SELECT a.stationRouteLine," + | |
| 96 | + " a.stationRouteStation," + | |
| 97 | + " a.stationRouteCode," + | |
| 98 | + " a.stationRouteLIneCode," + | |
| 99 | + " a.stationRouteStationMark," + | |
| 100 | + " a.stationOutStationNmber," + | |
| 101 | + " a.stationRoutedirections," + | |
| 102 | + " a.stationRouteDistances," + | |
| 103 | + " a.stationRouteToTime," + | |
| 104 | + " a.staitonRouteFirstTime," + | |
| 105 | + " a.stationRouteEndTime," + | |
| 106 | + " a.stationRouteDescriptions," + | |
| 107 | + " a.stationRouteDestroy," + | |
| 108 | + " a.stationRouteVersions," + | |
| 109 | + " a.stationRouteCreateBy," + | |
| 110 | + " a.stationRouteCreateDate," + | |
| 111 | + " a.stationRouteUpdateBy," + | |
| 112 | + " a.stationRouteUpdateDate," + | |
| 113 | + " b.id AS stationId," + | |
| 114 | + " b.station_cod AS stationCode," + | |
| 115 | + " a.stationRouteName," + | |
| 116 | + " b.road_coding AS stationRoadCoding," + | |
| 117 | + " b.db_type AS stationDbType," + | |
| 118 | + " b.b_jwpoints AS stationJwpoints," + | |
| 119 | + " b.g_lonx AS stationGlonx," + | |
| 120 | + " b.g_laty AS stationGlaty," + | |
| 121 | + " b.x AS stationX," + | |
| 122 | + " b.y AS stationY," + | |
| 123 | + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | |
| 124 | + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | |
| 125 | + " b.destroy AS stationDestroy," + | |
| 126 | + " b.radius AS stationRadius," + | |
| 127 | + " b.shapes_type AS stationShapesType," + | |
| 128 | + " b.versions AS stationVersions," + | |
| 129 | + " b.descriptions AS sttationDescriptions," + | |
| 130 | + " b.create_by AS stationCreateBy," + | |
| 131 | + " b.create_date AS stationCreateDate," + | |
| 132 | + " b.update_by AS stationUpdateBy," + | |
| 133 | + " b.update_date AS stationUpdateDate," + | |
| 134 | + " a.stationRouteId," + | |
| 135 | + "b.station_name as zdmc, "+ | |
| 136 | + "a.industryCode "+ | |
| 137 | + " FROM ( SELECT s.id AS stationRouteId," + | |
| 138 | + " s.line AS stationRouteLine," + | |
| 139 | + " s.station as stationRouteStation," + | |
| 140 | + " s.station_name AS stationRouteName," + | |
| 141 | + " s.station_route_code as stationRouteCode," + | |
| 142 | + " s.industry_code as industryCode," + | |
| 143 | + " s.line_code AS stationRouteLIneCode," + | |
| 144 | + " s.station_mark AS stationRouteStationMark," + | |
| 145 | + " s.out_station_nmber AS stationOutStationNmber," + | |
| 146 | + " s.directions AS stationRoutedirections," + | |
| 147 | + " s.distances AS stationRouteDistances," + | |
| 148 | + " s.to_time AS stationRouteToTime," + | |
| 149 | + " s.first_time AS staitonRouteFirstTime," + | |
| 150 | + " s.end_time AS stationRouteEndTime," + | |
| 151 | + " s.descriptions AS stationRouteDescriptions," + | |
| 152 | + " s.destroy AS stationRouteDestroy," + | |
| 153 | + " s.versions AS stationRouteVersions," + | |
| 154 | + " s.create_by AS stationRouteCreateBy," + | |
| 155 | + " s.create_date AS stationRouteCreateDate," + | |
| 156 | + " s.update_by AS stationRouteUpdateBy," + | |
| 157 | + " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.line = ?1 and s.directions = ?2 and s.versions=?3 and s.destroy = 0) a " + | |
| 158 | + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id order by a.stationRouteCode", nativeQuery=true) | |
| 159 | + List<Object[]> getStationRouteList(Integer lineId, Integer dir ,Integer version); | |
| 37 | 160 | /** |
| 38 | 161 | * 更新路线前删除线路版本号历史原有站点路由 |
| 39 | 162 | * |
| ... | ... | @@ -53,7 +176,7 @@ public interface LsStationRouteRepository extends BaseRepository<LsStationRoute, |
| 53 | 176 | @Modifying |
| 54 | 177 | @Query(value="UPDATE bsth_c_ls_stationroute set destroy = 1 where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true) |
| 55 | 178 | public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions); |
| 56 | - | |
| 179 | + | |
| 57 | 180 | /** |
| 58 | 181 | * 按线路编码查询各站点的顺序号 |
| 59 | 182 | * @param lineCode 线路编码 |
| ... | ... | @@ -70,4 +193,102 @@ public interface LsStationRouteRepository extends BaseRepository<LsStationRoute, |
| 70 | 193 | "ORDER BY " + |
| 71 | 194 | "lineCode,directions,stationRouteCode") |
| 72 | 195 | List<Map<String, String>> findLineWithLineCode4Ygc(String lineCode,Integer lineVersion); |
| 196 | + /** | |
| 197 | + * @Description : TODO(根据站点路由Id查询详情) | |
| 198 | + * | |
| 199 | + * @param id:站点路由ID | |
| 200 | + * | |
| 201 | + * @return List<Object[]> | |
| 202 | + */ | |
| 203 | + @Query(value = "SELECT a.stationRouteLine," + | |
| 204 | + " a.stationRouteStation," + | |
| 205 | + " a.stationRouteCode," + | |
| 206 | + " a.stationRouteLIneCode," + | |
| 207 | + " a.stationRouteStationMark," + | |
| 208 | + " a.stationOutStationNmber," + | |
| 209 | + " a.stationRoutedirections," + | |
| 210 | + " a.stationRouteDistances," + | |
| 211 | + " a.stationRouteToTime," + | |
| 212 | + " a.staitonRouteFirstTime," + | |
| 213 | + " a.stationRouteEndTime," + | |
| 214 | + " a.stationRouteDescriptions," + | |
| 215 | + " a.stationRouteDestroy," + | |
| 216 | + " a.stationRouteVersions," + | |
| 217 | + " a.stationRouteCreateBy," + | |
| 218 | + " a.stationRouteCreateDate," + | |
| 219 | + " a.stationRouteUpdateBy," + | |
| 220 | + " a.stationRouteUpdateDate," + | |
| 221 | + " b.id AS stationId," + | |
| 222 | + " b.station_cod AS stationCode," + | |
| 223 | + " a.stationRouteName," + | |
| 224 | + " b.road_coding AS stationRoadCoding," + | |
| 225 | + " b.db_type AS stationDbType," + | |
| 226 | + " b.b_jwpoints AS stationJwpoints," + | |
| 227 | + " b.g_lonx AS stationGlonx," + | |
| 228 | + " b.g_laty AS stationGlaty," + | |
| 229 | + " b.x AS stationX," + | |
| 230 | + " b.y AS stationY," + | |
| 231 | + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | |
| 232 | + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | |
| 233 | + " b.destroy AS stationDestroy," + | |
| 234 | + " b.radius AS stationRadius," + | |
| 235 | + " b.shapes_type AS stationShapesType," + | |
| 236 | + " b.versions AS stationVersions," + | |
| 237 | + " b.descriptions AS sttationDescriptions," + | |
| 238 | + " b.create_by AS stationCreateBy," + | |
| 239 | + " b.create_date AS stationCreateDate," + | |
| 240 | + " b.update_by AS stationUpdateBy," + | |
| 241 | + " b.update_date AS stationUpdateDate," + | |
| 242 | + " a.stationRouteId,b.station_name as zdmc, " + | |
| 243 | + " a.industryCode "+ | |
| 244 | + " FROM " + | |
| 245 | + "( SELECT s.id AS stationRouteId," + | |
| 246 | + " s.line AS stationRouteLine," + | |
| 247 | + " s.station as stationRouteStation," + | |
| 248 | + " s.station_name AS stationRouteName," + | |
| 249 | + " s.station_route_code as stationRouteCode," + | |
| 250 | + " s.industry_code as industryCode," + | |
| 251 | + " s.line_code AS stationRouteLIneCode," + | |
| 252 | + " s.station_mark AS stationRouteStationMark," + | |
| 253 | + " s.out_station_nmber AS stationOutStationNmber," + | |
| 254 | + " s.directions AS stationRoutedirections," + | |
| 255 | + " s.distances AS stationRouteDistances," + | |
| 256 | + " s.to_time AS stationRouteToTime," + | |
| 257 | + " s.first_time AS staitonRouteFirstTime," + | |
| 258 | + " s.end_time AS stationRouteEndTime," + | |
| 259 | + " s.descriptions AS stationRouteDescriptions," + | |
| 260 | + " s.destroy AS stationRouteDestroy," + | |
| 261 | + " s.versions AS stationRouteVersions," + | |
| 262 | + " s.create_by AS stationRouteCreateBy," + | |
| 263 | + " s.create_date AS stationRouteCreateDate," + | |
| 264 | + " s.update_by AS stationRouteUpdateBy," + | |
| 265 | + " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.id = ?1 ) a " + | |
| 266 | + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true) | |
| 267 | + List<Object[]> findStationRouteInfo(Integer id); | |
| 268 | + | |
| 269 | + // 批量修改站点行业编码 | |
| 270 | + @Modifying | |
| 271 | + @Query(value="update bsth_c_ls_stationroute set industry_code =?2 where id = ?1 ", nativeQuery=true) | |
| 272 | + void updIndustryCode(Integer id, String industryCode); | |
| 273 | + | |
| 274 | + @Modifying | |
| 275 | + @Query(value="UPDATE bsth_c_ls_stationroute set station_route_code = (station_route_code+10) where line = ?1 and directions = ?2 and station_route_code >=?3 and destroy = 0", nativeQuery=true) | |
| 276 | + void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod); | |
| 277 | + | |
| 278 | + @Modifying | |
| 279 | + @Query(value="update bsth_c_ls_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line = ?1 ", nativeQuery=true) | |
| 280 | + void stationRouteDir(Integer line); | |
| 281 | + | |
| 282 | + @Query("select r from LsStationRoute r where r.line.id=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") | |
| 283 | + List<LsStationRoute> findByLine(int lineId, int dir); | |
| 284 | + | |
| 285 | + @Modifying | |
| 286 | + @Query(value="update bsth_c_ls_stationroute set distances =?2 where id = ?1 ", nativeQuery=true) | |
| 287 | + void upddis(Integer id,Double dis); | |
| 288 | + | |
| 289 | + @Query(value="select * from bsth_c_ls_stationroute where line_code = ?3 and directions = ?4 and destroy = 0 and versions = ?5 limit ?1,?2", nativeQuery=true) | |
| 290 | + Iterable<LsStationRoute> page(int start , int end , int line ,int dir, int version); | |
| 291 | + | |
| 292 | + @Query(value="select count(*) from bsth_c_ls_stationroute where line_code = ?1 and directions = ?2 and destroy = 0 and versions = ?3 ", nativeQuery=true) | |
| 293 | + int count(int line, int dir, int version); | |
| 73 | 294 | } | ... | ... |
src/main/java/com/bsth/security/filter/.gitignore
0 → 100644
| 1 | +/LoginInterceptor.java | ... | ... |
src/main/java/com/bsth/service/oil/impl/.gitignore
0 → 100644
| 1 | +/CwjyServiceImpl.java | ... | ... |
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
| 1 | +<<<<<<< HEAD | |
| 1 | 2 | package com.bsth.service.oil.impl; |
| 2 | 3 | |
| 3 | 4 | import java.io.File; |
| ... | ... | @@ -588,3 +589,595 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw |
| 588 | 589 | |
| 589 | 590 | |
| 590 | 591 | } |
| 592 | +======= | |
| 593 | +package com.bsth.service.oil.impl; | |
| 594 | + | |
| 595 | +import java.io.File; | |
| 596 | +import java.io.FileInputStream; | |
| 597 | +import java.sql.ResultSet; | |
| 598 | +import java.sql.SQLException; | |
| 599 | +import java.text.DecimalFormat; | |
| 600 | +import java.text.ParseException; | |
| 601 | +import java.text.SimpleDateFormat; | |
| 602 | +import java.util.ArrayList; | |
| 603 | +import java.util.Arrays; | |
| 604 | +import java.util.Date; | |
| 605 | +import java.util.HashMap; | |
| 606 | +import java.util.List; | |
| 607 | +import java.util.Map; | |
| 608 | + | |
| 609 | +import javax.transaction.Transactional; | |
| 610 | + | |
| 611 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 612 | +import org.apache.poi.hssf.usermodel.HSSFCell; | |
| 613 | +import org.apache.poi.hssf.usermodel.HSSFRow; | |
| 614 | +import org.apache.poi.hssf.usermodel.HSSFSheet; | |
| 615 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
| 616 | +import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |
| 617 | +import org.apache.poi.ss.usermodel.Cell; | |
| 618 | +import org.slf4j.Logger; | |
| 619 | +import org.slf4j.LoggerFactory; | |
| 620 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 621 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 622 | +import org.springframework.jdbc.core.RowMapper; | |
| 623 | +import org.springframework.stereotype.Service; | |
| 624 | + | |
| 625 | +import com.alibaba.fastjson.JSONArray; | |
| 626 | +import com.alibaba.fastjson.JSONObject; | |
| 627 | +import com.bsth.common.ResponseCode; | |
| 628 | +import com.bsth.data.BasicData; | |
| 629 | +import com.bsth.entity.oil.Cwjy; | |
| 630 | +import com.bsth.entity.oil.Cyl; | |
| 631 | +import com.bsth.entity.oil.Ylb; | |
| 632 | +import com.bsth.entity.oil.Ylxxb; | |
| 633 | +import com.bsth.repository.oil.CwjyRepository; | |
| 634 | +import com.bsth.repository.oil.YlxxbRepository; | |
| 635 | +import com.bsth.service.impl.BaseServiceImpl; | |
| 636 | +import com.bsth.service.oil.CwjyService; | |
| 637 | +import com.bsth.util.Arith; | |
| 638 | +import com.bsth.util.PageHelper; | |
| 639 | +import com.bsth.util.PageObject; | |
| 640 | + | |
| 641 | +@Service | |
| 642 | +public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements CwjyService | |
| 643 | +{ | |
| 644 | + @Autowired | |
| 645 | + CwjyRepository repository; | |
| 646 | + @Autowired | |
| 647 | + YlxxbRepository ylxxbRepository; | |
| 648 | + | |
| 649 | + @Autowired | |
| 650 | + JdbcTemplate jdbcTemplate; | |
| 651 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 652 | + /*@SuppressWarnings("unchecked") | |
| 653 | + public PageObject<Ylxxb> Pagequery(Map<String, Object> map) { | |
| 654 | + int page=Integer.parseInt(map.get("page").toString()); | |
| 655 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 656 | + | |
| 657 | + String rq=map.get("rq").toString(); | |
| 658 | + String nbbm=""; | |
| 659 | + if(map.get("nbbh")!=null){ | |
| 660 | + nbbm=map.get("nbbh").toString(); | |
| 661 | + } | |
| 662 | + | |
| 663 | + Object gsdmIn=map.get("gsdm_in"); | |
| 664 | + Object fgsdmIn=map.get("fgsdm_in"); | |
| 665 | + String addSql=""; | |
| 666 | + String gsdmLike=""; | |
| 667 | + String fgsdmLike=""; | |
| 668 | + | |
| 669 | + //选择了公司 | |
| 670 | + if(gsdmIn==null){ | |
| 671 | + gsdmLike=map.get("gsdm_like").toString(); | |
| 672 | + addSql += " and a.gsdm = '"+gsdmLike+ "' "; | |
| 673 | + | |
| 674 | + //选择了分公司 | |
| 675 | + if(fgsdmIn==null){ | |
| 676 | + fgsdmLike=map.get("fgsdm_like").toString();; | |
| 677 | + addSql += " and a.fgsdm = '"+fgsdmLike+ "' "; | |
| 678 | + }else{ | |
| 679 | + String fgsdmIns[]= fgsdmIn.toString().split(","); | |
| 680 | + addSql +=" and a.fgsdm in ("; | |
| 681 | + for(int i=0;i<fgsdmIns.length;i++){ | |
| 682 | + addSql +="'"+fgsdmIns[i]+"'"; | |
| 683 | + if(i<fgsdmIns.length-1){ | |
| 684 | + addSql +=","; | |
| 685 | + } | |
| 686 | + } | |
| 687 | + addSql +=")"; | |
| 688 | + } | |
| 689 | + }else{ | |
| 690 | + //没有选择公司 (分公司也没有选择) | |
| 691 | + String gsdmIns[]=gsdmIn.toString().split(","); | |
| 692 | + addSql += " and a.gsdm in ("; | |
| 693 | + for(int i=0;i<gsdmIns.length;i++){ | |
| 694 | + addSql +="'" +gsdmIns[i]+"'"; | |
| 695 | + if(i<gsdmIns.length-1){ | |
| 696 | + addSql+=","; | |
| 697 | + } | |
| 698 | + } | |
| 699 | + addSql +=")"; | |
| 700 | + String fgsdmIns[]= fgsdmIn.toString().split(","); | |
| 701 | + addSql +=" and a.fgsdm in ("; | |
| 702 | + for(int i=0;i<fgsdmIns.length;i++){ | |
| 703 | + addSql +="'"+fgsdmIns[i]+"'"; | |
| 704 | + if(i<fgsdmIns.length-1){ | |
| 705 | + addSql +=","; | |
| 706 | + } | |
| 707 | + } | |
| 708 | + addSql +=")"; | |
| 709 | + | |
| 710 | + | |
| 711 | + } | |
| 712 | + String countSql="SELECT ifnull(count(*),0) as countTs FROM bsth_c_cwjy a "+ | |
| 713 | + " left join ( select * from bsth_c_ylxxb b where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " + | |
| 714 | + " on a.nbbm=b.nbbm left join (select nbbm,group_concat(jsy) as jsy " | |
| 715 | + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+ | |
| 716 | + " ) c on a.nbbm=c.nbbm where a.nbbm like '%"+nbbm+"%' " +addSql ; | |
| 717 | + int listsize=jdbcTemplate.queryForObject(countSql, Integer.class); | |
| 718 | + // TODO Auto-generated method stub | |
| 719 | + String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm,b.jsy as jsy,b.jzl as jzl ,b.stationid as stationid," | |
| 720 | + + "b.nylx as nylx,b.yj as yj,b.bz as bz,c.jsy as ldgh FROM bsth_c_cwjy a "+ | |
| 721 | + " left join ( select * from bsth_c_ylxxb b where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " + | |
| 722 | + " on a.nbbm=b.nbbm left join (select nbbm,group_concat(jsy) as jsy " | |
| 723 | + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+ | |
| 724 | + " ) c on a.nbbm=c.nbbm where a.nbbm like '%"+nbbm+"%' " +addSql+ " limit "+page*10+","+10; | |
| 725 | + | |
| 726 | + | |
| 727 | + List<Ylxxb> yList= jdbcTemplate.query(sql, | |
| 728 | + new RowMapper<Ylxxb>(){ | |
| 729 | + @Override | |
| 730 | + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 731 | + Ylxxb t=new Ylxxb(); | |
| 732 | + t.setGsdm(rs.getString("gsdm")); | |
| 733 | + t.setFgsdm(rs.getString("fgsdm")); | |
| 734 | + t.setNbbm(rs.getString("nbbm")); | |
| 735 | + t.setJsy(rs.getString("jsy")); | |
| 736 | + t.setJzl(rs.getDouble("jzl")); | |
| 737 | + t.setStationid(rs.getString("stationid")); | |
| 738 | + t.setNylx(rs.getInt("nylx")); | |
| 739 | + t.setYj(rs.getDouble("yj")); | |
| 740 | + t.setBz(rs.getString("bz")); | |
| 741 | + t.setLdgh(rs.getString("ldgh")); | |
| 742 | + return t; | |
| 743 | + } | |
| 744 | + }); | |
| 745 | + List<Object[]> list=repository.obtainCwjycl(rq,nbbm); | |
| 746 | + for (int i = 0; i < list.size(); i++) { | |
| 747 | + Ylxxb y=new Ylxxb(); | |
| 748 | + y.setGsdm(list.get(i)[0]==null?"":list.get(i)[0].toString()); | |
| 749 | + y.setNbbm(list.get(i)[1]==null?"":list.get(i)[1].toString()); | |
| 750 | + y.setJsy(list.get(i)[2]==null?"":list.get(i)[2].toString()); | |
| 751 | + y.setJzl(list.get(i)[3]==null?0.0:Double.parseDouble(list.get(i)[3].toString())); | |
| 752 | + y.setStationid(list.get(i)[4]==null?"":list.get(i)[4].toString()); | |
| 753 | + y.setNylx(list.get(i)[5]==null?0:Integer.parseInt(list.get(i)[5].toString())); | |
| 754 | + y.setYj(list.get(i)[6]==null?0.0:Double.parseDouble(list.get(i)[6].toString())); | |
| 755 | + y.setBz(list.get(i)[7]==null?"":list.get(i)[7].toString()); | |
| 756 | + y.setLdgh(list.get(i)[8]==null?"":list.get(i)[8].toString()); | |
| 757 | + try { | |
| 758 | + y.setYyrq(sdf.parse(rq)); | |
| 759 | + } catch (ParseException e) { | |
| 760 | + // TODO Auto-generated catch block | |
| 761 | + e.printStackTrace(); | |
| 762 | + } | |
| 763 | + yList.add(y); | |
| 764 | + } | |
| 765 | + PageHelper pageHelper = new PageHelper(listsize, map); | |
| 766 | + pageHelper.getMap(); | |
| 767 | + PageObject<Ylxxb> pageObject=pageHelper.getPageObject(); | |
| 768 | + pageObject.setDataList(yList); | |
| 769 | + return pageObject; | |
| 770 | + }*/ | |
| 771 | + | |
| 772 | + @Override | |
| 773 | + public Ylxxb bynbbm(Map<String, Object> map) { | |
| 774 | + // TODO Auto-generated method stub | |
| 775 | + // TODO Auto-generated method stub | |
| 776 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 777 | + String rq = map.get("rq").toString(); | |
| 778 | + String nbbm = ""; | |
| 779 | + if (map.get("nbbm") != null) { | |
| 780 | + nbbm = map.get("nbbm").toString(); | |
| 781 | + } | |
| 782 | + List<Object[]> list = repository.obtainCwjycl(rq, nbbm); | |
| 783 | + Ylxxb y = new Ylxxb(); | |
| 784 | + if (list.size() > 0) { | |
| 785 | + y.setGsdm(list.get(0)[0] == null ? "" : list.get(0)[0].toString()); | |
| 786 | + y.setNbbm(list.get(0)[1] == null ? "" : list.get(0)[1].toString()); | |
| 787 | + y.setJsy(list.get(0)[2] == null ? "" : list.get(0)[2].toString()); | |
| 788 | + y.setJzl(list.get(0)[3] == null ? 0.0 : Double.parseDouble(list.get(0)[3].toString())); | |
| 789 | + y.setStationid(list.get(0)[4] == null ? "" : list.get(0)[4].toString()); | |
| 790 | + y.setNylx(list.get(0)[5] == null ? 0 : Integer.parseInt(list.get(0)[5].toString())); | |
| 791 | + y.setYj(list.get(0)[6] == null ? 0.0 : Double.parseDouble(list.get(0)[6].toString())); | |
| 792 | + y.setBz(list.get(0)[7] == null ? "" : list.get(0)[7].toString()); | |
| 793 | + y.setLdgh(list.get(0)[8] == null ? "" : list.get(0)[8].toString()); | |
| 794 | + try { | |
| 795 | + y.setYyrq(sdf.parse(rq)); | |
| 796 | + } catch (ParseException e) { | |
| 797 | + // TODO Auto-generated catch block | |
| 798 | + e.printStackTrace(); | |
| 799 | + } | |
| 800 | + } | |
| 801 | + return y; | |
| 802 | + } | |
| 803 | + | |
| 804 | + @Transactional | |
| 805 | + @Override | |
| 806 | + public Map<String, Object> savejzl(Map<String, Object> maps) throws Exception { | |
| 807 | + // TODO Auto-generated method stub | |
| 808 | + Map<String, Object> map=new HashMap<String,Object>(); | |
| 809 | + try { | |
| 810 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 811 | +// String rq = sdf.format(t.getYyrq()); | |
| 812 | +// String nbbm=t.getNbbm(); | |
| 813 | +// List<Ylxxb> yList=ylxxbRepository.obtainYlxx2(rq,nbbm); | |
| 814 | +// if(yList.size()>0){ | |
| 815 | +// t.setId(yList.get(0).getId()); | |
| 816 | +// ylxxbRepository.save(t); | |
| 817 | +// }else{ | |
| 818 | +// ylxxbRepository.save(t); | |
| 819 | +// } | |
| 820 | + String gsbm=maps.get("gsbm").toString(); | |
| 821 | + String fgsbm=maps.get("fgsbm").toString(); | |
| 822 | + String rq=maps.get("rq").toString(); | |
| 823 | + Date date=sdf.parse(rq); | |
| 824 | + String json =StringEscapeUtils.unescapeHtml4(maps.get("ylbList").toString()); | |
| 825 | + JSONArray jsonArray=JSONArray.parseArray(json); | |
| 826 | + JSONObject jsonObject; | |
| 827 | + // 获取车辆存油信息 | |
| 828 | + for (int i = 0; i < jsonArray.size(); i++) { | |
| 829 | + jsonObject=jsonArray.getJSONObject(i); | |
| 830 | + Integer id =jsonObject.getInteger("id"); | |
| 831 | + String jsy=jsonObject.getString("jsy"); | |
| 832 | + double jzl=jsonObject.getDoubleValue("jzl"); | |
| 833 | + String stationid=jsonObject.getString("stationid"); | |
| 834 | + String nbbm=jsonObject.getString("nbbm"); | |
| 835 | + int nylx=jsonObject.getIntValue("nylx"); | |
| 836 | + String jyggh=jsonObject.getString("jyggh"); | |
| 837 | + String bz=jsonObject.getString("bz"); | |
| 838 | + Ylxxb y; | |
| 839 | + if(id>0){ | |
| 840 | + y=ylxxbRepository.findById(id).get(); | |
| 841 | + y.setJsy(jsy); | |
| 842 | + y.setJzl(jzl); | |
| 843 | + y.setStationid(stationid); | |
| 844 | + y.setJyggh(jyggh); | |
| 845 | + y.setBz(bz); | |
| 846 | + y.setCreatetime(new Date()); | |
| 847 | + y.setYyrq(date); | |
| 848 | + ylxxbRepository.save(y); | |
| 849 | + }else{ | |
| 850 | + if(jsy!="" && jzl>0){ | |
| 851 | + y=new Ylxxb(); | |
| 852 | + y.setGsdm(gsbm); | |
| 853 | + y.setJsy(jsy); | |
| 854 | + y.setNbbm(nbbm); | |
| 855 | + y.setJzl(jzl); | |
| 856 | + y.setStationid(stationid); | |
| 857 | + y.setJyggh(jyggh); | |
| 858 | + y.setBz(bz); | |
| 859 | + y.setCreatetime(new Date()); | |
| 860 | + y.setYyrq(date); | |
| 861 | + y.setJylx(1); | |
| 862 | + y.setNylx(0); | |
| 863 | + ylxxbRepository.save(y); | |
| 864 | + } | |
| 865 | + } | |
| 866 | + } | |
| 867 | + map.put("status", ResponseCode.SUCCESS); | |
| 868 | + | |
| 869 | + } catch (Exception e) { | |
| 870 | + map.put("status", ResponseCode.ERROR); | |
| 871 | + logger.error("save erro.", e); | |
| 872 | + throw e; | |
| 873 | + // TODO: handle exception | |
| 874 | + } | |
| 875 | + return map; | |
| 876 | + } | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + @Override | |
| 881 | + public List<Ylxxb> Pagequery(Map<String, Object> map) { | |
| 882 | + // TODO Auto-generated method stub | |
| 883 | + String rq=map.get("rq").toString(); | |
| 884 | + String nbbm=map.get("nbbh").toString(); | |
| 885 | + String gsdm=map.get("gsdm_like").toString(); | |
| 886 | + | |
| 887 | + String fgsdm=map.get("fgsdm_like").toString(); | |
| 888 | + String line =map.get("line_like").toString().trim(); | |
| 889 | + /*String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm," | |
| 890 | + + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy," | |
| 891 | + + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+ | |
| 892 | + " left join (" | |
| 893 | + + " select * from bsth_c_ylxxb b " | |
| 894 | + + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1 " | |
| 895 | + + " and gsdm = '"+gsdm+"') b " + | |
| 896 | + " on a.nbbm=b.nbbm " | |
| 897 | + + "left join (select nbbm,group_concat(jsy) as jsy " | |
| 898 | + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) " | |
| 899 | + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' group by nbbm "+ | |
| 900 | + " ) c on a.nbbm=c.nbbm " | |
| 901 | + + "where a.nbbm like '%"+nbbm+"%' and a.gsdm='"+gsdm+"' and a.fgsdm ='"+fgsdm+"'" | |
| 902 | + + " order by a.nbbm";*/ | |
| 903 | + String sql= " select * from bsth_c_ylxxb b " | |
| 904 | + + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1 " | |
| 905 | + + " and gsdm = '"+gsdm+"'"; | |
| 906 | + | |
| 907 | + List<Ylxxb> yList= jdbcTemplate.query(sql, | |
| 908 | + new RowMapper<Ylxxb>(){ | |
| 909 | + @Override | |
| 910 | + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 911 | + Ylxxb t=new Ylxxb(); | |
| 912 | + t.setId(rs.getInt("id")); | |
| 913 | + t.setGsdm(rs.getString("gsdm")); | |
| 914 | + t.setFgsdm(rs.getString("fgsdm")); | |
| 915 | + t.setNbbm(rs.getString("nbbm")); | |
| 916 | + t.setJyggh(rs.getString("jyggh")); | |
| 917 | + t.setJsy(rs.getString("jsy")); | |
| 918 | + t.setJzl(rs.getDouble("jzl")); | |
| 919 | + t.setStationid(rs.getString("stationid")); | |
| 920 | + t.setNylx(rs.getInt("nylx")); | |
| 921 | + t.setYj(rs.getDouble("yj")); | |
| 922 | + t.setBz(rs.getString("bz")); | |
| 923 | + return t; | |
| 924 | + } | |
| 925 | + }); | |
| 926 | + List<Cwjy> cwList=null; | |
| 927 | + if(line.equals("")){ | |
| 928 | + cwList = repository.selectAll(nbbm, gsdm, fgsdm); | |
| 929 | + }else{ | |
| 930 | + cwList = repository.selectAll_s(nbbm, gsdm, fgsdm, line); | |
| 931 | + } | |
| 932 | + | |
| 933 | + String sql_ylb="SELECT nbbm,group_concat(jsy) AS jsy FROM bsth_c_ylb WHERE " | |
| 934 | + + " rq = '"+rq+"' AND ssgsdm = '"+gsdm+"' AND " | |
| 935 | + + " fgsdm = '"+fgsdm+"' GROUP BY nbbm"; | |
| 936 | + | |
| 937 | + List<Map<String, String>> ylbList= jdbcTemplate.query(sql_ylb, | |
| 938 | + new RowMapper<Map<String, String>>(){ | |
| 939 | + @Override | |
| 940 | + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 941 | + Map<String, String> maps =new HashMap<String, String>(); | |
| 942 | + maps.put("nbbm", rs.getString("nbbm")); | |
| 943 | + maps.put("ldgh", rs.getString("jsy")); | |
| 944 | + return maps; | |
| 945 | + } | |
| 946 | + }); | |
| 947 | + | |
| 948 | + List<Ylxxb> ylxxbList= new ArrayList<Ylxxb>(); | |
| 949 | + Ylxxb y=null; | |
| 950 | + for (int i = 0; i < cwList.size(); i++) { | |
| 951 | + Cwjy cwjy=cwList.get(i); | |
| 952 | + y=new Ylxxb(); | |
| 953 | + y.setNylx(0); | |
| 954 | + y.setId(0); | |
| 955 | + y.setJzl(0.0); | |
| 956 | + y.setGsdm(cwjy.getGsdm()); | |
| 957 | + y.setFgsdm(cwjy.getFgsdm()); | |
| 958 | + y.setNbbm(cwjy.getNbbm()); | |
| 959 | + y.setLinename(cwjy.getLinename()); | |
| 960 | + for (int j = 0; j < yList.size(); j++) { | |
| 961 | + Ylxxb ylxxb=yList.get(j); | |
| 962 | + if(y.getNbbm().equals(ylxxb.getNbbm())){ | |
| 963 | + y.setId(ylxxb.getId()); | |
| 964 | + y.setJyggh(ylxxb.getJyggh()); | |
| 965 | + y.setJsy(ylxxb.getJsy()); | |
| 966 | + y.setJzl(ylxxb.getJzl()); | |
| 967 | + y.setStationid(ylxxb.getStationid()); | |
| 968 | + y.setNylx(ylxxb.getNylx()); | |
| 969 | + y.setYj(ylxxb.getYj()); | |
| 970 | + y.setBz(ylxxb.getBz()); | |
| 971 | + break; | |
| 972 | + } | |
| 973 | + } | |
| 974 | + for (int j = 0; j < ylbList.size(); j++) { | |
| 975 | + Map<String, String> m=ylbList.get(j); | |
| 976 | + if(m.get("nbbm").toString().equals(cwjy.getNbbm())){ | |
| 977 | + y.setLdgh(m.get("ldgh").toString()); | |
| 978 | + break; | |
| 979 | + } | |
| 980 | + | |
| 981 | + } | |
| 982 | + | |
| 983 | + ylxxbList.add(y); | |
| 984 | + | |
| 985 | + } | |
| 986 | + | |
| 987 | + return ylxxbList; | |
| 988 | + } | |
| 989 | + | |
| 990 | + @Override | |
| 991 | + public int checkNbbm(Cwjy t) { | |
| 992 | + // TODO Auto-generated method stub | |
| 993 | + String sql="select count(*) from bsth_c_cwjy where nbbm ='"+t.getNbbm()+"'" | |
| 994 | + + " and gsdm ='"+t.getFgsdm()+"' and fgsdm ='"+t.getFgsdm()+"'"; | |
| 995 | + int cs=jdbcTemplate.queryForObject(sql, Integer.class); | |
| 996 | + | |
| 997 | + return cs; | |
| 998 | + } | |
| 999 | + | |
| 1000 | + @Override | |
| 1001 | + public List<Ylxxb> cwjyList(Map<String, Object> map) { | |
| 1002 | + String rq=map.get("rq").toString(); | |
| 1003 | + String nbbm=map.get("nbbh").toString(); | |
| 1004 | + String gsdm=map.get("gsdm_like").toString(); | |
| 1005 | + | |
| 1006 | + String fgsdm=map.get("fgsdm_like").toString(); | |
| 1007 | + String line =map.get("line_like").toString().trim(); | |
| 1008 | + boolean type=false; | |
| 1009 | + if(map.get("type")!=null){ | |
| 1010 | + type=true; | |
| 1011 | + } | |
| 1012 | + String sql="select a.nbbm,a.gsdm,a.fgsdm,IFNULL(b.id,0) as id,IFNULL(b.jzl,0) as jzl," | |
| 1013 | + + " IFNULL(b.jyggh,0) as jyggh,IFNULL(b.jsy,0) as jsy,IFNULL(b.stationid,0) as stationid ," | |
| 1014 | + + " IFNULL(b.yj,0) as yj,IFNULL(b.nylx,0) as nylx,IFNULL(b.bz,'') as bz,IFNULL(c.jsy,'') as ldgh ," | |
| 1015 | + + " IFNULL(c.xlname,c.linename) as xlname from " | |
| 1016 | + + " (select * from bsth_c_cwjy where gsdm='"+gsdm+"' and fgsdm='"+fgsdm+"') a " | |
| 1017 | + + " left join (select * from bsth_c_ylxxb where yyrq='"+rq+"' and gsdm='"+gsdm+"' and jylx=1) b" | |
| 1018 | + + " on a.nbbm=b.nbbm LEFT JOIN (select u.nbbm,u.jsy,v.linename,v.xlname,v.xlbm from(select a.nbbm,GROUP_CONCAT(a.jsy) as jsy " | |
| 1019 | + + " from (select nbbm,jsy from bsth_c_ylb x where x.rq='"+rq+"' " | |
| 1020 | + + " and x.ssgsdm='"+gsdm+"' and x.fgsdm='"+fgsdm+"' group by nbbm,jsy ) a group by a.nbbm) u" | |
| 1021 | + + " LEFT JOIN(select o.nbbm,GROUP_CONCAT(o.xlbm) xlbm ,GROUP_CONCAT(o.linename) as xlname," | |
| 1022 | + + " GROUP_CONCAT(p.`name`) as linename from (select nbbm,xlbm,linename from bsth_c_ylb " | |
| 1023 | + + " where rq='"+rq+"' and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' group by nbbm,xlbm,linename) o " | |
| 1024 | + + " LEFT JOIN bsth_c_line p on o.xlbm=p.line_code group by o.nbbm ) v on u.nbbm=v.nbbm) c " | |
| 1025 | + + " on a.nbbm=c.nbbm where 1=1 "; | |
| 1026 | + if(!nbbm.equals("")){ | |
| 1027 | + sql +=" and a.nbbm like '%"+nbbm+"%'"; | |
| 1028 | + } | |
| 1029 | + if(!line.equals("")){ | |
| 1030 | + sql += " and c.xlbm ='"+line+"'"; | |
| 1031 | + } | |
| 1032 | + if(type){ | |
| 1033 | + sql +=" and c.xlbm is not null"; | |
| 1034 | + } | |
| 1035 | + sql +=" order by xlname desc"; | |
| 1036 | + List<Ylxxb> yList= jdbcTemplate.query(sql, | |
| 1037 | + new RowMapper<Ylxxb>(){ | |
| 1038 | + @Override | |
| 1039 | + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1040 | + Ylxxb t=new Ylxxb(); | |
| 1041 | + t.setId(rs.getInt("id")); | |
| 1042 | + t.setGsdm(rs.getString("gsdm")); | |
| 1043 | + t.setFgsdm(rs.getString("fgsdm")); | |
| 1044 | + t.setNbbm(rs.getString("nbbm")); | |
| 1045 | + t.setJyggh(rs.getString("jyggh")); | |
| 1046 | + t.setJsy(rs.getString("jsy")); | |
| 1047 | + t.setJzl(rs.getDouble("jzl")); | |
| 1048 | + t.setStationid(rs.getString("stationid")); | |
| 1049 | + t.setNylx(rs.getInt("nylx")); | |
| 1050 | + t.setYj(rs.getDouble("yj")); | |
| 1051 | + t.setBz(rs.getString("bz")); | |
| 1052 | + t.setLdgh(rs.getString("ldgh")); | |
| 1053 | + t.setLinename(rs.getString("xlname")); | |
| 1054 | + return t; | |
| 1055 | + } | |
| 1056 | + }); | |
| 1057 | + return yList; | |
| 1058 | + } | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + @Override | |
| 1062 | + public String importExcel(File file, String gsbm, String gsName) { | |
| 1063 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 1064 | + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 1065 | + DecimalFormat df = new DecimalFormat("######0.00"); | |
| 1066 | + List<String> textList = new ArrayList<String>(); | |
| 1067 | + try { | |
| 1068 | + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); | |
| 1069 | + HSSFWorkbook wb = new HSSFWorkbook(fs); | |
| 1070 | + HSSFSheet sheet = wb.getSheetAt(0); | |
| 1071 | + // 取得总行数 | |
| 1072 | + int rowNum = sheet.getLastRowNum() + 1; | |
| 1073 | + // 取得总列数 | |
| 1074 | + int cellNum = sheet.getRow(0).getLastCellNum(); | |
| 1075 | + HSSFRow row = null; | |
| 1076 | + HSSFCell cell = null; | |
| 1077 | + for(int i = 2; i < rowNum; i++){ | |
| 1078 | + row = sheet.getRow(i); | |
| 1079 | + if (row == null){ | |
| 1080 | + continue; | |
| 1081 | + } | |
| 1082 | + String text = ""; | |
| 1083 | + for(int j = 0; j < cellNum; j++){ | |
| 1084 | + cell = row.getCell(j); | |
| 1085 | + if(cell == null){ | |
| 1086 | + text += ","; | |
| 1087 | + continue; | |
| 1088 | + } | |
| 1089 | + text += String.valueOf(cell) + ","; | |
| 1090 | + } | |
| 1091 | + String[] split = (text+";").split(","); | |
| 1092 | + String str = ""; | |
| 1093 | + for(int j = 0; j < split.length && j < 5; j++){ | |
| 1094 | + str += split[j]; | |
| 1095 | + } | |
| 1096 | + if(str.trim().length() == 0){ | |
| 1097 | + continue; | |
| 1098 | + } | |
| 1099 | + textList.add(text + ";"); | |
| 1100 | + } | |
| 1101 | + for(int i = 0; i < textList.size(); i++){ | |
| 1102 | + String text = textList.get(i); | |
| 1103 | + System.out.println(text); | |
| 1104 | + String[] split = text.split(","); | |
| 1105 | + String rq = split[0].trim(); | |
| 1106 | + String nbbm = split[1].trim(); | |
| 1107 | + String jsy = split[2].trim(); | |
| 1108 | + double jzl = Double.valueOf(split[3].trim().length()!=0?split[3]:"0"); | |
| 1109 | + String jyz = split[4].trim(); | |
| 1110 | + String remarks = split[5].trim(); | |
| 1111 | + if(rq.trim().length() == 0){ | |
| 1112 | + rq = sdf.format(new Date()); | |
| 1113 | + } | |
| 1114 | + | |
| 1115 | + List<Double> jzl_ = repository.import_queryBySame(gsbm, rq, nbbm); | |
| 1116 | +// | |
| 1117 | + if(jzl_.size() == 0){ | |
| 1118 | + repository.import_insertData(gsbm, rq, nbbm, jsy, | |
| 1119 | + df.format(jzl), jyz, remarks, sd.format(new Date())); | |
| 1120 | + }else{ | |
| 1121 | + repository.import_UpdateJzl(df.format(jzl), jsy, jyz, remarks, gsbm, rq, nbbm); | |
| 1122 | + } | |
| 1123 | + } | |
| 1124 | + | |
| 1125 | + /** 以下为测试导入ylxxb用 */ | |
| 1126 | +// Date date = new Date(); | |
| 1127 | +// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 1128 | +// for(int i = 1; i < rowNum; i++){ | |
| 1129 | +// row = sheet.getRow(i); | |
| 1130 | +// if (row == null){ | |
| 1131 | +// continue; | |
| 1132 | +// } | |
| 1133 | +// String text = ""; | |
| 1134 | +// for(int j = 0; j < cellNum; j++){ | |
| 1135 | +// cell = row.getCell(j); | |
| 1136 | +// if(cell == null){ | |
| 1137 | +// text += ","; | |
| 1138 | +// continue; | |
| 1139 | +// } | |
| 1140 | +// if(j == 1 && cell.getCellType() == Cell.CELL_TYPE_NUMERIC){ | |
| 1141 | +// text += dateFormat.format(cell.getDateCellValue()) + ","; | |
| 1142 | +// } else if(j == 4 || j == 7){ | |
| 1143 | +// text += "0,"; | |
| 1144 | +//// } else if(j == 6 && String.valueOf(cell).contains("-")){ | |
| 1145 | +//// String str = String.valueOf(cell); | |
| 1146 | +//// text += str.split("-")[1] + ","; | |
| 1147 | +// } else { | |
| 1148 | +// text += String.valueOf(cell) + ","; | |
| 1149 | +// } | |
| 1150 | +// } | |
| 1151 | +// System.out.println(text); | |
| 1152 | +// Ylxxb ylxxb = new Ylxxb(); | |
| 1153 | +// String[] split = text.split(","); | |
| 1154 | +// ylxxb.setCreatetime(date); | |
| 1155 | +// ylxxb.setYyrq(sdf.parse(split[0].trim())); | |
| 1156 | +// ylxxb.setJlrq(dateFormat.parse(split[1])); | |
| 1157 | +// ylxxb.setFromgsdm("22"); | |
| 1158 | +// ylxxb.setNbbm(split[2]); | |
| 1159 | +// ylxxb.setJzl(Double.valueOf(split[3])); | |
| 1160 | +// ylxxb.setNylx(Integer.valueOf(split[4])); | |
| 1161 | +// ylxxb.setStationid(split[5]); | |
| 1162 | +// if(split[6].contains("-")){ | |
| 1163 | +// ylxxb.setJsy(split[6].split("-")[1]); | |
| 1164 | +// } | |
| 1165 | +// ylxxb.setBz(split[6]); | |
| 1166 | +// ylxxb.setJylx(Integer.valueOf(split[7])); | |
| 1167 | +// ylxxbRepository.save(ylxxb); | |
| 1168 | +// } | |
| 1169 | + wb.close(); | |
| 1170 | + fs.close(); | |
| 1171 | + } catch (Exception e) { | |
| 1172 | + // TODO Auto-generated catch block | |
| 1173 | + e.printStackTrace(); | |
| 1174 | + return "文件导入失败"; | |
| 1175 | + } finally { | |
| 1176 | + file.delete(); | |
| 1177 | + } | |
| 1178 | + return "文件导入成功"; | |
| 1179 | + } | |
| 1180 | + | |
| 1181 | + | |
| 1182 | +} | |
| 1183 | +>>>>>>> 2021.05.11 历史版本 选择版本 查看历史版本修改当前版本和待更新版本 | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/.gitignore
0 → 100644
| 1 | +/ScheduleRealInfoServiceImpl.java | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| 1 | +<<<<<<< HEAD | |
| 1 | 2 | package com.bsth.service.realcontrol.impl; |
| 2 | 3 | |
| 3 | 4 | import java.io.*; |
| ... | ... | @@ -6587,3 +6588,6594 @@ class compareFcsjType implements Comparator<ScheduleRealInfo> { |
| 6587 | 6588 | } |
| 6588 | 6589 | |
| 6589 | 6590 | } |
| 6591 | +======= | |
| 6592 | +package com.bsth.service.realcontrol.impl; | |
| 6593 | + | |
| 6594 | +import java.io.*; | |
| 6595 | +import java.net.HttpURLConnection; | |
| 6596 | +import java.net.MalformedURLException; | |
| 6597 | +import java.net.URL; | |
| 6598 | +import java.net.URLEncoder; | |
| 6599 | +import java.sql.ResultSet; | |
| 6600 | +import java.sql.SQLException; | |
| 6601 | +import java.text.DecimalFormat; | |
| 6602 | +import java.text.ParseException; | |
| 6603 | +import java.text.SimpleDateFormat; | |
| 6604 | +import java.util.ArrayList; | |
| 6605 | +import java.util.Calendar; | |
| 6606 | +import java.util.Collection; | |
| 6607 | +import java.util.Collections; | |
| 6608 | +import java.util.Comparator; | |
| 6609 | +import java.util.Date; | |
| 6610 | +import java.util.GregorianCalendar; | |
| 6611 | +import java.util.HashMap; | |
| 6612 | +import java.util.HashSet; | |
| 6613 | +import java.util.Iterator; | |
| 6614 | +import java.util.List; | |
| 6615 | +import java.util.Map; | |
| 6616 | +import java.util.Queue; | |
| 6617 | +import java.util.Set; | |
| 6618 | +import java.util.concurrent.ConcurrentLinkedQueue; | |
| 6619 | +import java.util.concurrent.Executors; | |
| 6620 | +import java.util.concurrent.ScheduledExecutorService; | |
| 6621 | +import java.util.concurrent.ThreadFactory; | |
| 6622 | +import java.util.concurrent.TimeUnit; | |
| 6623 | +import java.util.regex.Pattern; | |
| 6624 | + | |
| 6625 | +import org.apache.commons.io.IOUtils; | |
| 6626 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 6627 | +import org.apache.commons.lang3.StringUtils; | |
| 6628 | +import org.joda.time.format.DateTimeFormat; | |
| 6629 | +import org.joda.time.format.DateTimeFormatter; | |
| 6630 | +import org.slf4j.Logger; | |
| 6631 | +import org.slf4j.LoggerFactory; | |
| 6632 | +import org.springframework.beans.factory.DisposableBean; | |
| 6633 | +import org.springframework.beans.factory.InitializingBean; | |
| 6634 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 6635 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | |
| 6636 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 6637 | +import org.springframework.jdbc.core.RowMapper; | |
| 6638 | +import org.springframework.stereotype.Service; | |
| 6639 | +import org.springframework.transaction.annotation.Transactional; | |
| 6640 | + | |
| 6641 | +import com.alibaba.fastjson.JSON; | |
| 6642 | +import com.alibaba.fastjson.JSONArray; | |
| 6643 | +import com.alibaba.fastjson.JSONObject; | |
| 6644 | +import com.bsth.common.Constants; | |
| 6645 | +import com.bsth.common.ResponseCode; | |
| 6646 | +import com.bsth.controller.realcontrol.dto.ChangePersonCar; | |
| 6647 | +import com.bsth.controller.realcontrol.dto.DfsjChange; | |
| 6648 | +import com.bsth.controller.realcontrol.dto.LpData; | |
| 6649 | +import com.bsth.data.BasicData; | |
| 6650 | +import com.bsth.data.LineConfigData; | |
| 6651 | +import com.bsth.data.Station2ParkBuffer; | |
| 6652 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 6653 | +import com.bsth.data.schedule.SchAttrCalculator; | |
| 6654 | +import com.bsth.data.schedule.ScheduleComparator; | |
| 6655 | +import com.bsth.data.schedule.edit_logs.FormLogger; | |
| 6656 | +import com.bsth.data.schedule.edit_logs.ScheduleModifyLogger; | |
| 6657 | +import com.bsth.data.schedule.edit_logs.loggers.AfterwardsLogger; | |
| 6658 | +import com.bsth.data.schedule.edit_logs.loggers.FcxxwtLogger; | |
| 6659 | +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | |
| 6660 | +import com.bsth.data.schedule.late_adjust.LateAdjustHandle; | |
| 6661 | +import com.bsth.data.utils.CustomStringUtils; | |
| 6662 | +import com.bsth.entity.CarDevice; | |
| 6663 | +import com.bsth.entity.Cars; | |
| 6664 | +import com.bsth.entity.Line; | |
| 6665 | +import com.bsth.entity.Personnel; | |
| 6666 | +import com.bsth.entity.calc.CalcInterval; | |
| 6667 | +import com.bsth.entity.oil.Dlb; | |
| 6668 | +import com.bsth.entity.oil.Ylb; | |
| 6669 | +import com.bsth.entity.oil.Ylxxb; | |
| 6670 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | |
| 6671 | +import com.bsth.entity.realcontrol.LineConfig; | |
| 6672 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 6673 | +import com.bsth.entity.realcontrol.SvgAttribute; | |
| 6674 | +import com.bsth.entity.report.MileageReport; | |
| 6675 | +import com.bsth.entity.report.RepairReport; | |
| 6676 | +import com.bsth.entity.report.ScheduleCorrectionReport; | |
| 6677 | +import com.bsth.entity.schedule.CarConfigInfo; | |
| 6678 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | |
| 6679 | +import com.bsth.entity.schedule.GuideboardInfo; | |
| 6680 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 6681 | +import com.bsth.entity.sys.Dictionary; | |
| 6682 | +import com.bsth.entity.sys.DutyEmployee; | |
| 6683 | +import com.bsth.entity.sys.SysUser; | |
| 6684 | +import com.bsth.repository.CarDeviceRepository; | |
| 6685 | +import com.bsth.repository.CarsRepository; | |
| 6686 | +import com.bsth.repository.LineRepository; | |
| 6687 | +import com.bsth.repository.RepairReportRepository; | |
| 6688 | +import com.bsth.repository.calc.CalcIntervalRepository; | |
| 6689 | +import com.bsth.repository.oil.DlbRepository; | |
| 6690 | +import com.bsth.repository.oil.YlbRepository; | |
| 6691 | +import com.bsth.repository.oil.YlxxbRepository; | |
| 6692 | +import com.bsth.repository.realcontrol.ChildTaskPlanRepository; | |
| 6693 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | |
| 6694 | +import com.bsth.repository.realcontrol.SvgAttributeRepository; | |
| 6695 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | |
| 6696 | +import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | |
| 6697 | +import com.bsth.repository.schedule.GuideboardInfoRepository; | |
| 6698 | +import com.bsth.security.util.SecurityUtils; | |
| 6699 | +import com.bsth.service.LineService; | |
| 6700 | +import com.bsth.service.SectionRouteService; | |
| 6701 | +import com.bsth.service.directive.DirectiveService; | |
| 6702 | +import com.bsth.service.impl.BaseServiceImpl; | |
| 6703 | +import com.bsth.service.realcontrol.ScheduleRealInfoService; | |
| 6704 | +import com.bsth.service.report.CulateMileageService; | |
| 6705 | +import com.bsth.service.report.ReportService; | |
| 6706 | +import com.bsth.service.schedule.SchedulePlanInfoService; | |
| 6707 | +import com.bsth.service.sys.DictionaryService; | |
| 6708 | +import com.bsth.service.sys.DutyEmployeeService; | |
| 6709 | +import com.bsth.util.Arith; | |
| 6710 | +import com.bsth.util.ComparableChild; | |
| 6711 | +import com.bsth.util.ComparableLp; | |
| 6712 | +import com.bsth.util.ComparableReal; | |
| 6713 | +import com.bsth.util.ConfigUtil; | |
| 6714 | +import com.bsth.util.DateUtils; | |
| 6715 | +import com.bsth.util.ReportRelatedUtils; | |
| 6716 | +import com.bsth.util.ReportUtils; | |
| 6717 | +import com.bsth.util.TimeUtils; | |
| 6718 | +import com.bsth.util.TransGPS; | |
| 6719 | +import com.bsth.websocket.handler.SendUtils; | |
| 6720 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
| 6721 | +import com.github.stuxuhai.jpinyin.PinyinException; | |
| 6722 | +import com.github.stuxuhai.jpinyin.PinyinFormat; | |
| 6723 | +import com.github.stuxuhai.jpinyin.PinyinHelper; | |
| 6724 | +import com.google.common.base.Splitter; | |
| 6725 | +import com.google.common.collect.Lists; | |
| 6726 | + | |
| 6727 | +import javax.ws.rs.HEAD; | |
| 6728 | + | |
| 6729 | +@Service | |
| 6730 | +public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> | |
| 6731 | + implements ScheduleRealInfoService, InitializingBean, DisposableBean { | |
| 6732 | + @Autowired | |
| 6733 | + JdbcTemplate jdbcTemplate; | |
| 6734 | + @Autowired | |
| 6735 | + ScheduleRealInfoRepository scheduleRealInfoRepository; | |
| 6736 | + | |
| 6737 | + @Autowired | |
| 6738 | + EmployeeConfigInfoRepository employeeConfigInfoRepository; | |
| 6739 | + | |
| 6740 | + @Autowired | |
| 6741 | + CarConfigInfoRepository carConfigInfoRepository; | |
| 6742 | + | |
| 6743 | + @Autowired | |
| 6744 | + SectionRouteService sectionRouteService; | |
| 6745 | + | |
| 6746 | + @Autowired | |
| 6747 | + CulateMileageService culateMieageService; | |
| 6748 | + | |
| 6749 | + @Autowired | |
| 6750 | + DictionaryService dictionaryService; | |
| 6751 | + | |
| 6752 | + @Autowired | |
| 6753 | + CalcIntervalRepository calcIntervalRepository; | |
| 6754 | + /*@Autowired | |
| 6755 | + BorrowCenter borrowCenter;*/ | |
| 6756 | + | |
| 6757 | + @Autowired | |
| 6758 | + LineRepository lineRepository; | |
| 6759 | + @Autowired | |
| 6760 | + LineService lineService; | |
| 6761 | + @Autowired | |
| 6762 | + GuideboardInfoRepository guideboardInfoRepository; | |
| 6763 | + | |
| 6764 | + @Autowired | |
| 6765 | + ChildTaskPlanRepository cTaskPlanRepository; | |
| 6766 | + | |
| 6767 | + @Autowired | |
| 6768 | + SendUtils sendUtils; | |
| 6769 | + | |
| 6770 | + @Autowired | |
| 6771 | + DayOfSchedule dayOfSchedule; | |
| 6772 | + | |
| 6773 | + @Autowired | |
| 6774 | + SchAttrCalculator schAttrCalculator; | |
| 6775 | + | |
| 6776 | + @Autowired | |
| 6777 | + LineConfigData lineConfigData; | |
| 6778 | + | |
| 6779 | + @Autowired | |
| 6780 | + DutyEmployeeService dutyEmployeeService; | |
| 6781 | + | |
| 6782 | + @Autowired | |
| 6783 | + YlxxbRepository ylxxbRepository; | |
| 6784 | + | |
| 6785 | + @Autowired | |
| 6786 | + YlbRepository ylbRepository; | |
| 6787 | + | |
| 6788 | + @Autowired | |
| 6789 | + DlbRepository dlbRepository; | |
| 6790 | + | |
| 6791 | + @Autowired | |
| 6792 | + ReportService reposrService; | |
| 6793 | + | |
| 6794 | + @Autowired | |
| 6795 | + CulateMileageService culateService; | |
| 6796 | + | |
| 6797 | + @Autowired | |
| 6798 | + FormLogger schModifyLog; | |
| 6799 | + | |
| 6800 | + @Autowired | |
| 6801 | + DirectiveService directiveService; | |
| 6802 | + | |
| 6803 | + @Autowired | |
| 6804 | + CarDeviceRepository carDeviceRepository; | |
| 6805 | + | |
| 6806 | + @Autowired | |
| 6807 | + CarsRepository carsRepository; | |
| 6808 | + | |
| 6809 | + @Autowired | |
| 6810 | + RepairReportRepository repairReportRepository; | |
| 6811 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 6812 | + | |
| 6813 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 6814 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 6815 | + | |
| 6816 | + public static Map<String,String> DIRMAP ; // dvr电话 | |
| 6817 | + private Queue<RepairReport> queue = new ConcurrentLinkedQueue<>(); | |
| 6818 | + | |
| 6819 | + private ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { | |
| 6820 | + | |
| 6821 | + @Override | |
| 6822 | + public Thread newThread(Runnable r) { | |
| 6823 | + // TODO Auto-generated method stub | |
| 6824 | + Thread t = new Thread(r); | |
| 6825 | + t.setName("RepairReportReissuer"); | |
| 6826 | + | |
| 6827 | + return t; | |
| 6828 | + } | |
| 6829 | + }); | |
| 6830 | + | |
| 6831 | + | |
| 6832 | + | |
| 6833 | + private static Map<String, String> report2repair = new HashMap<String, String>(); | |
| 6834 | + | |
| 6835 | + static { | |
| 6836 | + report2repair.put("9101", "9109"); | |
| 6837 | + report2repair.put("9102", "9102"); | |
| 6838 | + report2repair.put("9103", "9103"); | |
| 6839 | + report2repair.put("9104", "9104"); | |
| 6840 | + report2repair.put("9109", "9109"); | |
| 6841 | + report2repair.put("9201", "9201"); | |
| 6842 | + report2repair.put("9202", "9202"); | |
| 6843 | + report2repair.put("9203", "9203"); | |
| 6844 | + report2repair.put("9204", "9204"); | |
| 6845 | + report2repair.put("9209", "9209"); | |
| 6846 | + report2repair.put("9301", "9301"); | |
| 6847 | + report2repair.put("9302", "9302"); | |
| 6848 | + report2repair.put("9303", "9303"); | |
| 6849 | + report2repair.put("9304", "9304"); | |
| 6850 | + report2repair.put("9305", "9305"); | |
| 6851 | + report2repair.put("9306", "9306"); | |
| 6852 | + report2repair.put("9309", "9309"); | |
| 6853 | + } | |
| 6854 | + | |
| 6855 | + | |
| 6856 | + /** | |
| 6857 | + * 校验人车 和 班次的公司和分公司归属 | |
| 6858 | + * | |
| 6859 | + * @param schId | |
| 6860 | + * @param jGh | |
| 6861 | + * @param sGh | |
| 6862 | + * @param nbbm | |
| 6863 | + * @return -2 跨营运公司,校验不过 | |
| 6864 | + * -1 跨分公司,二次确认 | |
| 6865 | + * 1 校验通过 | |
| 6866 | + */ | |
| 6867 | + @Override | |
| 6868 | + public Map<String, Object> checkPCFgsAscription(Long schId, String jGh, String sGh, String nbbm) { | |
| 6869 | + Map<String, Object> rs = new HashMap<>(); | |
| 6870 | + try { | |
| 6871 | + rs.put("status", ResponseCode.SUCCESS); | |
| 6872 | + rs.put("checkStatus", -2); | |
| 6873 | + | |
| 6874 | + String msg = null; | |
| 6875 | + ScheduleRealInfo sch = dayOfSchedule.get(schId); | |
| 6876 | + String gsbm = sch.getGsBm(), fgsbm = sch.getFgsBm(); | |
| 6877 | + | |
| 6878 | + if (nbbm != null && !carExist(gsbm, nbbm)) { | |
| 6879 | + msg = sch.getGsName() + "没有自编号为" + "[" + nbbm + "]的车辆"; | |
| 6880 | + rs.put("msg", msg); | |
| 6881 | + return rs; | |
| 6882 | + } | |
| 6883 | + | |
| 6884 | + if (nbbm != null && !sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(nbbm))) { | |
| 6885 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + nbbm + "】的车辆"); | |
| 6886 | + return rs; | |
| 6887 | + } | |
| 6888 | + | |
| 6889 | + if (nbbm != null && !(fgsbm + "_" + gsbm).equals(BasicData.nbbm2FgsCompanyCodeMap.get(nbbm))) { | |
| 6890 | + | |
| 6891 | + String clFgsName = BasicData.businessFgsCodeNameMap.get(BasicData.nbbm2FgsCompanyCodeMap.get(nbbm)); | |
| 6892 | + | |
| 6893 | + msg = ("【" + nbbm + "】" + "是" + clFgsName + "的车辆!"); | |
| 6894 | + rs.put("msg", msg); | |
| 6895 | + rs.put("checkStatus", -1); | |
| 6896 | + return rs; | |
| 6897 | + } | |
| 6898 | + | |
| 6899 | + if(null != jGh && !"/".equals(StringUtils.trim(jGh))){ | |
| 6900 | + Personnel jsy = BasicData.perMap.get(gsbm + "-" + jGh); | |
| 6901 | + | |
| 6902 | + if (null == jsy) { | |
| 6903 | + msg = "【驾驶员】:" + sch.getGsName() + "暂无工号为" + "【" + jGh + "】的人员"; | |
| 6904 | + rs.put("msg", msg); | |
| 6905 | + return rs; | |
| 6906 | + } | |
| 6907 | + else if (!fgsbm.equals(jsy.getBrancheCompanyCode())) { | |
| 6908 | + //校验分公司 | |
| 6909 | + msg = ("【驾驶员】:" + jGh + "/" + jsy.getPersonnelName() + "是" + jsy.getBrancheCompany() + "的人员"); | |
| 6910 | + rs.put("msg", msg); | |
| 6911 | + rs.put("checkStatus", -1); | |
| 6912 | + return rs; | |
| 6913 | + } | |
| 6914 | + } | |
| 6915 | + | |
| 6916 | + if (null != sGh && !"/".equals(StringUtils.trim(sGh))) { | |
| 6917 | + Personnel spy = BasicData.perMap.get(gsbm + "-" + sGh); | |
| 6918 | + if (null == spy) { | |
| 6919 | + msg = "【售票员】: " + sch.getGsName() + "暂无工号为" + "【" + sGh + "】的人员"; | |
| 6920 | + rs.put("msg", msg); | |
| 6921 | + return rs; | |
| 6922 | + } | |
| 6923 | + else if (!fgsbm.equals(spy.getBrancheCompanyCode())) { | |
| 6924 | + msg = ("【售票员】: " + sGh + "/" + spy.getPersonnelName() + "是" + spy.getBrancheCompany() + "的人员"); | |
| 6925 | + rs.put("msg", msg); | |
| 6926 | + rs.put("checkStatus", -1); | |
| 6927 | + return rs; | |
| 6928 | + } | |
| 6929 | + } | |
| 6930 | + | |
| 6931 | + rs.put("checkStatus", 1); | |
| 6932 | + } catch (Exception e) { | |
| 6933 | + logger.error("", e); | |
| 6934 | + rs.put("status", ResponseCode.ERROR); | |
| 6935 | + } | |
| 6936 | + return rs; | |
| 6937 | + } | |
| 6938 | + | |
| 6939 | + | |
| 6940 | + /** | |
| 6941 | + * 车辆是否存在 | |
| 6942 | + * | |
| 6943 | + * @param gsbm 公司编码 | |
| 6944 | + * @param nbbm 车辆自编号 | |
| 6945 | + * @return | |
| 6946 | + */ | |
| 6947 | + private boolean carExist(String gsbm, String nbbm) { | |
| 6948 | + return BasicData.nbbm2CompanyCodeMap.containsKey(nbbm); | |
| 6949 | + } | |
| 6950 | + | |
| 6951 | + /** | |
| 6952 | + * 获取人员姓名 | |
| 6953 | + * | |
| 6954 | + * @param gsbm 公司编码 | |
| 6955 | + * @param gh 人员工号 | |
| 6956 | + * @return | |
| 6957 | + */ | |
| 6958 | + private String getPersonName(String gsbm, String gh) { | |
| 6959 | + return BasicData.allPerson.get(gsbm + '-' + gh); | |
| 6960 | + } | |
| 6961 | + | |
| 6962 | + @Override | |
| 6963 | + public Iterable<ScheduleRealInfo> list(Map<String, Object> map) { | |
| 6964 | + Iterator<ScheduleRealInfo> iterator = super.list(map).iterator(); | |
| 6965 | + Set<ScheduleRealInfo> set = new HashSet<>(100); | |
| 6966 | + | |
| 6967 | + DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 6968 | + //计算时间戳 | |
| 6969 | + ScheduleRealInfo sch; | |
| 6970 | + while (iterator.hasNext()) { | |
| 6971 | + sch = iterator.next(); | |
| 6972 | + //待发时间戳 | |
| 6973 | + sch.setDfsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getDfsj())); | |
| 6974 | + //实发时间戳 | |
| 6975 | + if (StringUtils.isNotEmpty(sch.getFcsjActual())) { | |
| 6976 | + sch.setFcsjActualTime(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsjActual())); | |
| 6977 | + } | |
| 6978 | + set.add(sch); | |
| 6979 | + } | |
| 6980 | + return set; | |
| 6981 | + } | |
| 6982 | + | |
| 6983 | + @Override | |
| 6984 | + public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { | |
| 6985 | + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); | |
| 6986 | + | |
| 6987 | + /*Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create(); | |
| 6988 | + | |
| 6989 | + for (String lineCode : lineList) { | |
| 6990 | + mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode)); | |
| 6991 | + }*/ | |
| 6992 | + return dayOfSchedule.findByLineCodes(lineList); | |
| 6993 | + } | |
| 6994 | + | |
| 6995 | + private final static long DAY_TIME = 1000 * 60 * 60 * 24L; | |
| 6996 | + | |
| 6997 | + private static int BUF_SIZE = 1024; | |
| 6998 | + | |
| 6999 | + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 7000 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | |
| 7001 | + | |
| 7002 | + @Override | |
| 7003 | + public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType, String opType, String userId) { | |
| 7004 | + Map<String, Object> map = new HashMap<>(); | |
| 7005 | + try { | |
| 7006 | + | |
| 7007 | + ScheduleRealInfo schedule = dayOfSchedule.get(id); | |
| 7008 | + | |
| 7009 | + if (schedule.getStatus() > 0) { | |
| 7010 | + map.put("status", ResponseCode.SUCCESS); | |
| 7011 | + map.put("flag", "4008"); | |
| 7012 | + map.put("t", schedule); | |
| 7013 | + return map; | |
| 7014 | + } | |
| 7015 | + | |
| 7016 | + LineConfig config = lineConfigData.get(schedule.getXlBm()); | |
| 7017 | + //小于线路开始运营时间,则默认跨过24点 | |
| 7018 | + if (dfsj.compareTo(config.getStartOpt()) < 0) { | |
| 7019 | + schedule.setRealExecDate(fmtyyyyMMdd.print(schedule.getScheduleDate().getTime() + DAY_TIME)); | |
| 7020 | + } else { | |
| 7021 | + schedule.setRealExecDate(schedule.getScheduleDateStr()); | |
| 7022 | + } | |
| 7023 | + | |
| 7024 | + //记录日志 | |
| 7025 | + ScheduleModifyLogger.dftz(schedule, opType, schedule.getDfsj(), dfsj, remarks, userId); | |
| 7026 | + | |
| 7027 | + schedule.setDfsjAll(dfsj); | |
| 7028 | + schedule.setDfAuto(false); | |
| 7029 | + if ("1".equals(opType)) | |
| 7030 | + schedule.setRemarks(remarks); | |
| 7031 | + | |
| 7032 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 7033 | + ts.add(schedule); | |
| 7034 | + //调整终点时间和下一个班次的应到时间 | |
| 7035 | + //schedule.calcEndTime(); | |
| 7036 | + /*ScheduleRealInfo nextSch = dayOfSchedule.nextByLp2(schedule); | |
| 7037 | + if (null != nextSch) { | |
| 7038 | + nextSch.setQdzArrDatejh(schedule.getZdsj()); | |
| 7039 | + ts.add(nextSch); | |
| 7040 | + }*/ | |
| 7041 | + | |
| 7042 | + //调整班次类型 | |
| 7043 | + if (StringUtils.isNotEmpty(bcType) && !bcType.equals(schedule.getBcType())) { | |
| 7044 | + if ((schedule.getBcType().equals("major") | |
| 7045 | + || schedule.getBcType().equals("venting")) | |
| 7046 | + && bcType.equals("normal")) { | |
| 7047 | + //清空备注 | |
| 7048 | + schedule.setRemarks(""); | |
| 7049 | + } | |
| 7050 | + schedule.setBcType(bcType); | |
| 7051 | + } | |
| 7052 | + | |
| 7053 | + //如果正在执行该班次 | |
| 7054 | + //ScheduleRealInfo exec = dayOfSchedule.executeCurr(schedule.getClZbh()); | |
| 7055 | + //if(exec != null && exec == schedule){ | |
| 7056 | + //重新计算正在执行班次 | |
| 7057 | + dayOfSchedule.reCalcExecPlan(schedule.getClZbh()); | |
| 7058 | + //} | |
| 7059 | + | |
| 7060 | + //重新计算是否误点 | |
| 7061 | + schedule.reCalcLate(); | |
| 7062 | + //取消应发未到标记,不再自动调整待发 | |
| 7063 | + //if(schedule.isLate2()){ | |
| 7064 | + // schedule.setLate2(false); | |
| 7065 | + //LateAdjustHandle.remove(schedule); | |
| 7066 | + //} | |
| 7067 | + | |
| 7068 | + try { | |
| 7069 | + if (!schedule.getDirectiveState().equals(-1) && schedule.getStatus() == 0) { | |
| 7070 | + //重新下发调度指令 | |
| 7071 | + directiveService.send60Dispatch(schedule.getId(), "待发@系统"); | |
| 7072 | + } | |
| 7073 | + } catch (Exception e) { | |
| 7074 | + logger.error("", e); | |
| 7075 | + } | |
| 7076 | + | |
| 7077 | + // 持久化到数据库 | |
| 7078 | + dayOfSchedule.save(schedule); | |
| 7079 | + | |
| 7080 | + map.put("status", ResponseCode.SUCCESS); | |
| 7081 | + map.put("ts", ts); | |
| 7082 | + } catch (Exception e) { | |
| 7083 | + logger.error("", e); | |
| 7084 | + map.put("status", ResponseCode.ERROR); | |
| 7085 | + } | |
| 7086 | + return map; | |
| 7087 | + } | |
| 7088 | + | |
| 7089 | + @Override | |
| 7090 | + public Map<String, Object> destroy(String idsStr, String remarks, String reason, String userId) { | |
| 7091 | + | |
| 7092 | + Map<String, Object> map = new HashMap<>(); | |
| 7093 | + List<ScheduleRealInfo> rsList = new ArrayList<>(); | |
| 7094 | + map.put("ts", rsList); | |
| 7095 | + try { | |
| 7096 | + List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr)); | |
| 7097 | + | |
| 7098 | + ScheduleRealInfo schedule = null; | |
| 7099 | + for (String id : idList) { | |
| 7100 | + schedule = dayOfSchedule.get(Long.parseLong(id)); | |
| 7101 | + if (schedule.isDestroy()) { | |
| 7102 | + map.put("status", ResponseCode.ERROR); | |
| 7103 | + map.put("msg", "不必要的重复烂班!"); | |
| 7104 | + return map; | |
| 7105 | + } | |
| 7106 | + //记录日志 | |
| 7107 | + ScheduleModifyLogger.jhlb(schedule, remarks, userId); | |
| 7108 | + | |
| 7109 | + schedule.setAdjustExps(reason); | |
| 7110 | + schedule.destroy(); | |
| 7111 | + schedule.addRemarks(remarks); | |
| 7112 | + | |
| 7113 | + dayOfSchedule.save(schedule); | |
| 7114 | + rsList.add(schedule); | |
| 7115 | + } | |
| 7116 | + | |
| 7117 | + //重新计算当前执行班次 | |
| 7118 | + dayOfSchedule.reCalcExecPlan(schedule.getClZbh()); | |
| 7119 | + | |
| 7120 | + map.put("status", ResponseCode.SUCCESS); | |
| 7121 | + } catch (Exception e) { | |
| 7122 | + logger.error("", e); | |
| 7123 | + map.put("status", ResponseCode.ERROR); | |
| 7124 | + } | |
| 7125 | + return map; | |
| 7126 | + } | |
| 7127 | + | |
| 7128 | + // 线路id获取驾驶员 | |
| 7129 | + @Override | |
| 7130 | + public List<Map<String, String>> findDriverByLine(String lineCode) { | |
| 7131 | + List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode); | |
| 7132 | + | |
| 7133 | + List<Map<String, String>> rsList = new ArrayList<>(); | |
| 7134 | + Map<String, String> map = null; | |
| 7135 | + Personnel driver = null; | |
| 7136 | + String code = null; | |
| 7137 | + | |
| 7138 | + for (EmployeeConfigInfo employee : list) { | |
| 7139 | + driver = employee.getJsy(); | |
| 7140 | + if (driver != null) { | |
| 7141 | + map = new HashMap<>(); | |
| 7142 | + code = driver.getJobCode(); | |
| 7143 | + map.put("id", code + "/" + driver.getPersonnelName()); | |
| 7144 | + map.put("text", code + "/" + driver.getPersonnelName()); | |
| 7145 | + rsList.add(map); | |
| 7146 | + } | |
| 7147 | + } | |
| 7148 | + return rsList; | |
| 7149 | + } | |
| 7150 | + | |
| 7151 | + // 线路id获取售票员 | |
| 7152 | + @Override | |
| 7153 | + public List<Map<String, String>> findConductorByLine(String lineCode) { | |
| 7154 | + List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode); | |
| 7155 | + | |
| 7156 | + List<Map<String, String>> rsList = new ArrayList<>(); | |
| 7157 | + Map<String, String> map = null; | |
| 7158 | + Personnel conductor = null; | |
| 7159 | + String code = null; | |
| 7160 | + | |
| 7161 | + for (EmployeeConfigInfo employee : list) { | |
| 7162 | + conductor = employee.getSpy(); | |
| 7163 | + if (conductor != null) { | |
| 7164 | + code = conductor.getJobCode(); | |
| 7165 | + map = new HashMap<>(); | |
| 7166 | + map.put("id", code + "/" + conductor.getPersonnelName()); | |
| 7167 | + map.put("text", code + "/" + conductor.getPersonnelName()); | |
| 7168 | + rsList.add(map); | |
| 7169 | + } | |
| 7170 | + } | |
| 7171 | + return rsList; | |
| 7172 | + } | |
| 7173 | + | |
| 7174 | + @Override | |
| 7175 | + public List<Map<String, String>> findCarByLine(String lineCode) { | |
| 7176 | + | |
| 7177 | + List<CarConfigInfo> list = carConfigInfoRepository.findBylineCode(lineCode); | |
| 7178 | + | |
| 7179 | + List<Map<String, String>> rsList = new ArrayList<>(); | |
| 7180 | + Map<String, String> map = null; | |
| 7181 | + Cars car = null; | |
| 7182 | + String code = null; | |
| 7183 | + | |
| 7184 | + for (CarConfigInfo cci : list) { | |
| 7185 | + car = cci.getCl(); | |
| 7186 | + if (car != null) { | |
| 7187 | + code = car.getInsideCode(); | |
| 7188 | + map = new HashMap<>(); | |
| 7189 | + map.put("id", code); | |
| 7190 | + map.put("text", code); | |
| 7191 | + rsList.add(map); | |
| 7192 | + } | |
| 7193 | + } | |
| 7194 | + return rsList; | |
| 7195 | + } | |
| 7196 | + | |
| 7197 | + /** | |
| 7198 | + * 添加到历史库 | |
| 7199 | + * | |
| 7200 | + * @param t | |
| 7201 | + * @return | |
| 7202 | + */ | |
| 7203 | + @Override | |
| 7204 | + public Map<String, Object> addToHistory(ScheduleRealInfo t) { | |
| 7205 | + Map<String, Object> rs = new HashMap<>(); | |
| 7206 | + try { | |
| 7207 | + if (!carExist(t.getGsBm(), t.getClZbh())) { | |
| 7208 | + rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | |
| 7209 | + rs.put("status", ResponseCode.ERROR); | |
| 7210 | + return rs; | |
| 7211 | + } | |
| 7212 | + | |
| 7213 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 7214 | + //String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm()); | |
| 7215 | + | |
| 7216 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 7217 | + | |
| 7218 | + if (StringUtils.isEmpty(t.getjGh())) { | |
| 7219 | + rs.put("status", ResponseCode.ERROR); | |
| 7220 | + rs.put("msg", "驾驶员工号不能为空!"); | |
| 7221 | + return rs; | |
| 7222 | + } | |
| 7223 | + //截取驾驶员工号 | |
| 7224 | + if (t.getjGh().indexOf("-") != -1) { | |
| 7225 | + t.setjGh(t.getjGh().split("-")[1]); | |
| 7226 | + } | |
| 7227 | + //检查驾驶员工号 | |
| 7228 | + String jName = getPersonName(t.getGsBm(), t.getjGh()); | |
| 7229 | + if (StringUtils.isEmpty(jName)) { | |
| 7230 | + rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的驾驶员"); | |
| 7231 | + rs.put("status", ResponseCode.ERROR); | |
| 7232 | + return rs; | |
| 7233 | + } else if (StringUtils.isEmpty(t.getjName())) { | |
| 7234 | + t.setjName(jName);//补上驾驶员名称 | |
| 7235 | + } | |
| 7236 | + | |
| 7237 | + //有售票员 | |
| 7238 | + if (StringUtils.isNotEmpty(t.getsGh())) { | |
| 7239 | + String sName = getPersonName(t.getGsBm(), t.getsGh()); | |
| 7240 | + if (StringUtils.isEmpty(sName)) { | |
| 7241 | + rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的售票员"); | |
| 7242 | + rs.put("status", ResponseCode.ERROR); | |
| 7243 | + return rs; | |
| 7244 | + } else if (StringUtils.isEmpty(t.getsName())) { | |
| 7245 | + t.setsName(sName);//补上售票员名称 | |
| 7246 | + } | |
| 7247 | + } else { | |
| 7248 | + t.setsGh(""); | |
| 7249 | + t.setsName(""); | |
| 7250 | + } | |
| 7251 | + | |
| 7252 | + //公司 和 分公司名称 | |
| 7253 | + t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm())); | |
| 7254 | + t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getFgsBm()+ "_" + t.getGsBm() )); | |
| 7255 | + | |
| 7256 | + //t.setScheduleDateStr(schDate); | |
| 7257 | + t.setScheduleDate(sdfyyyyMMdd.parse(t.getScheduleDateStr())); | |
| 7258 | + t.setRealExecDate(t.getScheduleDateStr()); | |
| 7259 | + t.setCreateBy(user); | |
| 7260 | + t.setSflj(true); | |
| 7261 | + t.setLate(false); | |
| 7262 | + t.setDfsj(t.getFcsj()); | |
| 7263 | + t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime()); | |
| 7264 | + t.setJhlcOrig(t.getJhlc()); | |
| 7265 | + | |
| 7266 | + //班次历时 | |
| 7267 | + t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60); | |
| 7268 | + | |
| 7269 | + //起终点名称 | |
| 7270 | + String prefix = t.getXlBm() + "_" + t.getXlDir() + "_"; | |
| 7271 | + t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix)); | |
| 7272 | + t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix)); | |
| 7273 | + | |
| 7274 | + //计算班次实际执行时间 | |
| 7275 | + schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t); | |
| 7276 | + //处理计达跨24点 | |
| 7277 | + LineConfig conf = lineConfigData.get(t.getXlBm()); | |
| 7278 | + if (t.getZdsj().compareTo(conf.getStartOpt()) < 0) { | |
| 7279 | + t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | |
| 7280 | + } | |
| 7281 | + if (t.getZdsjT() < t.getFcsjT()) { | |
| 7282 | + rs.put("status", ResponseCode.ERROR); | |
| 7283 | + rs.put("msg", "起终点时间异常!"); | |
| 7284 | + return rs; | |
| 7285 | + } | |
| 7286 | + | |
| 7287 | + t.setId(dayOfSchedule.getId()); | |
| 7288 | + //实时入库 | |
| 7289 | + rs = super.save(t); | |
| 7290 | + } catch (Exception e) { | |
| 7291 | + logger.error("", e); | |
| 7292 | + rs.put("status", ResponseCode.ERROR); | |
| 7293 | + } | |
| 7294 | + return rs; | |
| 7295 | + } | |
| 7296 | + | |
| 7297 | + | |
| 7298 | + /** | |
| 7299 | + * 临加班次 | |
| 7300 | + */ | |
| 7301 | + @Override | |
| 7302 | + public Map<String, Object> save(ScheduleRealInfo sch) { | |
| 7303 | + Map<String, Object> rs = new HashMap<>(); | |
| 7304 | + try { | |
| 7305 | + String clZbh = sch.getClZbh(); | |
| 7306 | + if (StringUtils.isNotEmpty(clZbh)) { | |
| 7307 | + //检测 | |
| 7308 | + if (!carExist(sch.getGsBm(), clZbh)) { | |
| 7309 | + rs.put("status", ResponseCode.ERROR); | |
| 7310 | + rs.put("msg", "车辆 " + clZbh + " 不存在!"); | |
| 7311 | + return rs; | |
| 7312 | + } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(clZbh))) { | |
| 7313 | + rs.put("status", ResponseCode.ERROR); | |
| 7314 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + clZbh + "】的车辆"); | |
| 7315 | + return rs; | |
| 7316 | + } | |
| 7317 | + } | |
| 7318 | + | |
| 7319 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 7320 | + String schDate = DayOfSchedule.currSchDateMap.get(sch.getXlBm()); | |
| 7321 | + | |
| 7322 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 7323 | + | |
| 7324 | + if (StringUtils.isEmpty(sch.getjGh())) { | |
| 7325 | + rs.put("status", ResponseCode.ERROR); | |
| 7326 | + rs.put("msg", "驾驶员工号不能为空!"); | |
| 7327 | + return rs; | |
| 7328 | + } | |
| 7329 | + //截取驾驶员工号 | |
| 7330 | + if (sch.getjGh().indexOf("-") != -1) { | |
| 7331 | + sch.setjGh(sch.getjGh().split("-")[1]); | |
| 7332 | + } | |
| 7333 | + //检查驾驶员工号 | |
| 7334 | + String jName = getPersonName(sch.getGsBm(), sch.getjGh()); | |
| 7335 | + if (StringUtils.isEmpty(jName)) { | |
| 7336 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员"); | |
| 7337 | + rs.put("status", ResponseCode.ERROR); | |
| 7338 | + return rs; | |
| 7339 | + } else if (StringUtils.isEmpty(sch.getjName())) { | |
| 7340 | + sch.setjName(jName);//补上驾驶员名称 | |
| 7341 | + } | |
| 7342 | + | |
| 7343 | + //有售票员 | |
| 7344 | + if (StringUtils.isNotEmpty(sch.getsGh())) { | |
| 7345 | + String sName = getPersonName(sch.getGsBm(), sch.getsGh()); | |
| 7346 | + if (StringUtils.isEmpty(sName)) { | |
| 7347 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的售票员"); | |
| 7348 | + rs.put("status", ResponseCode.ERROR); | |
| 7349 | + return rs; | |
| 7350 | + } else if (StringUtils.isEmpty(sch.getsName())) { | |
| 7351 | + sch.setsName(sName);//补上售票员名称 | |
| 7352 | + } | |
| 7353 | + } else { | |
| 7354 | + sch.setsGh(""); | |
| 7355 | + sch.setsName(""); | |
| 7356 | + } | |
| 7357 | + | |
| 7358 | + //公司 和 分公司名称 | |
| 7359 | + sch.setGsName(BasicData.businessCodeNameMap.get(sch.getGsBm())); | |
| 7360 | + sch.setFgsName(BasicData.businessFgsCodeNameMap.get(sch.getFgsBm() + "_" + sch.getGsBm())); | |
| 7361 | + sch.setCreateDate(new Date()); | |
| 7362 | + sch.setScheduleDateStr(schDate); | |
| 7363 | + sch.setScheduleDate(sdfyyyyMMdd.parse(schDate)); | |
| 7364 | + sch.setRealExecDate(schDate); | |
| 7365 | + | |
| 7366 | + sch.setCreateBy(user); | |
| 7367 | + sch.setSflj(true); | |
| 7368 | + sch.setLate(false); | |
| 7369 | + sch.setDfsj(sch.getFcsj()); | |
| 7370 | + sch.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + sch.getZdsj()).getTime()); | |
| 7371 | + sch.setJhlcOrig(sch.getJhlc()); | |
| 7372 | + sch.setCreateDate(new Date()); | |
| 7373 | + sch.setUpdateDate(new Date()); | |
| 7374 | + sch.setSpId(-1L); | |
| 7375 | + //起终点名称 | |
| 7376 | + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_"; | |
| 7377 | + sch.setQdzName(BasicData.getStationNameByCode(sch.getQdzCode(), prefix)); | |
| 7378 | + sch.setZdzName(BasicData.getStationNameByCode(sch.getZdzCode(), prefix)); | |
| 7379 | + | |
| 7380 | + //计算班次实际执行时间 | |
| 7381 | + schAttrCalculator.calcRealDate(sch).calcAllTimeByFcsj(sch); | |
| 7382 | + | |
| 7383 | + //处理计达跨24点 | |
| 7384 | + LineConfig conf = lineConfigData.get(sch.getXlBm()); | |
| 7385 | + if (sch.getZdsj().compareTo(conf.getStartOpt()) < 0) { | |
| 7386 | + sch.setZdsjT(sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + sch.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | |
| 7387 | + } | |
| 7388 | + | |
| 7389 | + //班次历时 | |
| 7390 | + sch.setBcsj((int) ((sch.getZdsjT() - sch.getDfsjT()) / 1000 / 60)); | |
| 7391 | + if (sch.getZdsjT() < sch.getFcsjT()) { | |
| 7392 | + rs.put("status", ResponseCode.ERROR); | |
| 7393 | + rs.put("msg", "起终点时间异常!"); | |
| 7394 | + return rs; | |
| 7395 | + } | |
| 7396 | + | |
| 7397 | + sch.setId(dayOfSchedule.getId()); | |
| 7398 | + //实时入库 | |
| 7399 | + super.save(sch); | |
| 7400 | + | |
| 7401 | + // 加入缓存 | |
| 7402 | + dayOfSchedule.put(sch); | |
| 7403 | + | |
| 7404 | + //更新起点应到时间 | |
| 7405 | + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch); | |
| 7406 | + | |
| 7407 | + //重新计算车辆当前执行班次 | |
| 7408 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 7409 | + | |
| 7410 | + //记录站到场历时数据 | |
| 7411 | + Station2ParkBuffer.put(sch); | |
| 7412 | + | |
| 7413 | + rs.put("ts", ts); | |
| 7414 | + rs.put("t", sch); | |
| 7415 | + } catch (Exception e) { | |
| 7416 | + logger.error("", e); | |
| 7417 | + rs.put("status", ResponseCode.ERROR); | |
| 7418 | + } | |
| 7419 | + return rs; | |
| 7420 | + } | |
| 7421 | + | |
| 7422 | + /** | |
| 7423 | + * 删除历史表临加班次 | |
| 7424 | + * | |
| 7425 | + * @param id | |
| 7426 | + * @return | |
| 7427 | + */ | |
| 7428 | + @Override | |
| 7429 | + public Map<String, Object> deleteToHistory(Long id) { | |
| 7430 | + Map<String, Object> rs = new HashMap<>(); | |
| 7431 | + rs.put("status", ResponseCode.ERROR); | |
| 7432 | + | |
| 7433 | + try { | |
| 7434 | + ScheduleRealInfo sch = super.findById(id); | |
| 7435 | + if (sch == null) { | |
| 7436 | + rs.put("msg", "无效的id号"); | |
| 7437 | + return rs; | |
| 7438 | + } | |
| 7439 | + | |
| 7440 | + if (!sch.isSflj()) { | |
| 7441 | + rs.put("msg", "你只能删除临加班次"); | |
| 7442 | + return rs; | |
| 7443 | + } | |
| 7444 | + | |
| 7445 | + //解除和调度指令的外键约束 | |
| 7446 | + jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id); | |
| 7447 | + | |
| 7448 | + //数据库删除 | |
| 7449 | + rs = super.delete(id); | |
| 7450 | + } catch (Exception e) { | |
| 7451 | + logger.error("", e); | |
| 7452 | + rs.put("msg", e.getMessage()); | |
| 7453 | + } | |
| 7454 | + | |
| 7455 | + return rs; | |
| 7456 | + } | |
| 7457 | + | |
| 7458 | + @Override | |
| 7459 | + public Map<String, Object> delete(Long id) { | |
| 7460 | + Map<String, Object> rs = new HashMap<>(); | |
| 7461 | + rs.put("status", ResponseCode.ERROR); | |
| 7462 | + | |
| 7463 | + ScheduleRealInfo sch = null; | |
| 7464 | + try { | |
| 7465 | + sch = dayOfSchedule.get(id); | |
| 7466 | + if (sch == null) { | |
| 7467 | + rs.put("msg", "无效的id号"); | |
| 7468 | + return rs; | |
| 7469 | + } | |
| 7470 | + | |
| 7471 | + if (!sch.isSflj()) { | |
| 7472 | + rs.put("msg", "你只能删除临加班次"); | |
| 7473 | + return rs; | |
| 7474 | + } | |
| 7475 | + | |
| 7476 | + sch.setDeleted(true); | |
| 7477 | + //解除和调度指令的外键约束 | |
| 7478 | + jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id); | |
| 7479 | + | |
| 7480 | + //数据库删除 | |
| 7481 | + rs = super.delete(id); | |
| 7482 | + if (rs.get("status").equals(ResponseCode.SUCCESS)) { | |
| 7483 | + dayOfSchedule.delete(sch); | |
| 7484 | + //更新起点应到时间 | |
| 7485 | + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch); | |
| 7486 | + rs.put("ts", ts); | |
| 7487 | + rs.put("delete", sch); | |
| 7488 | + } else | |
| 7489 | + sch.setDeleted(false); | |
| 7490 | + } catch (Exception e) { | |
| 7491 | + logger.error("", e); | |
| 7492 | + rs.put("msg", e.getMessage()); | |
| 7493 | + sch.setDeleted(false); | |
| 7494 | + } | |
| 7495 | + | |
| 7496 | + return rs; | |
| 7497 | + } | |
| 7498 | + | |
| 7499 | + @Override | |
| 7500 | + public List<Map<String, String>> sreachVehic(String nbbm) { | |
| 7501 | + // 转大写 | |
| 7502 | + nbbm = nbbm.toUpperCase(); | |
| 7503 | + | |
| 7504 | + List<Map<String, String>> list = new ArrayList<>(); | |
| 7505 | + Map<String, String> map; | |
| 7506 | + Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet(); | |
| 7507 | + | |
| 7508 | + Line line; | |
| 7509 | + for (String k : allSet) { | |
| 7510 | + if (k.indexOf(nbbm) != -1) { | |
| 7511 | + // 所属线路 | |
| 7512 | + map = new HashMap<>(); | |
| 7513 | + line = BasicData.nbbm2LineMap.get(k); | |
| 7514 | + map.put("id", k); | |
| 7515 | + map.put("text", k); | |
| 7516 | + if (null != line) { | |
| 7517 | + map.put("lineName", line.getName()); | |
| 7518 | + map.put("lineCode", line.getLineCode()); | |
| 7519 | + } | |
| 7520 | + | |
| 7521 | + list.add(map); | |
| 7522 | + } | |
| 7523 | + | |
| 7524 | + if (list.size() > 20) | |
| 7525 | + break; | |
| 7526 | + } | |
| 7527 | + return list; | |
| 7528 | + } | |
| 7529 | + | |
| 7530 | + @Override | |
| 7531 | + public void adjustCar(ScheduleRealInfo schedule, String car) { | |
| 7532 | + schedule.setClZbh(car); | |
| 7533 | + } | |
| 7534 | + | |
| 7535 | + @Override | |
| 7536 | + public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) { | |
| 7537 | + if (driver.indexOf("-") != -1) | |
| 7538 | + driver = driver.split("-")[1]; | |
| 7539 | + schedule.setjGh(driver); | |
| 7540 | + schedule.setjName(driverName); | |
| 7541 | + } | |
| 7542 | + | |
| 7543 | + @Override | |
| 7544 | + public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) { | |
| 7545 | + if (conductor.indexOf("-") != -1) | |
| 7546 | + conductor = conductor.split("-")[1]; | |
| 7547 | + schedule.setsGh(conductor); | |
| 7548 | + schedule.setsName(conductorName); | |
| 7549 | + } | |
| 7550 | + | |
| 7551 | + @Override | |
| 7552 | + public List<ScheduleRealInfo> queryUserInfo(String line, String date, String state) { | |
| 7553 | + List<ScheduleRealInfo> scheduleRealInfos = new ArrayList<>(); | |
| 7554 | + List<Object[]> objects = null; | |
| 7555 | + if (state.equals("2")) { | |
| 7556 | + objects = scheduleRealInfoRepository.queryUserInfo2(line, date); | |
| 7557 | + for (Object[] objs : objects) { | |
| 7558 | + ScheduleRealInfo scheduleRealInfo = new ScheduleRealInfo(); | |
| 7559 | + scheduleRealInfo.setId((Long)objs[0]); | |
| 7560 | + scheduleRealInfo.setjGh((String)objs[1]); | |
| 7561 | + scheduleRealInfo.setClZbh((String)objs[2]); | |
| 7562 | + scheduleRealInfo.setLpName((String)objs[3]); | |
| 7563 | + scheduleRealInfo.setjName((String)objs[4]); | |
| 7564 | + | |
| 7565 | + scheduleRealInfos.add(scheduleRealInfo); | |
| 7566 | + } | |
| 7567 | + } else { | |
| 7568 | + objects = scheduleRealInfoRepository.queryUserInfo3(line, date); | |
| 7569 | + for (Object[] objs : objects) { | |
| 7570 | + ScheduleRealInfo scheduleRealInfo = new ScheduleRealInfo(); | |
| 7571 | + scheduleRealInfo.setId((Long)objs[0]); | |
| 7572 | + scheduleRealInfo.setClZbh((String)objs[1]); | |
| 7573 | + | |
| 7574 | + scheduleRealInfos.add(scheduleRealInfo); | |
| 7575 | + } | |
| 7576 | + } | |
| 7577 | + | |
| 7578 | + return scheduleRealInfos; | |
| 7579 | + } | |
| 7580 | + | |
| 7581 | + @Override | |
| 7582 | + public List<ScheduleRealInfo> queryUserInfoPx(String line, String date, String state, String type) { | |
| 7583 | +// List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | |
| 7584 | + state = state + ""; | |
| 7585 | + String lpname = state; | |
| 7586 | + String px = type; | |
| 7587 | + if (state.equals("lpName")) { | |
| 7588 | + state = state + "+1"; | |
| 7589 | + type = "ASC"; | |
| 7590 | + } | |
| 7591 | + String minfcsj = "02:00"; | |
| 7592 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 7593 | + if (lineList.size() > 0) { | |
| 7594 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 7595 | + + " id = (" | |
| 7596 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 7597 | + + ")"; | |
| 7598 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 7599 | + } | |
| 7600 | + String sqlPlan = "select * from (select * from (" | |
| 7601 | + + " select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, " | |
| 7602 | + + " s.lp_Name as lpName,min(s.j_Name) as jName,max(s.schedule_date_str) as dateStr ," | |
| 7603 | + + " min(s.fcsj) as fcsj,1 as px from bsth_c_s_sp_info_real s where " | |
| 7604 | + + " s.xl_Bm = '" + line + "' and s.schedule_date_str ='" + date + "'" | |
| 7605 | + + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name) x where x.fcsj >'" + minfcsj + "'" | |
| 7606 | + + " UNION " | |
| 7607 | + + " select * from ( select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, " | |
| 7608 | + + " s.lp_Name as lpName,min(s.j_Name) as jName, max(s.schedule_date_str) as dateStr," | |
| 7609 | + + " min(s.fcsj) as fcsj,2 as px from bsth_c_s_sp_info_real s " | |
| 7610 | + + " where s.xl_Bm = '" + line + "' and s.schedule_date_str ='" + date + "'" | |
| 7611 | + + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name" | |
| 7612 | + + " ) y where y.fcsj <='" + minfcsj + "') z order by (" + state + "),dateStr,px,fcsj " + type; | |
| 7613 | + List<ScheduleRealInfo> list = jdbcTemplate.query(sqlPlan, | |
| 7614 | + new RowMapper<ScheduleRealInfo>() { | |
| 7615 | + @Override | |
| 7616 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 7617 | + ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 7618 | + t.setId(rs.getLong("id")); | |
| 7619 | + t.setjGh(rs.getString("jGh")); | |
| 7620 | + t.setClZbh(rs.getString("clZbh")); | |
| 7621 | + t.setLpName(rs.getString("lpName")); | |
| 7622 | + t.setjName(rs.getString("jName")); | |
| 7623 | + t.setFcsj(rs.getString("fcsj")); | |
| 7624 | + return t; | |
| 7625 | + } | |
| 7626 | + }); | |
| 7627 | + if (lpname.equals("lpName")) { | |
| 7628 | + | |
| 7629 | + List<ScheduleRealInfo> listNew = new ArrayList<ScheduleRealInfo>(); | |
| 7630 | + Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); | |
| 7631 | +// if (px.equals("desc")) { | |
| 7632 | + int zt = 0; | |
| 7633 | + for (int l = 0; l < 2; l++) { | |
| 7634 | + for (int i = 0; i < list.size(); i++) { | |
| 7635 | + ScheduleRealInfo t = list.get(i); | |
| 7636 | + if (t.getLpName().indexOf("+") != -1) { | |
| 7637 | + if (zt == 0) { | |
| 7638 | + listNew.add(t); | |
| 7639 | + } | |
| 7640 | + } else if (pattern.matcher(t.getLpName()).matches()) { | |
| 7641 | + if (zt == 1) { | |
| 7642 | + listNew.add(t); | |
| 7643 | + } | |
| 7644 | + } else { | |
| 7645 | + continue; | |
| 7646 | + } | |
| 7647 | + } | |
| 7648 | + zt++; | |
| 7649 | + } | |
| 7650 | + | |
| 7651 | + Collections.sort(list, new ComparableLp()); | |
| 7652 | + for (int i = 0; i < list.size(); i++) { | |
| 7653 | + ScheduleRealInfo t = list.get(i); | |
| 7654 | + if (t.getLpName().indexOf("+") != -1) { | |
| 7655 | + continue; | |
| 7656 | + } else if (pattern.matcher(t.getLpName()).matches()) { | |
| 7657 | + continue; | |
| 7658 | + } else { | |
| 7659 | + listNew.add(t); | |
| 7660 | + } | |
| 7661 | + } | |
| 7662 | + return listNew; | |
| 7663 | + } else { | |
| 7664 | + return list; | |
| 7665 | + } | |
| 7666 | + | |
| 7667 | + } | |
| 7668 | + | |
| 7669 | + /** | |
| 7670 | + * | |
| 7671 | + */ | |
| 7672 | + @Override | |
| 7673 | + public List<ScheduleRealInfo> exportWaybill(String jName,String jGh, String clZbh, String lpName, String date, String line) { | |
| 7674 | + ReportUtils ee = new ReportUtils(); | |
| 7675 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 7676 | + List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 7677 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 7678 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 7679 | +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line); | |
| 7680 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 7681 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 7682 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 7683 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 7684 | + if (cts != null && cts.size() > 0) { | |
| 7685 | + lists.add(s); | |
| 7686 | + } else { | |
| 7687 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 7688 | + lists.add(s); | |
| 7689 | + } | |
| 7690 | + } | |
| 7691 | + } | |
| 7692 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 7693 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 7694 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 7695 | + //计算里程和班次数,并放入Map里 | |
| 7696 | + Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); | |
| 7697 | + | |
| 7698 | + map.put("jhlc", Arith.add(culateMieageService.culateJhgl(scheduleRealInfos), culateMieageService.culateJhJccgl(scheduleRealInfos))); | |
| 7699 | + map.put("remMileage", culateMieageService.culateLbgl(scheduleRealInfos)); | |
| 7700 | + map.put("addMileage", culateMieageService.culateLjgl(lists)); | |
| 7701 | + double yygl = Arith.add(culateMieageService.culateSjgl(lists), culateMieageService.culateLjgl(lists)); | |
| 7702 | + map.put("yygl", yygl); | |
| 7703 | + double ksgl = Arith.add(culateMieageService.culateKsgl(scheduleRealInfos), culateMieageService.culateJccgl(lists)); | |
| 7704 | + map.put("ksgl", ksgl); | |
| 7705 | + map.put("realMileage", Arith.add(yygl, ksgl)); | |
| 7706 | + map.put("jhbc", culateMieageService.culateJhbc(scheduleRealInfos, "")); | |
| 7707 | + map.put("cjbc", culateMieageService.culateLbbc(scheduleRealInfos)); | |
| 7708 | + map.put("ljbc", culateMieageService.culateLjbc(lists, "")); | |
| 7709 | + int sjbc = culateMieageService.culateLjbc(lists, "") + culateMieageService.culateSjbc(lists, ""); | |
| 7710 | + map.put("sjbc", sjbc); | |
| 7711 | +// map=new HashMap<String,Object>(); | |
| 7712 | + | |
| 7713 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 7714 | + String minfcsj = "02:00"; | |
| 7715 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 7716 | + if (lineList.size() > 0) { | |
| 7717 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 7718 | + + " id = (" | |
| 7719 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 7720 | + + ")"; | |
| 7721 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 7722 | + } | |
| 7723 | + String[] minSjs = minfcsj.split(":"); | |
| 7724 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 7725 | + | |
| 7726 | + | |
| 7727 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 7728 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 7729 | + String[] fcsj = s.getFcsj().split(":"); | |
| 7730 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 7731 | + | |
| 7732 | + Long fscjT = 0L; | |
| 7733 | + if (fcsjL < minSj) { | |
| 7734 | + Calendar calendar = new GregorianCalendar(); | |
| 7735 | + calendar.setTime(s.getScheduleDate()); | |
| 7736 | + calendar.add(calendar.DATE, 1); | |
| 7737 | + s.setScheduleDate(calendar.getTime()); | |
| 7738 | + try { | |
| 7739 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 7740 | + } catch (ParseException e) { | |
| 7741 | + // TODO Auto-generated catch block | |
| 7742 | + e.printStackTrace(); | |
| 7743 | + } | |
| 7744 | + | |
| 7745 | + } else { | |
| 7746 | + try { | |
| 7747 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 7748 | + } catch (ParseException e) { | |
| 7749 | + // TODO Auto-generated catch block | |
| 7750 | + e.printStackTrace(); | |
| 7751 | + } | |
| 7752 | + ; | |
| 7753 | + } | |
| 7754 | + s.setFcsjT(fscjT); | |
| 7755 | + } | |
| 7756 | + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 7757 | + Collections.sort(scheduleRealInfos, new ComparableReal()); | |
| 7758 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 7759 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 7760 | + s.setAdjustExps(i + 1 + ""); | |
| 7761 | + String remarks = ""; | |
| 7762 | + if (s.getRemarks() != null) { | |
| 7763 | + remarks += s.getRemarks(); | |
| 7764 | + } | |
| 7765 | + | |
| 7766 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 7767 | + if (!childTaskPlans.isEmpty()) { | |
| 7768 | + s.setFcsjActual(""); | |
| 7769 | + s.setZdsjActual(""); | |
| 7770 | + s.setJhlc(0.0); | |
| 7771 | + } | |
| 7772 | + | |
| 7773 | + if (s.isDestroy()) { | |
| 7774 | + s.setFcsjActual(""); | |
| 7775 | + s.setZdsjActual(""); | |
| 7776 | + s.setJhlc(0.0); | |
| 7777 | + remarks += "(烂班)"; | |
| 7778 | + s.setRemarks(remarks); | |
| 7779 | + } | |
| 7780 | + | |
| 7781 | + listSchedule.add(s); | |
| 7782 | + //计算营运里程,空驶里程 | |
| 7783 | + if (!childTaskPlans.isEmpty()) { | |
| 7784 | +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 7785 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 7786 | + Collections.sort(listit, new ComparableChild()); | |
| 7787 | + for (int j = 0; j < listit.size(); j++) { | |
| 7788 | + ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 7789 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 7790 | + if (childTaskPlan.isDestroy()) { | |
| 7791 | + t.setFcsjActual(""); | |
| 7792 | + t.setZdsjActual(""); | |
| 7793 | + t.setJhlc(0.0); | |
| 7794 | + } else { | |
| 7795 | + t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 7796 | + t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 7797 | + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 7798 | + } | |
| 7799 | + t.setQdzName(childTaskPlan.getStartStationName()); | |
| 7800 | + t.setZdzName(childTaskPlan.getEndStationName()); | |
| 7801 | + t.setRemarks(childTaskPlan.getRemarks()); | |
| 7802 | + t.setAdjustExps("子"); | |
| 7803 | + t.setjGh(""); | |
| 7804 | + t.setjName(""); | |
| 7805 | + t.setsGh(""); | |
| 7806 | + t.setsName(""); | |
| 7807 | + listSchedule.add(t); | |
| 7808 | + } | |
| 7809 | + } | |
| 7810 | + } | |
| 7811 | + Map<String, Object> maps; | |
| 7812 | + for (ScheduleRealInfo scheduleRealInfo : listSchedule) { | |
| 7813 | + maps = new HashMap<String, Object>(); | |
| 7814 | + try { | |
| 7815 | + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | |
| 7816 | + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | |
| 7817 | + maps = rru.getMapValue(scheduleRealInfo); | |
| 7818 | + maps.put("bcs", scheduleRealInfo.getAdjustExps()); | |
| 7819 | + String zdsj = scheduleRealInfo.getZdsj(); | |
| 7820 | + String zdsjActual = scheduleRealInfo.getZdsjActual(); | |
| 7821 | + if (zdsj != null && zdsjActual != null && | |
| 7822 | + !zdsj.equals(zdsjActual) && | |
| 7823 | + !zdsj.equals("") && | |
| 7824 | + !zdsjActual.equals("")) { | |
| 7825 | + int zdsjT = Integer.valueOf(zdsj.split(":")[0]) * 60 + Integer.valueOf(zdsj.split(":")[1]); | |
| 7826 | + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0]) * 60 + Integer.valueOf(zdsjActual.split(":")[1]); | |
| 7827 | + if (zdsj.compareTo(zdsjActual) > 0) { | |
| 7828 | + if (zdsjT - zdsjAT > 1000) { | |
| 7829 | + maps.put("fast", ""); | |
| 7830 | + maps.put("slow", zdsjAT - zdsjT + 1440); | |
| 7831 | + } else { | |
| 7832 | + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 7833 | + maps.put("slow", ""); | |
| 7834 | + } | |
| 7835 | + } else { | |
| 7836 | + if (zdsjAT - zdsjT > 1000) { | |
| 7837 | + maps.put("fast", zdsjT - zdsjAT + 1440); | |
| 7838 | + maps.put("slow", ""); | |
| 7839 | + } else { | |
| 7840 | + maps.put("fast", ""); | |
| 7841 | + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 7842 | + } | |
| 7843 | + } | |
| 7844 | + } else { | |
| 7845 | + maps.put("fast", ""); | |
| 7846 | + maps.put("slow", ""); | |
| 7847 | + } | |
| 7848 | + listMap.add(maps); | |
| 7849 | + } catch (Exception e) { | |
| 7850 | + e.printStackTrace(); | |
| 7851 | + } | |
| 7852 | + } | |
| 7853 | + | |
| 7854 | + String xls = ""; | |
| 7855 | + if (map.get("type").toString().equals("0")) { | |
| 7856 | + xls = "waybill_minhang.xls"; | |
| 7857 | + } else { | |
| 7858 | + xls = "waybill_minhang_dl.xls"; | |
| 7859 | + } | |
| 7860 | + | |
| 7861 | + | |
| 7862 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 7863 | + | |
| 7864 | + list.add(listMap.iterator()); | |
| 7865 | + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/" + xls, | |
| 7866 | + path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | |
| 7867 | + return scheduleRealInfos; | |
| 7868 | + } | |
| 7869 | + | |
| 7870 | + @Override | |
| 7871 | + public List<Map<String, Object>> dailyInfo(String line, String date, String type) { | |
| 7872 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 7873 | + ReportUtils ee = new ReportUtils(); | |
| 7874 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 7875 | + List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date); | |
| 7876 | + | |
| 7877 | + double totalZGL = 0, totalKSGL = 0, totalYH = 0; | |
| 7878 | + int totalBCS = 0; | |
| 7879 | + for (int i = 0; i < list.size(); i++) { | |
| 7880 | + String zgl = format.format(Double.parseDouble(list.get(i).get("zgl") == null ? "0" : list.get(i).get("zgl").toString())); | |
| 7881 | + String ksgl = format.format(Double.parseDouble(list.get(i).get("ksgl") == null ? "0" : list.get(i).get("ksgl").toString())); | |
| 7882 | + if (type.equals("export")) { | |
| 7883 | + totalZGL += Double.parseDouble(zgl); | |
| 7884 | + totalKSGL += Double.parseDouble(ksgl); | |
| 7885 | + totalBCS += Integer.parseInt(list.get(i).get("bcs").toString()); | |
| 7886 | + } | |
| 7887 | + list.get(i).put("zgl", zgl); | |
| 7888 | + list.get(i).put("ksgl", ksgl); | |
| 7889 | + } | |
| 7890 | + if (type.equals("export")) { | |
| 7891 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 7892 | + map.put("line", line); | |
| 7893 | + map.put("date", date); | |
| 7894 | + map.put("totalZGL", totalZGL); | |
| 7895 | + map.put("totalKSGL", totalKSGL); | |
| 7896 | + map.put("totalYH", totalYH); | |
| 7897 | + map.put("totalBCS", totalBCS); | |
| 7898 | + | |
| 7899 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 7900 | + | |
| 7901 | + listI.add(list.iterator()); | |
| 7902 | + try { | |
| 7903 | + ee.excelReplace(listI, new Object[]{map}, path + "mould/daily.xls", | |
| 7904 | + path + "export/班次日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 7905 | + } catch (ParseException e) { | |
| 7906 | + e.printStackTrace(); | |
| 7907 | + } | |
| 7908 | + } | |
| 7909 | + return list; | |
| 7910 | + } | |
| 7911 | + | |
| 7912 | + @Override | |
| 7913 | + public List<Object[]> historyMessage(String line, String date, String code, String type) { | |
| 7914 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 7915 | + | |
| 7916 | + long d = 0; | |
| 7917 | + long t = 0; | |
| 7918 | + if (date.length() > 0) { | |
| 7919 | + try { | |
| 7920 | + d = sdf.parse(date + " 00:00:00").getTime(); | |
| 7921 | + t = sdf.parse(date + " 23:59:59").getTime(); | |
| 7922 | + } catch (ParseException e) { | |
| 7923 | + // TODO Auto-generated catch block | |
| 7924 | + e.printStackTrace(); | |
| 7925 | + } | |
| 7926 | + | |
| 7927 | + } | |
| 7928 | + String device = ""; | |
| 7929 | + String device2 =""; | |
| 7930 | + long qyrqTime=0l; | |
| 7931 | + if (!code.equals("")) { | |
| 7932 | + try { | |
| 7933 | + List<CarDevice> deviceList=carDeviceRepository.findCarCode(code, sdf.parse(date+ " 00:00:00")); | |
| 7934 | + if(deviceList.size()>0){ | |
| 7935 | + device=deviceList.get(0).getOldDeviceNo(); | |
| 7936 | + Date qyrq=deviceList.get(0).getQyrq(); | |
| 7937 | + qyrqTime=qyrq.getTime(); | |
| 7938 | + if(qyrqTime<t){ | |
| 7939 | + device2=deviceList.get(0).getNewDeviceNo(); | |
| 7940 | + } | |
| 7941 | + }else{ | |
| 7942 | + device = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 7943 | + } | |
| 7944 | + } catch (ParseException e) { | |
| 7945 | + // TODO Auto-generated catch block | |
| 7946 | + e.printStackTrace(); | |
| 7947 | + } | |
| 7948 | + } | |
| 7949 | + List<Object[]> list=new ArrayList<Object[]>(); | |
| 7950 | + | |
| 7951 | + List<Object[]> list0 =scheduleRealInfoRepository.historyMessage(line, d, t, device); | |
| 7952 | + for (Object[] obj : list0) { | |
| 7953 | + if (obj != null) { | |
| 7954 | + if(code.equals("")){ | |
| 7955 | + if (BasicData.deviceId2NbbmMap.get(obj[0].toString()) == null) { | |
| 7956 | + List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 7957 | + try { | |
| 7958 | + carDeviceList = carDeviceRepository.findCarDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString()))); | |
| 7959 | + //启用日期大于营运日期 还是根据旧设备号查询 | |
| 7960 | + if(carDeviceList.size()==0){ | |
| 7961 | + carDeviceList = carDeviceRepository.findCarOldDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString()))); | |
| 7962 | + } | |
| 7963 | + } catch (Exception e) { | |
| 7964 | + // TODO Auto-generated catch block | |
| 7965 | + e.printStackTrace(); | |
| 7966 | + } | |
| 7967 | + if (carDeviceList.size() > 0) { | |
| 7968 | + obj[0] = carDeviceList.get(0).getClZbh(); | |
| 7969 | + } else { | |
| 7970 | + obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 7971 | + } | |
| 7972 | + } else { | |
| 7973 | + obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 7974 | + } | |
| 7975 | + }else{ | |
| 7976 | + obj[0]=code; | |
| 7977 | + } | |
| 7978 | + | |
| 7979 | + obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); | |
| 7980 | + obj[4] = BasicData.lineCode2NameMap.get(line); | |
| 7981 | + } | |
| 7982 | + } | |
| 7983 | + list.addAll(list0); | |
| 7984 | + if(!device2.equals("")){ | |
| 7985 | + List<Object[]> list1 =scheduleRealInfoRepository.historyMessage(line, d, t, device2); | |
| 7986 | + for (Object[] obj : list1) { | |
| 7987 | + if (obj != null) { | |
| 7988 | + obj[0] =code; | |
| 7989 | + obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); | |
| 7990 | + obj[4] = BasicData.lineCode2NameMap.get(line); | |
| 7991 | + } | |
| 7992 | + } | |
| 7993 | + list.addAll(list1); | |
| 7994 | + } | |
| 7995 | + | |
| 7996 | + if (type != null && type.length() != 0 && type.equals("export")) { | |
| 7997 | + String lineName = BasicData.lineCode2NameMap.get(line); | |
| 7998 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 7999 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 8000 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 8001 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 8002 | + ReportUtils ee = new ReportUtils(); | |
| 8003 | + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 8004 | + for (int i = 0; i < list.size(); i++) { | |
| 8005 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 8006 | + Object[] obj = list.get(i); | |
| 8007 | + map.put("num", i + 1); | |
| 8008 | + map.put("line", obj[4]); | |
| 8009 | + map.put("clZbh", obj[0]); | |
| 8010 | + map.put("sender", obj[1]); | |
| 8011 | + map.put("date", obj[3]); | |
| 8012 | + map.put("text", obj[2]); | |
| 8013 | + newList.add(map); | |
| 8014 | + } | |
| 8015 | + try { | |
| 8016 | + listI.add(newList.iterator()); | |
| 8017 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 8018 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/historyMessage.xls", | |
| 8019 | + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 8020 | + + "-" + lineName + "-调度历史消息.xls"); | |
| 8021 | + } catch (Exception e) { | |
| 8022 | + // TODO: handle exception | |
| 8023 | + e.printStackTrace(); | |
| 8024 | + } | |
| 8025 | + } | |
| 8026 | + | |
| 8027 | + if (type != null && type.length() != 0 && type.equals("export_msg")) { | |
| 8028 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 8029 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 8030 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 8031 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 8032 | + ReportUtils ee = new ReportUtils(); | |
| 8033 | + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 8034 | + for (int i = 0; i < list.size(); i++) { | |
| 8035 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 8036 | + Object[] obj = list.get(i); | |
| 8037 | + map.put("num", i + 1); | |
| 8038 | + map.put("line", obj[4]); | |
| 8039 | + map.put("clZbh", obj[0]); | |
| 8040 | + map.put("sender", obj[1]); | |
| 8041 | + map.put("date", obj[3]); | |
| 8042 | + map.put("text", obj[2]); | |
| 8043 | + newList.add(map); | |
| 8044 | + } | |
| 8045 | + try { | |
| 8046 | + listI.add(newList.iterator()); | |
| 8047 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 8048 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/message.xls", | |
| 8049 | + path + "export/调度消息分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 8050 | + } catch (Exception e) { | |
| 8051 | + // TODO: handle exception | |
| 8052 | + e.printStackTrace(); | |
| 8053 | + } | |
| 8054 | + } | |
| 8055 | + return list; | |
| 8056 | + } | |
| 8057 | + | |
| 8058 | + @Override | |
| 8059 | + public Map<Integer, Integer> trustStatus(String lineStr) { | |
| 8060 | + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr)); | |
| 8061 | + | |
| 8062 | + Map<Integer, Integer> map = new HashMap<>(); | |
| 8063 | + return map; | |
| 8064 | + } | |
| 8065 | + | |
| 8066 | + @Override | |
| 8067 | + public Map<String, Object> realOutAdjust(Map<String, String> map) { | |
| 8068 | + Map<String, Object> rs = new HashMap<>(); | |
| 8069 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 8070 | + try { | |
| 8071 | + // 维修上报 | |
| 8072 | + if (StringUtils.isNotBlank(map.get("reportTypes"))) { | |
| 8073 | + Map<String, Object> param = new HashMap<String, Object>(); | |
| 8074 | + param.putAll(map); | |
| 8075 | + rs = repairReport(param, false); | |
| 8076 | + } | |
| 8077 | + | |
| 8078 | + Long id = Long.parseLong(map.get("id")); | |
| 8079 | + String remarks = map.get("remarks"), fcsjActual = map.get("fcsjActual"); | |
| 8080 | + | |
| 8081 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 8082 | + | |
| 8083 | + LineConfig config = lineConfigData.get(sch.getXlBm()); | |
| 8084 | + //小于线路开始运营时间,则默认跨过24点 | |
| 8085 | + if (fcsjActual.compareTo(config.getStartOpt()) < 0) { | |
| 8086 | + sch.setRealExecDate(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME)); | |
| 8087 | + } else { | |
| 8088 | + sch.setRealExecDate(sch.getScheduleDateStr()); | |
| 8089 | + } | |
| 8090 | + | |
| 8091 | + //日志记录 | |
| 8092 | + ScheduleModifyLogger.sftz(sch, fcsjActual, remarks); | |
| 8093 | + | |
| 8094 | + sch.setFcsjActualAll(fcsjActual); | |
| 8095 | + sch.setRemarks(remarks); | |
| 8096 | + sch.calcStatus(); | |
| 8097 | + //if(sch.isLate2()){ | |
| 8098 | + //取消应发未到标记 | |
| 8099 | + // sch.setLate2(false); | |
| 8100 | + LateAdjustHandle.remove(sch); | |
| 8101 | + //} | |
| 8102 | + | |
| 8103 | + dayOfSchedule.save(sch); | |
| 8104 | + | |
| 8105 | + ts.add(sch); | |
| 8106 | + | |
| 8107 | + rs.put("status", ResponseCode.SUCCESS); | |
| 8108 | + rs.put("ts", ts); | |
| 8109 | + | |
| 8110 | + //通知页面刷新 | |
| 8111 | + sendUtils.refreshSch(ts); | |
| 8112 | + } catch (Exception e) { | |
| 8113 | + logger.error("", e); | |
| 8114 | + rs.put("status", ResponseCode.ERROR); | |
| 8115 | + } | |
| 8116 | + | |
| 8117 | + return rs; | |
| 8118 | + } | |
| 8119 | + | |
| 8120 | + @Override | |
| 8121 | + public Map<String, Object> revokeDestroy(Long id) { | |
| 8122 | + Map<String, Object> rs = new HashMap<>(); | |
| 8123 | + try { | |
| 8124 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 8125 | + if (sch.getStatus() != -1) { | |
| 8126 | + rs.put("status", ResponseCode.ERROR); | |
| 8127 | + rs.put("msg", "未烂班,无法撤销!"); | |
| 8128 | + } else { | |
| 8129 | + //日志记录 | |
| 8130 | + ScheduleModifyLogger.cxlb(sch); | |
| 8131 | + | |
| 8132 | + sch.setStatus(0); | |
| 8133 | + sch.setRemarks("");//清空备注 | |
| 8134 | + sch.setJhlc(sch.getJhlcOrig()); | |
| 8135 | + | |
| 8136 | + //入库 | |
| 8137 | + dayOfSchedule.save(sch); | |
| 8138 | + //重新计算当前执行班次 | |
| 8139 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 8140 | + rs.put("status", ResponseCode.SUCCESS); | |
| 8141 | + rs.put("t", sch); | |
| 8142 | + | |
| 8143 | + } | |
| 8144 | + } catch (Exception e) { | |
| 8145 | + logger.error("", e); | |
| 8146 | + rs.put("status", ResponseCode.ERROR); | |
| 8147 | + } | |
| 8148 | + return rs; | |
| 8149 | + } | |
| 8150 | + | |
| 8151 | + @Override | |
| 8152 | + public Map<String, Object> revokeRealOutgo(Long id) { | |
| 8153 | + Map<String, Object> rs = new HashMap<>(); | |
| 8154 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 8155 | + | |
| 8156 | + try { | |
| 8157 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 8158 | + if (sch.getFcsjActual() == null) { | |
| 8159 | + rs.put("status", ResponseCode.ERROR); | |
| 8160 | + rs.put("msg", "无实发时间,无法撤销!"); | |
| 8161 | + } else { | |
| 8162 | + //日志记录 | |
| 8163 | + ScheduleModifyLogger.cxsf(sch); | |
| 8164 | + | |
| 8165 | + sch.clearFcsjActual(); | |
| 8166 | + rs.put("status", ResponseCode.SUCCESS); | |
| 8167 | + | |
| 8168 | + ts.add(sch); | |
| 8169 | + rs.put("ts", ts); | |
| 8170 | + | |
| 8171 | + dayOfSchedule.save(sch); | |
| 8172 | + | |
| 8173 | + } | |
| 8174 | + } catch (Exception e) { | |
| 8175 | + logger.error("", e); | |
| 8176 | + rs.put("status", ResponseCode.ERROR); | |
| 8177 | + } | |
| 8178 | + return rs; | |
| 8179 | + } | |
| 8180 | + | |
| 8181 | + @Override | |
| 8182 | + public Map<String, Object> spaceAdjust(Long[] ids, Integer space) { | |
| 8183 | + | |
| 8184 | + List<ScheduleRealInfo> list = new ArrayList<>(), ts = new ArrayList<>(), tempTs = null; | |
| 8185 | + Map<String, Object> rs = new HashMap<>(), tempRs = new HashMap<>(); | |
| 8186 | + try { | |
| 8187 | + ScheduleRealInfo sch, next; | |
| 8188 | + for (Long id : ids) { | |
| 8189 | + sch = dayOfSchedule.get(id); | |
| 8190 | + if (null != sch) | |
| 8191 | + list.add(sch); | |
| 8192 | + } | |
| 8193 | + | |
| 8194 | + int size = list.size(); | |
| 8195 | + if (size == 0) { | |
| 8196 | + rs.put("status", ResponseCode.ERROR); | |
| 8197 | + } else { | |
| 8198 | + // 按发车时间排序 | |
| 8199 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | |
| 8200 | + | |
| 8201 | + // 以第一个实际发车/待发时间为起点,调整间隔 | |
| 8202 | + sch = list.get(0); | |
| 8203 | + Long st = sch.getFcsjActualTime() == null ? sch.getDfsjT() : sch.getFcsjActualTime(), plus = space * 60 * 1000L; | |
| 8204 | + | |
| 8205 | + for (int i = 1; i < size; i++) { | |
| 8206 | + st += plus; | |
| 8207 | + sch = list.get(i); | |
| 8208 | + | |
| 8209 | + //调整待发 | |
| 8210 | + tempRs = outgoAdjust(sch.getId(), null, fmtHHmm.print(st), null, "3", null); | |
| 8211 | + | |
| 8212 | + if (null != tempRs && tempRs.get("ts") != null) | |
| 8213 | + tempTs = (List<ScheduleRealInfo>) tempRs.get("ts"); | |
| 8214 | + | |
| 8215 | + ts.addAll(tempTs); | |
| 8216 | + } | |
| 8217 | + | |
| 8218 | + rs.put("status", ResponseCode.SUCCESS); | |
| 8219 | + //返回最后一个班次,页面会全量刷新 | |
| 8220 | + rs.put("ts", ts); | |
| 8221 | + } | |
| 8222 | + | |
| 8223 | + } catch (Exception e) { | |
| 8224 | + logger.error("", e); | |
| 8225 | + rs.put("status", ResponseCode.ERROR); | |
| 8226 | + } | |
| 8227 | + return rs; | |
| 8228 | + } | |
| 8229 | + | |
| 8230 | + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 8231 | + | |
| 8232 | + @Transactional | |
| 8233 | + @Override | |
| 8234 | + public Map<String, Object> schInfoFineTune(Map<String, String> map) { | |
| 8235 | + Map<String, Object> rs = new HashMap<>(); | |
| 8236 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 8237 | + try { | |
| 8238 | + // 维修上报 | |
| 8239 | + if (StringUtils.isNotBlank(map.get("reportTypes"))) { | |
| 8240 | + Map<String, Object> param = new HashMap<String, Object>(); | |
| 8241 | + param.putAll(map); | |
| 8242 | + rs = repairReport(param, false); | |
| 8243 | + } | |
| 8244 | + | |
| 8245 | + Long id = Long.parseLong(map.get("id")); | |
| 8246 | + String remarks = map.get("remarks"); | |
| 8247 | + | |
| 8248 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 8249 | + | |
| 8250 | + if (null == sch) { | |
| 8251 | + rs.put("status", ResponseCode.ERROR); | |
| 8252 | + rs.put("msg", "不存在的班次!"); | |
| 8253 | + return rs; | |
| 8254 | + } | |
| 8255 | + | |
| 8256 | + //日志记录器 | |
| 8257 | + FcxxwtLogger fLog = FcxxwtLogger.start(sch, remarks); | |
| 8258 | + | |
| 8259 | + String clZbh = map.get("clZbh"); | |
| 8260 | + String jsy = map.get("jsy"); | |
| 8261 | + if (!clZbh.equals(sch.getClZbh()) | |
| 8262 | + || !jsy.equals(sch.getjGh() + "/" + sch.getjName())) | |
| 8263 | + schModifyLog.saveChangetochange(sch, clZbh, jsy);//为换人换车情况表写入数据 | |
| 8264 | + /** | |
| 8265 | + * 换车 | |
| 8266 | + */ | |
| 8267 | + if (StringUtils.isNotEmpty(clZbh) && !clZbh.equals(sch.getClZbh())) { | |
| 8268 | + //换车 | |
| 8269 | + if (!carExist(sch.getGsBm(), clZbh)) { | |
| 8270 | + rs.put("status", ResponseCode.ERROR); | |
| 8271 | + rs.put("msg", "车辆 " + clZbh + " 不存在!"); | |
| 8272 | + return rs; | |
| 8273 | + } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(clZbh))) { | |
| 8274 | + rs.put("status", ResponseCode.ERROR); | |
| 8275 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + clZbh + "】的车辆"); | |
| 8276 | + return rs; | |
| 8277 | + } else { | |
| 8278 | + fLog.log("换车", sch.getClZbh(), clZbh); | |
| 8279 | + dayOfSchedule.changeCar(sch, clZbh); | |
| 8280 | + } | |
| 8281 | + } | |
| 8282 | + | |
| 8283 | + if(StringUtils.isBlank(jsy) || "/".equals(StringUtils.trim(jsy))){ | |
| 8284 | + rs.put("status", ResponseCode.ERROR); | |
| 8285 | + rs.put("msg", "无效的参数【驾驶员】"); | |
| 8286 | + return rs; | |
| 8287 | + } | |
| 8288 | + | |
| 8289 | + /** | |
| 8290 | + * 换驾驶员 | |
| 8291 | + */ | |
| 8292 | + if (StringUtils.isNotEmpty(jsy)) { | |
| 8293 | + String jGh = jsy.split("/")[0]; | |
| 8294 | + String jName = getPersonName(sch.getGsBm(), jGh); | |
| 8295 | + if (StringUtils.isEmpty(jName)) { | |
| 8296 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + jGh + "】的驾驶员"); | |
| 8297 | + rs.put("status", ResponseCode.ERROR); | |
| 8298 | + return rs; | |
| 8299 | + } else if (!jGh.equals(sch.getjGh())) { | |
| 8300 | + fLog.log("换驾驶员", sch.getjGh() + "/" + sch.getjName(), jsy); | |
| 8301 | + persoChange(sch, jGh); | |
| 8302 | + } | |
| 8303 | + } | |
| 8304 | + | |
| 8305 | + /** | |
| 8306 | + * 换售票员 | |
| 8307 | + */ | |
| 8308 | + String spy = map.get("spy"); | |
| 8309 | + if (StringUtils.isNotEmpty(spy) && !StringUtils.trim(spy).equals("/")) { | |
| 8310 | + String sGh = spy.split("/")[0]; | |
| 8311 | + | |
| 8312 | + String sName = getPersonName(sch.getGsBm(), sGh); | |
| 8313 | + if (StringUtils.isEmpty(sName)) { | |
| 8314 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sGh + "】的售票员"); | |
| 8315 | + rs.put("status", ResponseCode.ERROR); | |
| 8316 | + return rs; | |
| 8317 | + } else if (!sGh.equals(sch.getsGh())) { | |
| 8318 | + fLog.log("换售票员", sch.getsGh() + "/" + sch.getsName(), spy); | |
| 8319 | + persoChangeSPY(sch, sGh); | |
| 8320 | + } | |
| 8321 | + } else if (StringUtils.isNotEmpty(sch.getsGh())) { | |
| 8322 | + fLog.log("撤销售票员"); | |
| 8323 | + sch.setsGh(""); | |
| 8324 | + sch.setsName(""); | |
| 8325 | + } | |
| 8326 | + | |
| 8327 | + LineConfig config = lineConfigData.get(sch.getXlBm()); | |
| 8328 | + /** | |
| 8329 | + * 调整实发 | |
| 8330 | + */ | |
| 8331 | + String fcsjActual = map.get("fcsjActual"); | |
| 8332 | + if (StringUtils.isNotBlank(fcsjActual) | |
| 8333 | + && !fcsjActual.equals(sch.getFcsjActual())) { | |
| 8334 | + | |
| 8335 | + //long t = 0L; | |
| 8336 | + //小于线路开始运营时间,则默认跨过24点 | |
| 8337 | + long t = schAttrCalculator.getTime(sch.getScheduleDateStr(), fcsjActual, config); | |
| 8338 | + /* if (fcsjActual.compareTo(config.getStartOpt()) < 0) | |
| 8339 | + t = fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME) + fcsjActual); | |
| 8340 | + else | |
| 8341 | + t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual);*/ | |
| 8342 | + | |
| 8343 | + fLog.log("调整实发时间", sch.getFcsjActual(), fcsjActual); | |
| 8344 | + sch.setFcsjActualAll(t); | |
| 8345 | + //取消应发未到标记 | |
| 8346 | + //if(sch.isLate2()){ | |
| 8347 | + // sch.setLate2(false); | |
| 8348 | + LateAdjustHandle.remove(sch); | |
| 8349 | + //} | |
| 8350 | + } else if (StringUtils.isNotEmpty(sch.getFcsjActual()) && StringUtils.isEmpty(fcsjActual)) { | |
| 8351 | + fLog.log("撤销实发时间", sch.getFcsjActual(), ""); | |
| 8352 | + //撤销实发 | |
| 8353 | + revokeRealOutgo(sch.getId()); | |
| 8354 | + } | |
| 8355 | + | |
| 8356 | + /** | |
| 8357 | + * 调整实达 | |
| 8358 | + */ | |
| 8359 | + String zdsjActual = map.get("zdsjActual"); | |
| 8360 | + if (StringUtils.isNotBlank(zdsjActual) | |
| 8361 | + && !zdsjActual.equals(sch.getZdsjActual())) { | |
| 8362 | + | |
| 8363 | + //调整实达 | |
| 8364 | + fLog.log("调整实达时间", sch.getZdsjActual(), zdsjActual); | |
| 8365 | + | |
| 8366 | + long t = schAttrCalculator.getTime(sch.getScheduleDateStr(), zdsjActual, config); | |
| 8367 | + sch.setZdsjActualAll(t); | |
| 8368 | + //路牌下一班起点到达时间 | |
| 8369 | + ScheduleRealInfo next = dayOfSchedule.nextByLp2(sch); | |
| 8370 | + if (null != next) { | |
| 8371 | + next.setQdzArrDatesj(zdsjActual); | |
| 8372 | + next.setLate2(false); | |
| 8373 | + ts.add(next); | |
| 8374 | + } | |
| 8375 | + | |
| 8376 | + //重新计算车辆执行班次 | |
| 8377 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 8378 | + //取消应发未到标记 | |
| 8379 | + LateAdjustHandle.remove(sch); | |
| 8380 | + } else if (StringUtils.isNotEmpty(sch.getZdsjActual()) && StringUtils.isEmpty(zdsjActual)) { | |
| 8381 | + //清除实达时间 | |
| 8382 | + fLog.log("撤销实达时间", sch.getZdsjActual(), ""); | |
| 8383 | + sch.clearZdsjActual(); | |
| 8384 | + //清除路牌下一班起点到达时间 | |
| 8385 | + ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); | |
| 8386 | + if (null != next) { | |
| 8387 | + next.setQdzArrDatesj(null); | |
| 8388 | + ts.add(next); | |
| 8389 | + } | |
| 8390 | + //重新计算车辆执行班次 | |
| 8391 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 8392 | + } | |
| 8393 | + | |
| 8394 | + /** | |
| 8395 | + * 备注 | |
| 8396 | + */ | |
| 8397 | + sch.setRemarks(remarks); | |
| 8398 | + | |
| 8399 | + /** | |
| 8400 | + * 烂班 | |
| 8401 | + */ | |
| 8402 | + if (map.get("status") != null | |
| 8403 | + && Integer.parseInt(map.get("status").toString()) == -1) { | |
| 8404 | + destroy(sch.getId() + "", "", map.get("adjustExps").toString(), null); | |
| 8405 | + fLog.log("烂班"); | |
| 8406 | + } | |
| 8407 | + | |
| 8408 | + /** | |
| 8409 | + * 修改班次里程 | |
| 8410 | + */ | |
| 8411 | + String jhlc = map.get("jhlc"); | |
| 8412 | + if (StringUtils.isNotEmpty(jhlc)) { | |
| 8413 | + double jhlcNum = Double.parseDouble(jhlc); | |
| 8414 | + //烂班 | |
| 8415 | + if (jhlcNum == 0 && sch.getJhlcOrig() != 0 && !sch._isInout() && !sch.isDestroy()) { | |
| 8416 | + destroy(sch.getId() + "", "", map.get("adjustExps").toString(), null); | |
| 8417 | + fLog.log("里程设置为0,自动烂班"); | |
| 8418 | + } else if (jhlcNum != sch.getJhlc()) { | |
| 8419 | + fLog.log("设置里程", sch.getJhlc(), jhlcNum); | |
| 8420 | + sch.setJhlc(jhlcNum); | |
| 8421 | + //临加班次,实际计划一起改 | |
| 8422 | + if (sch.isSflj()) | |
| 8423 | + sch.setJhlcOrig(jhlcNum); | |
| 8424 | + } | |
| 8425 | + } | |
| 8426 | + | |
| 8427 | + /** | |
| 8428 | + * 修改班次类型 | |
| 8429 | + */ | |
| 8430 | + String bcType = map.get("bcType"); | |
| 8431 | + if (StringUtils.isNotEmpty(bcType) && !bcType.equals(sch.getBcType())) { | |
| 8432 | + fLog.log("修改班次类型", sch.getBcType(), bcType); | |
| 8433 | + sch.setBcType(bcType); | |
| 8434 | + } | |
| 8435 | + | |
| 8436 | + //重新计算班次状态 | |
| 8437 | + sch.calcStatus(); | |
| 8438 | + dayOfSchedule.save(sch); | |
| 8439 | + //页面需要更新的班次信息 | |
| 8440 | + ts.add(sch); | |
| 8441 | + | |
| 8442 | + rs.put("status", ResponseCode.SUCCESS); | |
| 8443 | + rs.put("ts", ts); | |
| 8444 | + | |
| 8445 | + //日志记录结束 | |
| 8446 | + fLog.end(); | |
| 8447 | + } catch (Exception e) { | |
| 8448 | + logger.error("", e); | |
| 8449 | + rs.put("status", ResponseCode.ERROR); | |
| 8450 | + } | |
| 8451 | + return rs; | |
| 8452 | + } | |
| 8453 | + | |
| 8454 | + @Override | |
| 8455 | + public Map<String, Object> outgoAdjustAll(String params) { | |
| 8456 | + Map<String, Object> rs = new HashMap<>(); | |
| 8457 | + try { | |
| 8458 | + JSONArray jsonArray = JSONArray.parseArray(params); | |
| 8459 | + | |
| 8460 | + ScheduleRealInfo schedule = null; | |
| 8461 | + JSONObject jsonObj; | |
| 8462 | + String dfsj; | |
| 8463 | + long id; | |
| 8464 | + for (int i = 0; i < jsonArray.size(); i++) { | |
| 8465 | + jsonObj = jsonArray.getJSONObject(i); | |
| 8466 | + dfsj = jsonObj.getString("t"); | |
| 8467 | + id = jsonObj.getLong("id"); | |
| 8468 | + schedule = dayOfSchedule.get(id); | |
| 8469 | + | |
| 8470 | + if (schedule != null) | |
| 8471 | + outgoAdjust(id, null, dfsj, null, "2", null); | |
| 8472 | + } | |
| 8473 | + | |
| 8474 | + rs.put("status", ResponseCode.SUCCESS); | |
| 8475 | + //将更新的最后一个班次返回,页面会做全量刷新 | |
| 8476 | + rs.put("t", schedule); | |
| 8477 | + } catch (Exception e) { | |
| 8478 | + logger.error("", e); | |
| 8479 | + rs.put("status", ResponseCode.ERROR); | |
| 8480 | + } | |
| 8481 | + return rs; | |
| 8482 | + } | |
| 8483 | + | |
| 8484 | + @Override | |
| 8485 | + public Map<String, Object> findRouteByLine(String lineCode) { | |
| 8486 | + Map<String, Object> map = new HashMap<>(); | |
| 8487 | + //上行 | |
| 8488 | + Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode); | |
| 8489 | + map.put("line.id_eq", lineId); | |
| 8490 | + map.put("directions_eq", 0); | |
| 8491 | + List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map); | |
| 8492 | + | |
| 8493 | + //下行 | |
| 8494 | + map.put("directions_eq", 1); | |
| 8495 | + List<Map<String, Object>> downList = sectionRouteService.getSectionRoute(map); | |
| 8496 | + | |
| 8497 | + Map<String, Object> rs = new HashMap<>(); | |
| 8498 | + | |
| 8499 | + String upVectors = "", vec; | |
| 8500 | + //拼接上行路段 | |
| 8501 | + for (Map<String, Object> temp : upList) { | |
| 8502 | + vec = temp.get("sectionBsectionVector").toString(); | |
| 8503 | + upVectors += vec.subSequence(11, vec.length() - 2) + " "; | |
| 8504 | + } | |
| 8505 | + | |
| 8506 | + //拼接下行路段 | |
| 8507 | + String downVectors = ""; | |
| 8508 | + for (Map<String, Object> temp : downList) {//LINESTRING( | |
| 8509 | + vec = temp.get("sectionBsectionVector").toString(); | |
| 8510 | + downVectors += vec.subSequence(11, vec.length() - 2) + " "; | |
| 8511 | + } | |
| 8512 | + | |
| 8513 | + | |
| 8514 | + rs.put("up", upVectors); | |
| 8515 | + //上行gcj | |
| 8516 | + rs.put("up_gcj", BdToGcjString(upVectors)); | |
| 8517 | + rs.put("down", downVectors); | |
| 8518 | + //下行gcj | |
| 8519 | + rs.put("down_gcj", BdToGcjString(downVectors)); | |
| 8520 | + rs.put("lineId", lineId); | |
| 8521 | + | |
| 8522 | + return rs; | |
| 8523 | + } | |
| 8524 | + | |
| 8525 | + /** | |
| 8526 | + * @param @param bdStr | |
| 8527 | + * @throws | |
| 8528 | + * @Title: BdToGcjString | |
| 8529 | + * @Description: TODO(将百度路由字符串 转 成GCJ 字符串) | |
| 8530 | + */ | |
| 8531 | + public String BdToGcjString(String bdStr) { | |
| 8532 | + String[] array = bdStr.split(","), subArray; | |
| 8533 | + if (array.length == 0 || bdStr.length() < 2) | |
| 8534 | + return ""; | |
| 8535 | + | |
| 8536 | + String gcjStr = ""; | |
| 8537 | + TransGPS.Location location; | |
| 8538 | + for (String crd : array) { | |
| 8539 | + subArray = crd.split(" "); | |
| 8540 | + if (subArray.length != 2) | |
| 8541 | + continue; | |
| 8542 | + location = TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(subArray[0]), Double.parseDouble(subArray[1]))); | |
| 8543 | + | |
| 8544 | + gcjStr += location.getLng() + " " + location.getLat() + ","; | |
| 8545 | + } | |
| 8546 | + | |
| 8547 | + return gcjStr.substring(0, gcjStr.length() - 1); | |
| 8548 | + } | |
| 8549 | + | |
| 8550 | + public List<Map<String, String>> findLine(String line) { | |
| 8551 | + List<Line> listLine = lineRepository.findLine("%" + line + "%"); | |
| 8552 | + List<Map<String, String>> list = new ArrayList<Map<String, String>>(); | |
| 8553 | + Map<String, String> map; | |
| 8554 | + for (Line temp : listLine) { | |
| 8555 | + if (temp != null) { | |
| 8556 | + String xlName = temp.getName(); | |
| 8557 | + if (xlName.indexOf(line) != -1) { | |
| 8558 | + map = new HashMap<String, String>(); | |
| 8559 | + map.put("id", temp.getLineCode()); | |
| 8560 | + map.put("text", xlName); | |
| 8561 | + list.add(map); | |
| 8562 | + } | |
| 8563 | + } | |
| 8564 | + } | |
| 8565 | + return list; | |
| 8566 | + } | |
| 8567 | + | |
| 8568 | + public List<Map<String, String>> findLpName(String lpName) { | |
| 8569 | + List<GuideboardInfo> listLpName = guideboardInfoRepository.findLpName("%" + lpName + "%"); | |
| 8570 | + List<Map<String, String>> list = new ArrayList<Map<String, String>>(); | |
| 8571 | + Map<String, String> map; | |
| 8572 | + for (GuideboardInfo temp : listLpName) { | |
| 8573 | + if (temp != null) { | |
| 8574 | + String lp = temp.getLpName(); | |
| 8575 | + if (lp.indexOf(lpName) != -1) { | |
| 8576 | + map = new HashMap<String, String>(); | |
| 8577 | + map.put("id", lp); | |
| 8578 | + map.put("text", lp); | |
| 8579 | + list.add(map); | |
| 8580 | + } | |
| 8581 | + } | |
| 8582 | + } | |
| 8583 | + return list; | |
| 8584 | + } | |
| 8585 | + | |
| 8586 | + @Override | |
| 8587 | + public Map<String, Object> findKMBC2(String jName, String clZbh, String date) { | |
| 8588 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date, "", ""); | |
| 8589 | + | |
| 8590 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 8591 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 8592 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 8593 | + int jhbc = 0, cjbc = 0, ljbc = 0; | |
| 8594 | + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0; | |
| 8595 | + float addMileage = 0l, remMileage = 0l; | |
| 8596 | + String j_Name = ""; | |
| 8597 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 8598 | + for (ScheduleRealInfo scheduleRealInfo : list) { | |
| 8599 | + if (scheduleRealInfo != null) { | |
| 8600 | + j_Name = scheduleRealInfo.getjName(); | |
| 8601 | + //计划里程(主任务过滤掉临加班次), | |
| 8602 | + //烂班里程(主任务烂班), | |
| 8603 | + //临加里程(主任务临加), | |
| 8604 | + //计划班次,烂班班次,增加班次 | |
| 8605 | + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); | |
| 8606 | + if (scheduleRealInfo.isSflj()) { | |
| 8607 | + addMileage += tempJhlc; | |
| 8608 | + ljbc++; | |
| 8609 | + } else { | |
| 8610 | + jhlc += tempJhlc; | |
| 8611 | + jhbc++; | |
| 8612 | + if (scheduleRealInfo.getStatus() == -1) { | |
| 8613 | + remMileage += tempJhlc; | |
| 8614 | + cjbc++; | |
| 8615 | + } | |
| 8616 | + } | |
| 8617 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 8618 | + //计算营运里程,空驶里程 | |
| 8619 | + if (childTaskPlans.isEmpty()) { | |
| 8620 | + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | |
| 8621 | + || scheduleRealInfo.getBcType().equals("venting")) { | |
| 8622 | + ksgl += tempJhlc; | |
| 8623 | + } else { | |
| 8624 | + yygl += tempJhlc; | |
| 8625 | + } | |
| 8626 | + } else { | |
| 8627 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 8628 | + while (it.hasNext()) { | |
| 8629 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 8630 | + if (childTaskPlan.getMileageType().equals("empty")) { | |
| 8631 | + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 8632 | + } else { | |
| 8633 | + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 8634 | + } | |
| 8635 | + } | |
| 8636 | + } | |
| 8637 | + } | |
| 8638 | + } | |
| 8639 | + map.put("j_name", j_Name); | |
| 8640 | + map.put("jhlc", format.format(jhlc)); | |
| 8641 | + map.put("remMileage", format.format(remMileage)); | |
| 8642 | + map.put("addMileage", format.format(addMileage)); | |
| 8643 | + map.put("yygl", format.format(yygl)); | |
| 8644 | + map.put("ksgl", format.format(ksgl)); | |
| 8645 | + map.put("realMileage", format.format(yygl + ksgl)); | |
| 8646 | + map.put("jhbc", jhbc); | |
| 8647 | + map.put("cjbc", cjbc); | |
| 8648 | + map.put("ljbc", ljbc); | |
| 8649 | + map.put("sjbc", jhbc - cjbc + ljbc); | |
| 8650 | + return map; | |
| 8651 | + } | |
| 8652 | + | |
| 8653 | + | |
| 8654 | + public Map<String, Object> findKMBC(String jGh, String clZbh, | |
| 8655 | + String lpName, String date, String line) { | |
| 8656 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 8657 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 8658 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 8659 | + for (int i = 0; i < list.size(); i++) { | |
| 8660 | + ScheduleRealInfo s = list.get(i); | |
| 8661 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 8662 | + if (cts != null && cts.size() > 0) { | |
| 8663 | + lists.add(s); | |
| 8664 | + } else { | |
| 8665 | + if (s.getFcsjActual() != null && s.getZdsjActual() != null) { | |
| 8666 | + lists.add(s); | |
| 8667 | + } | |
| 8668 | + } | |
| 8669 | + } | |
| 8670 | + map.put("jhbc", culateService.culateJhbc(list, ""));//计划班次 | |
| 8671 | + map.put("jhlc", Arith.add(culateService.culateJhgl(list), | |
| 8672 | + culateService.culateJhJccgl(list))); //计划总里程 | |
| 8673 | + map.put("cjbc", culateService.culateLbbc(list));//烂班班次 | |
| 8674 | + map.put("remMileage", culateService.culateLbgl(list)); //烂班公里 | |
| 8675 | + map.put("ljbc", culateService.culateLjbc(lists, ""));//临加班次 | |
| 8676 | + double ljgl = culateService.culateLjgl(lists); | |
| 8677 | + map.put("addMileage", ljgl); //临加公里 | |
| 8678 | + map.put("sjbc", culateService.culateSjbc(lists, "") + culateService.culateLjbc(lists, "")); | |
| 8679 | + double ksgl = culateService.culateKsgl(list);//子任务空驶公里 | |
| 8680 | + double jccgl = culateService.culateJccgl(lists);//空驶班次公里 | |
| 8681 | + map.put("ksgl", ksgl);//空驶公里 | |
| 8682 | + double sjgl = culateService.culateSjgl(lists);//实际营运公里 | |
| 8683 | + map.put("realMileage", Arith.add(Arith.add(ksgl, jccgl), Arith.add(sjgl, ljgl)));//总公里 | |
| 8684 | + map.put("zkslc", Arith.add(ksgl, jccgl)); | |
| 8685 | + map.put("jcclc", jccgl); | |
| 8686 | + map.put("yygl", Arith.add(sjgl, ljgl)); //总营运公里 | |
| 8687 | + return map; | |
| 8688 | + } | |
| 8689 | + | |
| 8690 | + public Map<String, Object> findKMBC_mh_2(String jGh, String clZbh, | |
| 8691 | + String lpName, String date, String line) { | |
| 8692 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 8693 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 8694 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 8695 | + for (int i = 0; i < list.size(); i++) { | |
| 8696 | + ScheduleRealInfo s = list.get(i); | |
| 8697 | + if (s.isDestroy() && s.isReissue()) { | |
| 8698 | + s.setRemark(""); | |
| 8699 | + s.setFcsjActual(s.getDfsj()); | |
| 8700 | + s.setZdsjActual(s.getZdsj()); | |
| 8701 | + s.setStatus(2); | |
| 8702 | + s.setJhlc(s.getJhlcOrig()); | |
| 8703 | + } | |
| 8704 | + | |
| 8705 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 8706 | + if (cts != null && cts.size() > 0) { | |
| 8707 | + lists.add(s); | |
| 8708 | + } else { | |
| 8709 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 8710 | + lists.add(s); | |
| 8711 | + } | |
| 8712 | + } | |
| 8713 | + } | |
| 8714 | + double ksgl = culateService.culateKsgl(list); | |
| 8715 | + double sjgl = culateService.culateSjgl(lists); | |
| 8716 | + double jccgl = culateService.culateJccgl(lists); | |
| 8717 | + double ljgl = culateService.culateLjgl(lists); | |
| 8718 | + | |
| 8719 | + map.put("jhlc", Arith.add(culateService.culateJhgl(list), culateService.culateJhJccgl(list))); //计划里程 | |
| 8720 | + map.put("remMileage", culateService.culateLbgl(list)); //烂班公里 | |
| 8721 | + map.put("addMileage", ljgl); //临加公里 | |
| 8722 | + map.put("yygl", Arith.add(sjgl, ljgl)); //实际公里 | |
| 8723 | + map.put("ksgl", ksgl);//空驶公里 | |
| 8724 | + map.put("realMileage", Arith.add(Arith.add(ksgl, jccgl), Arith.add(sjgl, ljgl))); | |
| 8725 | +// map.put("realMileage", format.format(yygl + ksgl + jcclc+addMileage)); | |
| 8726 | + map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 8727 | + map.put("cjbc", culateService.culateLbbc(list)); | |
| 8728 | + map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 8729 | + map.put("sjbc", culateService.culateJhbc(lists, "") - culateService.culateLbbc(lists) + culateService.culateLjbc(lists, "")); | |
| 8730 | + map.put("jcclc", jccgl); | |
| 8731 | + map.put("zkslc", Arith.add(ksgl, jccgl)); | |
| 8732 | +// map.put("zkslc", format.format(ksgl + jcclc+addMileageJc)); | |
| 8733 | + return map; | |
| 8734 | + } | |
| 8735 | + | |
| 8736 | + | |
| 8737 | + @Override | |
| 8738 | + public List<Map<String, Object>> accountPx(String line, String date, | |
| 8739 | + String code, String xlName, String px) { | |
| 8740 | +// List<Object[]> lsitObj = scheduleRealInfoRepository.accountPx(line, date, code,px); | |
| 8741 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 8742 | + if (!code.trim().equals("")) { | |
| 8743 | + code = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 8744 | + } | |
| 8745 | + String fgs = ""; | |
| 8746 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 8747 | + if (lineList.size() > 0) { | |
| 8748 | + Line l = lineList.get(0); | |
| 8749 | + fgs = BasicData.businessFgsCodeNameMap.get(l.getBrancheCompany() + "_" + l.getCompany()); | |
| 8750 | + } | |
| 8751 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 8752 | + String sql = "SELECT request_code,FROM_UNIXTIME(TIMESTAMP / 1000,'%Y-%m-%d %T') as TIMESTAMP ," | |
| 8753 | + + " device_id FROM bsth_v_report_80 WHERE " | |
| 8754 | + + " FROM_UNIXTIME( TIMESTAMP / 1000,'%Y-%m-%d') = '" + date + "' AND" | |
| 8755 | + + " line_id = '" + line + "' and device_id like '%" + code + "%'"; | |
| 8756 | + Map<String, Object> map; | |
| 8757 | + List<Object[]> lsitObj = jdbcTemplate.query(sql, | |
| 8758 | + new RowMapper<Object[]>() { | |
| 8759 | + @Override | |
| 8760 | + public Object[] mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 8761 | + Object[] t = new Object[3]; | |
| 8762 | + t[0] = rs.getString("request_code"); | |
| 8763 | + t[1] = rs.getString("TIMESTAMP"); | |
| 8764 | + t[2] = rs.getString("device_id"); | |
| 8765 | + return t; | |
| 8766 | + } | |
| 8767 | + }); | |
| 8768 | + int i = 1; | |
| 8769 | + for (Object[] obj : lsitObj) { | |
| 8770 | + if (obj != null) { | |
| 8771 | + map = new HashMap<String, Object>(); | |
| 8772 | + map.put("num", i++); | |
| 8773 | + map.put("xlName", xlName); | |
| 8774 | + if (BasicData.deviceId2NbbmMap.get(obj[2]) == null) { | |
| 8775 | + List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 8776 | + try { | |
| 8777 | + carDeviceList = carDeviceRepository.findCarDevice(obj[2].toString(), sdf.parse(obj[1].toString())); | |
| 8778 | + } catch (Exception e) { | |
| 8779 | + // TODO Auto-generated catch block | |
| 8780 | + e.printStackTrace(); | |
| 8781 | + } | |
| 8782 | + if (carDeviceList.size() > 0) { | |
| 8783 | + map.put("clZbh", carDeviceList.get(0).getClZbh()); | |
| 8784 | + | |
| 8785 | + } else { | |
| 8786 | + map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 8787 | + } | |
| 8788 | + } else { | |
| 8789 | + map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 8790 | + | |
| 8791 | + } | |
| 8792 | + map.put("company", fgs); | |
| 8793 | + map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[0] + "")).toUpperCase()); | |
| 8794 | + map.put("requestTime", obj[1]); | |
| 8795 | + listMap.add(map); | |
| 8796 | + } | |
| 8797 | + } | |
| 8798 | + if (listMap.size() > 1) { | |
| 8799 | + if (px.equals("asc")) { | |
| 8800 | + Collections.sort(listMap, new AccountMap()); | |
| 8801 | + } else { | |
| 8802 | + Collections.sort(listMap, new AccountMap2()); | |
| 8803 | + } | |
| 8804 | + } | |
| 8805 | + return listMap; | |
| 8806 | + } | |
| 8807 | + | |
| 8808 | + @Override | |
| 8809 | + public List<Map<String, Object>> account(String line, String date, | |
| 8810 | + String code, String xlName, String type) { | |
| 8811 | + if (!code.trim().equals("")) { | |
| 8812 | + code = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 8813 | + } | |
| 8814 | + String fgs = ""; | |
| 8815 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 8816 | + if (lineList.size() > 0) { | |
| 8817 | + Line l = lineList.get(0); | |
| 8818 | + fgs = BasicData.businessFgsCodeNameMap.get(l.getBrancheCompany() + "_" + l.getCompany()); | |
| 8819 | + } | |
| 8820 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 8821 | + List<Object[]> lsitObj = scheduleRealInfoRepository.account(line, date, code); | |
| 8822 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 8823 | + Map<String, Object> map; | |
| 8824 | + int i = 1; | |
| 8825 | + for (Object[] obj : lsitObj) { | |
| 8826 | + if (obj != null) { | |
| 8827 | + map = new HashMap<String, Object>(); | |
| 8828 | + map.put("num", i++); | |
| 8829 | + map.put("xlName", xlName); | |
| 8830 | + if (BasicData.deviceId2NbbmMap.get(obj[2]) == null) { | |
| 8831 | + List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 8832 | + try { | |
| 8833 | + carDeviceList = carDeviceRepository.findCarDevice(obj[2].toString(), sdf.parse(obj[1].toString())); | |
| 8834 | + } catch (Exception e) { | |
| 8835 | + // TODO Auto-generated catch block | |
| 8836 | + e.printStackTrace(); | |
| 8837 | + } | |
| 8838 | + if (carDeviceList.size() > 0) { | |
| 8839 | + map.put("clZbh", carDeviceList.get(0).getClZbh()); | |
| 8840 | + | |
| 8841 | + } else { | |
| 8842 | + map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 8843 | + } | |
| 8844 | + } else { | |
| 8845 | + map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 8846 | + | |
| 8847 | + } | |
| 8848 | + map.put("company", fgs); | |
| 8849 | + map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[0] + "")).toUpperCase()); | |
| 8850 | + map.put("requestTime", obj[1]); | |
| 8851 | + listMap.add(map); | |
| 8852 | + } | |
| 8853 | + } | |
| 8854 | + | |
| 8855 | + if (type != null && type.length() != 0 && type.equals("export")) { | |
| 8856 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 8857 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 8858 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 8859 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 8860 | + ReportUtils ee = new ReportUtils(); | |
| 8861 | + Map<String, Object> typeMap = new HashMap<String, Object>(); | |
| 8862 | + typeMap.put("0xA1", "请求恢复运营"); | |
| 8863 | + typeMap.put("0xA2", "申请调档"); | |
| 8864 | + typeMap.put("0xA3", "出场请求"); | |
| 8865 | + typeMap.put("0xA5", "进场请求"); | |
| 8866 | + typeMap.put("0xA7", "加油请求"); | |
| 8867 | + typeMap.put("0x50", "车辆故障"); | |
| 8868 | + typeMap.put("0x70", "路阻报告"); | |
| 8869 | + typeMap.put("0x60", "事故报告"); | |
| 8870 | + typeMap.put("0x11", "扣证纠纷"); | |
| 8871 | + typeMap.put("0x12", "报警"); | |
| 8872 | + for (Map<String, Object> map1 : listMap) { | |
| 8873 | + map1.put("requestText", typeMap.get(map1.get("requestType"))); | |
| 8874 | + } | |
| 8875 | + try { | |
| 8876 | + listI.add(listMap.iterator()); | |
| 8877 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 8878 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/account.xls", | |
| 8879 | + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 8880 | + + "-" + xlName + "-驾驶员请求台账.xls"); | |
| 8881 | + } catch (Exception e) { | |
| 8882 | + // TODO: handle exception | |
| 8883 | + e.printStackTrace(); | |
| 8884 | + } | |
| 8885 | + } | |
| 8886 | + | |
| 8887 | + return listMap; | |
| 8888 | + } | |
| 8889 | + | |
| 8890 | + @Override | |
| 8891 | + public List<SchEditInfoDto> correctForm(String line, String date, String endDate, | |
| 8892 | + String lpName, String code, String type, String changType) { | |
| 8893 | + | |
| 8894 | +// var types = {'DFTZ': '待发调整', 'FCXXWT':'发车信息微调', 'JHLB': '计划烂班', 'CXLB': '撤销烂班', | |
| 8895 | +// 'CXZX': '撤销执行', 'CXSF': '撤销实发', 'SFTZ': '实发调整', 'TZRC': '调整人车'}; | |
| 8896 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 8897 | + map.put("DFTZ", "待发调整"); | |
| 8898 | + map.put("FCXXWT", "发车信息微调"); | |
| 8899 | + map.put("JHLB", "计划烂班"); | |
| 8900 | + map.put("CXLB", "撤销烂班"); | |
| 8901 | + map.put("CXZX", "撤销执行"); | |
| 8902 | + map.put("CXSF", "撤销实发"); | |
| 8903 | + map.put("SFTZ", "实发调整"); | |
| 8904 | + map.put("TZRC", "调整人车"); | |
| 8905 | + | |
| 8906 | + SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm"); | |
| 8907 | + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 8908 | + String cont = ""; | |
| 8909 | + cont = " and xl_bm ='" + line + "'"; | |
| 8910 | + if (!lpName.equals("")) { | |
| 8911 | + cont += " and lp_name = '" + lpName + "'"; | |
| 8912 | + } | |
| 8913 | + if (!code.equals("")) { | |
| 8914 | + cont += " and cl_zbh ='" + code + "'"; | |
| 8915 | + } | |
| 8916 | + String sql = "select t1.*, t2.real_exec_date," | |
| 8917 | + + "t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name," | |
| 8918 | + + "t2.xl_dir,t2.real_exec_date from (select * from " | |
| 8919 | + + "logger_sch_modify where rq BETWEEN ? and ? and line_code=? )" | |
| 8920 | + + " t1 INNER JOIN bsth_c_s_sp_info_real t2 on " | |
| 8921 | + + "t1.sch_id=t2.id where 1=1 " + cont; | |
| 8922 | + | |
| 8923 | + List<SchEditInfoDto> list = jdbcTemplate.query(sql, | |
| 8924 | + new BeanPropertyRowMapper(SchEditInfoDto.class), date, endDate, line); | |
| 8925 | + List<SchEditInfoDto> lists = new ArrayList<SchEditInfoDto>(); | |
| 8926 | + for (int i = 0; i < list.size(); i++) { | |
| 8927 | + Long fcsjs = 0l; | |
| 8928 | + Long updsj = 0l; | |
| 8929 | + SchEditInfoDto t = list.get(i); | |
| 8930 | + if (map.get(t.getType()) != null) { | |
| 8931 | + | |
| 8932 | + if (changType.equals("")) { | |
| 8933 | + t.setType2(t.getUser() + "于" + t.getTimeStr() + "进行" + map.get(t.getType()).toString() + ";"); | |
| 8934 | + } else { | |
| 8935 | + String fcsj = ""; | |
| 8936 | + String updtime = ""; | |
| 8937 | + try { | |
| 8938 | + fcsj = sdf1.format(sdf1.parse(t.getFcsj())); | |
| 8939 | + updtime = sdf1.format(sdf1.parse(t.getTimeStr())); | |
| 8940 | + fcsjs = sdf2.parse(t.getRealExecDate() + " " + fcsj).getTime(); | |
| 8941 | + updsj = sdf2.parse(t.getRq() + " " + updtime).getTime(); | |
| 8942 | + } catch (ParseException e) { | |
| 8943 | + // TODO Auto-generated catch block | |
| 8944 | + e.printStackTrace(); | |
| 8945 | + } | |
| 8946 | + if (changType.equals("1")) { | |
| 8947 | + if (fcsjs > updsj) { | |
| 8948 | + t.setType2(t.getUser() + "于" + t.getTimeStr() + "进行" + map.get(t.getType()).toString() + ";"); | |
| 8949 | + } else { | |
| 8950 | + t.setType2(""); | |
| 8951 | + } | |
| 8952 | + } else if (changType.equals("2")) { | |
| 8953 | + if (fcsjs < updsj) { | |
| 8954 | + t.setType2(t.getUser() + "于" + t.getTimeStr() + "进行" + map.get(t.getType()).toString() + ";"); | |
| 8955 | + } else { | |
| 8956 | + t.setType2(""); | |
| 8957 | + } | |
| 8958 | + } | |
| 8959 | + } | |
| 8960 | + } else { | |
| 8961 | + t.setType2(""); | |
| 8962 | + } | |
| 8963 | + boolean fage = true; | |
| 8964 | + for (int j = 0; j < lists.size(); j++) { | |
| 8965 | + SchEditInfoDto s = lists.get(j); | |
| 8966 | + if (s.getSchId() == t.getSchId()) { | |
| 8967 | + s.setType2(s.getType2() + " " + t.getType2()); | |
| 8968 | + fage = false; | |
| 8969 | + } | |
| 8970 | + } | |
| 8971 | + | |
| 8972 | + if (fage) { | |
| 8973 | + if (changType.equals("")) { | |
| 8974 | + lists.add(t); | |
| 8975 | + } else { | |
| 8976 | + if (changType.equals("1")) { | |
| 8977 | + if (fcsjs > updsj) { | |
| 8978 | + lists.add(t); | |
| 8979 | + } | |
| 8980 | + } else if (changType.equals("2")) { | |
| 8981 | + if (fcsjs < updsj) { | |
| 8982 | + lists.add(t); | |
| 8983 | + } | |
| 8984 | + } | |
| 8985 | + } | |
| 8986 | + } | |
| 8987 | + } | |
| 8988 | + | |
| 8989 | + if (type != null && type.length() != 0 && type.equals("export")) { | |
| 8990 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 8991 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 8992 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 8993 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 8994 | + m.put("dates", date); | |
| 8995 | + ReportUtils ee = new ReportUtils(); | |
| 8996 | + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 8997 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 8998 | + for (SchEditInfoDto d : lists) { | |
| 8999 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 9000 | + tempMap.put("lpName", d.getLpName()); | |
| 9001 | + tempMap.put("rq", d.getRq()); | |
| 9002 | + tempMap.put("clZbh", d.getClZbh()); | |
| 9003 | + tempMap.put("jName", d.getjName() + "/" + d.getjGh()); | |
| 9004 | + tempMap.put("fcsj", d.getFcsj()); | |
| 9005 | + tempMap.put("type", d.getType2()); | |
| 9006 | + tempList.add(tempMap); | |
| 9007 | + } | |
| 9008 | + try { | |
| 9009 | + String dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 9010 | + if(!endDate.equals(date)){ | |
| 9011 | + dateTime += "-" + sdfSimple.format(sdfMonth.parse(endDate)); | |
| 9012 | + } | |
| 9013 | + String lineName = BasicData.lineCode2NameMap.get(line); | |
| 9014 | + listI.add(tempList.iterator()); | |
| 9015 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 9016 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/correctForm.xls", | |
| 9017 | + path + "export/" + dateTime + "-" + lineName + "-修正报表.xls"); | |
| 9018 | + } catch (Exception e) { | |
| 9019 | + // TODO: handle exception | |
| 9020 | + e.printStackTrace(); | |
| 9021 | + } | |
| 9022 | +// Map<String, Object> maps = tempList.get(tempList.size() - 1); | |
| 9023 | + } | |
| 9024 | + return lists; | |
| 9025 | + } | |
| 9026 | + | |
| 9027 | + @Override | |
| 9028 | + public List<ScheduleRealInfo> queryListWaybill(String jGh, String clZbh, | |
| 9029 | + String lpName, String date, String line) { | |
| 9030 | + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 9031 | + List<ScheduleRealInfo> list = null; | |
| 9032 | + list = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 9033 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 9034 | + String minfcsj = "02:00"; | |
| 9035 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 9036 | + if (lineList.size() > 0) { | |
| 9037 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 9038 | + + " id = (" | |
| 9039 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 9040 | + + ")"; | |
| 9041 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 9042 | + } | |
| 9043 | + String[] minSjs = minfcsj.split(":"); | |
| 9044 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 9045 | + | |
| 9046 | + for (int i = 0; i < list.size(); i++) { | |
| 9047 | + ScheduleRealInfo s = list.get(i); | |
| 9048 | + if (s.getBcType().equals("out")) { | |
| 9049 | + s.setRemark("1"); | |
| 9050 | + } else if (s.getBcType().equals("in")) { | |
| 9051 | + s.setRemark("3"); | |
| 9052 | + } else { | |
| 9053 | + s.setRemark("2"); | |
| 9054 | + } | |
| 9055 | + String[] fcsj = s.getFcsj().split(":"); | |
| 9056 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 9057 | + | |
| 9058 | + Long fscjT = 0L; | |
| 9059 | + if (fcsjL < minSj) { | |
| 9060 | + Calendar calendar = new GregorianCalendar(); | |
| 9061 | + calendar.setTime(s.getScheduleDate()); | |
| 9062 | + calendar.add(calendar.DATE, 1); | |
| 9063 | + s.setScheduleDate(calendar.getTime()); | |
| 9064 | + try { | |
| 9065 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 9066 | + } catch (ParseException e) { | |
| 9067 | + // TODO Auto-generated catch block | |
| 9068 | + e.printStackTrace(); | |
| 9069 | + } | |
| 9070 | + | |
| 9071 | + } else { | |
| 9072 | + try { | |
| 9073 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 9074 | + } catch (ParseException e) { | |
| 9075 | + // TODO Auto-generated catch block | |
| 9076 | + e.printStackTrace(); | |
| 9077 | + } | |
| 9078 | + ; | |
| 9079 | + } | |
| 9080 | + s.setFcsjT(fscjT); | |
| 9081 | + } | |
| 9082 | + Collections.sort(list, new compareFcsjType()); | |
| 9083 | + for (int i = 0; i < list.size(); i++) { | |
| 9084 | + ScheduleRealInfo s = list.get(i); | |
| 9085 | + s.setAdjustExps(i + 1 + ""); | |
| 9086 | + String remarks = ""; | |
| 9087 | + if (s.getRemarks() != null) { | |
| 9088 | + remarks += s.getRemarks(); | |
| 9089 | + } | |
| 9090 | + | |
| 9091 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 9092 | + if (!childTaskPlans.isEmpty()) { | |
| 9093 | + s.setFcsjActual(""); | |
| 9094 | + s.setZdsjActual(""); | |
| 9095 | + s.setJhlc(0.0); | |
| 9096 | + } | |
| 9097 | + | |
| 9098 | + if (s.isDestroy()) { | |
| 9099 | + s.setFcsjActual(""); | |
| 9100 | + s.setZdsjActual(""); | |
| 9101 | + s.setJhlc(0.0); | |
| 9102 | + remarks += "(烂班)"; | |
| 9103 | + s.setRemarks(remarks); | |
| 9104 | + } | |
| 9105 | + | |
| 9106 | + listSchedule.add(s); | |
| 9107 | + //计算营运里程,空驶里程 | |
| 9108 | + if (!childTaskPlans.isEmpty()) { | |
| 9109 | +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 9110 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 9111 | + Collections.sort(listit, new ComparableChild()); | |
| 9112 | + for (int j = 0; j < listit.size(); j++) { | |
| 9113 | + ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 9114 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 9115 | + if (childTaskPlan.getCcId() == null) { | |
| 9116 | + if (childTaskPlan.isDestroy()) { | |
| 9117 | + t.setFcsjActual(""); | |
| 9118 | + t.setZdsjActual(""); | |
| 9119 | + t.setJhlc(0.0); | |
| 9120 | + } else { | |
| 9121 | + t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 9122 | + t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 9123 | + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 9124 | + } | |
| 9125 | + t.setFcsj(childTaskPlan.getStartDate()); | |
| 9126 | + t.setZdsj(childTaskPlan.getEndDate()); | |
| 9127 | + t.setQdzName(childTaskPlan.getStartStationName()); | |
| 9128 | + t.setZdzName(childTaskPlan.getEndStationName()); | |
| 9129 | + t.setRemarks(childTaskPlan.getRemarks()); | |
| 9130 | + t.setAdjustExps("子"); | |
| 9131 | + listSchedule.add(t); | |
| 9132 | + } | |
| 9133 | + } | |
| 9134 | + } | |
| 9135 | + } | |
| 9136 | + | |
| 9137 | + return listSchedule; | |
| 9138 | + } | |
| 9139 | + | |
| 9140 | + @Override | |
| 9141 | + public List<ScheduleRealInfo> queryListWaybill2(String jName, String clZbh, | |
| 9142 | + String lpName, String date, String line) { | |
| 9143 | + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 9144 | + List<ScheduleRealInfo> list = null; | |
| 9145 | + list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line); | |
| 9146 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 9147 | + String minfcsj = "02:00"; | |
| 9148 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 9149 | + if (lineList.size() > 0) { | |
| 9150 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 9151 | + + " id = (" | |
| 9152 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 9153 | + + ")"; | |
| 9154 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 9155 | + } | |
| 9156 | + String[] minSjs = minfcsj.split(":"); | |
| 9157 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 9158 | + | |
| 9159 | + for (int i = 0; i < list.size(); i++) { | |
| 9160 | + ScheduleRealInfo s = list.get(i); | |
| 9161 | + String[] fcsj = s.getFcsj().split(":"); | |
| 9162 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 9163 | + | |
| 9164 | + Long fscjT = 0L; | |
| 9165 | + if (fcsjL < minSj) { | |
| 9166 | + Calendar calendar = new GregorianCalendar(); | |
| 9167 | + calendar.setTime(s.getScheduleDate()); | |
| 9168 | + calendar.add(calendar.DATE, 1); | |
| 9169 | + s.setScheduleDate(calendar.getTime()); | |
| 9170 | + try { | |
| 9171 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 9172 | + } catch (ParseException e) { | |
| 9173 | + // TODO Auto-generated catch block | |
| 9174 | + e.printStackTrace(); | |
| 9175 | + } | |
| 9176 | + | |
| 9177 | + } else { | |
| 9178 | + try { | |
| 9179 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 9180 | + } catch (ParseException e) { | |
| 9181 | + // TODO Auto-generated catch block | |
| 9182 | + e.printStackTrace(); | |
| 9183 | + } | |
| 9184 | + ; | |
| 9185 | + } | |
| 9186 | + s.setFcsjT(fscjT); | |
| 9187 | + } | |
| 9188 | + Collections.sort(list, new ComparableReal()); | |
| 9189 | + for (int i = 0; i < list.size(); i++) { | |
| 9190 | + ScheduleRealInfo s = list.get(i); | |
| 9191 | + s.setAdjustExps(i + 1 + ""); | |
| 9192 | + String remarks = ""; | |
| 9193 | + if (s.getRemarks() != null) { | |
| 9194 | + remarks += s.getRemarks(); | |
| 9195 | + } | |
| 9196 | + | |
| 9197 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 9198 | + if (!childTaskPlans.isEmpty()) { | |
| 9199 | + s.setFcsjActual(""); | |
| 9200 | + s.setZdsjActual(""); | |
| 9201 | + s.setJhlc(0.0); | |
| 9202 | + } | |
| 9203 | + | |
| 9204 | + if (s.isDestroy()) { | |
| 9205 | + if (s.isReissue()) { | |
| 9206 | + s.setFcsjActual(s.getDfsj()); | |
| 9207 | + s.setZdsjActual(s.getZdsj()); | |
| 9208 | + s.setRemarks(""); | |
| 9209 | + s.setStatus(2); | |
| 9210 | + s.setJhlc(s.getJhlcOrig()); | |
| 9211 | + } else { | |
| 9212 | + s.setFcsjActual(""); | |
| 9213 | + s.setZdsjActual(""); | |
| 9214 | + s.setJhlc(0.0); | |
| 9215 | + remarks += "(烂班)"; | |
| 9216 | + s.setRemarks(remarks); | |
| 9217 | + } | |
| 9218 | + } | |
| 9219 | + | |
| 9220 | + listSchedule.add(s); | |
| 9221 | + //计算营运里程,空驶里程 | |
| 9222 | + if (!childTaskPlans.isEmpty()) { | |
| 9223 | +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 9224 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 9225 | + Collections.sort(listit, new ComparableChild()); | |
| 9226 | + for (int j = 0; j < listit.size(); j++) { | |
| 9227 | + ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 9228 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 9229 | + if (childTaskPlan.isDestroy()) { | |
| 9230 | + t.setFcsjActual(""); | |
| 9231 | + t.setZdsjActual(""); | |
| 9232 | + t.setJhlc(0.0); | |
| 9233 | + } else { | |
| 9234 | + t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 9235 | + t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 9236 | + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 9237 | + } | |
| 9238 | + t.setQdzName(childTaskPlan.getStartStationName()); | |
| 9239 | + t.setZdzName(childTaskPlan.getEndStationName()); | |
| 9240 | + t.setRemarks(childTaskPlan.getRemarks()); | |
| 9241 | + t.setAdjustExps("子"); | |
| 9242 | + listSchedule.add(t); | |
| 9243 | + } | |
| 9244 | + } | |
| 9245 | + } | |
| 9246 | + | |
| 9247 | + return listSchedule; | |
| 9248 | + } | |
| 9249 | + | |
| 9250 | + @Override | |
| 9251 | + public Map<String, Object> removeChildTask(Long taskId) { | |
| 9252 | + Map<String, Object> rs = new HashMap<>(); | |
| 9253 | + ChildTaskPlan chTask = cTaskPlanRepository.findById(taskId).get(); | |
| 9254 | + | |
| 9255 | + ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId()); | |
| 9256 | + try { | |
| 9257 | + | |
| 9258 | + sch.getcTasks().remove(chTask); | |
| 9259 | + scheduleRealInfoRepository.save(sch); | |
| 9260 | + rs.put("status", ResponseCode.SUCCESS); | |
| 9261 | + } catch (Exception e) { | |
| 9262 | + logger.error("", e); | |
| 9263 | + rs.put("status", ResponseCode.ERROR); | |
| 9264 | + } | |
| 9265 | + return rs; | |
| 9266 | + } | |
| 9267 | + | |
| 9268 | + @Override | |
| 9269 | + public List<Map<String, Object>> statisticsDaily(String line, String date, | |
| 9270 | + String xlName, String type) { | |
| 9271 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 9272 | + List<ScheduleRealInfo> list_s = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date); | |
| 9273 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 9274 | + for (int i = 0; i < list_s.size(); i++) { | |
| 9275 | + ScheduleRealInfo s = list_s.get(i); | |
| 9276 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 9277 | + if (cts != null && cts.size() > 0) { | |
| 9278 | + lists.add(s); | |
| 9279 | + } else { | |
| 9280 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 9281 | + lists.add(s); | |
| 9282 | + } | |
| 9283 | + } | |
| 9284 | + } | |
| 9285 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 9286 | + map.put("xlName", xlName); | |
| 9287 | + double jhlc = culateService.culateJhgl(list_s); | |
| 9288 | + map.put("jhlc", jhlc); | |
| 9289 | + map.put("sjgl", Arith.add(culateService.culateSjgl(lists), culateService.culateLjgl(lists))); | |
| 9290 | + double lbgl = culateService.culateLbgl(list_s); | |
| 9291 | + map.put("ssgl", lbgl); | |
| 9292 | + map.put("ssgl_lz", culateService.culateCJLC(list_s, "路阻")); | |
| 9293 | + map.put("ssgl_dm", culateService.culateCJLC(list_s, "吊慢")); | |
| 9294 | + map.put("ssgl_gz", culateService.culateCJLC(list_s, "故障")); | |
| 9295 | + map.put("ssgl_jf", culateService.culateCJLC(list_s, "纠纷")); | |
| 9296 | + map.put("ssgl_zs", culateService.culateCJLC(list_s, "肇事")); | |
| 9297 | + map.put("ssgl_qr", culateService.culateCJLC(list_s, "缺人")); | |
| 9298 | + map.put("ssgl_qc", culateService.culateCJLC(list_s, "缺车")); | |
| 9299 | + map.put("ssgl_kx", culateService.culateCJLC(list_s, "客稀")); | |
| 9300 | + map.put("ssgl_qh", culateService.culateCJLC(list_s, "气候")); | |
| 9301 | + map.put("ssgl_yw", culateService.culateCJLC(list_s, "援外")); | |
| 9302 | + double ssgl_pc = culateService.culateCJLC(list_s, "配车"); | |
| 9303 | + double ssgl_by = culateService.culateCJLC(list_s, "保养"); | |
| 9304 | + double ssgl_cj = culateService.culateCJLC(list_s, "抽减"); | |
| 9305 | + double ssgl_qt = culateService.culateCJLC(list_s, "其他"); | |
| 9306 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 9307 | + map.put("ssbc", culateService.culateLbbc(list_s)); | |
| 9308 | + double ljgl = culateService.culateLjgl(lists); | |
| 9309 | + map.put("ljgl", ljgl); | |
| 9310 | + map.put("jhbc", culateService.culateJhbc(list_s, "")); | |
| 9311 | + map.put("jhbc_m", culateService.culateJhbc(list_s, "zgf")); | |
| 9312 | + map.put("jhbc_a", culateService.culateJhbc(list_s, "wgf")); | |
| 9313 | + map.put("sjbc", culateService.culateSjbc(lists, "")); | |
| 9314 | + map.put("sjbc_m", culateService.culateSjbc(lists, "zgf")); | |
| 9315 | + map.put("sjbc_a", culateService.culateSjbc(lists, "wgf")); | |
| 9316 | + map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 9317 | + map.put("ljbc_m", culateService.culateLjbc(lists, "zgf")); | |
| 9318 | + map.put("ljbc_a", culateService.culateLjbc(lists, "wgf")); | |
| 9319 | + map.put("fzbc", culateService.culateFzbc(lists, "")); | |
| 9320 | + map.put("fzbc_m", culateService.culateFzbc(lists, "zgf")); | |
| 9321 | + map.put("fzbc_a", culateService.culateFzbc(lists, "wgf")); | |
| 9322 | + map.put("dtbc", 0); | |
| 9323 | + map.put("dtbc_m", 0); | |
| 9324 | + map.put("dtbc_a", 0); | |
| 9325 | + List<CalcInterval> intervalList=calcIntervalRepository.selectByDateAndLine(line, date,""); | |
| 9326 | + if(intervalList.size()>0){ | |
| 9327 | + CalcInterval c=intervalList.get(0); | |
| 9328 | + map.put("djg",c.getDjgAll()); | |
| 9329 | + map.put("djg_m", c.getDjgZgf()); | |
| 9330 | + map.put("djg_a", c.getDjgWgf()); | |
| 9331 | + map.put("djg_time", c.getDjgTime()); | |
| 9332 | + }else{ | |
| 9333 | + Map<String, Object> m = culateService.culateDjg(list_s, line); | |
| 9334 | + map.put("djg", m.get("djgcsq")); | |
| 9335 | + map.put("djg_m", m.get("djgcsz")); | |
| 9336 | + map.put("djg_a", m.get("djgcsw")); | |
| 9337 | + map.put("djg_time", m.get("djgsj")); | |
| 9338 | + } | |
| 9339 | + | |
| 9340 | + map.put("jls", Arith.sub(Arith.add(jhlc, ljgl), lbgl)); | |
| 9341 | + lMap.add(map); | |
| 9342 | + | |
| 9343 | + if (date.length() == 10) { | |
| 9344 | + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59"); | |
| 9345 | + String dbdp = ""; | |
| 9346 | + try { | |
| 9347 | + for (int i = 0; i < list.size(); i++) { | |
| 9348 | + DutyEmployee t = list.get(i); | |
| 9349 | + if (dbdp.indexOf(t.getuName()) == -1) { | |
| 9350 | + if (!(dbdp.length() > 0)) { | |
| 9351 | + dbdp = t.getuName(); | |
| 9352 | + } else { | |
| 9353 | + dbdp += "," + t.getuName(); | |
| 9354 | + } | |
| 9355 | + } | |
| 9356 | + } | |
| 9357 | + } catch (Exception e) { | |
| 9358 | + // TODO: handle exception | |
| 9359 | + e.printStackTrace(); | |
| 9360 | + } | |
| 9361 | + map.put("dbdp", dbdp); | |
| 9362 | + } | |
| 9363 | + | |
| 9364 | + return lMap; | |
| 9365 | + } | |
| 9366 | + | |
| 9367 | + @Override | |
| 9368 | + public List<Map<String, Object>> statisticsDaily_mh_2(String line, String date, | |
| 9369 | + String xlName, String type) { | |
| 9370 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 9371 | + List<ScheduleRealInfo> list_s = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date); | |
| 9372 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 9373 | + for (int i = 0; i < list_s.size(); i++) { | |
| 9374 | + ScheduleRealInfo s = list_s.get(i); | |
| 9375 | + if (s.isDestroy() && s.isReissue()) { | |
| 9376 | + s.setRemark(""); | |
| 9377 | + s.setFcsjActual(s.getDfsj()); | |
| 9378 | + s.setZdsjActual(s.getZdsj()); | |
| 9379 | + s.setStatus(2); | |
| 9380 | + s.setJhlc(s.getJhlcOrig()); | |
| 9381 | + } | |
| 9382 | + | |
| 9383 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 9384 | + if (cts != null && cts.size() > 0) { | |
| 9385 | + lists.add(s); | |
| 9386 | + } else { | |
| 9387 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 9388 | + lists.add(s); | |
| 9389 | + } | |
| 9390 | + } | |
| 9391 | + } | |
| 9392 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 9393 | + map.put("xlName", xlName); | |
| 9394 | + double jhlc = culateService.culateJhgl(list_s); | |
| 9395 | + map.put("jhlc", jhlc); | |
| 9396 | + map.put("sjgl", Arith.add(culateService.culateSjgl(lists), culateService.culateLjgl(lists))); | |
| 9397 | + double lbgl = culateService.culateLbgl(list_s); | |
| 9398 | + map.put("ssgl", lbgl); | |
| 9399 | + map.put("ssgl_lz", culateService.culateCJLC(list_s, "路阻")); | |
| 9400 | + map.put("ssgl_dm", culateService.culateCJLC(list_s, "吊慢")); | |
| 9401 | + map.put("ssgl_gz", culateService.culateCJLC(list_s, "故障")); | |
| 9402 | + map.put("ssgl_jf", culateService.culateCJLC(list_s, "纠纷")); | |
| 9403 | + map.put("ssgl_zs", culateService.culateCJLC(list_s, "肇事")); | |
| 9404 | + map.put("ssgl_qr", culateService.culateCJLC(list_s, "缺人")); | |
| 9405 | + map.put("ssgl_qc", culateService.culateCJLC(list_s, "缺车")); | |
| 9406 | + map.put("ssgl_kx", culateService.culateCJLC(list_s, "客稀")); | |
| 9407 | + map.put("ssgl_qh", culateService.culateCJLC(list_s, "气候")); | |
| 9408 | + map.put("ssgl_yw", culateService.culateCJLC(list_s, "援外")); | |
| 9409 | + double ssgl_pc = culateService.culateCJLC(list_s, "配车"); | |
| 9410 | + double ssgl_by = culateService.culateCJLC(list_s, "保养"); | |
| 9411 | + double ssgl_cj = culateService.culateCJLC(list_s, "抽减"); | |
| 9412 | + double ssgl_qt = culateService.culateCJLC(list_s, "其他"); | |
| 9413 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 9414 | + map.put("ssbc", culateService.culateLbbc(list_s)); | |
| 9415 | + double ljgl = culateService.culateLjgl(lists); | |
| 9416 | + map.put("ljgl", ljgl); | |
| 9417 | + map.put("jhbc", culateService.culateJhbc(list_s, "")); | |
| 9418 | + map.put("jhbc_m", culateService.culateJhbc(list_s, "zgf")); | |
| 9419 | + map.put("jhbc_a", culateService.culateJhbc(list_s, "wgf")); | |
| 9420 | + map.put("sjbc", culateService.culateSjbc(lists, "")); | |
| 9421 | + map.put("sjbc_m", culateService.culateSjbc(lists, "zgf")); | |
| 9422 | + map.put("sjbc_a", culateService.culateSjbc(lists, "wgf")); | |
| 9423 | + map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 9424 | + map.put("ljbc_m", culateService.culateLjbc(lists, "zgf")); | |
| 9425 | + map.put("ljbc_a", culateService.culateLjbc(lists, "wgf")); | |
| 9426 | + map.put("fzbc", culateService.culateFzbc(lists, "")); | |
| 9427 | + map.put("fzbc_m", culateService.culateFzbc(lists, "zgf")); | |
| 9428 | + map.put("fzbc_a", culateService.culateFzbc(lists, "wgf")); | |
| 9429 | + map.put("dtbc", 0); | |
| 9430 | + map.put("dtbc_m", 0); | |
| 9431 | + map.put("dtbc_a", 0); | |
| 9432 | + map.put("djg", 0); | |
| 9433 | + map.put("djg_m", 0); | |
| 9434 | + map.put("djg_a", 0); | |
| 9435 | + map.put("djg_time", 0); | |
| 9436 | + map.put("jls", Arith.sub(Arith.add(jhlc, ljgl), lbgl)); | |
| 9437 | + lMap.add(map); | |
| 9438 | + return lMap; | |
| 9439 | + } | |
| 9440 | + | |
| 9441 | + public final Map<String, Object> staticTj(List<ScheduleRealInfo> list,Map<String, Object> m) { | |
| 9442 | + | |
| 9443 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 9444 | + for (int i = 0; i < list.size(); i++) { | |
| 9445 | + ScheduleRealInfo s = list.get(i); | |
| 9446 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 9447 | + if (cts != null && cts.size() > 0) { | |
| 9448 | + lists.add(s); | |
| 9449 | + } else { | |
| 9450 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 9451 | + lists.add(s); | |
| 9452 | + } | |
| 9453 | + } | |
| 9454 | + } | |
| 9455 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 9456 | + if (list.size() > 0) { | |
| 9457 | + map.put("fgsBm", list.get(0).getFgsBm()); | |
| 9458 | + map.put("xlBm", list.get(0).getXlBm()); | |
| 9459 | + map.put("xlName", list.get(0).getXlName()); | |
| 9460 | + map.put("fgsName", list.get(0).getFgsName()); | |
| 9461 | + try { | |
| 9462 | + map.put("xlNamePy", PinyinHelper.convertToPinyinString(list.get(0).getFgsBm()+list.get(0).getXlName(), "", PinyinFormat.WITHOUT_TONE)); | |
| 9463 | + } catch (PinyinException e) { | |
| 9464 | + // TODO Auto-generated catch block | |
| 9465 | + e.printStackTrace(); | |
| 9466 | + } | |
| 9467 | + double jhyygl = culateService.culateJhgl(list);//计划营运公里 | |
| 9468 | + double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | |
| 9469 | + map.put("jhlc", jhyygl); | |
| 9470 | + map.put("jcclc", jhjcclc); | |
| 9471 | + map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); | |
| 9472 | + double ljks=culateService.culateLjksgl(lists); | |
| 9473 | + map.put("ljks", ljks); | |
| 9474 | + double ljgl = culateService.culateLjgl(lists); | |
| 9475 | + double sjyygl = culateService.culateSjgl(lists); | |
| 9476 | + double zyygl = Arith.add(sjyygl, ljgl); | |
| 9477 | + | |
| 9478 | + double sjjccgl = culateService.culateJccgl(lists); | |
| 9479 | + double sjksgl = culateService.culateKsgl(lists); | |
| 9480 | + double zksgl = Arith.add(sjjccgl, sjksgl); | |
| 9481 | + map.put("sjzgl", Arith.add(zyygl, zksgl)); | |
| 9482 | + map.put("sjgl", zyygl); | |
| 9483 | + map.put("sjksgl", zksgl); | |
| 9484 | + double ssgl = culateService.culateLbgl(list); | |
| 9485 | + map.put("ssgl", ssgl); | |
| 9486 | + | |
| 9487 | + //计划+临加-少驶=实驶 | |
| 9488 | + double jl = Arith.sub(Arith.add(jhyygl, ljgl), ssgl); | |
| 9489 | + if (jl == zyygl) { | |
| 9490 | + map.put("zt", 0); | |
| 9491 | + } else { | |
| 9492 | + map.put("zt", 1); | |
| 9493 | + } | |
| 9494 | + | |
| 9495 | + map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); | |
| 9496 | + map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); | |
| 9497 | + map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); | |
| 9498 | + map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷")); | |
| 9499 | + map.put("ssgl_zs", culateService.culateCJLC(list, "肇事")); | |
| 9500 | + map.put("ssgl_qr", culateService.culateCJLC(list, "缺人")); | |
| 9501 | + map.put("ssgl_qc", culateService.culateCJLC(list, "缺车")); | |
| 9502 | + map.put("ssgl_kx", culateService.culateCJLC(list, "客稀")); | |
| 9503 | + map.put("ssgl_qh", culateService.culateCJLC(list, "气候")); | |
| 9504 | + map.put("ssgl_yw", culateService.culateCJLC(list, "援外")); | |
| 9505 | + double ssgl_pc = culateService.culateCJLC(list, "配车"); | |
| 9506 | + double ssgl_by = culateService.culateCJLC(list, "保养"); | |
| 9507 | + double ssgl_cj = culateService.culateCJLC(list, "抽减"); | |
| 9508 | + double ssgl_qt = culateService.culateCJLC(list, "其他"); | |
| 9509 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 9510 | + map.put("ssbc", culateService.culateLbbc(list)); | |
| 9511 | + map.put("ljgl", ljgl); | |
| 9512 | + map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 9513 | + map.put("jhbc_m", culateService.culateJhbc(list, "zgf")); | |
| 9514 | + map.put("jhbc_a", culateService.culateJhbc(list, "wgf")); | |
| 9515 | + map.put("sjbc", culateService.culateSjbc(lists, "")); | |
| 9516 | + map.put("sjbc_m", culateService.culateSjbc(lists, "zgf")); | |
| 9517 | + map.put("sjbc_a", culateService.culateSjbc(lists, "wgf")); | |
| 9518 | + map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 9519 | + map.put("ljbc_m", culateService.culateLjbc(lists, "zgf")); | |
| 9520 | + map.put("ljbc_a", culateService.culateLjbc(lists, "wgf")); | |
| 9521 | + map.put("fzbc", culateService.culateFzbc(lists, "")); | |
| 9522 | + map.put("fzbc_m", culateService.culateFzbc(lists, "zgf")); | |
| 9523 | + map.put("fzbc_a", culateService.culateFzbc(lists, "wgf")); | |
| 9524 | + map.put("dtbc", 0); | |
| 9525 | + map.put("dtbc_m", 0); | |
| 9526 | + map.put("dtbc_a", 0); | |
| 9527 | + if(m.get("xl")==null){ | |
| 9528 | + Map<String, Object> m_ = culateService.culateDjg(lists, list.get(0).getXlBm()); | |
| 9529 | + map.put("djg", m_.get("djgcsq")); | |
| 9530 | + map.put("djg_m", m_.get("djgcsz")); | |
| 9531 | + map.put("djg_a", m_.get("djgcsw")); | |
| 9532 | + map.put("djg_time", m_.get("djgsj")); | |
| 9533 | + }else{ | |
| 9534 | + map.put("djg", m.get("djgAll")==null?"0":m.get("djgAll")); | |
| 9535 | + map.put("djg_m", m.get("djgZgf")==null?"0":m.get("djgZgf")); | |
| 9536 | + map.put("djg_a", m.get("djgWgf")==null?"0":m.get("djgWgf")); | |
| 9537 | + map.put("djg_time", m.get("djgTime")==null?"0":m.get("djgTime")); | |
| 9538 | + } | |
| 9539 | + } | |
| 9540 | + return map; | |
| 9541 | + } | |
| 9542 | + | |
| 9543 | + @Override | |
| 9544 | + public List<Map<String, Object>> statisticsDailyTj(String gsdm, String fgsdm, String line, String date, String date2, | |
| 9545 | + String xlName, String type,String nature) { | |
| 9546 | + List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>(); | |
| 9547 | + List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | |
| 9548 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 9549 | + List<Object[]> listInterval=new ArrayList<Object[]>(); | |
| 9550 | + line = line.trim(); | |
| 9551 | + if (line.equals("")) { | |
| 9552 | + //查询所有线路 | |
| 9553 | + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); | |
| 9554 | + listInterval = calcIntervalRepository.countByDateAndLine(gsdm, fgsdm, date, date2); | |
| 9555 | + } else { | |
| 9556 | + //查询单条线路 | |
| 9557 | + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2); | |
| 9558 | + listInterval = calcIntervalRepository.countByDateAndLine(line, date, date2); | |
| 9559 | + } | |
| 9560 | + Map<String, Map<String,Object>> mapInterval=new HashMap<String, Map<String,Object>>(); | |
| 9561 | + for (int i = 0; i < listInterval.size(); i++) { | |
| 9562 | + Object[] interval=listInterval.get(i); | |
| 9563 | + String gs=interval[0].toString(); | |
| 9564 | + String fgs=interval[1].toString(); | |
| 9565 | + String xl=interval[2].toString(); | |
| 9566 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 9567 | + m.put("gs", gs); | |
| 9568 | + m.put("fgs", fgs); | |
| 9569 | + m.put("xl", xl); | |
| 9570 | + m.put("djgAll", interval[3]); | |
| 9571 | + m.put("djgZgf", interval[6]); | |
| 9572 | + m.put("djgWgf", interval[7]); | |
| 9573 | + m.put("djgTime", interval[8]); | |
| 9574 | + mapInterval.put(gs+"-"+fgs+"-"+xl, m); | |
| 9575 | + } | |
| 9576 | + Map<String, Boolean> lineMap=lineService.lineNature(); | |
| 9577 | + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | |
| 9578 | + for (int i = 0; i < listAll.size(); i++) { | |
| 9579 | + ScheduleRealInfo s=listAll.get(i); | |
| 9580 | + if (nature.equals("0")) { | |
| 9581 | + list.add(s); | |
| 9582 | + }else if(nature.equals("1")){ | |
| 9583 | + if(lineMap.get(s.getXlBm())){ | |
| 9584 | + list.add(s); | |
| 9585 | + } | |
| 9586 | + }else{ | |
| 9587 | + if(!lineMap.get(s.getXlBm())){ | |
| 9588 | + list.add(s); | |
| 9589 | + } | |
| 9590 | + } | |
| 9591 | + } | |
| 9592 | + for (int i = 0; i < list.size(); i++) { | |
| 9593 | + ScheduleRealInfo s = list.get(i); | |
| 9594 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 9595 | + if (cts != null && cts.size() > 0) { | |
| 9596 | + list_s.add(s); | |
| 9597 | + } else { | |
| 9598 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 9599 | + list_s.add(s); | |
| 9600 | + } | |
| 9601 | + } | |
| 9602 | + } | |
| 9603 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 9604 | + for (int i = 0; i < list.size(); i++) { | |
| 9605 | + if (i < list.size() - 1) { | |
| 9606 | + if ((list.get(i+1).getFgsBm()+list.get(i + 1).getXlBm()).equals(list.get(i).getFgsBm()+list.get(i).getXlBm())) { | |
| 9607 | + lists.add(list.get(i)); | |
| 9608 | + } else { | |
| 9609 | + lists.add(list.get(i)); | |
| 9610 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 9611 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 9612 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 9613 | + } | |
| 9614 | + Map<String, Object> map = staticTj(lists,mm); | |
| 9615 | + lMap.add(map); | |
| 9616 | + lists = new ArrayList<ScheduleRealInfo>(); | |
| 9617 | + } | |
| 9618 | + } else { | |
| 9619 | + if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) { | |
| 9620 | + lists.add(list.get(i)); | |
| 9621 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 9622 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 9623 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 9624 | + } | |
| 9625 | + Map<String, Object> map = staticTj(lists,mm); | |
| 9626 | + lMap.add(map); | |
| 9627 | + } else { | |
| 9628 | + lists = new ArrayList<ScheduleRealInfo>(); | |
| 9629 | + lists.add(list.get(i)); | |
| 9630 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 9631 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 9632 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 9633 | + } | |
| 9634 | + Map<String, Object> map = staticTj(lists,mm); | |
| 9635 | + lMap.add(map); | |
| 9636 | + } | |
| 9637 | + } | |
| 9638 | + } | |
| 9639 | + /*if(!line.equals("")){ | |
| 9640 | + List<Line> l=lineRepository.findLineByCode(line); | |
| 9641 | + if(l.size()>0) | |
| 9642 | + lMap.get(0).put("fgsName", BasicData.businessFgsCodeNameMap.get(l.get(0).getBrancheCompany()+"_"+l.get(0).getCompany())); | |
| 9643 | + }*/ | |
| 9644 | + Collections.sort(lMap, new AccountXlbm()); | |
| 9645 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 9646 | + map.put("xlName", "合计"); | |
| 9647 | + map.put("fgsName", ""); | |
| 9648 | + double jhyygl = culateService.culateJhgl(list);//计划营运公里 | |
| 9649 | + double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | |
| 9650 | + map.put("jhlc", jhyygl); | |
| 9651 | + map.put("jcclc", jhjcclc); | |
| 9652 | + map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); | |
| 9653 | + | |
| 9654 | + double ljgl = culateService.culateLjgl(list_s); | |
| 9655 | + double sjyygl = culateService.culateSjgl(list_s); | |
| 9656 | + double zyygl = Arith.add(sjyygl, ljgl); | |
| 9657 | + double ljks=culateService.culateLjksgl(list_s); | |
| 9658 | + map.put("ljks", ljks); | |
| 9659 | + double sjjccgl = culateService.culateJccgl(list_s); | |
| 9660 | + double sjksgl = culateService.culateKsgl(list_s); | |
| 9661 | + double zksgl = Arith.add(sjjccgl, sjksgl); | |
| 9662 | + map.put("sjzgl", Arith.add(zyygl, zksgl)); | |
| 9663 | + map.put("sjgl", zyygl); | |
| 9664 | + map.put("sjksgl", zksgl); | |
| 9665 | + | |
| 9666 | + double ssgl = culateService.culateLbgl(list); | |
| 9667 | + map.put("ssgl", ssgl); | |
| 9668 | + //计划+临加-少驶=实驶 | |
| 9669 | + double jl = Arith.sub(Arith.add(jhyygl, ljgl), ssgl); | |
| 9670 | + if (jl == zyygl) { | |
| 9671 | + map.put("zt", 0); | |
| 9672 | + } else { | |
| 9673 | + map.put("zt", 1); | |
| 9674 | + } | |
| 9675 | + map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); | |
| 9676 | + map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); | |
| 9677 | + map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); | |
| 9678 | + map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷")); | |
| 9679 | + map.put("ssgl_zs", culateService.culateCJLC(list, "肇事")); | |
| 9680 | + map.put("ssgl_qr", culateService.culateCJLC(list, "缺人")); | |
| 9681 | + map.put("ssgl_qc", culateService.culateCJLC(list, "缺车")); | |
| 9682 | + map.put("ssgl_kx", culateService.culateCJLC(list, "客稀")); | |
| 9683 | + map.put("ssgl_qh", culateService.culateCJLC(list, "气候")); | |
| 9684 | + map.put("ssgl_yw", culateService.culateCJLC(list, "援外")); | |
| 9685 | + double ssgl_pc = culateService.culateCJLC(list, "配车"); | |
| 9686 | + double ssgl_by = culateService.culateCJLC(list, "保养"); | |
| 9687 | + double ssgl_cj = culateService.culateCJLC(list, "抽减"); | |
| 9688 | + double ssgl_qt = culateService.culateCJLC(list, "其他"); | |
| 9689 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 9690 | + | |
| 9691 | + map.put("ssbc", culateService.culateLbbc(list)); | |
| 9692 | + map.put("ljgl", ljgl); | |
| 9693 | + map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 9694 | + map.put("jhbc_m", culateService.culateJhbc(list, "zgf")); | |
| 9695 | + map.put("jhbc_a", culateService.culateJhbc(list, "wgf")); | |
| 9696 | + map.put("sjbc", culateService.culateSjbc(list_s, "")); | |
| 9697 | + map.put("sjbc_m", culateService.culateSjbc(list_s, "zgf")); | |
| 9698 | + map.put("sjbc_a", culateService.culateSjbc(list_s, "wgf")); | |
| 9699 | + map.put("ljbc", culateService.culateLjbc(list_s, "")); | |
| 9700 | + map.put("ljbc_m", culateService.culateLjbc(list_s, "zgf")); | |
| 9701 | + map.put("ljbc_a", culateService.culateLjbc(list_s, "wgf")); | |
| 9702 | + map.put("fzbc", culateService.culateFzbc(list_s, "")); | |
| 9703 | + map.put("fzbc_m", culateService.culateFzbc(list_s, "zgf")); | |
| 9704 | + map.put("fzbc_a", culateService.culateFzbc(list_s, "wgf")); | |
| 9705 | + map.put("dtbc", 0); | |
| 9706 | + map.put("dtbc_m", 0); | |
| 9707 | + map.put("dtbc_a", 0); | |
| 9708 | + if (list.size() > 0) { | |
| 9709 | + int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0; | |
| 9710 | + for (Map<String, Object> m : lMap) { | |
| 9711 | + if (m.containsKey("djg") && m.get("djg") != null) | |
| 9712 | + djg += Integer.valueOf(m.get("djg").toString()); | |
| 9713 | + if (m.containsKey("djg_m") && m.get("djg_m") != null) | |
| 9714 | + djg_m += Integer.valueOf(m.get("djg_m").toString()); | |
| 9715 | + if (m.containsKey("djg_a") && m.get("djg_a") != null) | |
| 9716 | + djg_a += Integer.valueOf(m.get("djg_a").toString()); | |
| 9717 | + if (m.containsKey("djg_time") && m.get("djg_time") != null) { | |
| 9718 | + int t = Integer.valueOf(m.get("djg_time").toString()); | |
| 9719 | + if (t > djg_time) | |
| 9720 | + djg_time = t; | |
| 9721 | + } | |
| 9722 | + } | |
| 9723 | + map.put("djg", djg); | |
| 9724 | + map.put("djg_m", djg_m); | |
| 9725 | + map.put("djg_a", djg_a); | |
| 9726 | + map.put("djg_time", djg_time); | |
| 9727 | +// Map<String, Object> m_=culateService.culateDjg(list_s, list.get(0).getXlBm()); | |
| 9728 | +// map.put("djg", m_.get("djgcsq")); | |
| 9729 | +// map.put("djg_m", m_.get("djgcsz")); | |
| 9730 | +// map.put("djg_a", m_.get("djgcsw")); | |
| 9731 | +// map.put("djg_time", m_.get("djgsj")); | |
| 9732 | + } else { | |
| 9733 | + map.put("djg", "0"); | |
| 9734 | + map.put("djg_m", "0"); | |
| 9735 | + map.put("djg_a", "0"); | |
| 9736 | + map.put("djg_time", "0"); | |
| 9737 | + } | |
| 9738 | + lMap.add(map); | |
| 9739 | + if (type != null && type.length() != 0 && type.equals("export")) { | |
| 9740 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 9741 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 9742 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 9743 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 9744 | + m.put("date", date + "至" + date2); | |
| 9745 | + ReportUtils ee = new ReportUtils(); | |
| 9746 | + try { | |
| 9747 | + String dateTime = ""; | |
| 9748 | + if (date.equals(date2)) { | |
| 9749 | + dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 9750 | + } else { | |
| 9751 | + dateTime = sdfSimple.format(sdfMonth.parse(date)) | |
| 9752 | + + "-" + sdfSimple.format(sdfMonth.parse(date2)); | |
| 9753 | + } | |
| 9754 | + listI.add(lMap.iterator()); | |
| 9755 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 9756 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_2.xls", | |
| 9757 | + path + "export/" + dateTime + "-" + xlName + "-统计日报.xls"); | |
| 9758 | + } catch (Exception e) { | |
| 9759 | + // TODO: handle exception | |
| 9760 | + //e.printStackTrace(); | |
| 9761 | + logger.info("", e); | |
| 9762 | + } | |
| 9763 | + } | |
| 9764 | + | |
| 9765 | + return lMap; | |
| 9766 | + } | |
| 9767 | + | |
| 9768 | + @Override | |
| 9769 | + public List<Map<String, Object>> statisticsDailyTjHb(String gsdm, String fgsdm, String line, String date, String date2, | |
| 9770 | + String xlName, String type,String nature) { | |
| 9771 | + List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>(); | |
| 9772 | + List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | |
| 9773 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 9774 | + List<Object[]> listInterval=new ArrayList<Object[]>(); | |
| 9775 | + | |
| 9776 | + line = line.trim(); | |
| 9777 | + if (line.equals("")) { | |
| 9778 | + //查询所有线路 | |
| 9779 | + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); | |
| 9780 | + listInterval = calcIntervalRepository.countByDateAndLine(gsdm, fgsdm, date, date2); | |
| 9781 | + } else { | |
| 9782 | + //查询单条线路 | |
| 9783 | + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2); | |
| 9784 | + listInterval = calcIntervalRepository.countByDateAndLine(line, date, date2); | |
| 9785 | + } | |
| 9786 | + Map<String, Map<String,Object>> mapInterval=new HashMap<>(); | |
| 9787 | + for (int i = 0; i < listInterval.size(); i++) { | |
| 9788 | + Object[] interval=listInterval.get(i); | |
| 9789 | + String gs=interval[0].toString(); | |
| 9790 | + String fgs=interval[1].toString(); | |
| 9791 | + String xl=interval[2].toString(); | |
| 9792 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 9793 | + m.put("gs", gs); | |
| 9794 | + m.put("fgs", fgs); | |
| 9795 | + m.put("xl", xl); | |
| 9796 | + m.put("djgAll", interval[3]); | |
| 9797 | + m.put("djgZgf", interval[6]); | |
| 9798 | + m.put("djgWgf", interval[7]); | |
| 9799 | + m.put("djgTime", interval[8]); | |
| 9800 | + mapInterval.put(gs+"-"+fgs+"-"+xl, m); | |
| 9801 | + } | |
| 9802 | + | |
| 9803 | + Map<String, Boolean> lineMap=lineService.lineNature(); | |
| 9804 | + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | |
| 9805 | + for (int i = 0; i < listAll.size(); i++) { | |
| 9806 | + ScheduleRealInfo s=listAll.get(i); | |
| 9807 | + if (nature.equals("0")) { | |
| 9808 | + list.add(s); | |
| 9809 | + }else if(nature.equals("1")){ | |
| 9810 | + if(lineMap.get(s.getXlBm())){ | |
| 9811 | + list.add(s); | |
| 9812 | + } | |
| 9813 | + }else{ | |
| 9814 | + if(!lineMap.get(s.getXlBm())){ | |
| 9815 | + list.add(s); | |
| 9816 | + } | |
| 9817 | + } | |
| 9818 | + } | |
| 9819 | + for (int i = 0; i < list.size(); i++) { | |
| 9820 | + ScheduleRealInfo s = list.get(i); | |
| 9821 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 9822 | + if (cts != null && cts.size() > 0) { | |
| 9823 | + list_s.add(s); | |
| 9824 | + } else { | |
| 9825 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 9826 | + list_s.add(s); | |
| 9827 | + } | |
| 9828 | + } | |
| 9829 | + } | |
| 9830 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 9831 | + for (int i = 0; i < list.size(); i++) { | |
| 9832 | + if (i < list.size() - 1) { | |
| 9833 | + if ((list.get(i + 1).getFgsBm()+list.get(i + 1).getXlBm()).equals(list.get(i).getFgsBm()+list.get(i).getXlBm())) { | |
| 9834 | + lists.add(list.get(i)); | |
| 9835 | + } else { | |
| 9836 | + lists.add(list.get(i)); | |
| 9837 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 9838 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 9839 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 9840 | + } | |
| 9841 | + Map<String, Object> map = staticTj(lists,mm); | |
| 9842 | + lMap.add(map); | |
| 9843 | + lists = new ArrayList<ScheduleRealInfo>(); | |
| 9844 | + } | |
| 9845 | + } else { | |
| 9846 | + if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) { | |
| 9847 | + lists.add(list.get(i)); | |
| 9848 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 9849 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 9850 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 9851 | + } | |
| 9852 | + Map<String, Object> map = staticTj(lists,mm); | |
| 9853 | + lMap.add(map); | |
| 9854 | + } else { | |
| 9855 | + lists = new ArrayList<ScheduleRealInfo>(); | |
| 9856 | + lists.add(list.get(i)); | |
| 9857 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 9858 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 9859 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 9860 | + } | |
| 9861 | + Map<String, Object> map = staticTj(lists,mm); | |
| 9862 | + lMap.add(map); | |
| 9863 | + } | |
| 9864 | + } | |
| 9865 | + } | |
| 9866 | + | |
| 9867 | + Collections.sort(lMap, new AccountXlbm()); | |
| 9868 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 9869 | + map.put("xlBm", "hj"); | |
| 9870 | + map.put("xlName", "合计"); | |
| 9871 | + map.put("fgsBm", ""); | |
| 9872 | + map.put("fgsName", ""); | |
| 9873 | + map.put("gsBm", ""); | |
| 9874 | + double jhyygl = culateService.culateJhgl(list);//计划营运公里 | |
| 9875 | + double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | |
| 9876 | + map.put("jhlc", jhyygl); | |
| 9877 | + map.put("jcclc", jhjcclc); | |
| 9878 | + map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); | |
| 9879 | + | |
| 9880 | + double ljgl = culateService.culateLjgl(list_s); | |
| 9881 | + double sjyygl = culateService.culateSjgl(list_s); | |
| 9882 | + double zyygl = Arith.add(sjyygl, ljgl); | |
| 9883 | + double ljks=culateService.culateLjksgl(list_s); | |
| 9884 | + map.put("ljks", ljks); | |
| 9885 | + double sjjccgl = culateService.culateJccgl(list_s); | |
| 9886 | + double sjksgl = culateService.culateKsgl(list_s); | |
| 9887 | + double zksgl = Arith.add(sjjccgl, sjksgl); | |
| 9888 | + map.put("sjzgl", Arith.add(zyygl, zksgl)); | |
| 9889 | + map.put("sjgl", zyygl); | |
| 9890 | + map.put("sjksgl", zksgl); | |
| 9891 | + | |
| 9892 | + double ssgl = culateService.culateLbgl(list); | |
| 9893 | + map.put("ssgl", ssgl); | |
| 9894 | + //计划+临加-少驶=实驶 | |
| 9895 | + double jl = Arith.sub(Arith.add(jhyygl, ljgl), ssgl); | |
| 9896 | + if (jl == zyygl) { | |
| 9897 | + map.put("zt", 0); | |
| 9898 | + } else { | |
| 9899 | + map.put("zt", 1); | |
| 9900 | + } | |
| 9901 | + map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); | |
| 9902 | + map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); | |
| 9903 | + map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); | |
| 9904 | + map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷")); | |
| 9905 | + map.put("ssgl_zs", culateService.culateCJLC(list, "肇事")); | |
| 9906 | + map.put("ssgl_qr", culateService.culateCJLC(list, "缺人")); | |
| 9907 | + map.put("ssgl_qc", culateService.culateCJLC(list, "缺车")); | |
| 9908 | + map.put("ssgl_kx", culateService.culateCJLC(list, "客稀")); | |
| 9909 | + map.put("ssgl_qh", culateService.culateCJLC(list, "气候")); | |
| 9910 | + map.put("ssgl_yw", culateService.culateCJLC(list, "援外")); | |
| 9911 | + double ssgl_pc = culateService.culateCJLC(list, "配车"); | |
| 9912 | + double ssgl_by = culateService.culateCJLC(list, "保养"); | |
| 9913 | + double ssgl_cj = culateService.culateCJLC(list, "抽减"); | |
| 9914 | + double ssgl_qt = culateService.culateCJLC(list, "其他"); | |
| 9915 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 9916 | + | |
| 9917 | + map.put("ssbc", culateService.culateLbbc(list)); | |
| 9918 | + map.put("ljgl", ljgl); | |
| 9919 | + map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 9920 | + map.put("jhbc_m", culateService.culateJhbc(list, "zgf")); | |
| 9921 | + map.put("jhbc_a", culateService.culateJhbc(list, "wgf")); | |
| 9922 | + map.put("sjbc", culateService.culateSjbc(list_s, "")); | |
| 9923 | + map.put("sjbc_m", culateService.culateSjbc(list_s, "zgf")); | |
| 9924 | + map.put("sjbc_a", culateService.culateSjbc(list_s, "wgf")); | |
| 9925 | + map.put("ljbc", culateService.culateLjbc(list_s, "")); | |
| 9926 | + map.put("ljbc_m", culateService.culateLjbc(list_s, "zgf")); | |
| 9927 | + map.put("ljbc_a", culateService.culateLjbc(list_s, "wgf")); | |
| 9928 | + map.put("fzbc", culateService.culateFzbc(list_s, "")); | |
| 9929 | + map.put("fzbc_m", culateService.culateFzbc(list_s, "zgf")); | |
| 9930 | + map.put("fzbc_a", culateService.culateFzbc(list_s, "wgf")); | |
| 9931 | + map.put("dtbc", 0); | |
| 9932 | + map.put("dtbc_m", 0); | |
| 9933 | + map.put("dtbc_a", 0); | |
| 9934 | + if (list.size() > 0) { | |
| 9935 | + int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0; | |
| 9936 | + for (Map<String, Object> m : lMap) { | |
| 9937 | + if (m.containsKey("djg") && m.get("djg") != null) | |
| 9938 | + djg += Integer.valueOf(m.get("djg").toString()); | |
| 9939 | + if (m.containsKey("djg_m") && m.get("djg_m") != null) | |
| 9940 | + djg_m += Integer.valueOf(m.get("djg_m").toString()); | |
| 9941 | + if (m.containsKey("djg_a") && m.get("djg_a") != null) | |
| 9942 | + djg_a += Integer.valueOf(m.get("djg_a").toString()); | |
| 9943 | + if (m.containsKey("djg_time") && m.get("djg_time") != null) { | |
| 9944 | + int t = Integer.valueOf(m.get("djg_time").toString()); | |
| 9945 | + if (t > djg_time) | |
| 9946 | + djg_time = t; | |
| 9947 | + } | |
| 9948 | + } | |
| 9949 | + map.put("djg", djg); | |
| 9950 | + map.put("djg_m", djg_m); | |
| 9951 | + map.put("djg_a", djg_a); | |
| 9952 | + map.put("djg_time", djg_time); | |
| 9953 | + } else { | |
| 9954 | + map.put("djg", "0"); | |
| 9955 | + map.put("djg_m", "0"); | |
| 9956 | + map.put("djg_a", "0"); | |
| 9957 | + map.put("djg_time", "0"); | |
| 9958 | + } | |
| 9959 | + lMap.add(map); | |
| 9960 | + return lMap; | |
| 9961 | + } | |
| 9962 | + | |
| 9963 | + @Override | |
| 9964 | + public Map<String, Object> scheduleDaily(String line, String date) { | |
| 9965 | + Map<String, String> tempMap = null; | |
| 9966 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); | |
| 9967 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 9968 | + Double jhlc = 0.00; | |
| 9969 | + Float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f; | |
| 9970 | + int jhbc = 0; | |
| 9971 | + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) { | |
| 9972 | + if (scheduleRealInfo != null) { | |
| 9973 | + //计算里程(包括子任务) | |
| 9974 | + jhlc += scheduleRealInfo.getJhlc(); | |
| 9975 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 9976 | + if (!childTaskPlans.isEmpty()) { | |
| 9977 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 9978 | + while (it.hasNext()) { | |
| 9979 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 9980 | + //是否烂班,烂班就是少驶 | |
| 9981 | + if (!childTaskPlan.isDestroy()) { | |
| 9982 | + sjgl += childTaskPlan.getMileage(); | |
| 9983 | + } else { | |
| 9984 | + ssgl += childTaskPlan.getMileage(); | |
| 9985 | + if (childTaskPlan.getDestroyReason().equals("路阻")) { | |
| 9986 | + ssgl_lz += childTaskPlan.getMileage(); | |
| 9987 | + } else if (childTaskPlan.getDestroyReason().equals("吊慢")) { | |
| 9988 | + ssgl_dm += childTaskPlan.getMileage(); | |
| 9989 | + } else if (childTaskPlan.getDestroyReason().equals("故障")) { | |
| 9990 | + ssgl_gz += childTaskPlan.getMileage(); | |
| 9991 | + } else if (childTaskPlan.getDestroyReason().equals("纠纷")) { | |
| 9992 | + ssgl_jf += childTaskPlan.getMileage(); | |
| 9993 | + } else if (childTaskPlan.getDestroyReason().equals("肇事")) { | |
| 9994 | + ssgl_zs += childTaskPlan.getMileage(); | |
| 9995 | + } else if (childTaskPlan.getDestroyReason().equals("缺人")) { | |
| 9996 | + ssgl_qr += childTaskPlan.getMileage(); | |
| 9997 | + } else if (childTaskPlan.getDestroyReason().equals("缺车")) { | |
| 9998 | + ssgl_qc += childTaskPlan.getMileage(); | |
| 9999 | + } else if (childTaskPlan.getDestroyReason().equals("客稀")) { | |
| 10000 | + ssgl_kx += childTaskPlan.getMileage(); | |
| 10001 | + } else if (childTaskPlan.getDestroyReason().equals("气候")) { | |
| 10002 | + ssgl_qh += childTaskPlan.getMileage(); | |
| 10003 | + } else if (childTaskPlan.getDestroyReason().equals("援外")) { | |
| 10004 | + ssgl_yw += childTaskPlan.getMileage(); | |
| 10005 | + } else { | |
| 10006 | + ssgl_other += childTaskPlan.getMileage(); | |
| 10007 | + } | |
| 10008 | + } | |
| 10009 | + //临加公里 | |
| 10010 | + if (childTaskPlan.getType1().equals("临加")) { | |
| 10011 | + ljgl += childTaskPlan.getMileage(); | |
| 10012 | + } | |
| 10013 | + } | |
| 10014 | + } | |
| 10015 | + //班次 | |
| 10016 | + scheduleRealInfo.getFcsjT(); | |
| 10017 | + scheduleRealInfo.getFcsjActualTime(); | |
| 10018 | + } | |
| 10019 | + } | |
| 10020 | + map.put("jhlc", jhlc); | |
| 10021 | + map.put("sjgl", sjgl); | |
| 10022 | + map.put("ssgl", ssgl); | |
| 10023 | + map.put("ssgl_lz", ssgl_lz); | |
| 10024 | + map.put("ssgl_dm", ssgl_dm); | |
| 10025 | + map.put("ssgl_gz", ssgl_gz); | |
| 10026 | + map.put("ssgl_jf", ssgl_jf); | |
| 10027 | + map.put("ssgl_zs", ssgl_zs); | |
| 10028 | + map.put("ssgl_qr", ssgl_qr); | |
| 10029 | + map.put("ssgl_qc", ssgl_qc); | |
| 10030 | + map.put("ssgl_kx", ssgl_kx); | |
| 10031 | + map.put("ssgl_qh", ssgl_qh); | |
| 10032 | + map.put("ssgl_yw", ssgl_yw); | |
| 10033 | + map.put("ssgl_other", ssgl_other); | |
| 10034 | + map.put("ljgl", ljgl); | |
| 10035 | + | |
| 10036 | + map.put("jhbc", scheduleRealInfos.size()); | |
| 10037 | + return null; | |
| 10038 | + } | |
| 10039 | + | |
| 10040 | + @Override | |
| 10041 | + public int countByLineCodeAndDate(String xlBm, String schDate) { | |
| 10042 | + return scheduleRealInfoRepository.countByLineCodeAndDate(xlBm + "", schDate); | |
| 10043 | + } | |
| 10044 | + | |
| 10045 | + @Override | |
| 10046 | + public List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate) { | |
| 10047 | + return scheduleRealInfoRepository.findByLineCodeAndDate(xlBm + "", schDate); | |
| 10048 | + } | |
| 10049 | + | |
| 10050 | + @Override | |
| 10051 | + public void deleteByLineCodeAndDate(String xlBm, String schDate) { | |
| 10052 | + scheduleRealInfoRepository.deleteByLineCodeAndDate(xlBm + "", schDate); | |
| 10053 | + } | |
| 10054 | + | |
| 10055 | + @Override | |
| 10056 | + public Long getMaxId() { | |
| 10057 | + return scheduleRealInfoRepository.getMaxId(); | |
| 10058 | + } | |
| 10059 | + | |
| 10060 | + @Override | |
| 10061 | + public List<ScheduleRealInfo> realScheduleList(String line, String date) { | |
| 10062 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 10063 | + String lpName = "lpName"; | |
| 10064 | + String zdsj = ""; | |
| 10065 | + String zdsjActual = ""; | |
| 10066 | + String zdsj1 = ""; | |
| 10067 | + String zdsjActual1 = ""; | |
| 10068 | + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date); | |
| 10069 | + | |
| 10070 | + /* | |
| 10071 | + * 对计划发车时间相同的班次进行排序 out最前 in最后 | |
| 10072 | + */ | |
| 10073 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 10074 | + SimpleDateFormat sdfnyr =new SimpleDateFormat("yyyy-MM-dd"); | |
| 10075 | + String minfcsj = "02:00"; | |
| 10076 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 10077 | + if (lineList.size() > 0) { | |
| 10078 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 10079 | + + " id = (" | |
| 10080 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 10081 | + + ")"; | |
| 10082 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 10083 | + } | |
| 10084 | + String[] minSjs = minfcsj.split(":"); | |
| 10085 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 10086 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 10087 | + ScheduleRealInfo s = listInfo.get(i); | |
| 10088 | + if (s.getBcType().equals("out")) { | |
| 10089 | + s.setRemark("1"); | |
| 10090 | + } else if (s.getBcType().equals("in")) { | |
| 10091 | + s.setRemark("3"); | |
| 10092 | + } else { | |
| 10093 | + s.setRemark("2"); | |
| 10094 | + } | |
| 10095 | + String[] fcsj = s.getFcsj().split(":"); | |
| 10096 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 10097 | + | |
| 10098 | + Long fscjT = 0L; | |
| 10099 | + if (fcsjL < minSj) { | |
| 10100 | + Calendar calendar = new GregorianCalendar(); | |
| 10101 | + calendar.setTime(s.getScheduleDate()); | |
| 10102 | + calendar.add(calendar.DATE, 1); | |
| 10103 | + Date date_sch= calendar.getTime(); | |
| 10104 | + try { | |
| 10105 | + fscjT = sdf.parse(sdfnyr.format(date_sch) + " " + s.getFcsj()).getTime(); | |
| 10106 | + } catch (ParseException e) { | |
| 10107 | + // TODO Auto-generated catch block | |
| 10108 | + e.printStackTrace(); | |
| 10109 | + } | |
| 10110 | + | |
| 10111 | + } else { | |
| 10112 | + try { | |
| 10113 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 10114 | + } catch (ParseException e) { | |
| 10115 | + // TODO Auto-generated catch block | |
| 10116 | + e.printStackTrace(); | |
| 10117 | + }; | |
| 10118 | + } | |
| 10119 | + s.setFcsjT(fscjT); | |
| 10120 | + } | |
| 10121 | + List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>(); | |
| 10122 | + listInfo2.addAll(listInfo); | |
| 10123 | + Collections.sort(listInfo, new compareLpFcsjType()); | |
| 10124 | + Collections.sort(listInfo2,new compareDirLpFcsjType()); | |
| 10125 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 10126 | + ScheduleRealInfo t = listInfo.get(i); | |
| 10127 | + if (!lpName.equals(t.getLpName())) { | |
| 10128 | + zdsjActual = t.getZdsjActual(); | |
| 10129 | + zdsj = t.getZdsj(); | |
| 10130 | + t.setZdsjActual(""); | |
| 10131 | + t.setZdsj(""); | |
| 10132 | + } else { | |
| 10133 | + zdsj1 = t.getZdsj(); | |
| 10134 | + zdsjActual1 = t.getZdsjActual(); | |
| 10135 | + t.setZdsjActual(zdsjActual); | |
| 10136 | + t.setZdsj(zdsj); | |
| 10137 | + zdsj = zdsj1; | |
| 10138 | + zdsjActual = zdsjActual1; | |
| 10139 | + } | |
| 10140 | + lpName = t.getLpName(); | |
| 10141 | + list.add(t); | |
| 10142 | + } | |
| 10143 | +/* | |
| 10144 | + List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleDdrb2(line, date); | |
| 10145 | + for (int i = 0; i < listInfo2.size(); i++) { | |
| 10146 | + ScheduleRealInfo s = listInfo2.get(i); | |
| 10147 | + if (s.getBcType().equals("out")) { | |
| 10148 | + s.setRemark("1"); | |
| 10149 | + } else if (s.getBcType().equals("in")) { | |
| 10150 | + s.setRemark("3"); | |
| 10151 | + } else { | |
| 10152 | + s.setRemark("2"); | |
| 10153 | + } | |
| 10154 | + String[] fcsj = s.getFcsj().split(":"); | |
| 10155 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 10156 | + | |
| 10157 | + Long fscjT = 0L; | |
| 10158 | + if (fcsjL < minSj) { | |
| 10159 | + Calendar calendar = new GregorianCalendar(); | |
| 10160 | + calendar.setTime(s.getScheduleDate()); | |
| 10161 | + calendar.add(calendar.DATE, 1); | |
| 10162 | + s.setScheduleDate(calendar.getTime()); | |
| 10163 | + try { | |
| 10164 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 10165 | + } catch (ParseException e) { | |
| 10166 | + // TODO Auto-generated catch block | |
| 10167 | + e.printStackTrace(); | |
| 10168 | + } | |
| 10169 | + | |
| 10170 | + } else { | |
| 10171 | + try { | |
| 10172 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 10173 | + } catch (ParseException e) { | |
| 10174 | + // TODO Auto-generated catch block | |
| 10175 | + e.printStackTrace(); | |
| 10176 | + } | |
| 10177 | + ; | |
| 10178 | + } | |
| 10179 | + s.setFcsjT(fscjT); | |
| 10180 | + }*/ | |
| 10181 | + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | |
| 10182 | + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | |
| 10183 | + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | |
| 10184 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 10185 | + if (listInfo2.size() > 0) { | |
| 10186 | + int a = listInfo2.size() % 3; | |
| 10187 | + int b = listInfo2.size() / 3; | |
| 10188 | + int x = 0, y = 0; | |
| 10189 | + if (a == 2) { | |
| 10190 | + x = b + 1; | |
| 10191 | + y = x * 2; | |
| 10192 | + } else if (a == 1) { | |
| 10193 | + x = b + 1; | |
| 10194 | + y = x * 2 - 1; | |
| 10195 | + } else { | |
| 10196 | + x = b; | |
| 10197 | + y = 2 * x; | |
| 10198 | + | |
| 10199 | + } | |
| 10200 | + for (int i = 0; i < listInfo2.size(); i++) { | |
| 10201 | + ScheduleRealInfo s = listInfo2.get(i); | |
| 10202 | + if (i + 1 <= x) { | |
| 10203 | + xList.add(s); | |
| 10204 | + } else if ((i + 1) > x && (i + 1) <= y) { | |
| 10205 | + yList.add(s); | |
| 10206 | + } else { | |
| 10207 | + zList.add(s); | |
| 10208 | + } | |
| 10209 | + } | |
| 10210 | + for (int i = 0; i < x; i++) { | |
| 10211 | + newList.add(xList.get(i)); | |
| 10212 | + if (yList.size() > i) { | |
| 10213 | + newList.add(yList.get(i)); | |
| 10214 | + } else { | |
| 10215 | + newList.add(new ScheduleRealInfo()); | |
| 10216 | + } | |
| 10217 | + if (zList.size() > i) { | |
| 10218 | + newList.add(zList.get(i)); | |
| 10219 | + } else { | |
| 10220 | + newList.add(new ScheduleRealInfo()); | |
| 10221 | + } | |
| 10222 | + | |
| 10223 | + } | |
| 10224 | + } | |
| 10225 | + for (int i = 0; i < newList.size(); i++) { | |
| 10226 | + ScheduleRealInfo t1 = newList.get(i); | |
| 10227 | + for (int j = 0; j < list.size(); j++) { | |
| 10228 | + ScheduleRealInfo t2 = list.get(j); | |
| 10229 | + if (t1.getId() == t2.getId()) { | |
| 10230 | + t1 = t2; | |
| 10231 | + } | |
| 10232 | + } | |
| 10233 | + } | |
| 10234 | + | |
| 10235 | + for (int i = 0; i < newList.size(); i++) { | |
| 10236 | + ScheduleRealInfo t1 = newList.get(i); | |
| 10237 | + String reamrks1 = t1.getRemarks() == null ? "" : t1.getRemarks(); | |
| 10238 | + if (reamrks1.length() > 4) { | |
| 10239 | + t1.setRemarks(reamrks1.substring(0, 4)); | |
| 10240 | + t1.setRemark(reamrks1); | |
| 10241 | + } else { | |
| 10242 | + t1.setRemark(reamrks1); | |
| 10243 | + } | |
| 10244 | + } | |
| 10245 | + return newList; | |
| 10246 | + } | |
| 10247 | + | |
| 10248 | + @Override | |
| 10249 | + public List<ScheduleRealInfo> realScheduleList_zrw(String line, String date) { | |
| 10250 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 10251 | + String lpName = "lpName"; | |
| 10252 | + String zdsj = ""; | |
| 10253 | + String zdsjActual = ""; | |
| 10254 | + String zdsj1 = ""; | |
| 10255 | + String zdsjActual1 = ""; | |
| 10256 | + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date); | |
| 10257 | + | |
| 10258 | + /* | |
| 10259 | + * 对计划发车时间相同的班次进行排序 out最前 in最后 | |
| 10260 | + */ | |
| 10261 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 10262 | + SimpleDateFormat sdfnyr = new SimpleDateFormat("yyyy-MM-dd"); | |
| 10263 | + | |
| 10264 | + String minfcsj = "02:00"; | |
| 10265 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 10266 | + if (lineList.size() > 0) { | |
| 10267 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 10268 | + + " id = (" | |
| 10269 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 10270 | + + ")"; | |
| 10271 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 10272 | + } | |
| 10273 | + String[] minSjs = minfcsj.split(":"); | |
| 10274 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 10275 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 10276 | + ScheduleRealInfo s = listInfo.get(i); | |
| 10277 | + if (s.getBcType().equals("out")) { | |
| 10278 | + s.setRemark("1"); | |
| 10279 | + } else if (s.getBcType().equals("in")) { | |
| 10280 | + s.setRemark("3"); | |
| 10281 | + } else { | |
| 10282 | + s.setRemark("2"); | |
| 10283 | + } | |
| 10284 | + String[] fcsj = s.getFcsj().split(":"); | |
| 10285 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 10286 | + | |
| 10287 | + Long fscjT = 0L; | |
| 10288 | + if (fcsjL < minSj) { | |
| 10289 | + Calendar calendar = new GregorianCalendar(); | |
| 10290 | + calendar.setTime(s.getScheduleDate()); | |
| 10291 | + calendar.add(calendar.DATE, 1); | |
| 10292 | + Date date_sch=calendar.getTime(); | |
| 10293 | + try { | |
| 10294 | + fscjT = sdf.parse(sdfnyr.format(date_sch) + " " + s.getFcsj()).getTime(); | |
| 10295 | + } catch (ParseException e) { | |
| 10296 | + // TODO Auto-generated catch block | |
| 10297 | + e.printStackTrace(); | |
| 10298 | + } | |
| 10299 | + | |
| 10300 | + } else { | |
| 10301 | + try { | |
| 10302 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 10303 | + } catch (ParseException e) { | |
| 10304 | + // TODO Auto-generated catch block | |
| 10305 | + e.printStackTrace(); | |
| 10306 | + } | |
| 10307 | + ; | |
| 10308 | + } | |
| 10309 | + s.setFcsjT(fscjT); | |
| 10310 | + } | |
| 10311 | + | |
| 10312 | +// Collections.sort(listInfo, new compareLpFcsjType()); | |
| 10313 | + List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>(); | |
| 10314 | + | |
| 10315 | + Collections.sort(listInfo, new compareLpFcsjType()); | |
| 10316 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 10317 | + ScheduleRealInfo t = listInfo.get(i); | |
| 10318 | + if (!lpName.equals(t.getLpName())) { | |
| 10319 | + zdsjActual = t.getZdsjActual(); | |
| 10320 | + zdsj = t.getZdsj(); | |
| 10321 | + t.setZdsjActual(""); | |
| 10322 | + t.setZdsj(""); | |
| 10323 | + } else { | |
| 10324 | + zdsj1 = t.getZdsj(); | |
| 10325 | + zdsjActual1 = t.getZdsjActual(); | |
| 10326 | + t.setZdsjActual(zdsjActual); | |
| 10327 | + t.setZdsj(zdsj); | |
| 10328 | + zdsj = zdsj1; | |
| 10329 | + zdsjActual = zdsjActual1; | |
| 10330 | + } | |
| 10331 | + | |
| 10332 | + | |
| 10333 | + | |
| 10334 | + lpName = t.getLpName(); | |
| 10335 | + listInfo2.add(t); | |
| 10336 | + | |
| 10337 | + } | |
| 10338 | + | |
| 10339 | + Collections.sort(listInfo2,new compareDirLpFcsjType()); | |
| 10340 | + for (int i = 0; i < listInfo2.size(); i++) { | |
| 10341 | + ScheduleRealInfo t=listInfo2.get(i); | |
| 10342 | + list.add(t); | |
| 10343 | + Set<ChildTaskPlan> childTaskPlans = t.getcTasks(); | |
| 10344 | + //计算营运里程,空驶里程 | |
| 10345 | + if (!childTaskPlans.isEmpty()) { | |
| 10346 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 10347 | + Collections.sort(listit, new ComparableChild()); | |
| 10348 | + for (int j = 0; j < listit.size(); j++) { | |
| 10349 | + ScheduleRealInfo s = new ScheduleRealInfo(); | |
| 10350 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 10351 | + if (childTaskPlan.getCcId() == null) { | |
| 10352 | + if (childTaskPlan.isDestroy()) { | |
| 10353 | + s.setFcsjActual(""); | |
| 10354 | + s.setZdsjActual(""); | |
| 10355 | + } else { | |
| 10356 | + s.setFcsjActual(childTaskPlan.getStartDate()); | |
| 10357 | + s.setZdsjActual(""); | |
| 10358 | + s.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 10359 | + } | |
| 10360 | + s.setFcsj(childTaskPlan.getStartDate()); | |
| 10361 | + s.setZdsj(""); | |
| 10362 | + s.setQdzName(childTaskPlan.getStartStationName()); | |
| 10363 | + s.setZdzName(childTaskPlan.getEndStationName()); | |
| 10364 | + s.setRemarks(childTaskPlan.getRemarks()); | |
| 10365 | + s.setAdjustExps("子"); | |
| 10366 | + s.setLpName(""); | |
| 10367 | + list.add(s); | |
| 10368 | + } | |
| 10369 | + } | |
| 10370 | + } | |
| 10371 | + } | |
| 10372 | + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | |
| 10373 | + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | |
| 10374 | + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | |
| 10375 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 10376 | + if (list.size() > 0) { | |
| 10377 | + int a = list.size() % 3; | |
| 10378 | + int b = list.size() / 3; | |
| 10379 | + int x = 0, y = 0; | |
| 10380 | + if (a == 2) { | |
| 10381 | + x = b + 1; | |
| 10382 | + y = x * 2; | |
| 10383 | + } else if (a == 1) { | |
| 10384 | + x = b + 1; | |
| 10385 | + y = x * 2 - 1; | |
| 10386 | + } else { | |
| 10387 | + x = b; | |
| 10388 | + y = 2 * x; | |
| 10389 | + | |
| 10390 | + } | |
| 10391 | + for (int i = 0; i < list.size(); i++) { | |
| 10392 | + ScheduleRealInfo s = list.get(i); | |
| 10393 | + if (i + 1 <= x) { | |
| 10394 | + xList.add(s); | |
| 10395 | + } else if ((i + 1) > x && (i + 1) <= y) { | |
| 10396 | + yList.add(s); | |
| 10397 | + } else { | |
| 10398 | + zList.add(s); | |
| 10399 | + } | |
| 10400 | + } | |
| 10401 | + for (int i = 0; i < x; i++) { | |
| 10402 | + newList.add(xList.get(i)); | |
| 10403 | + if (yList.size() > i) { | |
| 10404 | + newList.add(yList.get(i)); | |
| 10405 | + } else { | |
| 10406 | + newList.add(new ScheduleRealInfo()); | |
| 10407 | + } | |
| 10408 | + if (zList.size() > i) { | |
| 10409 | + newList.add(zList.get(i)); | |
| 10410 | + } else { | |
| 10411 | + newList.add(new ScheduleRealInfo()); | |
| 10412 | + } | |
| 10413 | + | |
| 10414 | + } | |
| 10415 | + } | |
| 10416 | + /* for (int i = 0; i < newList.size(); i++) { | |
| 10417 | + ScheduleRealInfo t1 = newList.get(i); | |
| 10418 | + for (int j = 0; j < list.size(); j++) { | |
| 10419 | + ScheduleRealInfo t2 = list.get(j); | |
| 10420 | + if (t1.getId() == t2.getId()) { | |
| 10421 | + t1 = t2; | |
| 10422 | + } | |
| 10423 | + } | |
| 10424 | + }*/ | |
| 10425 | + | |
| 10426 | + for (int i = 0; i < newList.size(); i++) { | |
| 10427 | + ScheduleRealInfo t1 = newList.get(i); | |
| 10428 | + String reamrks1 = t1.getRemarks() == null ? "" : t1.getRemarks(); | |
| 10429 | + if (reamrks1.length() > 4) { | |
| 10430 | + t1.setRemarks(reamrks1.substring(0, 4)); | |
| 10431 | + t1.setRemark(reamrks1); | |
| 10432 | + } else { | |
| 10433 | + t1.setRemark(reamrks1); | |
| 10434 | + } | |
| 10435 | + } | |
| 10436 | + return newList; | |
| 10437 | + } | |
| 10438 | + | |
| 10439 | + @Override | |
| 10440 | + public List<ScheduleRealInfo> realScheduleList_mh_2(String line, String date) { | |
| 10441 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 10442 | + String lpName = "lpName"; | |
| 10443 | + String zdsj = ""; | |
| 10444 | + String zdsjActual = ""; | |
| 10445 | + String zdsj1 = ""; | |
| 10446 | + String zdsjActual1 = ""; | |
| 10447 | + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date); | |
| 10448 | + | |
| 10449 | + for (ScheduleRealInfo s : listInfo) { | |
| 10450 | + if (s.isDestroy() && s.isReissue()) { | |
| 10451 | + s.setRemark(""); | |
| 10452 | + s.setFcsjActual(s.getDfsj()); | |
| 10453 | + s.setZdsjActual(s.getZdsj()); | |
| 10454 | + s.setStatus(2); | |
| 10455 | + s.setJhlc(s.getJhlcOrig()); | |
| 10456 | + } | |
| 10457 | + } | |
| 10458 | + | |
| 10459 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 10460 | + ScheduleRealInfo t = listInfo.get(i); | |
| 10461 | + if (!lpName.equals(t.getLpName())) { | |
| 10462 | + zdsjActual = t.getZdsjActual(); | |
| 10463 | + zdsj = t.getZdsj(); | |
| 10464 | + t.setZdsjActual(""); | |
| 10465 | + t.setZdsj(""); | |
| 10466 | + } else { | |
| 10467 | + zdsj1 = t.getZdsj(); | |
| 10468 | + zdsjActual1 = t.getZdsjActual(); | |
| 10469 | + t.setZdsjActual(zdsjActual); | |
| 10470 | + t.setZdsj(zdsj); | |
| 10471 | + zdsj = zdsj1; | |
| 10472 | + zdsjActual = zdsjActual1; | |
| 10473 | + } | |
| 10474 | + lpName = t.getLpName(); | |
| 10475 | + list.add(t); | |
| 10476 | + } | |
| 10477 | + | |
| 10478 | + List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleByDateAndLineQp2(line, date); | |
| 10479 | + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | |
| 10480 | + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | |
| 10481 | + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | |
| 10482 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 10483 | + if (listInfo2.size() > 0) { | |
| 10484 | + int a = listInfo2.size() % 3; | |
| 10485 | + int b = listInfo2.size() / 3; | |
| 10486 | + int x = 0, y = 0; | |
| 10487 | + if (a == 2) { | |
| 10488 | + x = b + 1; | |
| 10489 | + y = x * 2; | |
| 10490 | + } else if (b == 1) { | |
| 10491 | + x = b + 1; | |
| 10492 | + y = x * 2 - 1; | |
| 10493 | + } else { | |
| 10494 | + x = b; | |
| 10495 | + y = 2 * x; | |
| 10496 | + | |
| 10497 | + } | |
| 10498 | + for (int i = 0; i < listInfo2.size(); i++) { | |
| 10499 | + ScheduleRealInfo s = listInfo2.get(i); | |
| 10500 | + if (i + 1 <= x) { | |
| 10501 | + xList.add(s); | |
| 10502 | + } else if ((i + 1) > x && (i + 1) <= y) { | |
| 10503 | + yList.add(s); | |
| 10504 | + } else { | |
| 10505 | + zList.add(s); | |
| 10506 | + } | |
| 10507 | + } | |
| 10508 | + for (int i = 0; i < x; i++) { | |
| 10509 | + newList.add(xList.get(i)); | |
| 10510 | + if (yList.size() > i) { | |
| 10511 | + newList.add(yList.get(i)); | |
| 10512 | + } else { | |
| 10513 | + newList.add(new ScheduleRealInfo()); | |
| 10514 | + } | |
| 10515 | + if (zList.size() > i) { | |
| 10516 | + newList.add(zList.get(i)); | |
| 10517 | + } else { | |
| 10518 | + newList.add(new ScheduleRealInfo()); | |
| 10519 | + } | |
| 10520 | + | |
| 10521 | + } | |
| 10522 | + } | |
| 10523 | + for (int i = 0; i < newList.size(); i++) { | |
| 10524 | + ScheduleRealInfo t1 = newList.get(i); | |
| 10525 | + for (int j = 0; j < list.size(); j++) { | |
| 10526 | + ScheduleRealInfo t2 = list.get(j); | |
| 10527 | + if (t1.getId() == t2.getId()) { | |
| 10528 | + t1 = t2; | |
| 10529 | + } | |
| 10530 | + } | |
| 10531 | + } | |
| 10532 | + return newList; | |
| 10533 | + } | |
| 10534 | + | |
| 10535 | + @Override | |
| 10536 | + public List<ScheduleRealInfo> realScheduleListQp(String line, String date) { | |
| 10537 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 10538 | + String lpName = "lpName"; | |
| 10539 | + String zdsj = ""; | |
| 10540 | + String zdsjActual = ""; | |
| 10541 | + String zdsj1 = ""; | |
| 10542 | + String zdsjActual1 = ""; | |
| 10543 | + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date); | |
| 10544 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 10545 | + ScheduleRealInfo t = listInfo.get(i); | |
| 10546 | + if (!lpName.equals(t.getLpName())) { | |
| 10547 | + zdsjActual = t.getZdsjActual(); | |
| 10548 | + zdsj = t.getZdsj(); | |
| 10549 | + t.setZdsjActual(""); | |
| 10550 | + t.setZdsj(""); | |
| 10551 | + } else { | |
| 10552 | + zdsj1 = t.getZdsj(); | |
| 10553 | + zdsjActual1 = t.getZdsjActual(); | |
| 10554 | + t.setZdsjActual(zdsjActual); | |
| 10555 | + t.setZdsj(zdsj); | |
| 10556 | + zdsj = zdsj1; | |
| 10557 | + zdsjActual = zdsjActual1; | |
| 10558 | + } | |
| 10559 | + | |
| 10560 | + lpName = t.getLpName(); | |
| 10561 | + list.add(t); | |
| 10562 | + } | |
| 10563 | + return list; | |
| 10564 | + } | |
| 10565 | + | |
| 10566 | + public List<Map<String, Object>> yesterdayDataList(String line, String date, String gsbm, String fgsbm, String jGh, String nbbm) { | |
| 10567 | + List<Map<String, Object>> yesterdayDataList = new ArrayList<Map<String, Object>>(); | |
| 10568 | + if (line.equals("")) { | |
| 10569 | + yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date, gsbm, fgsbm, nbbm); | |
| 10570 | + } else { | |
| 10571 | + yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList_eq(line, date, gsbm, fgsbm, nbbm); | |
| 10572 | + } | |
| 10573 | + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date, gsbm, fgsbm); | |
| 10574 | + for (int x = 0; x < yesterdayDataList.size(); x++) { | |
| 10575 | + String jsy = yesterdayDataList.get(x).get("jGh").toString(); | |
| 10576 | + String clZbh = yesterdayDataList.get(x).get("clZbh").toString(); | |
| 10577 | + String xlbm = yesterdayDataList.get(x).get("xlBm").toString(); | |
| 10578 | + String lp = yesterdayDataList.get(x).get("lpName").toString(); | |
| 10579 | + String realExecDate=yesterdayDataList.get(x).get("realExecDate").toString(); | |
| 10580 | + String fcsj[] =realExecDate.split(" "); | |
| 10581 | + //取出最小计划发车时间 | |
| 10582 | + yesterdayDataList.get(x).put("fcsj", fcsj[1]); | |
| 10583 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 10584 | + boolean fage = true; | |
| 10585 | + String company = ""; | |
| 10586 | + String bCompany = ""; | |
| 10587 | + String lineName=""; | |
| 10588 | + String jName=""; | |
| 10589 | + List<ScheduleRealInfo> listS = new ArrayList<ScheduleRealInfo>(); | |
| 10590 | + for (ScheduleRealInfo scheduleRealInfo : lists) { | |
| 10591 | + if (scheduleRealInfo.getjGh().equals(jsy) | |
| 10592 | + && scheduleRealInfo.getClZbh().equals(clZbh) | |
| 10593 | + && scheduleRealInfo.getXlBm().equals(xlbm) | |
| 10594 | + && scheduleRealInfo.getLpName().equals(lp)) { | |
| 10595 | + if (fage) { | |
| 10596 | + //根据线路代码获取公司 | |
| 10597 | + company = scheduleRealInfo.getGsBm(); | |
| 10598 | + bCompany = scheduleRealInfo.getFgsBm(); | |
| 10599 | + lineName = scheduleRealInfo.getXlName(); | |
| 10600 | + jName= scheduleRealInfo.getjName(); | |
| 10601 | + fage = false; | |
| 10602 | + } | |
| 10603 | + Set<ChildTaskPlan> cts = scheduleRealInfo.getcTasks(); | |
| 10604 | + if (cts != null && cts.size() > 0) { | |
| 10605 | + listS.add(scheduleRealInfo); | |
| 10606 | + } else { | |
| 10607 | + if (scheduleRealInfo.getZdsjActual() != null && scheduleRealInfo.getFcsjActual() != null) { | |
| 10608 | + listS.add(scheduleRealInfo); | |
| 10609 | + } | |
| 10610 | + } | |
| 10611 | + } | |
| 10612 | + } | |
| 10613 | + yesterdayDataList.get(x).put("company", company); | |
| 10614 | + yesterdayDataList.get(x).put("bCompany", bCompany); | |
| 10615 | + yesterdayDataList.get(x).put("lineName", lineName); | |
| 10616 | + yesterdayDataList.get(x).put("jName", jName); | |
| 10617 | + Double ljgl = culateMieageService.culateLjgl(listS); | |
| 10618 | + Double sjgl = culateMieageService.culateSjgl(listS); | |
| 10619 | + Double ksgl = culateMieageService.culateKsgl(listS); | |
| 10620 | + Double jccgl = culateMieageService.culateJccgl(listS); | |
| 10621 | + Double zyygl = Arith.add(sjgl, ljgl); | |
| 10622 | + Double zksgl = Arith.add(ksgl, jccgl); | |
| 10623 | + Double zlc = Arith.add(zyygl, zksgl); | |
| 10624 | + yesterdayDataList.get(x).put("totalKilometers", zlc); | |
| 10625 | + | |
| 10626 | + } | |
| 10627 | + //增加顺序号 | |
| 10628 | + for (int i = 0; i < yesterdayDataList.size(); i++) { | |
| 10629 | + if (i == 0) { | |
| 10630 | + yesterdayDataList.get(i).put("seqNumber", 1); | |
| 10631 | + } else { | |
| 10632 | + if (yesterdayDataList.get(i - 1).get("clZbh").equals(yesterdayDataList.get(i).get("clZbh"))) { | |
| 10633 | + yesterdayDataList.get(i).put("seqNumber", 1 + (int) yesterdayDataList.get(i - 1).get("seqNumber")); | |
| 10634 | + } else { | |
| 10635 | + yesterdayDataList.get(i).put("seqNumber", 1); | |
| 10636 | + } | |
| 10637 | + } | |
| 10638 | + } | |
| 10639 | + | |
| 10640 | + return yesterdayDataList; | |
| 10641 | + } | |
| 10642 | + | |
| 10643 | + /** | |
| 10644 | + * 批量调整人车 | |
| 10645 | + */ | |
| 10646 | + @Override | |
| 10647 | + public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs, String userId) { | |
| 10648 | + Map<String, Object> rs = new HashMap<>(); | |
| 10649 | + Set<ScheduleRealInfo> set = new HashSet<>(); | |
| 10650 | + | |
| 10651 | + ScheduleRealInfo sch; | |
| 10652 | + | |
| 10653 | + String jGh = null, jName, sGh, sName; | |
| 10654 | + for (ChangePersonCar cpc : cpcs) { | |
| 10655 | + | |
| 10656 | + sch = dayOfSchedule.get(cpc.getSchId()); | |
| 10657 | + if (sch == null) | |
| 10658 | + continue; | |
| 10659 | + | |
| 10660 | + if (cpc.getClZbh() != null) { | |
| 10661 | + if (!carExist(sch.getGsBm(), cpc.getClZbh())) { | |
| 10662 | + rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | |
| 10663 | + rs.put("status", ResponseCode.ERROR); | |
| 10664 | + return rs; | |
| 10665 | + } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(cpc.getClZbh()))) { | |
| 10666 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + cpc.getClZbh() + "】的车辆"); | |
| 10667 | + rs.put("status", ResponseCode.ERROR); | |
| 10668 | + return rs; | |
| 10669 | + } | |
| 10670 | + } | |
| 10671 | + | |
| 10672 | + if (StringUtils.isNotEmpty(cpc.getJsy())) { | |
| 10673 | + try{ | |
| 10674 | + jGh = cpc.getJsy().split("/")[0]; | |
| 10675 | + }catch (Exception e){ | |
| 10676 | + logger.error("", e); | |
| 10677 | + rs.put("msg", "驾驶员参数异常!!"); | |
| 10678 | + rs.put("status", ResponseCode.ERROR); | |
| 10679 | + return rs; | |
| 10680 | + } | |
| 10681 | + | |
| 10682 | + jName = getPersonName(sch.getGsBm(), jGh); | |
| 10683 | + if (StringUtils.isEmpty(jName)) { | |
| 10684 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + jGh + "】的驾驶员"); | |
| 10685 | + rs.put("status", ResponseCode.ERROR); | |
| 10686 | + return rs; | |
| 10687 | + } | |
| 10688 | + } | |
| 10689 | + | |
| 10690 | + | |
| 10691 | + //为换人换车情况表写入数据 | |
| 10692 | + schModifyLog.saveChangetochange(sch, cpc, userId); | |
| 10693 | + //日志记录 | |
| 10694 | + ScheduleModifyLogger.tzrc(sch, cpc, userId); | |
| 10695 | + | |
| 10696 | + //换驾驶员 | |
| 10697 | + if (StringUtils.isNotEmpty(cpc.getJsy())) { | |
| 10698 | + //换驾驶员 | |
| 10699 | + if (persoChange(sch, jGh)) | |
| 10700 | + set.add(sch); | |
| 10701 | + } | |
| 10702 | + | |
| 10703 | + //换售票员 | |
| 10704 | + if (StringUtils.isNotEmpty(cpc.getSpy()) | |
| 10705 | + && !"/".equals(StringUtils.trim(cpc.getSpy()))) { | |
| 10706 | + | |
| 10707 | + sGh = cpc.getSpy().split("/")[0]; | |
| 10708 | + sName = getPersonName(sch.getGsBm(), sGh); | |
| 10709 | + if (StringUtils.isEmpty(sName)) { | |
| 10710 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sGh + "】的售票员"); | |
| 10711 | + rs.put("status", ResponseCode.ERROR); | |
| 10712 | + return rs; | |
| 10713 | + } | |
| 10714 | + | |
| 10715 | + /*if(!sGh.equals(sch.getsGh())) | |
| 10716 | + sb.append(sch.getsGh() + " 换 " + sGh + ";");*/ | |
| 10717 | + if (persoChangeSPY(sch, sGh)) | |
| 10718 | + set.add(sch); | |
| 10719 | + } else if (StringUtils.isNotEmpty(sch.getsGh())) { | |
| 10720 | + sch.setsGh(""); | |
| 10721 | + sch.setsName(""); | |
| 10722 | + } | |
| 10723 | + | |
| 10724 | + //换车 | |
| 10725 | + if (StringUtils.isNotEmpty(cpc.getClZbh()) && !cpc.getClZbh().equals(sch.getClZbh())) { | |
| 10726 | + //sb.append(sch.getClZbh() + " 换 " + cpc.getClZbh() + ";"); | |
| 10727 | + set.add(sch); | |
| 10728 | + set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh())); | |
| 10729 | + } | |
| 10730 | + | |
| 10731 | + /*if(sb.length() > 0) | |
| 10732 | + sch.setRemarks(sb.toString());*/ | |
| 10733 | + | |
| 10734 | + dayOfSchedule.save(sch); | |
| 10735 | + set.add(sch); | |
| 10736 | + | |
| 10737 | + } | |
| 10738 | + rs.put("ts", set); | |
| 10739 | + rs.put("status", ResponseCode.SUCCESS); | |
| 10740 | + return rs; | |
| 10741 | + } | |
| 10742 | + | |
| 10743 | + /** | |
| 10744 | + * @Title: persoChange | |
| 10745 | + * @Description: TODO(班次换驾驶员) | |
| 10746 | + */ | |
| 10747 | + public boolean persoChange(ScheduleRealInfo sch, String jGh) { | |
| 10748 | + if (sch.getjGh().equals(jGh)) | |
| 10749 | + return false; | |
| 10750 | + String jName = getPersonName(sch.getGsBm(), jGh); | |
| 10751 | + if (StringUtils.isNotEmpty(jName)) { | |
| 10752 | + | |
| 10753 | + if (jGh.indexOf("-") != -1) | |
| 10754 | + sch.setjGh(jGh.substring(jGh.indexOf("-") + 1)); | |
| 10755 | + else | |
| 10756 | + sch.setjGh(jGh); | |
| 10757 | + | |
| 10758 | + sch.setjName(jName); | |
| 10759 | + return true; | |
| 10760 | + } | |
| 10761 | + return false; | |
| 10762 | + } | |
| 10763 | + | |
| 10764 | + /** | |
| 10765 | + * @Title: persoChange | |
| 10766 | + * @Description: TODO(班次换售票员) | |
| 10767 | + */ | |
| 10768 | + public boolean persoChangeSPY(ScheduleRealInfo sch, String sGh) { | |
| 10769 | + if (sch.getsGh().equals(sGh)) | |
| 10770 | + return false; | |
| 10771 | + String sName = getPersonName(sch.getGsBm(), sGh); | |
| 10772 | + if (StringUtils.isNotEmpty(sName)) { | |
| 10773 | + if (sGh.indexOf("-") != -1) | |
| 10774 | + sch.setsGh(sGh.substring(sGh.indexOf("-") + 1)); | |
| 10775 | + else | |
| 10776 | + sch.setsGh(sGh); | |
| 10777 | + sch.setsName(sName); | |
| 10778 | + return true; | |
| 10779 | + } | |
| 10780 | + return false; | |
| 10781 | + } | |
| 10782 | + | |
| 10783 | + /** | |
| 10784 | + * 批量待发调整 | |
| 10785 | + */ | |
| 10786 | + @Override | |
| 10787 | + public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) { | |
| 10788 | + Map<String, Object> rs = new HashMap<>(), tempMap = new HashMap<>(); | |
| 10789 | + List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 10790 | + | |
| 10791 | + for (DfsjChange dc : dfsjcs) { | |
| 10792 | + if (StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj())) | |
| 10793 | + continue; | |
| 10794 | + | |
| 10795 | + tempMap = outgoAdjust(dc.getSchId(), "", dc.getNew_dfsj(), null, "2", null); | |
| 10796 | + | |
| 10797 | + if (tempMap.get("status").equals(ResponseCode.SUCCESS)) { | |
| 10798 | + list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts")); | |
| 10799 | + } | |
| 10800 | + } | |
| 10801 | + | |
| 10802 | + rs.put("status", ResponseCode.SUCCESS); | |
| 10803 | + rs.put("ts", list); | |
| 10804 | + return rs; | |
| 10805 | + } | |
| 10806 | + | |
| 10807 | + | |
| 10808 | + @Override | |
| 10809 | + public Map<String, Object> findKMBC1(String jName, String clZbh, | |
| 10810 | + String date, String enddate) { | |
| 10811 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate); | |
| 10812 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 10813 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 10814 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 10815 | + int jhbc = 0, cjbc = 0, ljbc = 0; | |
| 10816 | + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0; | |
| 10817 | + float addMileage = 0l, remMileage = 0l; | |
| 10818 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 10819 | + for (ScheduleRealInfo scheduleRealInfo : list) { | |
| 10820 | + if (scheduleRealInfo != null) { | |
| 10821 | + //计划里程(主任务过滤掉临加班次), | |
| 10822 | + //烂班里程(主任务烂班), | |
| 10823 | + //临加里程(主任务临加), | |
| 10824 | + //计划班次,烂班班次,增加班次 | |
| 10825 | + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); | |
| 10826 | + if (scheduleRealInfo.isSflj()) { | |
| 10827 | + addMileage += tempJhlc; | |
| 10828 | + ljbc++; | |
| 10829 | + } else { | |
| 10830 | + jhlc += tempJhlc; | |
| 10831 | + jhbc++; | |
| 10832 | + if (scheduleRealInfo.getStatus() == -1) { | |
| 10833 | + remMileage += tempJhlc; | |
| 10834 | + cjbc++; | |
| 10835 | + } | |
| 10836 | + } | |
| 10837 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 10838 | + //计算营运里程,空驶里程 | |
| 10839 | + if (childTaskPlans.isEmpty()) { | |
| 10840 | + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | |
| 10841 | + || scheduleRealInfo.getBcType().equals("venting")) { | |
| 10842 | + ksgl += tempJhlc; | |
| 10843 | + } else { | |
| 10844 | + yygl += tempJhlc; | |
| 10845 | + } | |
| 10846 | + } else { | |
| 10847 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 10848 | + while (it.hasNext()) { | |
| 10849 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 10850 | + if (childTaskPlan.getMileageType().equals("empty")) { | |
| 10851 | + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 10852 | + } else { | |
| 10853 | + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 10854 | + } | |
| 10855 | + } | |
| 10856 | + } | |
| 10857 | + } | |
| 10858 | + } | |
| 10859 | + map.put("jhlc", format.format(jhlc)); | |
| 10860 | + map.put("remMileage", format.format(remMileage)); | |
| 10861 | + map.put("addMileage", format.format(addMileage)); | |
| 10862 | + map.put("yygl", format.format(yygl)); | |
| 10863 | + map.put("ksgl", format.format(ksgl)); | |
| 10864 | + map.put("realMileage", format.format(yygl + ksgl)); | |
| 10865 | + map.put("jhbc", jhbc); | |
| 10866 | + map.put("cjbc", cjbc); | |
| 10867 | + map.put("ljbc", ljbc); | |
| 10868 | + map.put("sjbc", jhbc - cjbc + ljbc); | |
| 10869 | + return map; | |
| 10870 | + } | |
| 10871 | + | |
| 10872 | + /** | |
| 10873 | + * 调整班次类型 | |
| 10874 | + * | |
| 10875 | + * @param id | |
| 10876 | + * @param bcType | |
| 10877 | + * @param remarks | |
| 10878 | + * @return | |
| 10879 | + */ | |
| 10880 | + @Override | |
| 10881 | + public Map<String, Object> changeBcType(Long id, String bcType, String remarks, String majorStationName) { | |
| 10882 | + Map<String, Object> rs = new HashMap<>(); | |
| 10883 | + | |
| 10884 | + try { | |
| 10885 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 10886 | + if (sch != null) { | |
| 10887 | + sch.setBcType(bcType); | |
| 10888 | + sch.setRemarks(remarks); | |
| 10889 | + rs.put("status", ResponseCode.SUCCESS); | |
| 10890 | + rs.put("t", sch); | |
| 10891 | + | |
| 10892 | + if ("major".equals(bcType)) { | |
| 10893 | + sch.setMajorStationName(majorStationName); | |
| 10894 | + } | |
| 10895 | + | |
| 10896 | + dayOfSchedule.save(sch); | |
| 10897 | + } | |
| 10898 | + } catch (Exception e) { | |
| 10899 | + logger.error("", e); | |
| 10900 | + rs.put("status", ResponseCode.ERROR); | |
| 10901 | + } | |
| 10902 | + | |
| 10903 | + return rs; | |
| 10904 | + } | |
| 10905 | + | |
| 10906 | + @Override | |
| 10907 | + public Map<String, Object> historySave(ScheduleRealInfo sch) { | |
| 10908 | + Map<String, Object> rs = new HashMap<>(); | |
| 10909 | + rs.put("status", ResponseCode.ERROR); | |
| 10910 | + | |
| 10911 | + ScheduleRealInfo oldSch = super.findById(sch.getId()); | |
| 10912 | + //事后日志记录 | |
| 10913 | + AfterwardsLogger aflog = AfterwardsLogger.start(oldSch, "事后调整"); | |
| 10914 | + | |
| 10915 | + //换车 | |
| 10916 | + if (StringUtils.isNotEmpty(sch.getClZbh()) && !oldSch.getClZbh().equals(sch.getClZbh())) { | |
| 10917 | + if (!carExist(oldSch.getGsBm(), sch.getClZbh())) { | |
| 10918 | + rs.put("msg", "车辆 " + sch.getClZbh() + " 不存在!"); | |
| 10919 | + return rs; | |
| 10920 | + } else { | |
| 10921 | + aflog.log("换车", oldSch.getClZbh(), sch.getClZbh()); | |
| 10922 | + oldSch.setClZbh(sch.getClZbh()); | |
| 10923 | + } | |
| 10924 | + } | |
| 10925 | + | |
| 10926 | + //换驾驶员 | |
| 10927 | + if (StringUtils.isNotEmpty(sch.getjGh()) && !oldSch.getjGh().equals(sch.getjGh())) { | |
| 10928 | + String jName = getPersonName(oldSch.getGsBm(), sch.getjGh()); | |
| 10929 | + if (StringUtils.isEmpty(jName)) { | |
| 10930 | + rs.put("msg", oldSch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员"); | |
| 10931 | + return rs; | |
| 10932 | + } | |
| 10933 | + aflog.log("换驾驶员", oldSch.getjGh() + "/" + oldSch.getjName(), sch.getjGh() + "/" + sch.getjName()); | |
| 10934 | + persoChange(oldSch, sch.getjGh()); | |
| 10935 | + } | |
| 10936 | + | |
| 10937 | + //换售票员 | |
| 10938 | + if (StringUtils.isNotEmpty(sch.getsGh()) && !oldSch.getsGh().equals(sch.getsGh())) { | |
| 10939 | + String sName = getPersonName(oldSch.getGsBm(), sch.getsGh()); | |
| 10940 | + if (StringUtils.isEmpty(sName)) { | |
| 10941 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getsGh() + "】的售票员"); | |
| 10942 | + return rs; | |
| 10943 | + } | |
| 10944 | + aflog.log("换售票员", oldSch.getsGh() + "/" + oldSch.getsName(), sch.getsGh() + "/" + sch.getsName()); | |
| 10945 | + persoChangeSPY(oldSch, sch.getsGh()); | |
| 10946 | + } | |
| 10947 | + | |
| 10948 | + //烂班 | |
| 10949 | + boolean dest1 = oldSch.getStatus() == -1; | |
| 10950 | + boolean dest2 = sch.getStatus() == -1; | |
| 10951 | + if (!dest1 && dest2) { | |
| 10952 | + oldSch.destroy(); | |
| 10953 | + aflog.log("烂班"); | |
| 10954 | + } else if (dest1 && !dest2) { | |
| 10955 | + //撤销烂班 | |
| 10956 | + oldSch.setJhlc(oldSch.getJhlcOrig()); | |
| 10957 | + oldSch.setStatus(0); | |
| 10958 | + oldSch.calcStatus(); | |
| 10959 | + oldSch.setAdjustExps(null); | |
| 10960 | + aflog.log("撤销烂班"); | |
| 10961 | + } | |
| 10962 | + | |
| 10963 | + oldSch.setAdjustExps(sch.getAdjustExps()); | |
| 10964 | + | |
| 10965 | + /** | |
| 10966 | + * 修改班次里程 | |
| 10967 | + */ | |
| 10968 | + if (!oldSch.getJhlc().equals(sch.getJhlc())) { | |
| 10969 | + double jhlcNum = sch.getJhlc(); | |
| 10970 | + aflog.log("修改班次里程", oldSch.getJhlc(), jhlcNum); | |
| 10971 | + //烂班 | |
| 10972 | + if (jhlcNum == 0 && oldSch.getJhlcOrig() != 0) | |
| 10973 | + oldSch.destroy(); | |
| 10974 | + else { | |
| 10975 | + oldSch.setJhlc(jhlcNum); | |
| 10976 | + //临加班次,实际计划一起改 | |
| 10977 | + if (oldSch.isSflj()) | |
| 10978 | + oldSch.setJhlcOrig(jhlcNum); | |
| 10979 | + } | |
| 10980 | + } | |
| 10981 | + | |
| 10982 | + //待发时间 | |
| 10983 | + if (!CustomStringUtils.equals(oldSch.getDfsj(), sch.getDfsj())) { | |
| 10984 | + aflog.log("修改待发时间", oldSch.getDfsj(), sch.getDfsj()); | |
| 10985 | + oldSch.setDfsj(sch.getDfsj()); | |
| 10986 | + } | |
| 10987 | + //实发时间 | |
| 10988 | + if (!CustomStringUtils.equals(oldSch.getFcsjActual(), sch.getFcsjActual())) { | |
| 10989 | + aflog.log("修改实发时间", oldSch.getFcsjActual(), sch.getFcsjActual()); | |
| 10990 | + oldSch.setFcsjActual(sch.getFcsjActual()); | |
| 10991 | + } | |
| 10992 | + //实际终点 | |
| 10993 | + if (!CustomStringUtils.equals(oldSch.getZdsjActual(), sch.getZdsjActual())) { | |
| 10994 | + aflog.log("修改实达时间", oldSch.getZdsjActual(), sch.getZdsjActual()); | |
| 10995 | + oldSch.setZdsjActual(sch.getZdsjActual()); | |
| 10996 | + } | |
| 10997 | + | |
| 10998 | + //备注 | |
| 10999 | + if (!CustomStringUtils.equals(oldSch.getRemarks(), sch.getRemarks())) { | |
| 11000 | + aflog.log("修改备注", oldSch.getRemarks(), sch.getRemarks()); | |
| 11001 | + oldSch.setRemarks(sch.getRemarks()); | |
| 11002 | + } | |
| 11003 | + | |
| 11004 | + scheduleRealInfoRepository.save(oldSch); | |
| 11005 | + | |
| 11006 | + aflog.end(); | |
| 11007 | + rs.put("status", ResponseCode.SUCCESS); | |
| 11008 | + return rs; | |
| 11009 | + } | |
| 11010 | + | |
| 11011 | + @Autowired | |
| 11012 | + SvgAttributeRepository svgAttributeRepository; | |
| 11013 | + | |
| 11014 | + @Override | |
| 11015 | + public Map<String, Object> svgAttr(String jsonStr) { | |
| 11016 | + Map<String, Object> rs = new HashMap<>(); | |
| 11017 | + | |
| 11018 | + try { | |
| 11019 | + JSONObject jObj = JSONObject.parseObject(StringEscapeUtils.unescapeHtml4(jsonStr)); | |
| 11020 | + | |
| 11021 | + SvgAttribute svgAttribute = new SvgAttribute(); | |
| 11022 | + svgAttribute.setLineCode(jObj.getString("lineCode")); | |
| 11023 | + svgAttribute.setHideStations(jObj.getString("hideStations")); | |
| 11024 | + svgAttribute.setNicknames(jObj.getString("nicknames")); | |
| 11025 | + svgAttributeRepository.save(svgAttribute); | |
| 11026 | + | |
| 11027 | + rs.put("t", svgAttribute); | |
| 11028 | + rs.put("status", ResponseCode.SUCCESS); | |
| 11029 | + } catch (Exception e) { | |
| 11030 | + logger.error("", e); | |
| 11031 | + rs.put("status", ResponseCode.ERROR); | |
| 11032 | + } | |
| 11033 | + return rs; | |
| 11034 | + } | |
| 11035 | + | |
| 11036 | + @Override | |
| 11037 | + public Map<String, Object> findSvgAttr(String idx) { | |
| 11038 | + Map<String, Object> rs = new HashMap<>(); | |
| 11039 | + try { | |
| 11040 | + List<String> lineCodes = Splitter.on(",").splitToList(idx); | |
| 11041 | + List<SvgAttribute> list = svgAttributeRepository.findSvgAttr(lineCodes); | |
| 11042 | + | |
| 11043 | + rs.put("status", ResponseCode.SUCCESS); | |
| 11044 | + rs.put("list", list); | |
| 11045 | + } catch (Exception e) { | |
| 11046 | + logger.error("", e); | |
| 11047 | + rs.put("status", ResponseCode.ERROR); | |
| 11048 | + } | |
| 11049 | + return rs; | |
| 11050 | + } | |
| 11051 | + | |
| 11052 | + @Override | |
| 11053 | + public Map<String, Object> addRemarks(Long id, String remarks) { | |
| 11054 | + Map<String, Object> rs = new HashMap<>(); | |
| 11055 | + try { | |
| 11056 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 11057 | + sch.addRemarks(remarks); | |
| 11058 | + | |
| 11059 | + rs.put("status", ResponseCode.SUCCESS); | |
| 11060 | + rs.put("t", sch); | |
| 11061 | + } catch (Exception e) { | |
| 11062 | + logger.error("", e); | |
| 11063 | + rs.put("status", ResponseCode.ERROR); | |
| 11064 | + } | |
| 11065 | + return rs; | |
| 11066 | + } | |
| 11067 | + | |
| 11068 | + @Override | |
| 11069 | + public List<Map<String, Object>> yesterdayDataList(String line) { | |
| 11070 | + // TODO Auto-generated method stub | |
| 11071 | + return null; | |
| 11072 | + } | |
| 11073 | + | |
| 11074 | + @Override | |
| 11075 | + public List<ScheduleRealInfo> exportWaybillQp(String clZbh, String date, String line) { | |
| 11076 | + // TODO Auto-generated method stub | |
| 11077 | + ReportUtils ee = new ReportUtils(); | |
| 11078 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 11079 | + List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 11080 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line); | |
| 11081 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 11082 | + | |
| 11083 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 11084 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 11085 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 11086 | + int jhbc = 0, cjbc = 0, ljbc = 0; | |
| 11087 | + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0; | |
| 11088 | + float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0; | |
| 11089 | + int xyz = 1; | |
| 11090 | + Map<String, Object> map; | |
| 11091 | + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) { | |
| 11092 | + if (scheduleRealInfo != null) { | |
| 11093 | + //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次 | |
| 11094 | + //计划里程(主任务过滤掉临加班次), | |
| 11095 | + //烂班里程(主任务烂班), | |
| 11096 | + //临加里程(主任务临加), | |
| 11097 | + //计划班次,烂班班次,增加班次 | |
| 11098 | + double jh = 0, sj = 0; | |
| 11099 | + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); | |
| 11100 | + if (scheduleRealInfo.isSflj()) { | |
| 11101 | + ljbc++; | |
| 11102 | + } else { | |
| 11103 | + if (!(scheduleRealInfo.getBcType().equals("in") | |
| 11104 | + || scheduleRealInfo.getBcType().equals("out"))) { | |
| 11105 | + jhbc++; | |
| 11106 | + jh += tempJhlc; | |
| 11107 | + } | |
| 11108 | + if (scheduleRealInfo.getStatus() == -1) { | |
| 11109 | + remMileage += tempJhlc; | |
| 11110 | + cjbc++; | |
| 11111 | + } | |
| 11112 | + } | |
| 11113 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 11114 | + //计算营运里程,空驶里程 | |
| 11115 | + if (childTaskPlans.isEmpty()) { | |
| 11116 | + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | |
| 11117 | + ) { | |
| 11118 | + jcclc += tempJhlc; | |
| 11119 | + } else { | |
| 11120 | + if (scheduleRealInfo.getStatus() != -1) { | |
| 11121 | + if (scheduleRealInfo.isSflj()) { | |
| 11122 | + addMileage += tempJhlc; | |
| 11123 | + } | |
| 11124 | + sj += tempJhlc; | |
| 11125 | + } | |
| 11126 | + } | |
| 11127 | + } else { | |
| 11128 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 11129 | + while (it.hasNext()) { | |
| 11130 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 11131 | + if (childTaskPlan.getMileageType().equals("empty")) { | |
| 11132 | + if (childTaskPlan.isDestroy()) { | |
| 11133 | + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 11134 | + } else { | |
| 11135 | + if (scheduleRealInfo.isSflj()) { | |
| 11136 | + addMileage += tempJhlc; | |
| 11137 | + } | |
| 11138 | + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 11139 | + } | |
| 11140 | + } else { | |
| 11141 | + if (childTaskPlan.isDestroy()) { | |
| 11142 | + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 11143 | +// cjbc++; | |
| 11144 | + } else { | |
| 11145 | + if (scheduleRealInfo.isSflj()) { | |
| 11146 | + addMileage += tempJhlc; | |
| 11147 | + } | |
| 11148 | + sj += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 11149 | + } | |
| 11150 | + } | |
| 11151 | + } | |
| 11152 | + } | |
| 11153 | + | |
| 11154 | + if (!(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out"))) { | |
| 11155 | + map = new HashMap<String, Object>(); | |
| 11156 | + try { | |
| 11157 | + scheduleRealInfo.setBcs(xyz); | |
| 11158 | + xyz++; | |
| 11159 | + Set<ChildTaskPlan> cs = scheduleRealInfo.getcTasks(); | |
| 11160 | + Double sjlc = 0.0; | |
| 11161 | + if (!cs.isEmpty()) { | |
| 11162 | + Iterator<ChildTaskPlan> it = cs.iterator(); | |
| 11163 | + while (it.hasNext()) { | |
| 11164 | + ChildTaskPlan c = it.next(); | |
| 11165 | + if (!c.isDestroy()) { | |
| 11166 | + sjlc += c.getMileage() == null ? 0 : c.getMileage(); | |
| 11167 | + } | |
| 11168 | + | |
| 11169 | + } | |
| 11170 | + } else { | |
| 11171 | + if (scheduleRealInfo.getStatus() != -1) { | |
| 11172 | + sjlc = scheduleRealInfo.getJhlc(); | |
| 11173 | + } | |
| 11174 | + } | |
| 11175 | + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | |
| 11176 | + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | |
| 11177 | + scheduleRealInfo.setSjlc(format.format(sjlc)); | |
| 11178 | + map = rru.getMapValue(scheduleRealInfo); | |
| 11179 | + String zdsj = scheduleRealInfo.getZdsj(); | |
| 11180 | + String zdsjActual = scheduleRealInfo.getZdsjActual(); | |
| 11181 | + if (zdsj != null && zdsjActual != null && | |
| 11182 | + !zdsj.equals(zdsjActual)) { | |
| 11183 | + int zdsjT = Integer.valueOf(zdsj.split(":")[0]) * 60 + Integer.valueOf(zdsj.split(":")[1]); | |
| 11184 | + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0]) * 60 + Integer.valueOf(zdsjActual.split(":")[1]); | |
| 11185 | + if (zdsj.compareTo(zdsjActual) > 0) { | |
| 11186 | + if (zdsjT - zdsjAT > 1000) { | |
| 11187 | + map.put("fast", ""); | |
| 11188 | + map.put("slow", zdsjAT - zdsjT + 1440); | |
| 11189 | + } else { | |
| 11190 | + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 11191 | + map.put("slow", ""); | |
| 11192 | + } | |
| 11193 | + } else { | |
| 11194 | + if (zdsjAT - zdsjT > 1000) { | |
| 11195 | + map.put("fast", zdsjT - zdsjAT + 1440); | |
| 11196 | + map.put("slow", ""); | |
| 11197 | + } else { | |
| 11198 | + map.put("fast", ""); | |
| 11199 | + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 11200 | + } | |
| 11201 | + } | |
| 11202 | + } else { | |
| 11203 | + map.put("fast", ""); | |
| 11204 | + map.put("slow", ""); | |
| 11205 | + } | |
| 11206 | + listMap.add(map); | |
| 11207 | + } catch (Exception e) { | |
| 11208 | + e.printStackTrace(); | |
| 11209 | + } | |
| 11210 | + } | |
| 11211 | + jhlc += jh; | |
| 11212 | + yygl += sj; | |
| 11213 | + if (jh > sj) { | |
| 11214 | + remgl += jh - sj; | |
| 11215 | + } else { | |
| 11216 | + addgl += sj - jh; | |
| 11217 | + } | |
| 11218 | + } | |
| 11219 | + } | |
| 11220 | + | |
| 11221 | + | |
| 11222 | + List<Ylxxb> listYlxxb = ylxxbRepository.queryListYlxxb(clZbh, date); | |
| 11223 | + Double jzl = 0.0; | |
| 11224 | + for (int t = 0; t < listYlxxb.size(); t++) { | |
| 11225 | + Ylxxb y = listYlxxb.get(t); | |
| 11226 | + jzl += y.getJzl(); | |
| 11227 | + } | |
| 11228 | + | |
| 11229 | + //计算里程和班次数,并放入Map里 | |
| 11230 | + map = findKMBCQp(clZbh, date, line); | |
| 11231 | + map.put("jzl", jzl); | |
| 11232 | +// map.put("jhlc", format.format(jhlc + jcclc)); | |
| 11233 | +// map.put("yygljh", format.format(jhlc)); | |
| 11234 | +// map.put("ssgl", format.format(remMileage)); | |
| 11235 | +// map.put("ksgl", format.format(ksgl)); | |
| 11236 | +// map.put("yyglsj", format.format(yygl)); | |
| 11237 | +// map.put("jhbc", jhbc); | |
| 11238 | +// map.put("jcclc", jcclc); | |
| 11239 | +// | |
| 11240 | +// map.put("ljgl", format.format(addMileage)); | |
| 11241 | +// map.put("ssbc", cjbc); | |
| 11242 | +// map.put("ysgl", format.format(yygl)); | |
| 11243 | +// map.put("sjbc", jhbc - cjbc + ljbc); | |
| 11244 | +// map.put("zgl", format.format(yygl + ksgl + jcclc)); | |
| 11245 | +// map.put("ljbc", ljbc); | |
| 11246 | + | |
| 11247 | + String zdp = "", zwdp = "", wdp = ""; | |
| 11248 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 11249 | + List<DutyEmployee> listDtuy = dutyEmployeeService.getDutyEmployee(line, date + "00:00", date + "23:59"); | |
| 11250 | + try { | |
| 11251 | + Long fcsj1 = sdf.parse(date + " 03:00").getTime(); | |
| 11252 | + Long fcsj2 = sdf.parse(date + " 11:00").getTime(); | |
| 11253 | + Long fcsj3 = sdf.parse(date + " 22:00").getTime(); | |
| 11254 | + for (int i = 0; i < listDtuy.size(); i++) { | |
| 11255 | + DutyEmployee t = listDtuy.get(i); | |
| 11256 | + Long ts = t.getTs(); | |
| 11257 | + if (ts > fcsj1 && ts < fcsj2) { | |
| 11258 | + if (zdp.indexOf(t.getuName()) == -1) { | |
| 11259 | + zdp += t.getuName() + ","; | |
| 11260 | + | |
| 11261 | + } | |
| 11262 | + } else if (ts > fcsj2 && ts < fcsj3) { | |
| 11263 | + if (zwdp.indexOf(t.getuName()) == -1) { | |
| 11264 | + zwdp += t.getuName() + ","; | |
| 11265 | + } | |
| 11266 | + } else { | |
| 11267 | + if (wdp.indexOf(t.getuName()) == -1) { | |
| 11268 | + wdp += t.getuName() + ","; | |
| 11269 | + } | |
| 11270 | + } | |
| 11271 | + } | |
| 11272 | + } catch (ParseException e) { | |
| 11273 | + // TODO Auto-generated catch block | |
| 11274 | + e.printStackTrace(); | |
| 11275 | + } | |
| 11276 | + map.put("zdp", zdp); | |
| 11277 | + map.put("zwdp", zwdp); | |
| 11278 | + map.put("wdp", wdp); | |
| 11279 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 11280 | + list.add(listMap.iterator()); | |
| 11281 | + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/waybill_qingpu.xls", | |
| 11282 | + path + "export/" + date + "-" + clZbh + "-行车路单.xls"); | |
| 11283 | + | |
| 11284 | + return scheduleRealInfos; | |
| 11285 | + } | |
| 11286 | + | |
| 11287 | + @Override | |
| 11288 | + public Map<String, Object> findKMBCQp(String clZbh, String date, String line) { | |
| 11289 | + // TODO Auto-generated method stub | |
| 11290 | + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line); | |
| 11291 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 11292 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 11293 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 11294 | + int jhbc = 0, cjbc = 0, ljbc = 0, sjbc = 0; | |
| 11295 | + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0, ljjcclc = 0, jhjcclc = 0; | |
| 11296 | + double addMileage = 0, remMileage = 0, addgl = 0, remgl = 0; | |
| 11297 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 11298 | + jhlc = culateMieageService.culateJhgl(lists); | |
| 11299 | + jcclc = culateMieageService.culateJccgl(lists); | |
| 11300 | + jhjcclc = culateMieageService.culateJhJccgl(lists); | |
| 11301 | + remMileage = culateMieageService.culateLbgl(lists); | |
| 11302 | + ksgl = culateMieageService.culateKsgl(lists); | |
| 11303 | + yygl = culateMieageService.culateSjgl(lists); | |
| 11304 | + jhbc = culateMieageService.culateJhbc(lists, ""); | |
| 11305 | + addMileage = culateMieageService.culateLjgl(lists); | |
| 11306 | + cjbc = culateMieageService.culateLbbc(lists); | |
| 11307 | + sjbc = culateMieageService.culateSjbc(lists, ""); | |
| 11308 | + ljbc = culateMieageService.culateLjbc(lists, ""); | |
| 11309 | + double zyygl = Arith.add(yygl, addMileage); | |
| 11310 | + double zksgl = Arith.add(ksgl, jcclc); | |
| 11311 | + map.put("jhlc", Arith.add(jhlc, jhjcclc)); | |
| 11312 | + map.put("yygljh", jhlc); | |
| 11313 | + map.put("ssgl", remMileage); | |
| 11314 | + map.put("ksgl", ksgl); | |
| 11315 | + map.put("yyglsj", Arith.add(yygl, addMileage)); | |
| 11316 | + map.put("jcclc", jcclc); | |
| 11317 | + map.put("jhbc", jhbc); | |
| 11318 | + map.put("ljgl", addMileage); | |
| 11319 | + map.put("ssbc", cjbc); | |
| 11320 | + map.put("ysgl", Arith.add(yygl, addMileage)); | |
| 11321 | + map.put("sjbc", sjbc); | |
| 11322 | + map.put("zgl", Arith.add(zyygl, zksgl)); | |
| 11323 | + map.put("ljbc", ljbc); | |
| 11324 | + | |
| 11325 | + return map; | |
| 11326 | + } | |
| 11327 | + | |
| 11328 | + @Override | |
| 11329 | + public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) { | |
| 11330 | + // TODO Auto-generated method stub | |
| 11331 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 11332 | + List<ScheduleRealInfo> list = null; | |
| 11333 | + list = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line); | |
| 11334 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 11335 | + for (int i = 0; i < list.size(); i++) { | |
| 11336 | + ScheduleRealInfo s = list.get(i); | |
| 11337 | + if (!(s.getBcType().equals("in") || s.getBcType().equals("out"))) { | |
| 11338 | + String remarks = ""; | |
| 11339 | + Double sjlc = 0.0; | |
| 11340 | + if (s.getRemarks() != null) { | |
| 11341 | + remarks += s.getRemarks(); | |
| 11342 | + } | |
| 11343 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 11344 | + if (!childTaskPlans.isEmpty()) { | |
| 11345 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 11346 | + while (it.hasNext()) { | |
| 11347 | + ChildTaskPlan c = it.next(); | |
| 11348 | + if (c.getRemarks() != null && c.getRemarks().length() > 0) { | |
| 11349 | + if (remarks.indexOf(c.getRemarks()) == -1) { | |
| 11350 | + remarks += c.getRemarks(); | |
| 11351 | + } | |
| 11352 | + } | |
| 11353 | + | |
| 11354 | + if (!c.isDestroy()) { | |
| 11355 | + if (c.getMileageType().equals("service")) { | |
| 11356 | + sjlc += c.getMileage() == null ? 0 : c.getMileage(); | |
| 11357 | + } | |
| 11358 | + } | |
| 11359 | + | |
| 11360 | + } | |
| 11361 | + } else { | |
| 11362 | + if (s.getStatus() != -1) { | |
| 11363 | + sjlc = s.getJhlc(); | |
| 11364 | + } | |
| 11365 | + } | |
| 11366 | + s.setSjlc(format.format(sjlc)); | |
| 11367 | + s.setRemarks(remarks); | |
| 11368 | + newList.add(s); | |
| 11369 | + } | |
| 11370 | + | |
| 11371 | + } | |
| 11372 | + | |
| 11373 | + return newList; | |
| 11374 | + } | |
| 11375 | + | |
| 11376 | + @Override | |
| 11377 | + public Map<String, Object> MapById(Long id) { | |
| 11378 | + // TODO Auto-generated method stub | |
| 11379 | + Map<String, Object> dMap=new HashMap<>(); | |
| 11380 | + dMap.put("dGroup_eq", "oilType"); | |
| 11381 | + Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); | |
| 11382 | + while (it.hasNext()) { | |
| 11383 | + Dictionary d=it.next(); | |
| 11384 | + dMap.put(d.getdCode(), d.getdName()); | |
| 11385 | + } | |
| 11386 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 11387 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 11388 | + ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(id); | |
| 11389 | + String xlbm = s.getXlBm(); | |
| 11390 | + String fcrq = s.getScheduleDateStr(); | |
| 11391 | + | |
| 11392 | + int type = 2; | |
| 11393 | + Double ccyl = 0.0; | |
| 11394 | + Double jcyl = 0.0; | |
| 11395 | + Double yh = 0.0; | |
| 11396 | + Double jzl = 0.0; | |
| 11397 | + Double zlc = 0.0; | |
| 11398 | + String rylx=""; | |
| 11399 | + List<Cars> listCars = carsRepository.findCarsByCode(s.getClZbh()); | |
| 11400 | + if (listCars.size() > 0) { | |
| 11401 | + if (listCars.get(0).getSfdc() != null) { | |
| 11402 | + if (listCars.get(0).getSfdc()) { | |
| 11403 | + List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 11404 | + type = 1; | |
| 11405 | + for (int i = 0; i < listDlb.size(); i++) { | |
| 11406 | + Dlb d = listDlb.get(i); | |
| 11407 | + if (d.getLp() == null) { | |
| 11408 | + ccyl = Arith.add(ccyl, d.getCzcd()); | |
| 11409 | + jcyl = Arith.add(jcyl, d.getJzcd()); | |
| 11410 | + yh = Arith.add(yh, d.getHd()); | |
| 11411 | + jzl = Arith.add(jzl, d.getCdl()); | |
| 11412 | + zlc = Arith.add(zlc, d.getZlc()); | |
| 11413 | + } else { | |
| 11414 | + if (d.getLp().equals(s.getLpName())) { | |
| 11415 | + ccyl = Arith.add(ccyl, d.getCzcd()); | |
| 11416 | + jcyl = Arith.add(jcyl, d.getJzcd()); | |
| 11417 | + yh = Arith.add(yh, d.getHd()); | |
| 11418 | + jzl = Arith.add(jzl, d.getCdl()); | |
| 11419 | + zlc = Arith.add(zlc, d.getZlc()); | |
| 11420 | + } | |
| 11421 | + } | |
| 11422 | + | |
| 11423 | + } | |
| 11424 | + } else { | |
| 11425 | + List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 11426 | + type = 0; | |
| 11427 | + for (int i = 0; i < listYlb.size(); i++) { | |
| 11428 | + Ylb y = listYlb.get(i); | |
| 11429 | + if (y.getLp() == null) { | |
| 11430 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 11431 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 11432 | + yh = Arith.add(yh, y.getYh()); | |
| 11433 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 11434 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 11435 | + if(dMap.get(y.getRylx())!=null) | |
| 11436 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 11437 | + } else { | |
| 11438 | + if (y.getLp().equals(s.getLpName())) { | |
| 11439 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 11440 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 11441 | + yh = Arith.add(yh, y.getYh()); | |
| 11442 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 11443 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 11444 | + if(dMap.get(y.getRylx())!=null) | |
| 11445 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 11446 | + } | |
| 11447 | + } | |
| 11448 | + } | |
| 11449 | + } | |
| 11450 | + } | |
| 11451 | + } | |
| 11452 | + | |
| 11453 | + map.put("rylx", "加注类别:"+rylx); | |
| 11454 | + map.put("jzl", jzl); | |
| 11455 | + map.put("yh", yh); | |
| 11456 | + map.put("ccyl", ccyl); | |
| 11457 | + map.put("jcyl", jcyl); | |
| 11458 | + map.put("type", type); | |
| 11459 | + map.put("zlc", zlc); | |
| 11460 | + map.put("xlName", s.getXlName()); | |
| 11461 | + map.put("clZbh", s.getClZbh()); | |
| 11462 | + map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | |
| 11463 | + map.put("fcsjActual", s.getFcsjActual()); | |
| 11464 | + map.put("zdzName", s.getZdzName()); | |
| 11465 | + map.put("scheduleDate", s.getScheduleDateStr()); | |
| 11466 | + map.put("lpName", s.getLpName()); | |
| 11467 | + String zdp = "", zwdp = "", wdp = ""; | |
| 11468 | + String zdpT = "", zwdpT = "", wdpT = ""; | |
| 11469 | + String dbdp = ""; | |
| 11470 | + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59"); | |
| 11471 | + try { | |
| 11472 | + Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime(); | |
| 11473 | + Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime(); | |
| 11474 | + Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime(); | |
| 11475 | + for (int i = 0; i < list.size(); i++) { | |
| 11476 | + DutyEmployee t = list.get(i); | |
| 11477 | + if (dbdp.indexOf(t.getuName()) == -1) { | |
| 11478 | + if (!(dbdp.length() > 0)) { | |
| 11479 | + dbdp = t.getuName(); | |
| 11480 | + } else { | |
| 11481 | + dbdp += "," + t.getuName(); | |
| 11482 | + } | |
| 11483 | + } | |
| 11484 | + Long ts = t.getTs(); | |
| 11485 | + if (ts > fcsj1 && ts < fcsj2) { | |
| 11486 | + if (zdp.indexOf(t.getuName()) == -1) { | |
| 11487 | + if (!(zdp.length() > 0)) { | |
| 11488 | + zdpT = t.getuName() + "..."; | |
| 11489 | + } | |
| 11490 | + zdp += t.getuName() + ","; | |
| 11491 | + | |
| 11492 | + } | |
| 11493 | + } else if (ts > fcsj2 && ts < fcsj3) { | |
| 11494 | + if (zwdp.indexOf(t.getuName()) == -1) { | |
| 11495 | + if (!(zwdp.length() > 0)) { | |
| 11496 | + zwdpT = t.getuName() + "..."; | |
| 11497 | + } | |
| 11498 | + zwdp += t.getuName() + ","; | |
| 11499 | + } | |
| 11500 | + } else { | |
| 11501 | + if (wdp.indexOf(t.getuName()) == -1) { | |
| 11502 | + if (!(wdp.length() > 0)) { | |
| 11503 | + wdpT = t.getuName() + "..."; | |
| 11504 | + } | |
| 11505 | + wdp += t.getuName() + ","; | |
| 11506 | + } | |
| 11507 | + } | |
| 11508 | + } | |
| 11509 | + } catch (ParseException e) { | |
| 11510 | + // TODO Auto-generated catch block | |
| 11511 | + e.printStackTrace(); | |
| 11512 | + } | |
| 11513 | + map.put("zdp", zdp); | |
| 11514 | + map.put("zwdp", zwdp); | |
| 11515 | + map.put("wdp", wdp); | |
| 11516 | + map.put("zdpT", zdpT); | |
| 11517 | + map.put("zwdpT", zwdpT); | |
| 11518 | + map.put("wdpT", wdpT); | |
| 11519 | + map.put("dbdp", dbdp); | |
| 11520 | + return map; | |
| 11521 | + } | |
| 11522 | + | |
| 11523 | + @Override | |
| 11524 | + public Map<String, Object> MapByIdQp(Long id) { | |
| 11525 | + // TODO Auto-generated method stub | |
| 11526 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 11527 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 11528 | + ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(id); | |
| 11529 | + String xlbm = s.getXlBm(); | |
| 11530 | + String fcrq = s.getScheduleDateStr(); | |
| 11531 | + | |
| 11532 | + int type = 0; | |
| 11533 | + Double ccyl = 0.0; | |
| 11534 | + Double jcyl = 0.0; | |
| 11535 | + Double yh = 0.0; | |
| 11536 | + Double jzl = 0.0; | |
| 11537 | + Double zlc = 0.0; | |
| 11538 | +// List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | |
| 11539 | +// List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | |
| 11540 | +// if(listYlb.size()>0){ | |
| 11541 | +// type=0; | |
| 11542 | +// for (int i = 0; i < listYlb.size(); i++) { | |
| 11543 | +// Ylb y = listYlb.get(i); | |
| 11544 | +// if(y.getLp()==null){ | |
| 11545 | +// ccyl=Arith.add(ccyl, y.getCzyl()); | |
| 11546 | +// jcyl=Arith.add(jcyl, y.getJzyl()); | |
| 11547 | +// yh =Arith.add(yh ,y.getYh()); | |
| 11548 | +// jzl =Arith.add(jzl, y.getJzl()); | |
| 11549 | +// zlc =Arith.add(zlc, y.getZlc()); | |
| 11550 | +// }else{ | |
| 11551 | +// if(y.getLp().equals(s.getLpName())){ | |
| 11552 | +// ccyl=Arith.add(ccyl, y.getCzyl()); | |
| 11553 | +// jcyl=Arith.add(jcyl, y.getJzyl()); | |
| 11554 | +// yh =Arith.add(yh ,y.getYh()); | |
| 11555 | +// jzl =Arith.add(jzl, y.getJzl()); | |
| 11556 | +// zlc =Arith.add(zlc, y.getZlc()); | |
| 11557 | +// } | |
| 11558 | +// } | |
| 11559 | +// | |
| 11560 | +// } | |
| 11561 | +// }else{ | |
| 11562 | +// type=1; | |
| 11563 | +// for (int i = 0; i < listDlb.size(); i++) { | |
| 11564 | +// Dlb d=listDlb.get(i); | |
| 11565 | +// if(d.getLp()==null){ | |
| 11566 | +// ccyl=Arith.add(ccyl, d.getCzcd()); | |
| 11567 | +// jcyl=Arith.add(jcyl, d.getJzcd()); | |
| 11568 | +// yh =Arith.add(yh ,d.getHd()); | |
| 11569 | +// jzl =Arith.add(jzl, d.getCdl()); | |
| 11570 | +// zlc =Arith.add(zlc, d.getZlc()); | |
| 11571 | +// }else{ | |
| 11572 | +// if(d.getLp().equals(s.getLpName())){ | |
| 11573 | +// ccyl=Arith.add(ccyl, d.getCzcd()); | |
| 11574 | +// jcyl=Arith.add(jcyl, d.getJzcd()); | |
| 11575 | +// yh =Arith.add(yh ,d.getHd()); | |
| 11576 | +// jzl =Arith.add(jzl, d.getCdl()); | |
| 11577 | +// zlc =Arith.add(zlc, d.getZlc()); | |
| 11578 | +// } | |
| 11579 | +// } | |
| 11580 | +// | |
| 11581 | +// } | |
| 11582 | +// } | |
| 11583 | + | |
| 11584 | + List<Ylxxb> listylxxb = ylxxbRepository.queryListYlxxb(s.getClZbh(), fcrq); | |
| 11585 | + for (int i = 0; i < listylxxb.size(); i++) { | |
| 11586 | + Ylxxb t = listylxxb.get(i); | |
| 11587 | + jzl = Arith.add(jzl, t.getJzl()); | |
| 11588 | + } | |
| 11589 | + map.put("jzl", jzl); | |
| 11590 | + map.put("yh", yh); | |
| 11591 | + map.put("ccyl", ccyl); | |
| 11592 | + map.put("jcyl", jcyl); | |
| 11593 | + map.put("type", type); | |
| 11594 | + map.put("zlc", zlc); | |
| 11595 | + map.put("xlName", s.getXlName()); | |
| 11596 | + map.put("clZbh", s.getClZbh()); | |
| 11597 | + map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | |
| 11598 | + map.put("fcsjActual", s.getFcsjActual()); | |
| 11599 | + map.put("zdzName", s.getZdzName()); | |
| 11600 | + map.put("scheduleDate", s.getScheduleDateStr()); | |
| 11601 | + map.put("lpName", s.getLpName()); | |
| 11602 | + String zdp = "", zwdp = "", wdp = ""; | |
| 11603 | + String zdpT = "", zwdpT = "", wdpT = ""; | |
| 11604 | + String dbdp = ""; | |
| 11605 | + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59"); | |
| 11606 | + try { | |
| 11607 | + Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime(); | |
| 11608 | + Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime(); | |
| 11609 | + Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime(); | |
| 11610 | + for (int i = 0; i < list.size(); i++) { | |
| 11611 | + DutyEmployee t = list.get(i); | |
| 11612 | + if (dbdp.indexOf(t.getuName()) == -1) { | |
| 11613 | + if (!(dbdp.length() > 0)) { | |
| 11614 | + dbdp = t.getuName(); | |
| 11615 | + } else { | |
| 11616 | + dbdp += "," + t.getuName(); | |
| 11617 | + } | |
| 11618 | + } | |
| 11619 | + Long ts = t.getTs(); | |
| 11620 | + if (ts > fcsj1 && ts < fcsj2) { | |
| 11621 | + if (zdp.indexOf(t.getuName()) == -1) { | |
| 11622 | + if (!(zdp.length() > 0)) { | |
| 11623 | + zdpT = t.getuName() + "..."; | |
| 11624 | + } | |
| 11625 | + zdp += t.getuName() + ","; | |
| 11626 | + | |
| 11627 | + } | |
| 11628 | + } else if (ts > fcsj2 && ts < fcsj3) { | |
| 11629 | + if (zwdp.indexOf(t.getuName()) == -1) { | |
| 11630 | + if (!(zwdp.length() > 0)) { | |
| 11631 | + zwdpT = t.getuName() + "..."; | |
| 11632 | + } | |
| 11633 | + zwdp += t.getuName() + ","; | |
| 11634 | + } | |
| 11635 | + } else { | |
| 11636 | + if (wdp.indexOf(t.getuName()) == -1) { | |
| 11637 | + if (!(wdp.length() > 0)) { | |
| 11638 | + wdpT = t.getuName() + "..."; | |
| 11639 | + } | |
| 11640 | + wdp += t.getuName() + ","; | |
| 11641 | + } | |
| 11642 | + } | |
| 11643 | + } | |
| 11644 | + } catch (ParseException e) { | |
| 11645 | + // TODO Auto-generated catch block | |
| 11646 | + e.printStackTrace(); | |
| 11647 | + } | |
| 11648 | + map.put("zdp", zdp); | |
| 11649 | + map.put("zwdp", zwdp); | |
| 11650 | + map.put("wdp", wdp); | |
| 11651 | + map.put("zdpT", zdpT); | |
| 11652 | + map.put("zwdpT", zwdpT); | |
| 11653 | + map.put("wdpT", wdpT); | |
| 11654 | + map.put("dbdp", dbdp); | |
| 11655 | + return map; | |
| 11656 | + } | |
| 11657 | + | |
| 11658 | + @Override | |
| 11659 | + public List<Map<String, Object>> scheduleDailyQp(String line, String date) { | |
| 11660 | + // TODO Auto-generated method stub | |
| 11661 | + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); | |
| 11662 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleDailyQp(line, date); | |
| 11663 | + Map<String, Object> map = null; | |
| 11664 | + String lp = "lp"; | |
| 11665 | + String jgh = "jgh"; | |
| 11666 | + String clzbh = "clzbh"; | |
| 11667 | + int bcs = 0; | |
| 11668 | + String thclzbh = ""; | |
| 11669 | + String sgh = "sgh"; | |
| 11670 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 11671 | + ScheduleRealInfo scheduleRealInfo = scheduleRealInfos.get(i); | |
| 11672 | + if (scheduleRealInfo.getLpName().equals(lp)) { | |
| 11673 | + bcs++; | |
| 11674 | + String fcsj = scheduleRealInfo.getFcsj(); | |
| 11675 | + | |
| 11676 | + if (!clzbh.equals(scheduleRealInfo.getClZbh())) { | |
| 11677 | + clzbh = scheduleRealInfo.getClZbh(); | |
| 11678 | + if (thclzbh == "") { | |
| 11679 | + thclzbh += scheduleRealInfo.getClZbh() + ","; | |
| 11680 | + } else { | |
| 11681 | + thclzbh += scheduleRealInfo.getClZbh(); | |
| 11682 | + } | |
| 11683 | + map.put("thclzbh", thclzbh); | |
| 11684 | + } | |
| 11685 | + | |
| 11686 | + if (!jgh.equals(scheduleRealInfo.getjGh())) { | |
| 11687 | + jgh = scheduleRealInfo.getjGh(); | |
| 11688 | + if (map.get("jjb2") != null) { | |
| 11689 | + map.put("jjb3", scheduleRealInfo.getjGh() + "/" + | |
| 11690 | + scheduleRealInfo.getFcsjActual()); | |
| 11691 | + | |
| 11692 | + } else { | |
| 11693 | + map.put("jjb2", scheduleRealInfo.getjGh() + "/" + | |
| 11694 | + scheduleRealInfo.getFcsjActual()); | |
| 11695 | + } | |
| 11696 | + | |
| 11697 | + } | |
| 11698 | + | |
| 11699 | + if (scheduleRealInfo.getsGh() != null) { | |
| 11700 | + if (!scheduleRealInfo.getsGh().equals(sgh)) { | |
| 11701 | + sgh = scheduleRealInfo.getsGh() == null ? "" : scheduleRealInfo.getsGh(); | |
| 11702 | + if (!sgh.equals("")) { | |
| 11703 | + if (map.get("sjb1") != null) { | |
| 11704 | + if (map.get("sjb2") != null) { | |
| 11705 | + map.put("sjb3", scheduleRealInfo.getsGh() + "/" + | |
| 11706 | + scheduleRealInfo.getFcsjActual()); | |
| 11707 | + } else { | |
| 11708 | + map.put("sjb2", scheduleRealInfo.getsGh() + "/" + | |
| 11709 | + scheduleRealInfo.getFcsjActual()); | |
| 11710 | + } | |
| 11711 | + } else { | |
| 11712 | + map.put("sjb1", scheduleRealInfo.getsGh() + "/" + | |
| 11713 | + scheduleRealInfo.getFcsjActual()); | |
| 11714 | + } | |
| 11715 | + } | |
| 11716 | + } | |
| 11717 | + } | |
| 11718 | + if (scheduleRealInfo.getFcsjActual() != null) { | |
| 11719 | + String fcsjs[] = fcsj.split(":"); | |
| 11720 | + String fcsjActuals[] = scheduleRealInfo.getFcsjActual().split(":"); | |
| 11721 | + int a = Integer.parseInt(fcsjActuals[0]) * 60 + Integer.parseInt(fcsjActuals[1]); | |
| 11722 | + int b = Integer.parseInt(fcsjs[0]) * 60 + Integer.parseInt(fcsjs[1]); | |
| 11723 | + map.put("cz" + bcs, b - a); | |
| 11724 | + } else { | |
| 11725 | + map.put("cz" + bcs, "无"); | |
| 11726 | + } | |
| 11727 | + map.put("lp", scheduleRealInfo.getLpName()); | |
| 11728 | + map.put("dd" + bcs, scheduleRealInfo.getZdsjActual()); | |
| 11729 | + map.put("kc" + bcs, scheduleRealInfo.getFcsjActual()); | |
| 11730 | + | |
| 11731 | + if (i < scheduleRealInfos.size() - 1) { | |
| 11732 | + if (!scheduleRealInfos.get(i + 1).getLpName().equals | |
| 11733 | + (scheduleRealInfos.get(i).getLpName())) { | |
| 11734 | + list.add(map); | |
| 11735 | + lp = "lp"; | |
| 11736 | + jgh = "jgh"; | |
| 11737 | + clzbh = "clzbh"; | |
| 11738 | + bcs = 0; | |
| 11739 | + thclzbh = ""; | |
| 11740 | + sgh = "sgh"; | |
| 11741 | + } | |
| 11742 | + } else { | |
| 11743 | + list.add(map); | |
| 11744 | + } | |
| 11745 | + } else { | |
| 11746 | + bcs = 1; | |
| 11747 | + map = new HashMap<String, Object>(); | |
| 11748 | + lp = scheduleRealInfo.getLpName(); | |
| 11749 | + jgh = scheduleRealInfo.getjGh(); | |
| 11750 | + clzbh = scheduleRealInfo.getClZbh(); | |
| 11751 | + if (scheduleRealInfo.getsGh() != null) { | |
| 11752 | + sgh = scheduleRealInfo.getsGh(); | |
| 11753 | + map.put("sjb1", scheduleRealInfo.getsGh() + "/" + | |
| 11754 | + scheduleRealInfo.getFcsjActual()); | |
| 11755 | + } | |
| 11756 | + String fcsj = scheduleRealInfo.getFcsj(); | |
| 11757 | + scheduleRealInfo.getFcsjActual(); | |
| 11758 | + map.put("jjb1", jgh + "/" + scheduleRealInfo.getFcsjActual()); | |
| 11759 | + map.put("cccl", clzbh); | |
| 11760 | + | |
| 11761 | + if (scheduleRealInfo.getFcsjActual() != null) { | |
| 11762 | + String fcsjs[] = fcsj.split(":"); | |
| 11763 | + String fcsjActuals[] = scheduleRealInfo.getFcsjActual().split(":"); | |
| 11764 | + int a = Integer.parseInt(fcsjActuals[0]) * 60 + Integer.parseInt(fcsjActuals[1]); | |
| 11765 | + int b = Integer.parseInt(fcsjs[0]) * 60 + Integer.parseInt(fcsjs[1]); | |
| 11766 | + map.put("cz" + bcs, b - a); | |
| 11767 | + } else { | |
| 11768 | + map.put("cz" + bcs, "无"); | |
| 11769 | + } | |
| 11770 | + | |
| 11771 | + | |
| 11772 | + map.put("lp", scheduleRealInfo.getLpName()); | |
| 11773 | + map.put("dd" + bcs, scheduleRealInfo.getZdsjActual()); | |
| 11774 | + map.put("kc" + bcs, scheduleRealInfo.getFcsjActual()); | |
| 11775 | + | |
| 11776 | + if (i < scheduleRealInfos.size() - 1) { | |
| 11777 | + if (!scheduleRealInfos.get(i + 1).getLpName().equals | |
| 11778 | + (scheduleRealInfos.get(i).getLpName())) { | |
| 11779 | + list.add(map); | |
| 11780 | + lp = "lp"; | |
| 11781 | + jgh = "jgh"; | |
| 11782 | + clzbh = "clzbh"; | |
| 11783 | + bcs = 0; | |
| 11784 | + thclzbh = ""; | |
| 11785 | + sgh = "sgh"; | |
| 11786 | + } | |
| 11787 | + } else { | |
| 11788 | + list.add(map); | |
| 11789 | + } | |
| 11790 | + } | |
| 11791 | + | |
| 11792 | + } | |
| 11793 | + return list; | |
| 11794 | + } | |
| 11795 | + | |
| 11796 | + | |
| 11797 | + @Override | |
| 11798 | + public List<Map<String, Object>> scheduleDailyExport(Map<String, Object> map) { | |
| 11799 | + String line = map.get("line").toString(); | |
| 11800 | + String date = map.get("date").toString(); | |
| 11801 | + String xlName = map.get("xlName").toString(); | |
| 11802 | + String state = map.get("state").toString(); | |
| 11803 | + String type = map.get("type").toString(); | |
| 11804 | + String genre =map.get("genre").toString(); | |
| 11805 | + String df=""; | |
| 11806 | + if(map.get("df")!=null){ | |
| 11807 | + df=map.get("df").toString(); | |
| 11808 | + } | |
| 11809 | + | |
| 11810 | + List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>(); | |
| 11811 | + List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>(); | |
| 11812 | + List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null); | |
| 11813 | + List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state); | |
| 11814 | + List<ScheduleRealInfo> list3 = new ArrayList<ScheduleRealInfo>(); | |
| 11815 | + if(genre.equals("qp")) | |
| 11816 | + list3=this.realScheduleListQp(line, date); | |
| 11817 | + else if(genre.equals("zrw")) | |
| 11818 | + list3=this.realScheduleList_zrw(line, date); | |
| 11819 | + else | |
| 11820 | + list3=this.realScheduleList(line, date); | |
| 11821 | + Map<String, Object> nMap = new HashMap<String, Object>(); | |
| 11822 | + nMap.put("date", xlName + date); | |
| 11823 | + nMap.put("jls", list1.get(0).get("jls")); | |
| 11824 | + nMap.put("sjgl", list1.get(0).get("sjgl")); | |
| 11825 | + for (Map<String, Object> m : list1) { | |
| 11826 | +// m.put("ssgl", m.get("ssgl")); | |
| 11827 | +// m.put("ssbc", m.get("ssbc")); | |
| 11828 | +// m.put("ssgl_lz", m.get("ssgl_lz") + " / " + m.get("ssbc_lz")); | |
| 11829 | +// m.put("ssgl_dm", m.get("ssgl_dm") + " / " + m.get("ssbc_dm")); | |
| 11830 | +// m.put("ssgl_gz", m.get("ssgl_gz") + " / " + m.get("ssbc_gz")); | |
| 11831 | +// m.put("ssgl_jf", m.get("ssgl_jf") + " / " + m.get("ssbc_jf")); | |
| 11832 | +// m.put("ssgl_zs", m.get("ssgl_zs") + " / " + m.get("ssbc_zs")); | |
| 11833 | +// m.put("ssgl_qr", m.get("ssgl_qr") + " / " + m.get("ssbc_qr")); | |
| 11834 | +// m.put("ssgl_qc", m.get("ssgl_qc") + " / " + m.get("ssbc_qc")); | |
| 11835 | +// m.put("ssgl_kx", m.get("ssgl_kx") + " / " + m.get("ssbc_kx")); | |
| 11836 | +// m.put("ssgl_qh", m.get("ssgl_qh") + " / " + m.get("ssbc_qh")); | |
| 11837 | +// m.put("ssgl_yw", m.get("ssgl_yw") + " / " + m.get("ssbc_yw")); | |
| 11838 | +// m.put("ssgl_other", m.get("ssgl_other") + " / " + m.get("ssbc_other")); | |
| 11839 | + } | |
| 11840 | + | |
| 11841 | + int size = 0; | |
| 11842 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 11843 | + for (int i = 0; i < list2.size(); i++) { | |
| 11844 | + ScheduleRealInfo s = list2.get(i); | |
| 11845 | + if (size == 5) { | |
| 11846 | + size = 0; | |
| 11847 | + dataList2.add(tempMap); | |
| 11848 | + tempMap = new HashMap<String, Object>(); | |
| 11849 | + } | |
| 11850 | + tempMap.put("lp" + size, s.getLpName()); | |
| 11851 | + tempMap.put("ch" + size, s.getClZbh()); | |
| 11852 | + tempMap.put("jz" + size, s.getjGh() + "/" + s.getjName()); | |
| 11853 | + tempMap.put("sz" + size, ""); | |
| 11854 | + tempMap.put("jw" + size, ""); | |
| 11855 | + tempMap.put("sw" + size, ""); | |
| 11856 | + | |
| 11857 | + size++; | |
| 11858 | + } | |
| 11859 | + if (size < 5) { | |
| 11860 | + for (; size < 5; size++) { | |
| 11861 | + tempMap.put("lp" + size, ""); | |
| 11862 | + tempMap.put("ch" + size, ""); | |
| 11863 | + tempMap.put("jz" + size, ""); | |
| 11864 | + tempMap.put("sz" + size, ""); | |
| 11865 | + tempMap.put("jw" + size, ""); | |
| 11866 | + tempMap.put("sw" + size, ""); | |
| 11867 | + } | |
| 11868 | + } | |
| 11869 | + | |
| 11870 | + dataList2.add(tempMap); | |
| 11871 | +/* | |
| 11872 | + size = 0; | |
| 11873 | + tempMap = new HashMap<String, Object>(); | |
| 11874 | + for (ScheduleRealInfo schedule : list3) { | |
| 11875 | + if (size == 3) { | |
| 11876 | + size = 0; | |
| 11877 | + dataList3.add(tempMap); | |
| 11878 | + tempMap = new HashMap<String, Object>(); | |
| 11879 | + } | |
| 11880 | + tempMap.put("lpName" + size, schedule.getLpName()); | |
| 11881 | + tempMap.put("qdzName" + size, schedule.getQdzName()); | |
| 11882 | + tempMap.put("zdsj" + size, schedule.getZdsj()); | |
| 11883 | + tempMap.put("zdsjActual" + size, schedule.getZdsjActual() != null ? schedule.getZdsjActual() : ""); | |
| 11884 | + tempMap.put("zdsjk" + size, ""); | |
| 11885 | + tempMap.put("zdsjm" + size, ""); | |
| 11886 | + tempMap.put("fcsj" + size, schedule.getFcsj()); | |
| 11887 | + String fcsjActural=schedule.getFcsjActual() != null ? schedule.getFcsjActual() : ""; | |
| 11888 | + String bcType=schedule.getBcType()!=null?schedule.getBcType():""; | |
| 11889 | + if(bcType.equals("in")){ | |
| 11890 | + fcsjActural=fcsjActural+"(进)"; | |
| 11891 | + } | |
| 11892 | + if(bcType.equals("out")){ | |
| 11893 | + fcsjActural=fcsjActural+"(出)"; | |
| 11894 | + } | |
| 11895 | + tempMap.put("fcsjActual" + size, fcsjActural); | |
| 11896 | + tempMap.put("fcsjk" + size, ""); | |
| 11897 | + tempMap.put("fcsjm" + size, ""); | |
| 11898 | + tempMap.put("remarks" + size, schedule.getRemarks() != null ? schedule.getRemarks() : ""); | |
| 11899 | + | |
| 11900 | + size++; | |
| 11901 | + } | |
| 11902 | + if (size < 3) { | |
| 11903 | + for (; size < 3; size++) { | |
| 11904 | + tempMap.put("lpName" + size, ""); | |
| 11905 | + tempMap.put("qdzName" + size, ""); | |
| 11906 | + tempMap.put("zdsj" + size, ""); | |
| 11907 | + tempMap.put("zdsjActual" + size, ""); | |
| 11908 | + tempMap.put("zdsjk" + size, ""); | |
| 11909 | + tempMap.put("zdsjm" + size, ""); | |
| 11910 | + tempMap.put("fcsj" + size, ""); | |
| 11911 | + tempMap.put("fcsjActual" + size, ""); | |
| 11912 | + tempMap.put("fcsjk" + size, ""); | |
| 11913 | + tempMap.put("fcsjm" + size, ""); | |
| 11914 | + tempMap.put("remarks" + size, ""); | |
| 11915 | + } | |
| 11916 | + } | |
| 11917 | +*/ | |
| 11918 | + | |
| 11919 | + size = 0; | |
| 11920 | + tempMap = new HashMap<String, Object>(); | |
| 11921 | + for (ScheduleRealInfo schedule : list3) { | |
| 11922 | + int x = size % 3; | |
| 11923 | + if (x == 0 && size > 0) { | |
| 11924 | + dataList3.add(tempMap); | |
| 11925 | + tempMap = new HashMap<String, Object>(); | |
| 11926 | + } | |
| 11927 | + tempMap.put("lpName" + x, schedule.getLpName()); | |
| 11928 | + tempMap.put("qdzName" + x, schedule.getQdzName()); | |
| 11929 | + tempMap.put("zdsj" + x, schedule.getZdsj()); | |
| 11930 | + String zdsjActual = schedule.getZdsjActual() != null ? schedule.getZdsjActual() : ""; | |
| 11931 | + tempMap.put("zdsjActual" + x, zdsjActual); | |
| 11932 | + | |
| 11933 | + String zdsjk = ""; | |
| 11934 | + String zdsjm = ""; | |
| 11935 | + if (!zdsjActual.equals("")) { | |
| 11936 | + String[] zdsj_s = schedule.getZdsj().split(":"); | |
| 11937 | + String[] zdsjActual_s = zdsjActual.split(":"); | |
| 11938 | + Long zdsj_ = Long.parseLong(zdsj_s[0]) * 60 + Long.parseLong(zdsj_s[1]); | |
| 11939 | + Long zdsjActual_ = Long.parseLong(zdsjActual_s[0]) * 60 + Long.parseLong(zdsjActual_s[1]); | |
| 11940 | + if ((zdsj_ - zdsjActual_) > 0) { | |
| 11941 | + if(zdsj_ - zdsjActual_>1200){ | |
| 11942 | + zdsjm=String.valueOf(1440-(zdsj_-zdsjActual_)); | |
| 11943 | + }else{ | |
| 11944 | + zdsjk = String.valueOf(zdsj_ - zdsjActual_); | |
| 11945 | + } | |
| 11946 | + } else { | |
| 11947 | + if(zdsjActual_ - zdsj_>1200){ | |
| 11948 | + zdsjk =String.valueOf(1440-(zdsjActual_ - zdsj_)); | |
| 11949 | + }else{ | |
| 11950 | + zdsjm = String.valueOf(zdsjActual_ - zdsj_); | |
| 11951 | + } | |
| 11952 | + } | |
| 11953 | + } | |
| 11954 | + tempMap.put("zdsjk" + x, zdsjk); | |
| 11955 | + tempMap.put("zdsjm" + x, zdsjm.equals("0")?"":zdsjm); | |
| 11956 | + tempMap.put("fcsj" + x, schedule.getFcsj()); | |
| 11957 | + String fcsjActural = schedule.getFcsjActual() != null ? schedule.getFcsjActual() : ""; | |
| 11958 | + String bcType = schedule.getBcType() != null ? schedule.getBcType() : ""; | |
| 11959 | + String fcsjActuralstr = ""; | |
| 11960 | + if (bcType.equals("in")) { | |
| 11961 | + fcsjActuralstr = fcsjActural + "(进)"; | |
| 11962 | + } else if (bcType.equals("out")) { | |
| 11963 | + fcsjActuralstr = fcsjActural + "(出)"; | |
| 11964 | + } else { | |
| 11965 | + fcsjActuralstr = fcsjActural; | |
| 11966 | + } | |
| 11967 | + tempMap.put("fcsjActual" + x, fcsjActuralstr); | |
| 11968 | + String fcsjk = ""; | |
| 11969 | + String fcsjm = ""; | |
| 11970 | + String dfsjk =""; | |
| 11971 | + String dfsjm=""; | |
| 11972 | + if (!fcsjActural.equals("")) { | |
| 11973 | + String[] fcsj_s = schedule.getFcsj().split(":"); | |
| 11974 | + String[] fcsjActural_s = fcsjActural.split(":"); | |
| 11975 | + Long fcsj_ = Long.parseLong(fcsj_s[0]) * 60 + Long.parseLong(fcsj_s[1]); | |
| 11976 | + Long fcsjActural_ = Long.parseLong(fcsjActural_s[0]) * 60 + Long.parseLong(fcsjActural_s[1]); | |
| 11977 | + if ((fcsj_ - fcsjActural_) > 0) { | |
| 11978 | + if(fcsj_ - fcsjActural_>1200){ | |
| 11979 | + fcsjm=String.valueOf(1440-(fcsj_ - fcsjActural_)); | |
| 11980 | + }else{ | |
| 11981 | + fcsjk = String.valueOf(fcsj_ - fcsjActural_); | |
| 11982 | + } | |
| 11983 | + } else { | |
| 11984 | + if(fcsjActural_ - fcsj_>1200){ | |
| 11985 | + fcsjk =String.valueOf(1440-(fcsjActural_ - fcsj_)); | |
| 11986 | + } | |
| 11987 | + else{ | |
| 11988 | + fcsjm = String.valueOf(fcsjActural_ - fcsj_); | |
| 11989 | + } | |
| 11990 | + } | |
| 11991 | + if(df.equals("df")){ | |
| 11992 | + String[] dfsj_s =schedule.getDfsj().split(":"); | |
| 11993 | + Long dfsj_ = Long.parseLong(dfsj_s[0]) * 60 + Long.parseLong(dfsj_s[1]); | |
| 11994 | + if ((dfsj_ - fcsjActural_) > 0) { | |
| 11995 | + if(dfsj_ - fcsjActural_>1200){ | |
| 11996 | + dfsjm=String.valueOf(1440-(dfsj_ - fcsjActural_)); | |
| 11997 | + }else{ | |
| 11998 | + dfsjk = String.valueOf(dfsj_ - fcsjActural_); | |
| 11999 | + } | |
| 12000 | + } else { | |
| 12001 | + if(fcsjActural_ - dfsj_>1200){ | |
| 12002 | + dfsjk= String.valueOf(1440-(fcsjActural_ - dfsj_)); | |
| 12003 | + }else{ | |
| 12004 | + dfsjm = String.valueOf(fcsjActural_ - dfsj_); | |
| 12005 | + } | |
| 12006 | + } | |
| 12007 | + } | |
| 12008 | + } | |
| 12009 | + if(df.equals("df")){ | |
| 12010 | + tempMap.put("dfsj"+x,schedule.getDfsj()); | |
| 12011 | + tempMap.put("dfsjk" + x, dfsjk); | |
| 12012 | + tempMap.put("dfsjm" + x, dfsjm.equals("0")?"":dfsjm); | |
| 12013 | + } | |
| 12014 | + tempMap.put("fcsjk" + x, fcsjk); | |
| 12015 | + tempMap.put("fcsjm" + x, fcsjm.equals("0")?"":fcsjm); | |
| 12016 | + tempMap.put("remarks" + x, schedule.getRemark() != null ? schedule.getRemark() : ""); | |
| 12017 | + | |
| 12018 | + size++; | |
| 12019 | + } | |
| 12020 | + if (tempMap.get("lpName0") != null) { | |
| 12021 | + if (tempMap.get("lpName1") == null) { | |
| 12022 | + tempMap.put("lpName1", ""); | |
| 12023 | + tempMap.put("qdzName1", ""); | |
| 12024 | + tempMap.put("zdsj1", ""); | |
| 12025 | + tempMap.put("zdsjActual1", ""); | |
| 12026 | + tempMap.put("zdsjk1", ""); | |
| 12027 | + tempMap.put("zdsjm1", ""); | |
| 12028 | + tempMap.put("fcsj1", ""); | |
| 12029 | + tempMap.put("fcsjActual1", ""); | |
| 12030 | + tempMap.put("fcsjk1", ""); | |
| 12031 | + tempMap.put("fcsjm1", ""); | |
| 12032 | + if(df.equals("df")){ | |
| 12033 | + tempMap.put("dfsj1",""); | |
| 12034 | + tempMap.put("dfsjk1" , ""); | |
| 12035 | + tempMap.put("dfsjm1" , ""); | |
| 12036 | + } | |
| 12037 | + tempMap.put("remarks1", ""); | |
| 12038 | + } | |
| 12039 | + if (tempMap.get("lpName2") == null) { | |
| 12040 | + tempMap.put("lpName2", ""); | |
| 12041 | + tempMap.put("qdzName2", ""); | |
| 12042 | + tempMap.put("zdsj2", ""); | |
| 12043 | + tempMap.put("zdsjActual2", ""); | |
| 12044 | + tempMap.put("zdsjk2", ""); | |
| 12045 | + tempMap.put("zdsjm2", ""); | |
| 12046 | + tempMap.put("fcsj2", ""); | |
| 12047 | + tempMap.put("fcsjActual2", ""); | |
| 12048 | + tempMap.put("fcsjk2", ""); | |
| 12049 | + tempMap.put("fcsjm2", ""); | |
| 12050 | + if(df.equals("df")){ | |
| 12051 | + tempMap.put("dfsj2",""); | |
| 12052 | + tempMap.put("dfsjk2" , ""); | |
| 12053 | + tempMap.put("dfsjm2" , ""); | |
| 12054 | + } | |
| 12055 | + tempMap.put("remarks2", ""); | |
| 12056 | + } | |
| 12057 | + dataList3.add(tempMap); | |
| 12058 | + } | |
| 12059 | + | |
| 12060 | + if (date.length() == 10) { | |
| 12061 | + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59"); | |
| 12062 | + String dbdp = ""; | |
| 12063 | + try { | |
| 12064 | + for (int i = 0; i < list.size(); i++) { | |
| 12065 | + DutyEmployee t = list.get(i); | |
| 12066 | + if (dbdp.indexOf(t.getuName()) == -1) { | |
| 12067 | + if (!(dbdp.length() > 0)) { | |
| 12068 | + dbdp = t.getuName(); | |
| 12069 | + } else { | |
| 12070 | + dbdp += "," + t.getuName(); | |
| 12071 | + } | |
| 12072 | + } | |
| 12073 | + } | |
| 12074 | + } catch (Exception e) { | |
| 12075 | + // TODO: handle exception | |
| 12076 | + e.printStackTrace(); | |
| 12077 | + } | |
| 12078 | + nMap.put("dbdp", dbdp); | |
| 12079 | + } | |
| 12080 | + | |
| 12081 | + if (type.equals("export")) { | |
| 12082 | + String lineName = ""; | |
| 12083 | + if (map.containsKey("lineName")) | |
| 12084 | + lineName = "-" + map.get("lineName").toString() + "-"; | |
| 12085 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 12086 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 12087 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 12088 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 12089 | + ReportUtils ee = new ReportUtils(); | |
| 12090 | + try { | |
| 12091 | + listI.add(list1.iterator()); | |
| 12092 | + listI.add(dataList2.iterator()); | |
| 12093 | + listI.add(dataList3.iterator()); | |
| 12094 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 12095 | + String sourcePath = path + "mould/scheduleDaily.xls"; | |
| 12096 | + if (date.length() == 7) { | |
| 12097 | + sdfMonth = new SimpleDateFormat("yyyy-MM"); | |
| 12098 | + sdfSimple = new SimpleDateFormat("yyyyMM"); | |
| 12099 | + sourcePath = path + "mould/scheduleDaily_m.xls"; | |
| 12100 | + } | |
| 12101 | + if(df.equals("df")){ | |
| 12102 | + sourcePath =path + "mould/scheduleDaily_df.xls"; | |
| 12103 | + } | |
| 12104 | + ee.excelReplace(listI, new Object[]{nMap}, sourcePath, | |
| 12105 | + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) + lineName + "调度日报.xls"); | |
| 12106 | + } catch (Exception e) { | |
| 12107 | + // TODO: handle exception | |
| 12108 | + e.printStackTrace(); | |
| 12109 | + } | |
| 12110 | + } | |
| 12111 | + | |
| 12112 | + return new ArrayList<Map<String, Object>>(); | |
| 12113 | + } | |
| 12114 | + | |
| 12115 | + public void exportWaybill_pl(List<ScheduleRealInfo> listpl, | |
| 12116 | + String date, String jName, String clZbh, String lpName) { | |
| 12117 | + ReportUtils ee = new ReportUtils(); | |
| 12118 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 12119 | + List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 12120 | + List<ScheduleRealInfo> scheduleRealInfos = listpl; | |
| 12121 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 12122 | +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line); | |
| 12123 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 12124 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 12125 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 12126 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 12127 | + if (cts != null && cts.size() > 0) { | |
| 12128 | + lists.add(s); | |
| 12129 | + } else { | |
| 12130 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 12131 | + lists.add(s); | |
| 12132 | + } | |
| 12133 | + } | |
| 12134 | + } | |
| 12135 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 12136 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 12137 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 12138 | + //计算里程和班次数,并放入Map里 | |
| 12139 | + Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); | |
| 12140 | + | |
| 12141 | + map.put("jhlc", Arith.add(culateMieageService.culateJhgl(scheduleRealInfos), culateMieageService.culateJhJccgl(scheduleRealInfos))); | |
| 12142 | + map.put("remMileage", culateMieageService.culateLbgl(scheduleRealInfos)); | |
| 12143 | + map.put("addMileage", culateMieageService.culateLjgl(lists)); | |
| 12144 | + double yygl = Arith.add(culateMieageService.culateSjgl(lists), culateMieageService.culateLjgl(lists)); | |
| 12145 | + map.put("yygl", yygl); | |
| 12146 | + double ksgl = Arith.add(culateMieageService.culateKsgl(scheduleRealInfos), culateMieageService.culateJccgl(lists)); | |
| 12147 | + map.put("ksgl", ksgl); | |
| 12148 | + map.put("realMileage", Arith.add(yygl, ksgl)); | |
| 12149 | + map.put("jhbc", culateMieageService.culateJhbc(scheduleRealInfos, "")); | |
| 12150 | + map.put("cjbc", culateMieageService.culateLbbc(scheduleRealInfos)); | |
| 12151 | + map.put("ljbc", culateMieageService.culateLjbc(lists, "")); | |
| 12152 | + int sjbc = culateMieageService.culateLjbc(lists, "") + culateMieageService.culateSjbc(lists, ""); | |
| 12153 | + map.put("sjbc", sjbc); | |
| 12154 | +// map=new HashMap<String,Object>(); | |
| 12155 | + | |
| 12156 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 12157 | + String minfcsj = "02:00"; | |
| 12158 | + List<Line> lineList = lineRepository.findLineByCode(listpl.get(0).getXlBm()); | |
| 12159 | + if (lineList.size() > 0) { | |
| 12160 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 12161 | + + " id = (" | |
| 12162 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 12163 | + + ")"; | |
| 12164 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 12165 | + } | |
| 12166 | + String[] minSjs = minfcsj.split(":"); | |
| 12167 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 12168 | + | |
| 12169 | + | |
| 12170 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 12171 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 12172 | + String[] fcsj = s.getFcsj().split(":"); | |
| 12173 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 12174 | + | |
| 12175 | + Long fscjT = 0L; | |
| 12176 | + if (fcsjL < minSj) { | |
| 12177 | + Calendar calendar = new GregorianCalendar(); | |
| 12178 | + calendar.setTime(s.getScheduleDate()); | |
| 12179 | + calendar.add(calendar.DATE, 1); | |
| 12180 | + s.setScheduleDate(calendar.getTime()); | |
| 12181 | + try { | |
| 12182 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 12183 | + } catch (ParseException e) { | |
| 12184 | + // TODO Auto-generated catch block | |
| 12185 | + e.printStackTrace(); | |
| 12186 | + } | |
| 12187 | + | |
| 12188 | + } else { | |
| 12189 | + try { | |
| 12190 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 12191 | + } catch (ParseException e) { | |
| 12192 | + // TODO Auto-generated catch block | |
| 12193 | + e.printStackTrace(); | |
| 12194 | + } | |
| 12195 | + ; | |
| 12196 | + } | |
| 12197 | + s.setFcsjT(fscjT); | |
| 12198 | + } | |
| 12199 | + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 12200 | + Collections.sort(scheduleRealInfos, new ComparableReal()); | |
| 12201 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 12202 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 12203 | + s.setAdjustExps(i + 1 + ""); | |
| 12204 | + String remarks = ""; | |
| 12205 | + if (s.getRemarks() != null) { | |
| 12206 | + remarks += s.getRemarks(); | |
| 12207 | + } | |
| 12208 | + | |
| 12209 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 12210 | + if (!childTaskPlans.isEmpty()) { | |
| 12211 | + s.setFcsjActual(""); | |
| 12212 | + s.setZdsjActual(""); | |
| 12213 | + s.setJhlc(0.0); | |
| 12214 | + } | |
| 12215 | + | |
| 12216 | + if (s.isDestroy()) { | |
| 12217 | + s.setFcsjActual(""); | |
| 12218 | + s.setZdsjActual(""); | |
| 12219 | + s.setJhlc(0.0); | |
| 12220 | + remarks += "(烂班)"; | |
| 12221 | + s.setRemarks(remarks); | |
| 12222 | + } | |
| 12223 | + | |
| 12224 | + listSchedule.add(s); | |
| 12225 | + //计算营运里程,空驶里程 | |
| 12226 | + if (!childTaskPlans.isEmpty()) { | |
| 12227 | +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 12228 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 12229 | + Collections.sort(listit, new ComparableChild()); | |
| 12230 | + for (int j = 0; j < listit.size(); j++) { | |
| 12231 | + ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 12232 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 12233 | + if (childTaskPlan.isDestroy()) { | |
| 12234 | + t.setFcsjActual(""); | |
| 12235 | + t.setZdsjActual(""); | |
| 12236 | + t.setJhlc(0.0); | |
| 12237 | + } else { | |
| 12238 | + t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 12239 | + t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 12240 | + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 12241 | + } | |
| 12242 | + t.setQdzName(childTaskPlan.getStartStationName()); | |
| 12243 | + t.setZdzName(childTaskPlan.getEndStationName()); | |
| 12244 | + t.setRemarks(childTaskPlan.getRemarks()); | |
| 12245 | + t.setAdjustExps("子"); | |
| 12246 | + t.setjGh(""); | |
| 12247 | + t.setjName(""); | |
| 12248 | + t.setsGh(""); | |
| 12249 | + t.setsName(""); | |
| 12250 | + listSchedule.add(t); | |
| 12251 | + } | |
| 12252 | + } | |
| 12253 | + } | |
| 12254 | + Map<String, Object> maps; | |
| 12255 | + for (ScheduleRealInfo scheduleRealInfo : listSchedule) { | |
| 12256 | + maps = new HashMap<String, Object>(); | |
| 12257 | + try { | |
| 12258 | + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | |
| 12259 | + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | |
| 12260 | + maps = rru.getMapValue(scheduleRealInfo); | |
| 12261 | + maps.put("bcs", scheduleRealInfo.getAdjustExps()); | |
| 12262 | + String zdsj = scheduleRealInfo.getZdsj(); | |
| 12263 | + String zdsjActual = scheduleRealInfo.getZdsjActual(); | |
| 12264 | + if (zdsj != null && zdsjActual != null && | |
| 12265 | + !zdsj.equals(zdsjActual) && | |
| 12266 | + !zdsj.equals("") && | |
| 12267 | + !zdsjActual.equals("")) { | |
| 12268 | + int zdsjT = Integer.valueOf(zdsj.split(":")[0]) * 60 + Integer.valueOf(zdsj.split(":")[1]); | |
| 12269 | + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0]) * 60 + Integer.valueOf(zdsjActual.split(":")[1]); | |
| 12270 | + if (zdsj.compareTo(zdsjActual) > 0) { | |
| 12271 | + if (zdsjT - zdsjAT > 1000) { | |
| 12272 | + maps.put("fast", ""); | |
| 12273 | + maps.put("slow", zdsjAT - zdsjT + 1440); | |
| 12274 | + } else { | |
| 12275 | + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 12276 | + maps.put("slow", ""); | |
| 12277 | + } | |
| 12278 | + } else { | |
| 12279 | + if (zdsjAT - zdsjT > 1000) { | |
| 12280 | + maps.put("fast", zdsjT - zdsjAT + 1440); | |
| 12281 | + maps.put("slow", ""); | |
| 12282 | + } else { | |
| 12283 | + maps.put("fast", ""); | |
| 12284 | + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 12285 | + } | |
| 12286 | + } | |
| 12287 | + } else { | |
| 12288 | + maps.put("fast", ""); | |
| 12289 | + maps.put("slow", ""); | |
| 12290 | + } | |
| 12291 | + listMap.add(maps); | |
| 12292 | + } catch (Exception e) { | |
| 12293 | + e.printStackTrace(); | |
| 12294 | + } | |
| 12295 | + } | |
| 12296 | + | |
| 12297 | + | |
| 12298 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 12299 | + list.add(listMap.iterator()); | |
| 12300 | + String xls = ""; | |
| 12301 | + if (map.get("type").toString().equals("0")) { | |
| 12302 | + xls = "waybill_minhang.xls"; | |
| 12303 | + } else { | |
| 12304 | + xls = "waybill_minhang_dl.xls"; | |
| 12305 | + } | |
| 12306 | + map.put("sheetName", jName + "-" + clZbh + "-" + lpName); | |
| 12307 | + ee.excelReplace(list, new Object[]{map}, path + "mould/" + xls, | |
| 12308 | + path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | |
| 12309 | + } | |
| 12310 | + | |
| 12311 | + @Override | |
| 12312 | + public Map<String, Object> exportWaybillMore(Map<String, Object> map) { | |
| 12313 | + String date = map.get("date").toString(); | |
| 12314 | + String line = map.get("line").toString(); | |
| 12315 | + ReportUtils ee = new ReportUtils(); | |
| 12316 | + List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class); | |
| 12317 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/"; | |
| 12318 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 12319 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 12320 | + int num = 0; | |
| 12321 | + File file = null; | |
| 12322 | + try { | |
| 12323 | + while (true) { | |
| 12324 | + String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date)); | |
| 12325 | +// file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹 | |
| 12326 | + file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件 | |
| 12327 | + if (file.exists()) { //判断是否已存在重名 | |
| 12328 | + num++; | |
| 12329 | + } else { | |
| 12330 | + break; | |
| 12331 | + } | |
| 12332 | + } | |
| 12333 | +// file.mkdirs(); //创建 | |
| 12334 | + List<ScheduleRealInfo> lists_line = scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); | |
| 12335 | + List<File> files = new ArrayList<File>(); | |
| 12336 | + for (List<String> list : lists) { | |
| 12337 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 12338 | + String jName = list.get(0); | |
| 12339 | + String clZbh = list.get(1); | |
| 12340 | + String lpName = list.get(2); | |
| 12341 | + String jGh = list.get(3); | |
| 12342 | + for (int i = 0; i < lists_line.size(); i++) { | |
| 12343 | + ScheduleRealInfo s = lists_line.get(i); | |
| 12344 | + if (s.getjGh().equals(jGh) && s.getClZbh().equals(clZbh) && s.getLpName().equals(lpName)) { | |
| 12345 | + newList.add(s); | |
| 12346 | + } | |
| 12347 | + } | |
| 12348 | + this.exportWaybill_pl(newList, date, jName, clZbh, lpName); | |
| 12349 | + File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | |
| 12350 | + String fileName = file.getName(); | |
| 12351 | + files.add(temp); | |
| 12352 | + } | |
| 12353 | + for (int i = 1; i < files.size(); i++) { | |
| 12354 | + File file1 = files.get(0); | |
| 12355 | + File file2 = files.get(i); | |
| 12356 | + ee.copySheetByFile(file2, file1, 0, 145); | |
| 12357 | + } | |
| 12358 | + File newFile = files.get(0); | |
| 12359 | + newFile.renameTo(file); | |
| 12360 | +// temp.renameTo(new File(path + fileName + "/" + temp.getName())); | |
| 12361 | +// File[] listFiles = file.listFiles(); | |
| 12362 | +// ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip"))); | |
| 12363 | +//// zos.setEncoding("gbk"); | |
| 12364 | +//// zos.putNextEntry(new ZipEntry(fileName + "/")); | |
| 12365 | +// for (int i = 0; i < listFiles.length; i++) { | |
| 12366 | +// zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName())); | |
| 12367 | +// BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i])); | |
| 12368 | +// BufferedOutputStream bos = new BufferedOutputStream(zos); | |
| 12369 | +// int bytesRead = 0; | |
| 12370 | +// for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) { | |
| 12371 | +//// zos.write(buffer, 0, bytesRead); | |
| 12372 | +//// zos.flush(); | |
| 12373 | +// bos.write(buffer, 0, bytesRead); | |
| 12374 | +// bos.flush(); | |
| 12375 | +// } | |
| 12376 | +//// bos.close(); | |
| 12377 | +// bis.close(); | |
| 12378 | +// } | |
| 12379 | +// zos.close(); | |
| 12380 | +// } | |
| 12381 | + | |
| 12382 | + } catch (Exception e) { | |
| 12383 | + // TODO: handle exception | |
| 12384 | + e.printStackTrace(); | |
| 12385 | + } | |
| 12386 | + | |
| 12387 | + map.put("fileName", file.getName()); | |
| 12388 | + return map; | |
| 12389 | + } | |
| 12390 | + | |
| 12391 | + @Autowired | |
| 12392 | + SchedulePlanInfoService schPlanService; | |
| 12393 | + | |
| 12394 | + @Override | |
| 12395 | + public List<SchedulePlanInfo> currentSchedulePlan(String lineCode) { | |
| 12396 | + List<SchedulePlanInfo> rs = dayOfSchedule.schedulePlanMap.get(lineCode); | |
| 12397 | + | |
| 12398 | + if (rs == null || rs.size() == 0) { | |
| 12399 | + //尝试刷新内存 | |
| 12400 | + Map<String, Object> data = new HashMap<>(); | |
| 12401 | + data.put("scheduleDate_eq", dayOfSchedule.currSchDateMap.get(lineCode)); | |
| 12402 | + data.put("xlBm_eq", lineCode); | |
| 12403 | + List<SchedulePlanInfo> planItr = dayOfSchedule.cleanSchPlanItr(schPlanService.list(data).iterator()); | |
| 12404 | + | |
| 12405 | + if (planItr.size() > 0) { | |
| 12406 | + dayOfSchedule.schedulePlanMap.put(lineCode, planItr); | |
| 12407 | + return planItr; | |
| 12408 | + } | |
| 12409 | + } | |
| 12410 | + return rs; | |
| 12411 | + } | |
| 12412 | + | |
| 12413 | + | |
| 12414 | + @Override | |
| 12415 | + public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx, int type) { | |
| 12416 | + Map<String, Object> rs = new HashMap<>(); | |
| 12417 | + Set<ScheduleRealInfo> ts = new HashSet<>(); | |
| 12418 | + try { | |
| 12419 | + List<String> leftList = Splitter.on(",").splitToList(leftIdx); | |
| 12420 | + List<String> rightList = Splitter.on(",").splitToList(rightIdx); | |
| 12421 | + Set<String> lpSet = new HashSet<>(); | |
| 12422 | + Set<String> carSet = new HashSet<>(); | |
| 12423 | + | |
| 12424 | + List<ScheduleRealInfo> largeList, smallList; | |
| 12425 | + if (leftList.size() > rightList.size()) { | |
| 12426 | + largeList = getByIdx(leftList); | |
| 12427 | + smallList = getByIdx(rightList); | |
| 12428 | + } else { | |
| 12429 | + largeList = getByIdx(rightList); | |
| 12430 | + smallList = getByIdx(leftList); | |
| 12431 | + } | |
| 12432 | + | |
| 12433 | + ScheduleRealInfo leftSch, rightSch = null; | |
| 12434 | + for (int i = 0; i < largeList.size(); i++) { | |
| 12435 | + leftSch = largeList.get(i); | |
| 12436 | + leftSch.setLpChange(1); | |
| 12437 | + if (i < smallList.size()) { | |
| 12438 | + rightSch = smallList.get(i); | |
| 12439 | + rightSch.setLpChange(1); | |
| 12440 | + ts.add(rightSch); | |
| 12441 | + } else { | |
| 12442 | + //不对称时多出来的 | |
| 12443 | + lpChangeByLeft(leftSch, largeList.get(i - 1), type); | |
| 12444 | + ts.add(leftSch); | |
| 12445 | + lpSet.add(leftSch.getXlBm() + "_" + leftSch.getLpName()); | |
| 12446 | + continue; | |
| 12447 | + } | |
| 12448 | + | |
| 12449 | + //调换路牌 | |
| 12450 | + lpChange(leftSch, rightSch, type); | |
| 12451 | + ts.add(leftSch); | |
| 12452 | + | |
| 12453 | + lpSet.add(leftSch.getXlBm() + "_" + leftSch.getLpName()); | |
| 12454 | + lpSet.add(rightSch.getXlBm() + "_" + rightSch.getLpName()); | |
| 12455 | + | |
| 12456 | + carSet.add(leftSch.getClZbh()); | |
| 12457 | + carSet.add(rightSch.getClZbh()); | |
| 12458 | + scheduleRealInfoRepository.updateLpChange(leftSch.getId()); | |
| 12459 | + scheduleRealInfoRepository.updateLpChange(rightSch.getId()); | |
| 12460 | + } | |
| 12461 | + | |
| 12462 | + //重新计算路牌的起点应到时间 | |
| 12463 | + for (String lpName : lpSet) { | |
| 12464 | + ts.addAll(dayOfSchedule.updateQdzTimePlan(lpName)); | |
| 12465 | + } | |
| 12466 | + | |
| 12467 | + //重新就算车辆当前执行班次 | |
| 12468 | + for(String nbbm : carSet){ | |
| 12469 | + dayOfSchedule.reCalcExecPlan(nbbm); | |
| 12470 | + } | |
| 12471 | + | |
| 12472 | + | |
| 12473 | + for (ScheduleRealInfo sch : ts) { | |
| 12474 | + dayOfSchedule.save(sch); | |
| 12475 | + } | |
| 12476 | + | |
| 12477 | + rs.put("status", ResponseCode.SUCCESS); | |
| 12478 | + rs.put("ts", ts); | |
| 12479 | + } catch (Exception e) { | |
| 12480 | + logger.error("", e); | |
| 12481 | + rs.put("status", ResponseCode.ERROR); | |
| 12482 | + rs.put("msg", e.getMessage()); | |
| 12483 | + } | |
| 12484 | + | |
| 12485 | + return rs; | |
| 12486 | + } | |
| 12487 | + | |
| 12488 | + private List<ScheduleRealInfo> getByIdx(List<String> idList) { | |
| 12489 | + List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 12490 | + for (String id : idList) { | |
| 12491 | + list.add(dayOfSchedule.get(Long.parseLong(id))); | |
| 12492 | + } | |
| 12493 | + return list; | |
| 12494 | + } | |
| 12495 | + | |
| 12496 | + @Override | |
| 12497 | + public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) { | |
| 12498 | + //释放班次映射 | |
| 12499 | + if (type > 0) { | |
| 12500 | + dayOfSchedule.removeNbbm2SchMapp(leftSch); | |
| 12501 | + dayOfSchedule.removeNbbm2SchMapp(rightSch); | |
| 12502 | + } | |
| 12503 | + | |
| 12504 | + //对调数据 | |
| 12505 | + LpData leftData = new LpData(leftSch); | |
| 12506 | + LpData rightData = new LpData(rightSch); | |
| 12507 | + | |
| 12508 | + leftData.appendTo(rightSch, type); | |
| 12509 | + rightData.appendTo(leftSch, type); | |
| 12510 | + | |
| 12511 | + if (type > 0) { | |
| 12512 | + //重新映射 | |
| 12513 | + dayOfSchedule.addNbbm2SchMapp(leftSch); | |
| 12514 | + dayOfSchedule.addNbbm2SchMapp(rightSch); | |
| 12515 | + } | |
| 12516 | + } | |
| 12517 | + | |
| 12518 | + /** | |
| 12519 | + * 更换左边班次的路牌,右边不变 | |
| 12520 | + * | |
| 12521 | + * @param leftSch | |
| 12522 | + * @param rightSch | |
| 12523 | + * @param type | |
| 12524 | + */ | |
| 12525 | + public void lpChangeByLeft(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) { | |
| 12526 | + //释放班次映射 | |
| 12527 | + if (type > 0) | |
| 12528 | + dayOfSchedule.removeNbbm2SchMapp(leftSch); | |
| 12529 | + | |
| 12530 | + LpData rightData = new LpData(rightSch); | |
| 12531 | + rightData.appendTo(leftSch, type); | |
| 12532 | + | |
| 12533 | + //重新映射 | |
| 12534 | + if (type > 0) | |
| 12535 | + dayOfSchedule.addNbbm2SchMapp(leftSch); | |
| 12536 | + | |
| 12537 | + } | |
| 12538 | + | |
| 12539 | + @Override | |
| 12540 | + public Map<String, Object> revokeRealArrive(Long id) { | |
| 12541 | + Map<String, Object> rs = new HashMap<>(); | |
| 12542 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 12543 | + | |
| 12544 | + try { | |
| 12545 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 12546 | + if (sch.getZdsjActual() == null && sch.getFcsjActual() == null) { | |
| 12547 | + rs.put("status", ResponseCode.ERROR); | |
| 12548 | + rs.put("msg", "班次未执行,无法撤销!"); | |
| 12549 | + } else { | |
| 12550 | + //日志记录 | |
| 12551 | + ScheduleModifyLogger.cxzx(sch); | |
| 12552 | + | |
| 12553 | + sch.clearFcsjActual(); | |
| 12554 | + sch.clearZdsjActual(); | |
| 12555 | + //清除路牌下一个班的起点到达时间 | |
| 12556 | + ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); | |
| 12557 | + if (null != next) { | |
| 12558 | + next.setQdzArrDatesj(null); | |
| 12559 | + ts.add(next); | |
| 12560 | + } | |
| 12561 | + | |
| 12562 | + rs.put("status", ResponseCode.SUCCESS); | |
| 12563 | + | |
| 12564 | + ts.add(sch); | |
| 12565 | + rs.put("ts", ts); | |
| 12566 | + | |
| 12567 | + dayOfSchedule.save(sch); | |
| 12568 | + //重新计算当前执行班次 | |
| 12569 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 12570 | + | |
| 12571 | + } | |
| 12572 | + } catch (Exception e) { | |
| 12573 | + logger.error("", e); | |
| 12574 | + rs.put("status", ResponseCode.ERROR); | |
| 12575 | + } | |
| 12576 | + return rs; | |
| 12577 | + } | |
| 12578 | + | |
| 12579 | + @Override | |
| 12580 | + public Map<String, Object> lateAdjust(String idx, float minute) { | |
| 12581 | + Map<String, Object> rs = new HashMap<>(); | |
| 12582 | + try { | |
| 12583 | + int count = 0; | |
| 12584 | + List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 12585 | + List<String> ids = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(idx); | |
| 12586 | + | |
| 12587 | + ScheduleRealInfo sch; | |
| 12588 | + for (String id : ids) { | |
| 12589 | + sch = dayOfSchedule.get(Long.parseLong(id)); | |
| 12590 | + if (sch != null && sch.getStatus() == 0) { | |
| 12591 | + if (minute > 0) { | |
| 12592 | + sch.setLateMinute(minute); | |
| 12593 | + } else if (minute == 0) { | |
| 12594 | + LateAdjustHandle.remove(sch); | |
| 12595 | + } | |
| 12596 | + count++; | |
| 12597 | + list.add(sch); | |
| 12598 | + } | |
| 12599 | + } | |
| 12600 | + | |
| 12601 | + rs.put("status", ResponseCode.SUCCESS); | |
| 12602 | + rs.put("count", count); | |
| 12603 | + rs.put("ts", list); | |
| 12604 | + } catch (Exception e) { | |
| 12605 | + logger.error("", e); | |
| 12606 | + rs.put("status", ResponseCode.ERROR); | |
| 12607 | + rs.put("msg", e.getMessage()); | |
| 12608 | + } | |
| 12609 | + | |
| 12610 | + return rs; | |
| 12611 | + } | |
| 12612 | + | |
| 12613 | + @Override | |
| 12614 | + public List<ScheduleRealInfo> allLate2(String idx) { | |
| 12615 | + List<ScheduleRealInfo> rs = new ArrayList<>(); | |
| 12616 | + List<String> ids = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(idx); | |
| 12617 | + | |
| 12618 | + Collection<ScheduleRealInfo> all = LateAdjustHandle.allLateSch(); | |
| 12619 | + for (ScheduleRealInfo sch : all) { | |
| 12620 | + if (ids.indexOf(sch.getXlBm()) != -1) { | |
| 12621 | + rs.add(sch); | |
| 12622 | + } | |
| 12623 | + } | |
| 12624 | + return rs; | |
| 12625 | + } | |
| 12626 | + | |
| 12627 | + | |
| 12628 | + @Override | |
| 12629 | + public List<Map<String, Object>> mileageReport(String gsdm, | |
| 12630 | + String fgsdm, String line, String date, String date2) { | |
| 12631 | + | |
| 12632 | + String sql = "select * from calc_mileage where 1=1 "; | |
| 12633 | + if (!line.equals(" ")) { | |
| 12634 | + sql = sql + " and line_code='" + line + "' "; | |
| 12635 | + } | |
| 12636 | + sql = sql + " and DATE_FORMAT(rq,'%Y-%m-%d') between '" + date + "' and '" + date2 + "'"; | |
| 12637 | + if (!gsdm.equals(" ")) { | |
| 12638 | + sql = sql + " and company_id=" + gsdm; | |
| 12639 | + } | |
| 12640 | + if (!gsdm.equals(" ")) { | |
| 12641 | + sql = sql + " and sub_company_id=" + fgsdm; | |
| 12642 | + } | |
| 12643 | + sql = sql + " order by line_code"; | |
| 12644 | + List<MileageReport> list = jdbcTemplate.query(sql, | |
| 12645 | + new RowMapper<MileageReport>() { | |
| 12646 | + @Override | |
| 12647 | + public MileageReport mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 12648 | + MileageReport mr = new MileageReport(); | |
| 12649 | + mr.setCompanyName(rs.getString("company_name")); | |
| 12650 | + mr.setSubCompanyName(rs.getString("sub_company_name")); | |
| 12651 | + mr.setLineName(rs.getString("line_name")); | |
| 12652 | + mr.setSjyygl(rs.getDouble("sjyygl")); | |
| 12653 | + mr.setSjksgl(rs.getDouble("sjksgl")); | |
| 12654 | + mr.setZgl(rs.getDouble("zyygl")); | |
| 12655 | + mr.setZddfgl(rs.getDouble("zddfgl")); | |
| 12656 | + mr.setSddfgl(rs.getDouble("sddfgl")); | |
| 12657 | + mr.setWqwxhgl(rs.getDouble("wqwxhgl")); | |
| 12658 | + mr.setBfwxhgl(rs.getDouble("bfwxhgl")); | |
| 12659 | + mr.setPygl(rs.getDouble("pygl")); | |
| 12660 | + mr.setLjgl(rs.getDouble("ljgl")); | |
| 12661 | + mr.setZrwgl(rs.getDouble("zrwgl")); | |
| 12662 | + mr.setOther(rs.getString("other")); | |
| 12663 | + return mr; | |
| 12664 | + } | |
| 12665 | + }); | |
| 12666 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 12667 | + double sjyygl = 0.0; | |
| 12668 | + double sjksgl = 0.0; | |
| 12669 | + double zgl = 0.0; | |
| 12670 | + double sddfgl = 0.0; | |
| 12671 | + double zddfgl = 0.0; | |
| 12672 | + double wqwxhgl = 0.0; | |
| 12673 | + double bfwxhgl = 0.0; | |
| 12674 | + double pygl = 0.0; | |
| 12675 | + double ljgl = 0.0; | |
| 12676 | + double zrwgl = 0.0; | |
| 12677 | + for (MileageReport mr : list) { | |
| 12678 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 12679 | + resMap.put("gsName", mr.getCompanyName()); | |
| 12680 | + resMap.put("fgsName", mr.getSubCompanyName()); | |
| 12681 | + resMap.put("xlName", mr.getLineName()); | |
| 12682 | + resMap.put("sjyygl", mr.getSjyygl()); | |
| 12683 | + resMap.put("sjksgl", mr.getSjksgl()); | |
| 12684 | + resMap.put("zgl", mr.getZgl()); | |
| 12685 | + resMap.put("sddfgl", mr.getSddfgl()); | |
| 12686 | + resMap.put("zddfgl", mr.getZddfgl()); | |
| 12687 | + resMap.put("wqwxhgl", mr.getWqwxhgl()); | |
| 12688 | + resMap.put("bfwxhgl", mr.getBfwxhgl()); | |
| 12689 | + resMap.put("pygl", mr.getPygl()); | |
| 12690 | + resMap.put("ljgl", mr.getLjgl()); | |
| 12691 | + resMap.put("zrwgl", mr.getZrwgl()); | |
| 12692 | + resMap.put("other", mr.getOther()); | |
| 12693 | + lMap.add(resMap); | |
| 12694 | + sjyygl = Arith.add(sjyygl, mr.getSjyygl()); | |
| 12695 | + sjksgl = Arith.add(sjksgl, mr.getSjksgl()); | |
| 12696 | + zgl = Arith.add(zgl, mr.getZgl()); | |
| 12697 | + sddfgl = Arith.add(sddfgl, mr.getSddfgl()); | |
| 12698 | + zddfgl = Arith.add(zddfgl, mr.getZddfgl()); | |
| 12699 | + wqwxhgl = Arith.add(wqwxhgl, mr.getWqwxhgl()); | |
| 12700 | + bfwxhgl = Arith.add(bfwxhgl, mr.getBfwxhgl()); | |
| 12701 | + pygl = Arith.add(pygl, mr.getPygl()); | |
| 12702 | + ljgl = Arith.add(ljgl, mr.getLjgl()); | |
| 12703 | + zrwgl = Arith.add(zrwgl, mr.getZrwgl()); | |
| 12704 | + } | |
| 12705 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 12706 | + resMap.put("xlName", "合计"); | |
| 12707 | + resMap.put("sjyygl", sjyygl); | |
| 12708 | + resMap.put("sjksgl", sjksgl); | |
| 12709 | + resMap.put("zgl", zgl); | |
| 12710 | + resMap.put("sddfgl", sddfgl); | |
| 12711 | + resMap.put("zddfgl", zddfgl); | |
| 12712 | + resMap.put("wqwxhgl", wqwxhgl); | |
| 12713 | + resMap.put("bfwxhgl", bfwxhgl); | |
| 12714 | + resMap.put("pygl", pygl); | |
| 12715 | + resMap.put("ljgl", ljgl); | |
| 12716 | + resMap.put("zrwgl", zrwgl); | |
| 12717 | + resMap.put("other", null); | |
| 12718 | + lMap.add(resMap); | |
| 12719 | + return lMap; | |
| 12720 | + } | |
| 12721 | + | |
| 12722 | + @Override | |
| 12723 | + public List<Map<String, Object>> scheduleCorrectionReport(String gsdm, | |
| 12724 | + String fgsdm, String line, String date, String date2) { | |
| 12725 | + | |
| 12726 | + String sql = "select * from calc_schedule where 1=1 "; | |
| 12727 | + if (!line.equals(" ")) { | |
| 12728 | + sql = sql + " and line_code='" + line + "' "; | |
| 12729 | + } | |
| 12730 | + sql = sql + " and DATE_FORMAT(rq,'%Y-%m-%d') between '" + date + "' and '" + date2 + "'"; | |
| 12731 | + if (!gsdm.equals(" ")) { | |
| 12732 | + sql = sql + " and company_id=" + gsdm; | |
| 12733 | + } | |
| 12734 | + if (!gsdm.equals(" ")) { | |
| 12735 | + sql = sql + " and sub_company_id=" + fgsdm; | |
| 12736 | + } | |
| 12737 | + sql = sql + " order by line_code"; | |
| 12738 | + List<ScheduleCorrectionReport> list = jdbcTemplate.query(sql, | |
| 12739 | + new RowMapper<ScheduleCorrectionReport>() { | |
| 12740 | + @Override | |
| 12741 | + public ScheduleCorrectionReport mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 12742 | + ScheduleCorrectionReport sReport = new ScheduleCorrectionReport(); | |
| 12743 | + sReport.setCompanyName(rs.getString("company_name")); | |
| 12744 | + sReport.setSubCompanyName(rs.getString("sub_company_name")); | |
| 12745 | + sReport.setLineName(rs.getString("line_name")); | |
| 12746 | + sReport.setSjyybc(rs.getInt("sjyybc")); | |
| 12747 | + sReport.setSjksbc(rs.getInt("sjksbc")); | |
| 12748 | + sReport.setZbc(rs.getInt("zyybc")); | |
| 12749 | + sReport.setZddfbc(rs.getInt("zddfbc")); | |
| 12750 | + sReport.setSddfbc(rs.getInt("sddfbc")); | |
| 12751 | + sReport.setWqwxhbc(rs.getInt("wqwxhbc")); | |
| 12752 | + sReport.setBfwxhbc(rs.getInt("bfwxhbc")); | |
| 12753 | + sReport.setPybc(rs.getInt("pybc")); | |
| 12754 | + sReport.setLjbc(rs.getInt("ljbc")); | |
| 12755 | + sReport.setZrwbc(rs.getInt("zrwbc")); | |
| 12756 | + sReport.setOther(rs.getString("other")); | |
| 12757 | + return sReport; | |
| 12758 | + } | |
| 12759 | + }); | |
| 12760 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 12761 | + int sjyybc = 0; | |
| 12762 | + int sjksbc = 0; | |
| 12763 | + int zbc = 0; | |
| 12764 | + int sddfbc = 0; | |
| 12765 | + int zddfbc = 0; | |
| 12766 | + int wqwxhbc = 0; | |
| 12767 | + int bfwxhbc = 0; | |
| 12768 | + int pybc = 0; | |
| 12769 | + int ljbc = 0; | |
| 12770 | + int zrwbc = 0; | |
| 12771 | + for (ScheduleCorrectionReport sReport : list) { | |
| 12772 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 12773 | + resMap.put("gsName", sReport.getCompanyName()); | |
| 12774 | + resMap.put("fgsName", sReport.getSubCompanyName()); | |
| 12775 | + resMap.put("xlName", sReport.getLineName()); | |
| 12776 | + resMap.put("sjyybc", sReport.getSjyybc()); | |
| 12777 | + resMap.put("sjksbc", sReport.getSjksbc()); | |
| 12778 | + resMap.put("zbc", sReport.getZbc()); | |
| 12779 | + resMap.put("sddfbc", sReport.getSddfbc()); | |
| 12780 | + resMap.put("zddfbc", sReport.getZddfbc()); | |
| 12781 | + resMap.put("wqwxhbc", sReport.getWqwxhbc()); | |
| 12782 | + resMap.put("bfwxhbc", sReport.getBfwxhbc()); | |
| 12783 | + resMap.put("pybc", sReport.getPybc()); | |
| 12784 | + resMap.put("ljbc", sReport.getLjbc()); | |
| 12785 | + resMap.put("zrwbc", sReport.getZrwbc()); | |
| 12786 | + resMap.put("other", sReport.getOther()); | |
| 12787 | + lMap.add(resMap); | |
| 12788 | + sjyybc = sjyybc + sReport.getSjyybc(); | |
| 12789 | + sjksbc = sjksbc + sReport.getSjksbc(); | |
| 12790 | + zbc = zbc + sReport.getZbc(); | |
| 12791 | + sddfbc = sddfbc + sReport.getSddfbc(); | |
| 12792 | + zddfbc = zddfbc + sReport.getZddfbc(); | |
| 12793 | + wqwxhbc = wqwxhbc + sReport.getWqwxhbc(); | |
| 12794 | + bfwxhbc = bfwxhbc + sReport.getBfwxhbc(); | |
| 12795 | + pybc = pybc + sReport.getPybc(); | |
| 12796 | + ljbc = ljbc + sReport.getLjbc(); | |
| 12797 | + zrwbc = zrwbc + sReport.getZrwbc(); | |
| 12798 | + } | |
| 12799 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 12800 | + resMap.put("xlName", "合计"); | |
| 12801 | + resMap.put("sjyybc", sjyybc); | |
| 12802 | + resMap.put("sjksbc", sjksbc); | |
| 12803 | + resMap.put("zbc", zbc); | |
| 12804 | + resMap.put("sddfbc", sddfbc); | |
| 12805 | + resMap.put("zddfbc", zddfbc); | |
| 12806 | + resMap.put("wqwxhbc", wqwxhbc); | |
| 12807 | + resMap.put("bfwxhbc", bfwxhbc); | |
| 12808 | + resMap.put("pybc", pybc); | |
| 12809 | + resMap.put("ljbc", ljbc); | |
| 12810 | + resMap.put("zrwbc", zrwbc); | |
| 12811 | + resMap.put("other", null); | |
| 12812 | + lMap.add(resMap); | |
| 12813 | + return lMap; | |
| 12814 | + } | |
| 12815 | + | |
| 12816 | + @Override | |
| 12817 | + public Integer isCircleQdz(String clzbh, String sdr, String xlbm, String qdzCode) { | |
| 12818 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 12819 | + String time =sdf.format(Long.parseLong(sdr)); | |
| 12820 | + | |
| 12821 | + Long num=scheduleRealInfoRepository.isCircleQdz(clzbh, time, xlbm, qdzCode); | |
| 12822 | + Integer num2=num==0L?0:1; | |
| 12823 | + return num2; | |
| 12824 | + } | |
| 12825 | + | |
| 12826 | + @SuppressWarnings("unchecked") | |
| 12827 | + private static Map<String, Object> request(String url) { | |
| 12828 | + Map<String, Object> res = new HashMap<String, Object>(); | |
| 12829 | + res.put("status", ResponseCode.SUCCESS); | |
| 12830 | + InputStream in = null; | |
| 12831 | + HttpURLConnection con = null; | |
| 12832 | + try { | |
| 12833 | + con = (HttpURLConnection)new URL(url).openConnection(); | |
| 12834 | + con.setRequestMethod("POST"); | |
| 12835 | + con.setRequestProperty("keep-alive", "true"); | |
| 12836 | + con.setRequestProperty("accept", "application/json"); | |
| 12837 | + con.setRequestProperty("content-type", "application/json"); | |
| 12838 | + con.setDoInput(true); | |
| 12839 | + con.setReadTimeout(2500); | |
| 12840 | + con.setConnectTimeout(2500); | |
| 12841 | + | |
| 12842 | + con.connect(); | |
| 12843 | + if (con.getResponseCode() == 200) { | |
| 12844 | + in = con.getInputStream(); | |
| 12845 | + ByteArrayOutputStream bout = new ByteArrayOutputStream(); | |
| 12846 | + IOUtils.copy(in, bout); bout.close(); | |
| 12847 | + Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class); | |
| 12848 | + if (!"报修成功".equals(response.get("msg"))) { | |
| 12849 | + res.put("status", ResponseCode.ERROR); | |
| 12850 | + res.putAll(response); | |
| 12851 | + } | |
| 12852 | + } else { | |
| 12853 | + res.put("status", ResponseCode.ERROR); | |
| 12854 | + res.put("msg", "调用上报接口异常"); | |
| 12855 | + } | |
| 12856 | + } catch (IOException e) { | |
| 12857 | + // TODO Auto-generated catch block | |
| 12858 | + res.put("status", ResponseCode.ERROR); | |
| 12859 | + res.put("msg", "调用上报接口异常"); | |
| 12860 | + } finally { | |
| 12861 | + try { | |
| 12862 | + if (in != null) in.close(); | |
| 12863 | + if (con != null) con.disconnect(); | |
| 12864 | + } catch (IOException e) { | |
| 12865 | + // TODO Auto-generated catch block | |
| 12866 | + e.printStackTrace(); | |
| 12867 | + } | |
| 12868 | + } | |
| 12869 | + | |
| 12870 | + return res; | |
| 12871 | + } | |
| 12872 | + | |
| 12873 | + /** | |
| 12874 | + ** 维修记录上报 | |
| 12875 | + * @param param 参数信息 | |
| 12876 | + * @param isActive 主/被动上报 | |
| 12877 | + */ | |
| 12878 | + @Override | |
| 12879 | + @Transactional | |
| 12880 | + public Map<String, Object> repairReport(Map<String, Object> param, boolean isActive) { | |
| 12881 | + Map<String, Object> res = new HashMap<String, Object>(); | |
| 12882 | + res.put("status", ResponseCode.SUCCESS); | |
| 12883 | + // 获取实际排班信息 | |
| 12884 | + Long id = Long.parseLong((String)param.get("id")); | |
| 12885 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 12886 | + | |
| 12887 | + if (null == sch) { | |
| 12888 | + res.put("status", ResponseCode.ERROR); | |
| 12889 | + res.put("msg", "不存在的班次!"); | |
| 12890 | + | |
| 12891 | + return res; | |
| 12892 | + } | |
| 12893 | + | |
| 12894 | + int reportState = -1; | |
| 12895 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 12896 | + String reportUser = user.getUserName(), reportName = user.getName(), incode = (String)param.get("clZbh"), reportTypes = (String)param.get("reportTypes"), repairTypes = reportType2RepairType(reportTypes); | |
| 12897 | + // 分公司保存格式 分公司编码_公司编码 | |
| 12898 | + String val = BasicData.nbbm2FgsCompanyCodeMap.get(incode); | |
| 12899 | + String[] arr = val.split("_"); | |
| 12900 | + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1])); | |
| 12901 | + url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]); | |
| 12902 | + | |
| 12903 | + int count = repairReportRepository.repairReportBySch(id, isActive ? 1 : 0); | |
| 12904 | + if (count > 0) return res; | |
| 12905 | + RepairReport lrr = dayOfSchedule.getLastestRepairReport(incode); | |
| 12906 | + // 非主动上报并且无上报记录或上次已上报 则不用上报 | |
| 12907 | + if (!isActive && (lrr == null || lrr.getReportState() != 0)) { | |
| 12908 | + reportState = 0; | |
| 12909 | + } else { | |
| 12910 | + res = request(url.toString()); | |
| 12911 | + if (ResponseCode.SUCCESS.equals(res.get("status"))) reportState = 1; | |
| 12912 | + } | |
| 12913 | + // 持久化此次上报记录 | |
| 12914 | + RepairReport rr = new RepairReport(); | |
| 12915 | + rr.setLineId(sch.getXlBm()); | |
| 12916 | + rr.setLineName(sch.getXlName()); | |
| 12917 | + rr.setReportUser(reportUser); | |
| 12918 | + rr.setReportName(reportName); | |
| 12919 | + rr.setSchId(id); | |
| 12920 | + rr.setIncode(incode); | |
| 12921 | + rr.setDepartureTime(sch.getFcsj()); | |
| 12922 | + rr.setRepairType(repairTypes); | |
| 12923 | + rr.setReportType(reportTypes); | |
| 12924 | + rr.setReportDate(new Date()); | |
| 12925 | + rr.setReportState(reportState); | |
| 12926 | + rr.setReportMode(isActive ? 1 : 0); | |
| 12927 | + rr = repairReportRepository.save(rr); | |
| 12928 | + dayOfSchedule.setLastestRepairReport(rr); | |
| 12929 | + // 如果上报失败,放到重传队列 | |
| 12930 | + if (rr.getReportState() == -1) queue.add(rr); | |
| 12931 | + | |
| 12932 | + return res; | |
| 12933 | + } | |
| 12934 | + | |
| 12935 | + private void repairReport(RepairReport rr) { | |
| 12936 | + int reportState = -1; | |
| 12937 | + // 分公司保存格式 分公司编码_公司编码 | |
| 12938 | + String val = BasicData.nbbm2FgsCompanyCodeMap.get(rr.getIncode()); | |
| 12939 | + String[] arr = val.split("_"); | |
| 12940 | + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1])); | |
| 12941 | + url.append("?nbbm=").append(rr.getIncode()).append("&bxy=").append(rr.getReportUser()).append("&bxbm=").append(rr.getRepairType()).append("&fgs=").append(arr[0]); | |
| 12942 | + | |
| 12943 | + Map<String, Object> res = request(url.toString()); | |
| 12944 | + if (ResponseCode.SUCCESS.equals(res.get("status"))) reportState = 1; | |
| 12945 | + if (reportState == 1) { | |
| 12946 | + rr.setReportState(1); | |
| 12947 | + repairReportRepository.save(rr); | |
| 12948 | + } | |
| 12949 | + } | |
| 12950 | + | |
| 12951 | + /** | |
| 12952 | + ** 业务类型转报修类型 | |
| 12953 | + */ | |
| 12954 | + private String reportType2RepairType(String reportType) { | |
| 12955 | + String[] reportTypes = reportType.split(";"); | |
| 12956 | + List<String> repairTypes = new ArrayList<>(); | |
| 12957 | + for (String rt : reportTypes) { | |
| 12958 | + repairTypes.add(report2repair.get(rt)); | |
| 12959 | + } | |
| 12960 | + | |
| 12961 | + return StringUtils.join(repairTypes, ";"); | |
| 12962 | + } | |
| 12963 | + | |
| 12964 | + @Override | |
| 12965 | + public List<RepairReport> repairReportList(String lineId, String date, String incode, String type) { | |
| 12966 | + List<RepairReport> result = new ArrayList<RepairReport>(); | |
| 12967 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 12968 | + | |
| 12969 | + Date start = null, end = null; | |
| 12970 | + if (date.length() > 0) { | |
| 12971 | + try { | |
| 12972 | + start = sdf.parse(date + " 00:00:00"); | |
| 12973 | + end = sdf.parse(date + " 23:59:59"); | |
| 12974 | + } catch (ParseException e) { | |
| 12975 | + // TODO Auto-generated catch block | |
| 12976 | + e.printStackTrace(); | |
| 12977 | + } | |
| 12978 | + | |
| 12979 | + } | |
| 12980 | + | |
| 12981 | + result = repairReportRepository.repairReportList(lineId, start, end, incode); | |
| 12982 | + Map<String, Object> dMap=new HashMap<>(); | |
| 12983 | + dMap.put("dGroup_eq", "repairtype"); | |
| 12984 | + Map<String, String> code2name = new HashMap<String, String>(); | |
| 12985 | + for (Dictionary dic : dictionaryService.list(dMap)) { | |
| 12986 | + code2name.put(dic.getdCode(), dic.getdName()); | |
| 12987 | + } | |
| 12988 | + for (RepairReport rr : result) { | |
| 12989 | + String reportType = rr.getReportType(); | |
| 12990 | + String[] types = reportType.split(";"); | |
| 12991 | + StringBuilder sb = new StringBuilder(); | |
| 12992 | + | |
| 12993 | + for (String t : types) { | |
| 12994 | + sb.append(code2name.get(t)).append(";"); | |
| 12995 | + } | |
| 12996 | + | |
| 12997 | + rr.setRepairType(sb.toString()); | |
| 12998 | + rr.setReportDateStr(sdf.format(rr.getReportDate())); | |
| 12999 | + switch (rr.getReportState()) { | |
| 13000 | + case 0: | |
| 13001 | + rr.setReportStateStr("不报"); | |
| 13002 | + break; | |
| 13003 | + case 1: | |
| 13004 | + rr.setReportStateStr("上报成功"); | |
| 13005 | + break; | |
| 13006 | + case -1: | |
| 13007 | + rr.setReportStateStr("上报失败"); | |
| 13008 | + break; | |
| 13009 | + default: | |
| 13010 | + break; | |
| 13011 | + } | |
| 13012 | + } | |
| 13013 | + | |
| 13014 | + if ("export".equals(type)) { | |
| 13015 | + String lineName = BasicData.lineCode2NameMap.get(lineId); | |
| 13016 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 13017 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 13018 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 13019 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 13020 | + ReportUtils ee = new ReportUtils(); | |
| 13021 | + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 13022 | + for (int i = 0; i < result.size(); i++) { | |
| 13023 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 13024 | + RepairReport rr = result.get(i); | |
| 13025 | + map.put("row", i + 1); | |
| 13026 | + map.put("lineId", rr.getLineName()); | |
| 13027 | + map.put("incode", rr.getIncode()); | |
| 13028 | + map.put("departureTime", rr.getDepartureTime()); | |
| 13029 | + map.put("reportUser", rr.getReportUser()); | |
| 13030 | + map.put("reportDateStr", rr.getReportDate()); | |
| 13031 | + map.put("repairType", rr.getRepairType()); | |
| 13032 | + map.put("reportStateStr", rr.getReportStateStr()); | |
| 13033 | + newList.add(map); | |
| 13034 | + } | |
| 13035 | + try { | |
| 13036 | + listI.add(newList.iterator()); | |
| 13037 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 13038 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/repairReport.xls", | |
| 13039 | + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 13040 | + + "-" + lineName + "-维修上报记录.xls"); | |
| 13041 | + } catch (Exception e) { | |
| 13042 | + // TODO: handle exception | |
| 13043 | + e.printStackTrace(); | |
| 13044 | + } | |
| 13045 | + } | |
| 13046 | + | |
| 13047 | + return result; | |
| 13048 | + } | |
| 13049 | + | |
| 13050 | + @Override | |
| 13051 | + public Map<String, String> getLevelsByLines(List<String> lines) { | |
| 13052 | + Map<String, String> result = new HashMap<String, String>(), currSchDate = dayOfSchedule.getCurrSchDate(); | |
| 13053 | + for (String line : lines) { | |
| 13054 | + String level = BasicData.lineDate2Level.get(line + "_" + currSchDate.get(line)); | |
| 13055 | + result.put(line, level == null ? "" : level); | |
| 13056 | + } | |
| 13057 | + | |
| 13058 | + return result; | |
| 13059 | + } | |
| 13060 | + | |
| 13061 | + | |
| 13062 | + @Override | |
| 13063 | + public void destroy() throws Exception { | |
| 13064 | + // TODO Auto-generated method stub | |
| 13065 | + exec.shutdown(); | |
| 13066 | + } | |
| 13067 | + | |
| 13068 | + | |
| 13069 | + @Override | |
| 13070 | + public void afterPropertiesSet() throws Exception { | |
| 13071 | + // TODO Auto-generated method stub | |
| 13072 | + // 维修上报重发调度 | |
| 13073 | + exec.scheduleAtFixedRate(new Runnable() { | |
| 13074 | + | |
| 13075 | + @Override | |
| 13076 | + public void run() { | |
| 13077 | + // TODO Auto-generated method stub | |
| 13078 | + try { | |
| 13079 | + Iterator<RepairReport> it = queue.iterator(); | |
| 13080 | + while (it.hasNext()) { | |
| 13081 | + RepairReport rr = it.next(); | |
| 13082 | + repairReport(rr); | |
| 13083 | + if (rr.getReportState() == 1 || System.currentTimeMillis() - rr.getReportDate().getTime() > 86400000) queue.remove(rr); | |
| 13084 | + } | |
| 13085 | + } catch (Exception e) { | |
| 13086 | + logger.error("维修上报重发错误", e); | |
| 13087 | + } | |
| 13088 | + } | |
| 13089 | + }, 30, 30, TimeUnit.MINUTES); | |
| 13090 | + | |
| 13091 | + //// --- | |
| 13092 | + exec.scheduleWithFixedDelay(new Runnable() { | |
| 13093 | + @Override | |
| 13094 | + public void run() { | |
| 13095 | + Map<String, Object> res = new HashMap<>(); | |
| 13096 | + InputStream in = null; | |
| 13097 | + String url ="http://211.95.61.66:9008/modules/tSafedrivingCs/DSMBHforCLBH"; | |
| 13098 | + | |
| 13099 | + try { | |
| 13100 | + HttpURLConnection con = (HttpURLConnection)new URL(url.toString()).openConnection(); | |
| 13101 | + con.setDoInput(true); | |
| 13102 | + con.setRequestMethod("POST"); | |
| 13103 | + con.setConnectTimeout(5000); | |
| 13104 | + con.setReadTimeout(5000); | |
| 13105 | + con.setRequestProperty("keep-alive", "true"); | |
| 13106 | + con.setRequestProperty("accept", "*/*"); | |
| 13107 | + con.setRequestProperty("content-type", "application/x-www-form-urlencoded"); | |
| 13108 | + con.connect(); | |
| 13109 | + | |
| 13110 | + if (con.getResponseCode() == 200) { | |
| 13111 | + in = con.getInputStream(); | |
| 13112 | + ByteArrayOutputStream bout = new ByteArrayOutputStream(); | |
| 13113 | + IOUtils.copy(in, bout); | |
| 13114 | + DIRMAP = new ObjectMapper().readValue(bout.toByteArray(), Map.class); | |
| 13115 | + } | |
| 13116 | + } catch (MalformedURLException e) { | |
| 13117 | + // TODO Auto-generated catch block | |
| 13118 | + e.printStackTrace(); | |
| 13119 | + } catch (IOException e) { | |
| 13120 | + // TODO Auto-generated catch block | |
| 13121 | + e.printStackTrace(); | |
| 13122 | + } | |
| 13123 | + | |
| 13124 | + } | |
| 13125 | + }, 0, 60 * 60 * 24, TimeUnit.MINUTES); | |
| 13126 | + } | |
| 13127 | +} | |
| 13128 | + | |
| 13129 | +class AccountMap implements Comparator<Map<String, Object>> { | |
| 13130 | + @Override | |
| 13131 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 13132 | + // TODO Auto-generated method stub | |
| 13133 | + return o1.get("clZbh").toString().compareTo(o2.get("clZbh").toString()); | |
| 13134 | + } | |
| 13135 | +} | |
| 13136 | + | |
| 13137 | +class AccountMap2 implements Comparator<Map<String, Object>> { | |
| 13138 | + @Override | |
| 13139 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 13140 | + // TODO Auto-generated method stub | |
| 13141 | + return o2.get("clZbh").toString().compareTo(o1.get("clZbh").toString()); | |
| 13142 | + } | |
| 13143 | +} | |
| 13144 | + | |
| 13145 | +class AccountXlbm implements Comparator<Map<String, Object>> { | |
| 13146 | + @Override | |
| 13147 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 13148 | + // TODO Auto-generated method stub | |
| 13149 | +// PinyinHelper.convertToPinyinString(ppy.getName(), | |
| 13150 | +// "" , PinyinFormat.WITHOUT_TONE) | |
| 13151 | + return o1.get("xlNamePy").toString().compareTo( | |
| 13152 | + o2.get("xlNamePy").toString()); | |
| 13153 | + } | |
| 13154 | +} | |
| 13155 | + | |
| 13156 | +class compareLpFcsjType implements Comparator<ScheduleRealInfo> { | |
| 13157 | + @Override | |
| 13158 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 13159 | + // TODO Auto-generated method stub | |
| 13160 | + return (o1.getLpName()+o1.getFcsjT() + o1.getRemark()).compareTo(o2.getLpName()+o2.getFcsjT() + o2.getRemark()); | |
| 13161 | + } | |
| 13162 | + | |
| 13163 | +} | |
| 13164 | + | |
| 13165 | +class compareDirLpFcsjType implements Comparator<ScheduleRealInfo> { | |
| 13166 | + @Override | |
| 13167 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 13168 | + // TODO Auto-generated method stub | |
| 13169 | + return (o1.getXlDir()+o1.getFcsjT() + o1.getRemark()+o1.getLpName()).compareTo(o2.getXlDir()+o2.getFcsjT() + o2.getRemark()+o2.getLpName()); | |
| 13170 | + } | |
| 13171 | + | |
| 13172 | +} | |
| 13173 | +class compareFcsjType implements Comparator<ScheduleRealInfo> { | |
| 13174 | + @Override | |
| 13175 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 13176 | + // TODO Auto-generated method stub | |
| 13177 | + return (o1.getFcsjT() + o1.getRemark()).compareTo(o2.getFcsjT() + o2.getRemark()); | |
| 13178 | + } | |
| 13179 | + | |
| 13180 | +} | |
| 13181 | +>>>>>>> 2021.05.11 历史版本 选择版本 查看历史版本修改当前版本和待更新版本 | ... | ... |
src/main/java/com/bsth/util/db/.gitignore
0 → 100644
| 1 | +/DBUtils_control.java | ... | ... |
src/main/resources/static/pages/base/lineversions/add.html
| ... | ... | @@ -98,6 +98,15 @@ |
| 98 | 98 | <input type="text" class="form-control" name="versions" id="versionsInput" placeholder="线路版本" /> |
| 99 | 99 | </div> |
| 100 | 100 | </div> |
| 101 | + | |
| 102 | + <div class="form-group"> | |
| 103 | + <label class="control-label col-md-5"> | |
| 104 | + 使用历史副本 : | |
| 105 | + </label> | |
| 106 | + <div class="col-md-4"> | |
| 107 | + <select name="hisVersions" class="form-control" style="width:100%" id="hisVersionsInput"></select> | |
| 108 | + </div> | |
| 109 | + </div> | |
| 101 | 110 | <!-- 表单分组组件 form-group END --> |
| 102 | 111 | |
| 103 | 112 | <!-- <div class="form-group"> | ... | ... |
src/main/resources/static/pages/base/lineversions/js/lineversions-add-from.js
| ... | ... | @@ -54,6 +54,8 @@ |
| 54 | 54 | }); |
| 55 | 55 | if($('span').hasClass('select2-selection')) |
| 56 | 56 | $('span .select2-selection').remove(); |
| 57 | + | |
| 58 | + | |
| 57 | 59 | initPinYinSelect2($('#lineSelect'),paramsD,function(selector) { |
| 58 | 60 | selector.select2("val", "请选择..."); |
| 59 | 61 | }); |
| ... | ... | @@ -80,6 +82,39 @@ |
| 80 | 82 | } |
| 81 | 83 | }); |
| 82 | 84 | if(type) { |
| 85 | + $.get('/lineVersions/findAllHistroyLineVersionsById',{'lineId':lineSelectValueArray[1]}, function(lineVersions){ | |
| 86 | +// console.log(lineVersions); | |
| 87 | + | |
| 88 | + console.log($('#hisVersionsInput option')); | |
| 89 | + | |
| 90 | + if($('span .select2-selection').length > 1){ | |
| 91 | + $($('span .select2-selection')[1]).remove(); | |
| 92 | + $('#hisVersionsInput option').remove() | |
| 93 | + } | |
| 94 | + | |
| 95 | + var paramsD = new Array(); | |
| 96 | + | |
| 97 | + paramsD.push({'id':"",'text':"新版本"}); | |
| 98 | + | |
| 99 | + for(let i = 0; i < lineVersions.length;i++){ | |
| 100 | + let g = lineVersions[i]; | |
| 101 | + paramsD.push({'id':g.versions,'text':g.name + '(' + g.versions + ")"}); | |
| 102 | + } | |
| 103 | + console.log(paramsD); | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + initPinYinSelect2($('#hisVersionsInput'),paramsD,function(selector) { | |
| 109 | +// selector.select2("val", "请选择..."); | |
| 110 | + }); | |
| 111 | + }); | |
| 112 | + | |
| 113 | + | |
| 114 | + $.get('/lineVersions/findLineVersionsMax',{'lineId':lineSelectValueArray[1]}, function(lineVersionsMax){ | |
| 115 | + $('#versionsInput').val(++lineVersionsMax.versions);// 设值线路编码. | |
| 116 | + }); | |
| 117 | + | |
| 83 | 118 | $.get('/lineVersions/findLineVersionsMax',{'lineId':lineSelectValueArray[1]}, function(lineVersionsMax){ |
| 84 | 119 | $('#versionsInput').val(++lineVersionsMax.versions);// 设值线路编码. |
| 85 | 120 | }); | ... | ... |
src/main/resources/static/pages/base/stationroute/add.html
| ... | ... | @@ -248,11 +248,10 @@ $('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,stao |
| 248 | 248 | // 是否撤销 |
| 249 | 249 | $('#destroySelect').val(0); |
| 250 | 250 | // 版本号 |
| 251 | - $.get('/lineVersions/findCurrentVersion',{'lineId':Line.id},function(versions){ | |
| 252 | - $('#versionsInput').val(versions); | |
| 253 | - }); | |
| 251 | + | |
| 252 | + $('#versionsInput').val($("#versions").val()); | |
| 254 | 253 | |
| 255 | - var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir}; | |
| 254 | + var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir,"versions_eq":$("#versions").val()}; | |
| 256 | 255 | initSelect(initzdlyP); |
| 257 | 256 | }); |
| 258 | 257 | }); |
| ... | ... | @@ -321,6 +320,8 @@ $('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,stao |
| 321 | 320 | params.shapesType='d'; |
| 322 | 321 | if(params.stationRouteCode=='请选择...') |
| 323 | 322 | params.stationRouteCode=''; |
| 323 | + | |
| 324 | + params.status = $($("#versions").find("option:selected")[0]).attr("status"); | |
| 324 | 325 | // 保存 |
| 325 | 326 | ajaxd.stationSave(params,function(data) { |
| 326 | 327 | if(data.status=='SUCCESS') { | ... | ... |
src/main/resources/static/pages/base/stationroute/batch_update_industryCode.html
| ... | ... | @@ -174,6 +174,8 @@ $('#batch_update_industryCode_mobal').on('batch_update_industryCodeMobal.show', |
| 174 | 174 | submitHandler : function(f) { |
| 175 | 175 | // 获取表单内容,并序列化 |
| 176 | 176 | var params = form.serializeJSON(); |
| 177 | + params.status = $($("#versions").find("option:selected")[0]).attr("status"); | |
| 178 | + | |
| 177 | 179 | $post('/stationroute/updIndustryCode',params,function(data) { |
| 178 | 180 | // 隐藏错误提示 |
| 179 | 181 | tzbcAlert.hide(); | ... | ... |
src/main/resources/static/pages/base/stationroute/deletesection.html
| ... | ... | @@ -139,6 +139,8 @@ $('#delete_section_mobal').on('deleteSectionMobal.show',function(e, ajaxd, line, |
| 139 | 139 | ids = ids.substr(1, ids.length - 1); |
| 140 | 140 | var params = {}; |
| 141 | 141 | params.ids = ids; |
| 142 | + | |
| 143 | + params.status = $($("#versions").find("option:selected")[0]).attr("status"); | |
| 142 | 144 | $.post('/sectionroute/batchDestroy',params,function(resuntDate) { |
| 143 | 145 | if (resuntDate.status == 'SUCCESS') { |
| 144 | 146 | // 弹出添加成功提示消息 |
| ... | ... | @@ -235,10 +237,13 @@ $('#delete_section_mobal').on('deleteSectionMobal.show',function(e, ajaxd, line, |
| 235 | 237 | params['direction'] = 'ASC,ASC'; |
| 236 | 238 | // 记录当前页数 |
| 237 | 239 | params['page'] = page; |
| 240 | + | |
| 241 | + params.version = $("#versions").val(); | |
| 242 | + | |
| 238 | 243 | // 弹出正在加载层 |
| 239 | 244 | var i = layer.load(2); |
| 240 | 245 | // 异步请求获取表格数据 |
| 241 | - $.get('/sectionroute',params,function(result) { | |
| 246 | + $.get('/sectionroute/allls',params,function(result) { | |
| 242 | 247 | // 添加序号 |
| 243 | 248 | result.content.page = page; |
| 244 | 249 | // 把数据填充到模版中 | ... | ... |
src/main/resources/static/pages/base/stationroute/deletestation.html
| ... | ... | @@ -141,6 +141,7 @@ $('#delete_station_mobal').on('deleteStationMobal.show',function(e, ajaxd, line, |
| 141 | 141 | ids = ids.substr(1, ids.length - 1); |
| 142 | 142 | var params = {}; |
| 143 | 143 | params.ids = ids; |
| 144 | + params.status = $($("#versions").find("option:selected")[0]).attr("status"); | |
| 144 | 145 | $.post('/stationroute/batchDestroy',params,function(resuntDate) { |
| 145 | 146 | if (resuntDate.status == 'SUCCESS') { |
| 146 | 147 | // 弹出添加成功提示消息 |
| ... | ... | @@ -237,10 +238,12 @@ $('#delete_station_mobal').on('deleteStationMobal.show',function(e, ajaxd, line, |
| 237 | 238 | params['direction'] = 'ASC,ASC'; |
| 238 | 239 | // 记录当前页数 |
| 239 | 240 | params['page'] = page; |
| 241 | + | |
| 242 | + params.version = $("#versions").val(); | |
| 240 | 243 | // 弹出正在加载层 |
| 241 | 244 | var i = layer.load(2); |
| 242 | 245 | // 异步请求获取表格数据 |
| 243 | - $.get('/stationroute',params,function(result) { | |
| 246 | + $.get('/stationroute/allls',params,function(result) { | |
| 244 | 247 | // 添加序号 |
| 245 | 248 | result.content.page = page; |
| 246 | 249 | // 把数据填充到模版中 | ... | ... |
src/main/resources/static/pages/base/stationroute/doublename_road.html
| ... | ... | @@ -44,9 +44,10 @@ |
| 44 | 44 | // 方向 |
| 45 | 45 | var dir = params.directions; |
| 46 | 46 | var lineId = params.lineId; |
| 47 | + var version = params.versions; | |
| 47 | 48 | |
| 48 | 49 | // 获取路段号元素,并添加下拉属性值 |
| 49 | - ajaxd.getStation(lineId,dir,function(treeData) { | |
| 50 | + ajaxd.getStation(lineId,dir,version,function(treeData) { | |
| 50 | 51 | var array = treeData[0].children[1].children,paramsD =new Array(); |
| 51 | 52 | paramsD.push({'id':'启始路段(默认在所有路段的前面)','text':'启始路段(默认在所有路段的前面)'}); |
| 52 | 53 | // 记录最后一个路段 | ... | ... |
src/main/resources/static/pages/base/stationroute/edit.html
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | </div> |
| 14 | 14 | <!-- 线路ID --> |
| 15 | 15 | <input type="hidden" name="stationId" id="stationIdInput"> |
| 16 | + <input type="hidden" name="status" id="statusInput"> | |
| 16 | 17 | <input type="hidden" name="stationRouteId" id="stationRouteIdInput"> |
| 17 | 18 | <input type="hidden" name="stationRouteLine" id="stationRouteLineInput"> |
| 18 | 19 | <input type="hidden" name="lineCode" id="lineCodeInput"> |
| ... | ... | @@ -190,13 +191,17 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati |
| 190 | 191 | $('#edit_station_mobal').on('hide.bs.modal', function () { |
| 191 | 192 | closeMobleSetClean(); |
| 192 | 193 | }); |
| 194 | + $('#statusInput').val(addLine.status); | |
| 193 | 195 | function closeMobleSetClean() { |
| 194 | 196 | // 清除地图覆盖物 |
| 195 | 197 | map_.clearMarkAndOverlays(); |
| 198 | + | |
| 199 | + var version = station_.getEitdStation().stationRouteVersions; | |
| 196 | 200 | /** 设置新增站点集合对象为空 */ |
| 197 | 201 | station_.setEitdStation({}); |
| 202 | + | |
| 198 | 203 | var add_direction_v = $('#stationdirSelect').val(); |
| 199 | - fun.resjtreeDate(addLine.id,add_direction_v); | |
| 204 | + fun.resjtreeDate(addLine.id,add_direction_v,version); | |
| 200 | 205 | fun.editAChangeCssRemoveDisabled(); |
| 201 | 206 | ajaxd.getSectionRouteInfo(addLine.id,add_direction_v,function(data) { |
| 202 | 207 | fun.linePanlThree(addLine.id,data,add_direction_v); | ... | ... |
src/main/resources/static/pages/base/stationroute/editsection.html
| ... | ... | @@ -61,13 +61,15 @@ |
| 61 | 61 | <script type="text/javascript"> |
| 62 | 62 | |
| 63 | 63 | $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fun){ |
| 64 | + debugger; | |
| 64 | 65 | var Section = p.data; |
| 65 | 66 | fun.setSectionFormValue(Section); |
| 66 | 67 | // 方向 |
| 67 | 68 | var dir = Section.sectionrouteDirections; |
| 68 | 69 | var lineId = Section.sectionrouteLine; |
| 70 | + var version = Section.versions; | |
| 69 | 71 | // 获取路段号元素,并添加下拉属性值 |
| 70 | - ajaxd.getStation(lineId,dir,function(treeData) { | |
| 72 | + ajaxd.getStation(lineId,dir,version,function(treeData) { | |
| 71 | 73 | var array = treeData[0].children[1].children,paramsD =new Array(); |
| 72 | 74 | var eq_scetionRouteCode = Section.sectionrouteCode; |
| 73 | 75 | paramsD.push({'id':'请选择...','text':'将此路段设置位第一个路段'}); |
| ... | ... | @@ -105,11 +107,11 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fu |
| 105 | 107 | function closeMobleSetClean() { |
| 106 | 108 | // 清除地图覆盖物 |
| 107 | 109 | map_.clearMarkAndOverlays(); |
| 108 | - fun.resjtreeDate(lineId,dir); | |
| 110 | + fun.resjtreeDate(lineId,dir,$("#versions").val()); | |
| 109 | 111 | fun.editAChangeCssRemoveDisabled(); |
| 110 | - ajaxd.getSectionRouteInfo(lineId,dir,function(data) { | |
| 111 | - fun.linePanlThree(lineId,data,dir); | |
| 112 | - }); | |
| 112 | + //ajaxd.getSectionRouteInfo(lineId,dir,$("#versions").val(),function(data) { | |
| 113 | + // fun.linePanlThree(lineId,data,dir); | |
| 114 | + //}); | |
| 113 | 115 | setTimeout(function () { |
| 114 | 116 | map_.openSectionInfoWin(p); |
| 115 | 117 | },1000); |
| ... | ... | @@ -161,6 +163,7 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fu |
| 161 | 163 | params.destroy=0; |
| 162 | 164 | params.sectionDistance=0; |
| 163 | 165 | params.sectionTime=0; |
| 166 | + params.status=$($("#versions").find("option:selected")[0]).attr("status"); | |
| 164 | 167 | error.hide(); |
| 165 | 168 | if(params.sectionrouteCode=='请选择...') |
| 166 | 169 | params.sectionrouteCode=''; | ... | ... |
src/main/resources/static/pages/base/stationroute/js/drawingManager.js
| ... | ... | @@ -51,6 +51,7 @@ var DrawingManagerObj = function () { |
| 51 | 51 | |
| 52 | 52 | var addStation = AddStationObj.getAddStation(); |
| 53 | 53 | |
| 54 | + debugger; | |
| 54 | 55 | GetAjaxData.getSectionRouteInfo(addLine.id,addStation.dir,function(data) { |
| 55 | 56 | |
| 56 | 57 | PublicFunctions.linePanlThree(addLine.id,data,addStation.dir); | ... | ... |
src/main/resources/static/pages/base/stationroute/js/line.js
| ... | ... | @@ -7,7 +7,9 @@ var LineObj = function () { |
| 7 | 7 | |
| 8 | 8 | /** 定义线路对象 */ |
| 9 | 9 | |
| 10 | - var line={}; | |
| 10 | + var line={ | |
| 11 | + | |
| 12 | + }; | |
| 11 | 13 | |
| 12 | 14 | var lineObj = { |
| 13 | 15 | |
| ... | ... | @@ -24,10 +26,15 @@ var LineObj = function () { |
| 24 | 26 | getLineObj : function() { |
| 25 | 27 | |
| 26 | 28 | return line; |
| 29 | + }, | |
| 30 | + | |
| 31 | + setStatus:function(s){ | |
| 32 | + line.status = s; | |
| 27 | 33 | } |
| 28 | 34 | |
| 29 | 35 | } |
| 30 | 36 | |
| 37 | + | |
| 31 | 38 | return lineObj; |
| 32 | 39 | |
| 33 | 40 | }(); |
| 34 | 41 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
| ... | ... | @@ -42,9 +42,9 @@ var GetAjaxData = function(){ |
| 42 | 42 | }, |
| 43 | 43 | |
| 44 | 44 | // 树数据获取 |
| 45 | - getStation : function(id_,dir_,callback) { | |
| 45 | + getStation : function(id_,dir_,version,callback) { | |
| 46 | 46 | var treeDateJson = []; |
| 47 | - $get('/stationroute/findStations',{'line.id_eq' : id_ , 'directions_eq' : dir_},function(resultdata) { | |
| 47 | + $get('/stationroute/findStations',{'line.id_eq' : id_ , 'directions_eq' : dir_,'version':version},function(resultdata) { | |
| 48 | 48 | treeDateJson = createTreeData(resultdata); |
| 49 | 49 | callback && callback(treeDateJson); |
| 50 | 50 | }); |
| ... | ... | @@ -60,13 +60,13 @@ var GetAjaxData = function(){ |
| 60 | 60 | // }); |
| 61 | 61 | }, |
| 62 | 62 | getzdlyInfo : function(params,callback) { |
| 63 | - $get('/stationroute/all',params,function(result) { | |
| 63 | + $get('/stationroute/all_ls',params,function(result) { | |
| 64 | 64 | callback && callback(result); |
| 65 | 65 | }); |
| 66 | 66 | }, |
| 67 | 67 | // 查询线路某方向下所有站点的中心百度坐标 |
| 68 | - getStationRoutePoint : function(id_,dir_,callback) { | |
| 69 | - $get('/stationroute/getStationRouteList',{lineId:id_,direction:dir_},function(result) { | |
| 68 | + getStationRoutePoint : function(id_,dir_,version,callback) { | |
| 69 | + $get('/stationroute/getStationRouteList',{lineId:id_,direction:dir_,version:version},function(result) { | |
| 70 | 70 | callback && callback(result); |
| 71 | 71 | }); |
| 72 | 72 | }, |
| ... | ... | @@ -92,6 +92,11 @@ var GetAjaxData = function(){ |
| 92 | 92 | callback && callback(sectionCode); |
| 93 | 93 | }); |
| 94 | 94 | }, |
| 95 | + getAllLineVersions:function(lineId,callback){ | |
| 96 | + $get('/lineVersions/findAllHistroyLineVersionsById',{lineId:lineId},function(result) { | |
| 97 | + callback && callback(result); | |
| 98 | + }); | |
| 99 | + }, | |
| 95 | 100 | findUpStationRouteCode : function(lineId,diraction,stationRouteCode,callback) { |
| 96 | 101 | $get('/stationroute/findUpStationRouteCode',{lineId:lineId,direction:diraction,stationRouteCode:stationRouteCode},function(result) { |
| 97 | 102 | callback && callback(result); |
| ... | ... | @@ -117,11 +122,8 @@ var GetAjaxData = function(){ |
| 117 | 122 | |
| 118 | 123 | // 撤销站点 |
| 119 | 124 | stationRouteIsDestroy : function(stationRoute,callback) { |
| 120 | - | |
| 121 | 125 | $post('/stationroute/stationRouteIsDestroy',stationRoute,function(data) { |
| 122 | - | |
| 123 | 126 | callback && callback(data); |
| 124 | - | |
| 125 | 127 | }) |
| 126 | 128 | |
| 127 | 129 | }, |
| ... | ... | @@ -166,8 +168,14 @@ var GetAjaxData = function(){ |
| 166 | 168 | }, |
| 167 | 169 | |
| 168 | 170 | // 查询路段信息 |
| 169 | - getSectionRouteInfo : function(lineId,direction,callback) { | |
| 170 | - $get('/sectionroute/findSection',{'line.id_eq' : lineId , 'directions_eq' : direction},function(resultdata) { | |
| 171 | + getSectionRouteInfo : function(lineId,direction,version,callback) { | |
| 172 | + | |
| 173 | + if(!callback){ | |
| 174 | + callback = version; | |
| 175 | + version = $("#versions").val(); | |
| 176 | + } | |
| 177 | + | |
| 178 | + $get('/sectionroute/findSection',{'line.id_eq' : lineId , 'directions_eq' : direction,'version':version},function(resultdata) { | |
| 171 | 179 | callback && callback(resultdata); |
| 172 | 180 | }); |
| 173 | 181 | }, | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
| ... | ... | @@ -6,6 +6,8 @@ $(function(){ |
| 6 | 6 | // 下行方向 (0:上行;1:下行) |
| 7 | 7 | var directionDownValue = $('.downSystem').data('direction'); |
| 8 | 8 | |
| 9 | + | |
| 10 | + | |
| 9 | 11 | // 系统规划上行站点点击事件 |
| 10 | 12 | $('.upSystem').on('click',function() { |
| 11 | 13 | // 隐藏上行规划 |
| ... | ... | @@ -85,7 +87,7 @@ $(function(){ |
| 85 | 87 | shade: [0.1,'#fff'] // 透明度的白色背景 |
| 86 | 88 | }); |
| 87 | 89 | var Line = LineObj.getLineObj(); |
| 88 | - $post('/stationroute/updSwitchDir?lineIds='+ Line.id,null,function(data) { | |
| 90 | + $post('/stationroute/updSwitchDir?lineIds='+ Line.id + "&status=" + $($("#versions").find("option:selected")[0]).attr("status") ,null,function(data) { | |
| 89 | 91 | layer.close(index); |
| 90 | 92 | if(data.status=='SUCCESS') { |
| 91 | 93 | // 弹出操作成功提示消息 |
| ... | ... | @@ -95,20 +97,26 @@ $(function(){ |
| 95 | 97 | layer.msg('操作成功...'); |
| 96 | 98 | } |
| 97 | 99 | WorldsBMap.clearMarkAndOverlays(); |
| 100 | + $('#stationDown').removeClass('active'); | |
| 101 | + $('#stationDown').removeClass('in'); | |
| 102 | + $('#stationDown').addClass('fade'); | |
| 103 | + $('#stationUp').addClass('active in'); | |
| 104 | + $('#downLine').parent().removeClass('active'); | |
| 105 | + $('#upLine').parent().addClass('active'); | |
| 98 | 106 | // 刷新左边树 |
| 99 | - PublicFunctions.resjtreeDate(Line.id,0); | |
| 107 | + PublicFunctions.resjtreeDate(Line.id,0,$("#versions").val()); | |
| 100 | 108 | /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ |
| 101 | - GetAjaxData.getSectionRouteInfo(Line.id,0,function(data) { | |
| 102 | - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 103 | - PublicFunctions.linePanlThree(Line.id,data,0); | |
| 104 | - }); | |
| 109 | +// GetAjaxData.getSectionRouteInfo(Line.id,0,function(data) { | |
| 110 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 111 | +// PublicFunctions.linePanlThree(Line.id,data,0); | |
| 112 | +// }); | |
| 105 | 113 | }); |
| 106 | 114 | }); |
| 107 | 115 | }); |
| 108 | 116 | |
| 109 | 117 | $('#wrenchUpDis').on('click',function() { |
| 110 | 118 | var Line = LineObj.getLineObj(); |
| 111 | - GetAjaxData.getStation(Line.id,directionUpValue,function(rd) { | |
| 119 | + GetAjaxData.getStation(Line.id,directionUpValue,$("#versions").val(),function(rd) { | |
| 112 | 120 | // 加载其它规划选择弹出层mobal页面 |
| 113 | 121 | $.get('tzzj.html', function(m){ |
| 114 | 122 | $(pjaxContainer).append(m); |
| ... | ... | @@ -119,7 +127,7 @@ $(function(){ |
| 119 | 127 | |
| 120 | 128 | $('#wrenchDownDis').on('click',function() { |
| 121 | 129 | var Line = LineObj.getLineObj(); |
| 122 | - GetAjaxData.getStation(Line.id,directionDownValue,function(rd) { | |
| 130 | + GetAjaxData.getStation(Line.id,directionDownValue,$("#versions").val(),function(rd) { | |
| 123 | 131 | // 加载其它规划选择弹出层mobal页面 |
| 124 | 132 | $.get('tzzj.html', function(m){ |
| 125 | 133 | $(pjaxContainer).append(m); |
| ... | ... | @@ -134,7 +142,7 @@ $(function(){ |
| 134 | 142 | shade: [0.1,'#fff'] // 透明度的白色背景 |
| 135 | 143 | }); |
| 136 | 144 | var Line = LineObj.getLineObj(); |
| 137 | - var params = {'lineId':Line.id ,'dir':1,'toDir':0} ; | |
| 145 | + var params = {'lineId':Line.id ,'dir':1,'toDir':0,status:$($("#versions").find("option:selected")[0]).attr("status")} ; | |
| 138 | 146 | quote(params,index); |
| 139 | 147 | }); |
| 140 | 148 | |
| ... | ... | @@ -144,7 +152,8 @@ $(function(){ |
| 144 | 152 | shade: [0.1,'#fff'] // 透明度的白色背景 |
| 145 | 153 | }); |
| 146 | 154 | var Line = LineObj.getLineObj(); |
| 147 | - var params = {'lineId':Line.id ,'dir':0,'toDir':1}; | |
| 155 | + console.log($($("#versions").find("option:selected")[0]).attr("status")); | |
| 156 | + var params = {'lineId':Line.id ,'dir':0,'toDir':1,status:$($("#versions").find("option:selected")[0]).attr("status")}; | |
| 148 | 157 | quote(params,index); |
| 149 | 158 | }); |
| 150 | 159 | |
| ... | ... | @@ -176,13 +185,20 @@ $(function(){ |
| 176 | 185 | layer.msg('操作成功...'); |
| 177 | 186 | } |
| 178 | 187 | WorldsBMap.clearMarkAndOverlays(); |
| 188 | + | |
| 189 | + var dir = params.dir; | |
| 190 | + if(dir == 0){ | |
| 191 | + dir = 1; | |
| 192 | + }else{ | |
| 193 | + dir = 0; | |
| 194 | + } | |
| 179 | 195 | // 刷新左边树 |
| 180 | - PublicFunctions.resjtreeDate(params.lineId,params.dir); | |
| 196 | + PublicFunctions.resjtreeDate(params.lineId,dir,$("#versions").val()); | |
| 181 | 197 | /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ |
| 182 | - GetAjaxData.getSectionRouteInfo(params.lineId,params.dir,function(data) { | |
| 183 | - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 184 | - PublicFunctions.linePanlThree(params.lineId,data,params.dir); | |
| 185 | - }); | |
| 198 | +// GetAjaxData.getSectionRouteInfo(params.lineId,params.dir,function(data) { | |
| 199 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 200 | +// PublicFunctions.linePanlThree(params.lineId,data,params.dir); | |
| 201 | +// }); | |
| 186 | 202 | }); |
| 187 | 203 | } |
| 188 | 204 | // 编辑线路上行走向 |
| ... | ... | @@ -191,9 +207,12 @@ $(function(){ |
| 191 | 207 | // 线路上行 |
| 192 | 208 | $('#leftUpOrDown #upLine').on('click', function(){ |
| 193 | 209 | var lineIdEvents = LineObj.getLineObj(); |
| 194 | - GetAjaxData.getSectionRouteInfo(lineIdEvents.id,directionUpValue,function(data) { | |
| 195 | - PublicFunctions.linePanlThree(lineIdEvents.id,data,directionUpValue); | |
| 196 | - }); | |
| 210 | + | |
| 211 | + var val = $("#versions").val(); | |
| 212 | + | |
| 213 | + /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ | |
| 214 | + PublicFunctions.resjtreeDate(lineIdEvents.id,'0',val); | |
| 215 | + | |
| 197 | 216 | }); |
| 198 | 217 | |
| 199 | 218 | // 系统规划下行站点 |
| ... | ... | @@ -269,9 +288,11 @@ $(function(){ |
| 269 | 288 | // 线路下行 |
| 270 | 289 | $('#leftUpOrDown #downLine').on('click', function(){ |
| 271 | 290 | var lineIdEvents = LineObj.getLineObj(); |
| 272 | - GetAjaxData.getSectionRouteInfo(lineIdEvents.id,directionDownValue,function(data) { | |
| 273 | - PublicFunctions.linePanlThree(lineIdEvents.id,data,directionDownValue); | |
| 274 | - }); | |
| 291 | + | |
| 292 | + | |
| 293 | + var val = $("#versions").val(); | |
| 294 | + /** 初始化下行树 @param:<Line.id:线路Id;1:下行> */ | |
| 295 | + PublicFunctions.resjtreeDate(lineIdEvents.id,'1',val); | |
| 275 | 296 | }); |
| 276 | 297 | |
| 277 | 298 | // 生成行单 |
| ... | ... | @@ -320,10 +341,10 @@ $(function(){ |
| 320 | 341 | $('.portlet-title .match_station').addClass('hidden'); |
| 321 | 342 | PublicFunctions.resjtreeDate(lineId,0); |
| 322 | 343 | /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ |
| 323 | - GetAjaxData.getSectionRouteInfo(lineId,0,function(data) { | |
| 324 | - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 325 | - PublicFunctions.linePanlThree(lineId,data,0); | |
| 326 | - }); | |
| 344 | +// GetAjaxData.getSectionRouteInfo(lineId,0,function(data) { | |
| 345 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 346 | +// PublicFunctions.linePanlThree(lineId,data,0); | |
| 347 | +// }); | |
| 327 | 348 | $('#stationDown').removeClass('active'); |
| 328 | 349 | $('#stationDown').removeClass('in'); |
| 329 | 350 | $('#stationDown').addClass('fade'); | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
| ... | ... | @@ -35,17 +35,17 @@ var PublicFunctions = function () { |
| 35 | 35 | $('.portlet-title .caption').text(lineNameV); |
| 36 | 36 | }); |
| 37 | 37 | }, |
| 38 | - /** @param diraction 方向 @return array */ | |
| 39 | - getCurrSelNode : function(diraction){ | |
| 38 | + /** @param direction 方向 @return array */ | |
| 39 | + getCurrSelNode : function(direction){ | |
| 40 | 40 | // 定义Obj |
| 41 | 41 | var array = []; |
| 42 | 42 | try { |
| 43 | 43 | // 上行 |
| 44 | - if(diraction=='0'){ | |
| 44 | + if(direction=='0'){ | |
| 45 | 45 | // 获取上行选中节点 |
| 46 | 46 | array = $.jstree.reference("#station_Up_tree").get_selected(true); |
| 47 | 47 | // 下行 |
| 48 | - }else if(diraction=='1'){ | |
| 48 | + }else if(direction=='1'){ | |
| 49 | 49 | // 获取下行选中节点 |
| 50 | 50 | array = $.jstree.reference("#station_Down_tree").get_selected(true); |
| 51 | 51 | } |
| ... | ... | @@ -56,9 +56,14 @@ var PublicFunctions = function () { |
| 56 | 56 | return array; |
| 57 | 57 | }, |
| 58 | 58 | /** @param id:线路ID ;directionData:方向 */ |
| 59 | - resjtreeDate : function(id,directionData){ | |
| 59 | + resjtreeDate : function(id,directionData,version){ | |
| 60 | + | |
| 61 | + if(!version){ | |
| 62 | + version = $("#versions").val(); | |
| 63 | + } | |
| 64 | + | |
| 60 | 65 | // 获取树数据 |
| 61 | - GetAjaxData.getStation(id,directionData,function(treeDateJson) { | |
| 66 | + GetAjaxData.getStation(id,directionData,version,function(treeDateJson) { | |
| 62 | 67 | // 获取数据长度 |
| 63 | 68 | var len = treeDateJson[0].children[0].children.length; |
| 64 | 69 | // 上行 |
| ... | ... | @@ -72,8 +77,13 @@ var PublicFunctions = function () { |
| 72 | 77 | // 刷新树 |
| 73 | 78 | StationTreeData.upreloadeTree(treeDateJson); |
| 74 | 79 | }else { |
| 75 | - // 显示上行规划 | |
| 76 | - $('#upToolsMobal').show(); | |
| 80 | + if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | |
| 81 | + // 显示上行规划 | |
| 82 | + $('#upToolsMobal').show(); | |
| 83 | + }else{ | |
| 84 | + $('#upToolsMobal').hide(); | |
| 85 | + | |
| 86 | + } | |
| 77 | 87 | // 隐藏上行树 |
| 78 | 88 | $('#uptreeMobal').hide(); |
| 79 | 89 | } |
| ... | ... | @@ -89,12 +99,21 @@ var PublicFunctions = function () { |
| 89 | 99 | // 跟新树 |
| 90 | 100 | StationTreeData.dwonreloadeTree(treeDateJson); |
| 91 | 101 | }else { |
| 92 | - // 显示下行规划 | |
| 93 | - $('#downToolsMobal').show(); | |
| 102 | + if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | |
| 103 | + // 显示下行规划 | |
| 104 | + $('#downToolsMobal').show(); | |
| 105 | + }else{ | |
| 106 | + $('#downToolsMobal').hide(); | |
| 107 | + } | |
| 94 | 108 | // 隐藏下行树 |
| 95 | 109 | $('#DowntreeMobal').hide(); |
| 96 | 110 | } |
| 97 | 111 | } |
| 112 | + | |
| 113 | + PublicFunctions.linePanlThree(id,treeDateJson,directionData,version,function (polyline_center) { | |
| 114 | + var map = WorldsBMap.getmapBValue(); | |
| 115 | + map.panTo(polyline_center); | |
| 116 | + }); | |
| 98 | 117 | }); |
| 99 | 118 | }, |
| 100 | 119 | |
| ... | ... | @@ -242,10 +261,10 @@ var PublicFunctions = function () { |
| 242 | 261 | // 刷新树 |
| 243 | 262 | PublicFunctions.resjtreeDate(addLine.id,directionData); |
| 244 | 263 | /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ |
| 245 | - GetAjaxData.getSectionRouteInfo(addLine.id,directionData,function(data) { | |
| 246 | - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 247 | - PublicFunctions.linePanlThree(addLine.id,data,directionData); | |
| 248 | - }); | |
| 264 | +// GetAjaxData.getSectionRouteInfo(addLine.id,directionData,function(data) { | |
| 265 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 266 | +// PublicFunctions.linePanlThree(addLine.id,data,directionData); | |
| 267 | +// }); | |
| 249 | 268 | }); |
| 250 | 269 | } |
| 251 | 270 | }) |
| ... | ... | @@ -301,10 +320,17 @@ var PublicFunctions = function () { |
| 301 | 320 | } |
| 302 | 321 | // 弹出是否撤销提示框 |
| 303 | 322 | layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){ |
| 323 | + | |
| 324 | + debugger; | |
| 304 | 325 | // 站点路由ID |
| 305 | 326 | var stationRouteId = obj[0].original.stationRouteId; |
| 327 | + | |
| 328 | + var Line = LineObj.getLineObj(); | |
| 329 | + | |
| 330 | + clonsole.log(Line); | |
| 331 | + | |
| 306 | 332 | // 撤销参数集合 |
| 307 | - var params = {stationRouteId:stationRouteId,destroy:'1'}; | |
| 333 | + var params = {stationRouteId:stationRouteId,destroy:'1',status:Line.status}; | |
| 308 | 334 | // 方向 |
| 309 | 335 | var stationRouteDirections = obj[0].original.stationRouteDirections; |
| 310 | 336 | // 撤销 |
| ... | ... | @@ -317,14 +343,16 @@ var PublicFunctions = function () { |
| 317 | 343 | layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】失败!'); |
| 318 | 344 | } |
| 319 | 345 | WorldsBMap.clearMarkAndOverlays(); |
| 320 | - var Line = LineObj.getLineObj(); | |
| 346 | + | |
| 347 | + var ver = $("#versions").val(); | |
| 348 | + | |
| 321 | 349 | // 刷行左边树 |
| 322 | - PublicFunctions.resjtreeDate(Line.id,stationRouteDirections); | |
| 350 | + PublicFunctions.resjtreeDate(Line.id,stationRouteDirections,ver); | |
| 323 | 351 | /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ |
| 324 | - GetAjaxData.getSectionRouteInfo(Line.id,stationRouteDirections,function(data) { | |
| 325 | - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 326 | - PublicFunctions.linePanlThree(Line.id,data,stationRouteDirections); | |
| 327 | - }); | |
| 352 | +// GetAjaxData.getSectionRouteInfo(Line.id,stationRouteDirections,ver,function(data) { | |
| 353 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 354 | +// PublicFunctions.linePanlThree(Line.id,data,stationRouteDirections); | |
| 355 | +// }); | |
| 328 | 356 | }); |
| 329 | 357 | }); |
| 330 | 358 | }, |
| ... | ... | @@ -431,41 +459,42 @@ var PublicFunctions = function () { |
| 431 | 459 | }, |
| 432 | 460 | |
| 433 | 461 | /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ |
| 434 | - linePanlThree : function(lineId,data,direction,callback) { | |
| 462 | + linePanlThree : function(lineId,data,direction,version,callback) { | |
| 435 | 463 | /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */ |
| 436 | 464 | var polyline_center; |
| 437 | - GetAjaxData.getStationRoutePoint(lineId,direction,function(resultdata) { | |
| 465 | + GetAjaxData.getStationRoutePoint(lineId,direction,version,function(resultdata) { | |
| 438 | 466 | WorldsBMap.clearMarkAndOverlays(); |
| 439 | 467 | // 如果站点路由数据不为空 |
| 440 | 468 | if(resultdata.length>0) { |
| 441 | - var ceter_index = Math.round(resultdata.length / 2); | |
| 442 | - var ceterPointsStr = resultdata[ceter_index].stationJwpoints; | |
| 469 | +// var ceter_index = Math.round(resultdata.length / 2); | |
| 470 | + var ceterPointsStr = resultdata[0].stationJwpoints; | |
| 443 | 471 | var ceterPointsArray = ceterPointsStr.split(' '); |
| 444 | 472 | polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]); |
| 445 | 473 | // 遍历站点路由数据 |
| 446 | 474 | for(var s = 0 ; s<resultdata.length;s++) { |
| 447 | 475 | WorldsBMap.drawingUpStationPoint(resultdata[s], s+1); |
| 448 | 476 | } |
| 449 | - | |
| 450 | 477 | } |
| 478 | + data = data[0].children[1]; | |
| 451 | 479 | // 路段数据长度 |
| 452 | - var dataLen = data.length; | |
| 480 | + var dataLen = data.children.length; | |
| 453 | 481 | // 如果大于零 |
| 454 | 482 | if(dataLen>0) { |
| 455 | - WorldsBMap.drawingUpline01(data); | |
| 483 | + WorldsBMap.drawingUpline01(data.children); | |
| 456 | 484 | // WorldsBMap.drawingUpline01(polyline_center,data); |
| 457 | 485 | } |
| 458 | 486 | callback && callback(polyline_center); |
| 459 | 487 | }); |
| 460 | 488 | }, |
| 461 | - /** 加载树 @param:<lineId:线路ID;diraction:方向(0:上行;1:下行)> */ | |
| 462 | - TreeUpOrDown : function(lineId,diraction) { | |
| 463 | - /** 获取树结果数据 @param:<lineId:线路ID;diraction:方向;callback:回调函数> */ | |
| 464 | - GetAjaxData.getStation(lineId,diraction,function(treeDateJson) { | |
| 489 | + /** 加载树 @param:<lineId:线路ID;direction:方向(0:上行;1:下行)> */ | |
| 490 | + TreeUpOrDown : function(lineId,direction,version) { | |
| 491 | + | |
| 492 | + /** 获取树结果数据 @param:<lineId:线路ID;direction:方向;callback:回调函数> */ | |
| 493 | + GetAjaxData.getStation(lineId,direction,version,function(treeDateJson) { | |
| 465 | 494 | // 获取返回数据长度 |
| 466 | 495 | var len = treeDateJson[0].children[0].children.length; |
| 467 | 496 | // 上行 |
| 468 | - if(diraction == 0) { | |
| 497 | + if(direction == 0) { | |
| 469 | 498 | /** 初始化上行树 @param:<treeDateJson:树数据结构> */ |
| 470 | 499 | StationTreeData.upInit(treeDateJson); |
| 471 | 500 | if(len>0) { |
| ... | ... | @@ -475,8 +504,14 @@ var PublicFunctions = function () { |
| 475 | 504 | $('#upToolsMobal').show(); |
| 476 | 505 | $('#uptreeMobal').hide(); |
| 477 | 506 | } |
| 507 | + | |
| 508 | + PublicFunctions.linePanlThree(lineId,treeDateJson,direction,version,function (polyline_center) { | |
| 509 | + var map = WorldsBMap.getmapBValue(); | |
| 510 | + map.panTo(polyline_center); | |
| 511 | + }); | |
| 512 | + | |
| 478 | 513 | // 下行 |
| 479 | - }else if(diraction ==1) { | |
| 514 | + }else if(direction ==1) { | |
| 480 | 515 | /** 出事画下行树 @param:<treeDateJson:树数据结构> */ |
| 481 | 516 | StationTreeData.downInit(treeDateJson); |
| 482 | 517 | if(len>0) { | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| ... | ... | @@ -261,14 +261,16 @@ window.WorldsBMap = function () { |
| 261 | 261 | '<span class="help-block" >到站距离:' + objStation.stationRouteDistances + ' 公里</span>' + |
| 262 | 262 | '<span class="help-block" >缓冲区形状:' + (shapes == "r" ? "圆形" : "多边形") + '</span>' + |
| 263 | 263 | (shapes=="r" ? ("<span class='help-block' >半径  :" + objStation.stationRadius + "</span>") : " ")+ |
| 264 | - '<span class="help-block" >版本号  :' + objStation.stationRouteVersions + '</span>' + | |
| 265 | - '<div>' + | |
| 266 | - '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editStation(' + objStation.stationRouteId+','+objStation.stationRoutedirections + ')">修改</button>' + | |
| 267 | - '<button class="info_win_btn" onclick="WorldsBMap.destroyStation('+ objStation.stationRouteId + ','+objStation.stationRouteLine+','+objStation.stationRoutedirections+')">撤销</button>' + | |
| 268 | - '<button class="info_win_btn" id="addBetweenStationRoad" onclick="WorldsBMap.addBetweenStationRoad(' + objStation.stationRouteId + ')">添加站点间路段</button>' + | |
| 269 | - '<button class="info_win_btn" id="editIndustryCode" onclick="WorldsBMap.editIndustryCode(' + objStation.stationRouteId + ')">匹配周边站点行业编码</button>' + | |
| 270 | - '</div>'; | |
| 264 | + '<span class="help-block" >版本号  :' + objStation.stationRouteVersions + '</span>'; | |
| 271 | 265 | |
| 266 | + if($($("#versions").find("option:selected")[0]).attr("status") > 0){ | |
| 267 | + htm += '<div>' + | |
| 268 | + '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editStation(' + objStation.stationRouteId+','+objStation.stationRoutedirections + ')">修改</button>' + | |
| 269 | + '<button class="info_win_btn" onclick="WorldsBMap.destroyStation('+ objStation.stationRouteId + ','+objStation.stationRouteLine+','+objStation.stationRoutedirections+')">撤销</button>' + | |
| 270 | + '<button class="info_win_btn" id="addBetweenStationRoad" onclick="WorldsBMap.addBetweenStationRoad(' + objStation.stationRouteId + ')">添加站点间路段</button>' + | |
| 271 | + '<button class="info_win_btn" id="editIndustryCode" onclick="WorldsBMap.editIndustryCode(' + objStation.stationRouteId + ')">匹配周边站点行业编码</button>' + | |
| 272 | + '</div>'; | |
| 273 | + } | |
| 272 | 274 | // 创建信息窗口 |
| 273 | 275 | var infoWindow_target = new BMap.InfoWindow(htm, opts); |
| 274 | 276 | setTimeout(function () { |
| ... | ... | @@ -785,9 +787,9 @@ window.WorldsBMap = function () { |
| 785 | 787 | ,btn3: function(index, layero){ |
| 786 | 788 | PublicFunctions.resjtreeDate(params.lineId,params.directions); |
| 787 | 789 | PublicFunctions.editAChangeCssRemoveDisabled(); |
| 788 | - GetAjaxData.getSectionRouteInfo(params.lineId,params.directions,function(data) { | |
| 789 | - PublicFunctions.linePanlThree(params.lineId,data,params.directions); | |
| 790 | - }); | |
| 790 | +// GetAjaxData.getSectionRouteInfo(params.lineId,params.directions,function(data) { | |
| 791 | +// PublicFunctions.linePanlThree(params.lineId,data,params.directions); | |
| 792 | +// }); | |
| 791 | 793 | PublicFunctions.editMapStatusRemove(); |
| 792 | 794 | } |
| 793 | 795 | }, function(index, layero){ |
| ... | ... | @@ -828,7 +830,6 @@ window.WorldsBMap = function () { |
| 828 | 830 | transit.search(poiOne, poiTwo); |
| 829 | 831 | transit.disableAutoViewport(); |
| 830 | 832 | // 地图编辑状态 |
| 831 | - debugger; | |
| 832 | 833 | PublicFunctions.editMapStatus(stationRouteFinish.stationRoutedirections); |
| 833 | 834 | } else { |
| 834 | 835 | layer.msg("您选择的站点后没有站点了,不能生成站点间路段!") |
| ... | ... | @@ -884,7 +885,7 @@ window.WorldsBMap = function () { |
| 884 | 885 | if(matchStation.stationRouteId == stationRouteId){ |
| 885 | 886 | var station = matchStation; |
| 886 | 887 | var keys = "dis_"+station.stationRouteId; |
| 887 | - var params = {}; | |
| 888 | + var params = {status:$($("#versions").find("option:selected")[0]).attr("status")}; | |
| 888 | 889 | // var params = new Map(); |
| 889 | 890 | params[keys] = station.stationStandardCode; |
| 890 | 891 | // params.set(keys,station.stationStandardCode); |
| ... | ... | @@ -907,10 +908,10 @@ window.WorldsBMap = function () { |
| 907 | 908 | // 刷新左边树 |
| 908 | 909 | PublicFunctions.resjtreeDate(lineId,dir); |
| 909 | 910 | /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ |
| 910 | - GetAjaxData.getSectionRouteInfo(lineId,dir,function(data1) { | |
| 911 | - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 912 | - PublicFunctions.linePanlThree(lineId,data1,dir); | |
| 913 | - }); | |
| 911 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data1) { | |
| 912 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 913 | +// PublicFunctions.linePanlThree(lineId,data1,dir); | |
| 914 | +// }); | |
| 914 | 915 | |
| 915 | 916 | // 退出编辑状态 |
| 916 | 917 | PublicFunctions.editMapStatusRemove(); |
| ... | ... | @@ -1023,6 +1024,8 @@ window.WorldsBMap = function () { |
| 1023 | 1024 | params.destroy = 0; |
| 1024 | 1025 | params.directions = dir; |
| 1025 | 1026 | params.descriptions = ''; |
| 1027 | + | |
| 1028 | + params.status=$($("#versions").find("option:selected")[0]).attr("status"); | |
| 1026 | 1029 | GetAjaxData.sectionSave(params, function (result) { |
| 1027 | 1030 | if(result.status =="SUCCESS"){ |
| 1028 | 1031 | $('.main_left_panel_m_layer').hide(); |
| ... | ... | @@ -1030,9 +1033,9 @@ window.WorldsBMap = function () { |
| 1030 | 1033 | PublicFunctions.editMapStatusRemove(); |
| 1031 | 1034 | PublicFunctions.resjtreeDate(lineId,dir); |
| 1032 | 1035 | PublicFunctions.editAChangeCssRemoveDisabled(); |
| 1033 | - GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1034 | - PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1035 | - }); | |
| 1036 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1037 | +// PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1038 | +// }); | |
| 1036 | 1039 | layer.msg("添加成功!"); |
| 1037 | 1040 | } else if(result.status =="ERROR") { |
| 1038 | 1041 | layer.msg("添加失败!"); |
| ... | ... | @@ -1111,6 +1114,8 @@ window.WorldsBMap = function () { |
| 1111 | 1114 | params.destroy = 0; |
| 1112 | 1115 | params.directions = dir; |
| 1113 | 1116 | params.descriptions = ''; |
| 1117 | + params.status=$($("#versions").find("option:selected")[0]).attr("status"); | |
| 1118 | + | |
| 1114 | 1119 | GetAjaxData.sectionSave(params, function (result) { |
| 1115 | 1120 | if(result.status =="SUCCESS"){ |
| 1116 | 1121 | $('.main_left_panel_m_layer').hide(); |
| ... | ... | @@ -1118,9 +1123,9 @@ window.WorldsBMap = function () { |
| 1118 | 1123 | PublicFunctions.editMapStatusRemove(); |
| 1119 | 1124 | PublicFunctions.resjtreeDate(lineId,dir); |
| 1120 | 1125 | PublicFunctions.editAChangeCssRemoveDisabled(); |
| 1121 | - GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1122 | - PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1123 | - }); | |
| 1126 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1127 | +// PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1128 | +// }); | |
| 1124 | 1129 | layer.msg("添加成功!"); |
| 1125 | 1130 | } else if(result.status =="ERROR") { |
| 1126 | 1131 | layer.msg("添加失败!"); |
| ... | ... | @@ -1141,7 +1146,10 @@ window.WorldsBMap = function () { |
| 1141 | 1146 | layer.confirm('你确定要撤销此站点吗?', { |
| 1142 | 1147 | btn : [ '撤销','返回' ], icon: 3, title:'提示' |
| 1143 | 1148 | }, function(){ |
| 1144 | - $.post('/stationroute/stationRouteIsDestroy',{'stationRouteId':stationRouteId,destroy:'1'},function(resuntDate) { | |
| 1149 | + | |
| 1150 | + var status = $($("#versions").find("option:selected")[0]).attr("status"); | |
| 1151 | + | |
| 1152 | + $.post('/stationroute/stationRouteIsDestroy',{'stationRouteId':stationRouteId,destroy:'1',status:status},function(resuntDate) { | |
| 1145 | 1153 | if (resuntDate.status == 'SUCCESS') { |
| 1146 | 1154 | // 弹出添加成功提示消息 |
| 1147 | 1155 | layer.msg('撤销成功!'); |
| ... | ... | @@ -1152,10 +1160,10 @@ window.WorldsBMap = function () { |
| 1152 | 1160 | // 刷新左边树 |
| 1153 | 1161 | PublicFunctions.resjtreeDate(lineId,dir); |
| 1154 | 1162 | /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */ |
| 1155 | - GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1156 | - /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */ | |
| 1157 | - PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1158 | - }); | |
| 1163 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1164 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */ | |
| 1165 | +// PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1166 | +// }); | |
| 1159 | 1167 | }); |
| 1160 | 1168 | }); |
| 1161 | 1169 | }, |
| ... | ... | @@ -1164,7 +1172,8 @@ window.WorldsBMap = function () { |
| 1164 | 1172 | layer.confirm('你确定要撤销此路段吗?', { |
| 1165 | 1173 | btn : [ '撤销','返回' ], icon: 3, title:'提示' |
| 1166 | 1174 | }, function(){ |
| 1167 | - $.post('/sectionroute/destroy',{'id': sectionRoudId},function(resuntDate) { | |
| 1175 | + var status = $($("#versions").find("option:selected")[0]).attr("status"); | |
| 1176 | + $.post('/sectionroute/destroy',{'id': sectionRoudId,status:status},function(resuntDate) { | |
| 1168 | 1177 | if (resuntDate.status == 'SUCCESS') { |
| 1169 | 1178 | // 弹出添加成功提示消息 |
| 1170 | 1179 | layer.msg('撤销成功!'); |
| ... | ... | @@ -1175,10 +1184,10 @@ window.WorldsBMap = function () { |
| 1175 | 1184 | // 刷新左边树 |
| 1176 | 1185 | PublicFunctions.resjtreeDate(lineId,dir); |
| 1177 | 1186 | /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */ |
| 1178 | - GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1179 | - /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */ | |
| 1180 | - PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1181 | - }); | |
| 1187 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1188 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */ | |
| 1189 | +// PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1190 | +// }); | |
| 1182 | 1191 | }); |
| 1183 | 1192 | }); |
| 1184 | 1193 | }, |
| ... | ... | @@ -1204,11 +1213,14 @@ window.WorldsBMap = function () { |
| 1204 | 1213 | '<span class="help-block" >路段编码:' + section.sectionCode + '</span>' + |
| 1205 | 1214 | '<span class="help-block" >路段序号:' + section.sectionrouteCode + '</span>' + |
| 1206 | 1215 | '<span class="help-block" >版本号  :' + section.versions + '</span>' + |
| 1207 | - '<div >' + | |
| 1208 | - '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editSection(' + section.sectionrouteId +','+dir+ ')">修改</button>' + | |
| 1216 | + '<div >'; | |
| 1217 | + | |
| 1218 | + if($($("#versions").find("option:selected")[0]).attr("status") > 0){ | |
| 1219 | + htm += '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editSection(' + section.sectionrouteId +','+dir+ ')">修改</button>' + | |
| 1209 | 1220 | '<button class="info_win_btn" id="addBetweenStationRoad" onclick="WorldsBMap.destroySection('+ section.sectionrouteId + ','+section.sectionrouteLine+','+section.sectionrouteDirections+')">撤销</button>' + |
| 1210 | 1221 | '<button class="info_win_btn" id="addSectionAfter" onclick="WorldsBMap.addSectionAfter('+section.sectionrouteId+')">添加路段(之后)</button>' + |
| 1211 | 1222 | '</div>'; |
| 1223 | + } | |
| 1212 | 1224 | |
| 1213 | 1225 | // 创建信息窗口 |
| 1214 | 1226 | var infoWindow_target = new BMap.InfoWindow(htm, opts); | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
| ... | ... | @@ -4,21 +4,23 @@ |
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -$(function(){ | |
| 8 | - | |
| 7 | +$(function() { | |
| 8 | + | |
| 9 | 9 | // 关闭左侧栏 |
| 10 | - if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} | |
| 10 | + if (!$('body').hasClass('page-sidebar-closed')) { | |
| 11 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 12 | + } | |
| 11 | 13 | // 获取参数线路ID |
| 12 | 14 | var idAndDir = $.url().param('no'); |
| 13 | 15 | var param = idAndDir.split(","); |
| 14 | 16 | var dir = 0, id; |
| 15 | - if(param.length == 1){ | |
| 17 | + if (param.length == 1) { | |
| 16 | 18 | id = param[0]; |
| 17 | 19 | } else { |
| 18 | 20 | id = param[0]; |
| 19 | 21 | dir = param[1]; |
| 20 | 22 | } |
| 21 | - if(dir==1) { | |
| 23 | + if (dir == 1) { | |
| 22 | 24 | $('#stationUp').removeClass('active'); |
| 23 | 25 | $('#stationUp').removeClass('in'); |
| 24 | 26 | $('#stationUp').addClass('fade'); |
| ... | ... | @@ -27,99 +29,237 @@ $(function(){ |
| 27 | 29 | $('#downLine').parent().addClass('active'); |
| 28 | 30 | } |
| 29 | 31 | // 如果线路ID不为空 |
| 30 | - if(id) { | |
| 32 | + if (id) { | |
| 31 | 33 | var styleOptions = { |
| 32 | - strokeColor : "blue",//边线颜色。 | |
| 33 | - fillColor : "blue",//填充颜色。当参数为空时,圆形将没有填充效果。 | |
| 34 | - strokeWeight : 3,//边线的宽度,以像素为单位。 | |
| 35 | - strokeOpacity : 0.8,//边线透明度,取值范围0 - 1。 | |
| 36 | - fillOpacity : 0.6,//填充的透明度,取值范围0 - 1。 | |
| 37 | - strokeStyle : 'solid' //边线的样式,solid或dashed。 | |
| 34 | + strokeColor : "blue",// 边线颜色。 | |
| 35 | + fillColor : "blue",// 填充颜色。当参数为空时,圆形将没有填充效果。 | |
| 36 | + strokeWeight : 3,// 边线的宽度,以像素为单位。 | |
| 37 | + strokeOpacity : 0.8,// 边线透明度,取值范围0 - 1。 | |
| 38 | + fillOpacity : 0.6,// 填充的透明度,取值范围0 - 1。 | |
| 39 | + strokeStyle : 'solid' // 边线的样式,solid或dashed。 | |
| 38 | 40 | }; |
| 39 | 41 | |
| 40 | 42 | // 等候500毫秒执行 |
| 41 | - setTimeout(function(){ | |
| 43 | + setTimeout(function() { | |
| 42 | 44 | |
| 43 | - /** 初始化线路对象,这里只初始化线路Id属性 @param:<id:线路ID> @return:Line */ | |
| 45 | + /** | |
| 46 | + * 初始化线路对象,这里只初始化线路Id属性 | |
| 47 | + * | |
| 48 | + * @param:<id:线路ID> | |
| 49 | + * @return:Line | |
| 50 | + */ | |
| 44 | 51 | var Line = LineObj.init(id); |
| 45 | 52 | |
| 46 | - /** 初始化线路标题 @param:<Line.id:线路ID> */ | |
| 53 | + $("#versions").change( | |
| 54 | + function() { | |
| 55 | + var val = $(this).val(); | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 初始化上行树 | |
| 59 | + * | |
| 60 | + * @param:<Line.id:线路Id;0:上行> | |
| 61 | + */ | |
| 62 | + PublicFunctions.resjtreeDate(Line.id, '0', val); | |
| 63 | + | |
| 64 | + | |
| 65 | + LineObj.setStatus($($("#versions").find("option:selected")[0]).attr("status")); | |
| 66 | + /** | |
| 67 | + * 初始化下行树 | |
| 68 | + * | |
| 69 | + * @param:<Line.id:线路Id;1:下行> | |
| 70 | + */ | |
| 71 | + // PublicFunctions.resjtreeDate(Line.id,'1',val); | |
| 72 | + $('#stationDown').removeClass('active'); | |
| 73 | + $('#stationDown').removeClass('in'); | |
| 74 | + $('#stationDown').addClass('fade'); | |
| 75 | + $('#stationUp').addClass('active in'); | |
| 76 | + $('#downLine').parent().removeClass('active'); | |
| 77 | + $('#upLine').parent().addClass('active'); | |
| 78 | + | |
| 79 | + if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | |
| 80 | + $(".table-toolbar").show(); | |
| 81 | + } else { | |
| 82 | + $(".table-toolbar").hide(); | |
| 83 | + } | |
| 84 | + | |
| 85 | + }); | |
| 86 | + | |
| 87 | + /** | |
| 88 | + * 初始化线路标题 | |
| 89 | + * | |
| 90 | + * @param:<Line.id:线路ID> | |
| 91 | + */ | |
| 47 | 92 | PublicFunctions.setTiteText(Line.id); |
| 48 | 93 | |
| 49 | - /** 初始化地图对象map @return:Map对象 */ | |
| 94 | + /** | |
| 95 | + * 初始化地图对象map | |
| 96 | + * | |
| 97 | + * @return:Map对象 | |
| 98 | + */ | |
| 50 | 99 | var map_ = WorldsBMap.init(); |
| 51 | 100 | |
| 52 | - /** 初始化绘图工具类 @param:<map_:map对象;styleOptions:绘图样式对象> @return:DrawingManager对象 */ | |
| 53 | - var drawingManager_ = DrawingManagerObj.init(map_,styleOptions); | |
| 101 | + /** | |
| 102 | + * 初始化绘图工具类 | |
| 103 | + * | |
| 104 | + * @param:<map_:map对象;styleOptions:绘图样式对象> | |
| 105 | + * @return:DrawingManager对象 | |
| 106 | + */ | |
| 107 | + var drawingManager_ = DrawingManagerObj.init(map_, styleOptions); | |
| 108 | + | |
| 109 | + GetAjaxData.getAllLineVersions(Line.id, function(data) { | |
| 110 | + | |
| 111 | + $("#versions option").remove(); | |
| 112 | + | |
| 113 | + var reqData = false; | |
| 114 | + | |
| 115 | + for (var i = 0; i < data.length; i++) { | |
| 116 | + | |
| 117 | + var ver = data[i]; | |
| 118 | + | |
| 119 | + if (ver.status == 1) { | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * 初始化上行树 | |
| 123 | + * | |
| 124 | + * @param:<Line.id:线路Id;0:上行> | |
| 125 | + */ | |
| 126 | + PublicFunctions | |
| 127 | + .TreeUpOrDown(Line.id, '0', ver.versions); | |
| 128 | + | |
| 129 | + /** | |
| 130 | + * 初始化下行树 | |
| 131 | + * | |
| 132 | + * @param:<Line.id:线路Id;1:下行> | |
| 133 | + */ | |
| 134 | + PublicFunctions | |
| 135 | + .TreeUpOrDown(Line.id, '1', ver.versions); | |
| 136 | + | |
| 137 | + reqData = true; | |
| 138 | + | |
| 139 | + var option = "<option value=" + ver.versions | |
| 140 | + + " status=" + ver.status + " selected>" | |
| 141 | + + ver.name + " (" + ver.versions + ")" | |
| 142 | + + "</option>" | |
| 143 | + $("#versions").append(option); | |
| 144 | + LineObj.setStatus(ver.status); | |
| 145 | + continue; | |
| 146 | + } | |
| 54 | 147 | |
| 55 | - /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ | |
| 56 | - PublicFunctions.TreeUpOrDown(Line.id,'0'); | |
| 148 | + var option = "<option value=" + ver.versions + " status=" | |
| 149 | + + ver.status + ">" + ver.name + " (" + ver.versions | |
| 150 | + + ")" + "</option>" | |
| 151 | + $("#versions").append(option); | |
| 152 | + } | |
| 57 | 153 | |
| 58 | - /** 初始化下行树 @param:<Line.id:线路Id;1:下行> */ | |
| 59 | - PublicFunctions.TreeUpOrDown(Line.id,'1'); | |
| 154 | + if (!reqData) { | |
| 155 | + for (var i = 0; i < data.length; i++) { | |
| 156 | + if (ver.status == 2) { | |
| 60 | 157 | |
| 61 | - /** 查询路段信息 @param:<Line.id:线路Id;dir:方向> @return:data:路段数据 */ | |
| 62 | - GetAjaxData.getSectionRouteInfo(Line.id,dir,function(data) { | |
| 63 | - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 64 | - PublicFunctions.linePanlThree(Line.id,data,dir,function (polyline_center) { | |
| 65 | - var map = WorldsBMap.getmapBValue(); | |
| 66 | - map.panTo(polyline_center); | |
| 67 | - }); | |
| 158 | + /** | |
| 159 | + * 初始化上行树 | |
| 160 | + * | |
| 161 | + * @param:<Line.id:线路Id;0:上行> | |
| 162 | + */ | |
| 163 | + PublicFunctions.TreeUpOrDown(Line.id, '0', | |
| 164 | + ver.versions); | |
| 68 | 165 | |
| 166 | + /** | |
| 167 | + * 初始化下行树 | |
| 168 | + * | |
| 169 | + * @param:<Line.id:线路Id;1:下行> | |
| 170 | + */ | |
| 171 | + PublicFunctions.TreeUpOrDown(Line.id, '1', | |
| 172 | + ver.versions); | |
| 173 | + | |
| 174 | + GetAjaxData.getSectionRouteInfo(Line.id, dir, | |
| 175 | + ver.versions, function(data) { | |
| 176 | + /** | |
| 177 | + * 在地图上画出线路走向 | |
| 178 | + * | |
| 179 | + * @param:<Line.id:线路Id;0:上行;data:路段数据> | |
| 180 | + */ | |
| 181 | + PublicFunctions.linePanlThree(Line.id, | |
| 182 | + data, dir, function( | |
| 183 | + polyline_center) { | |
| 184 | + var map = WorldsBMap | |
| 185 | + .getmapBValue(); | |
| 186 | + map.panTo(polyline_center); | |
| 187 | + }); | |
| 188 | + | |
| 189 | + }); | |
| 190 | + reqData = true; | |
| 191 | + | |
| 192 | + LineObj.setStatus(ver.status); | |
| 193 | + break; | |
| 194 | + } | |
| 195 | + } | |
| 196 | + | |
| 197 | + } | |
| 198 | + | |
| 199 | + }); | |
| 200 | + | |
| 201 | + GetAjaxData.getLineMatchStationIsUpdate(Line.id, function(data) { | |
| 202 | + if (data.status == 'SUCCESS' && data.data == "1") { | |
| 203 | + $('.portlet-title .match_station').removeClass('hidden'); | |
| 204 | + } | |
| 69 | 205 | }); |
| 70 | 206 | |
| 71 | - GetAjaxData.getLineMatchStationIsUpdate(Line.id,function (data) { | |
| 72 | - if(data.status=='SUCCESS' && data.data == "1"){ | |
| 73 | - $('.portlet-title .match_station').removeClass('hidden'); | |
| 74 | - } | |
| 75 | - }); | |
| 76 | - | |
| 77 | - $('#esc_edit_div').on('click',function () { | |
| 78 | - var index = layer.open({ | |
| 79 | - title: '退出提示', | |
| 80 | - content:'退出编辑模式后,当前没有保存的所有操作将被还原,确定要退出吗!', | |
| 81 | - // type: 1, | |
| 82 | - // area: ['600px', '360px'], | |
| 83 | - // scrollbar: false, | |
| 84 | - | |
| 85 | - btn:['确定','取消'], | |
| 86 | - yes: function(index){ | |
| 87 | - | |
| 88 | - // 刷新左边树 | |
| 89 | - // PublicFunctions.resjtreeDate(Line.id,dir); | |
| 90 | - var dir = WorldsBMap.getDir(); | |
| 91 | - // 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 | |
| 92 | - GetAjaxData.getSectionRouteInfo(Line.id,dir,function(data) { | |
| 93 | - // 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> | |
| 94 | - PublicFunctions.linePanlThree(Line.id,data,dir); | |
| 95 | - }); | |
| 96 | - PublicFunctions.editMapStatusRemove(); | |
| 97 | - layer.msg("已退出编辑模式!"); | |
| 98 | - layer.close(index); | |
| 99 | - }, | |
| 100 | - btn2:function(){ | |
| 101 | - layer.closeAll(index); //关闭当前窗口 | |
| 102 | - layer.msg("您没有退出编辑模式,请继续完成您未完成的操作!") | |
| 103 | - } | |
| 104 | - }); | |
| 105 | - }); | |
| 106 | - },500); | |
| 107 | - | |
| 108 | - }else { | |
| 109 | - | |
| 207 | + $('#esc_edit_div').on( | |
| 208 | + 'click', | |
| 209 | + function() { | |
| 210 | + var index = layer.open({ | |
| 211 | + title : '退出提示', | |
| 212 | + content : '退出编辑模式后,当前没有保存的所有操作将被还原,确定要退出吗!', | |
| 213 | + // type: 1, | |
| 214 | + // area: ['600px', '360px'], | |
| 215 | + // scrollbar: false, | |
| 216 | + | |
| 217 | + btn : [ '确定', '取消' ], | |
| 218 | + yes : function(index) { | |
| 219 | + | |
| 220 | + // 刷新左边树 | |
| 221 | + // PublicFunctions.resjtreeDate(Line.id,dir); | |
| 222 | + var dir = WorldsBMap.getDir(); | |
| 223 | + // 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> | |
| 224 | + // @return:data:路段数据 | |
| 225 | + GetAjaxData.getSectionRouteInfo(Line.id, dir, | |
| 226 | + function(data) { | |
| 227 | + // 在地图上画出线路走向 | |
| 228 | + // @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> | |
| 229 | + PublicFunctions.linePanlThree( | |
| 230 | + Line.id, data, dir); | |
| 231 | + }); | |
| 232 | + PublicFunctions.editMapStatusRemove(); | |
| 233 | + layer.msg("已退出编辑模式!"); | |
| 234 | + layer.close(index); | |
| 235 | + }, | |
| 236 | + btn2 : function() { | |
| 237 | + layer.closeAll(index); // 关闭当前窗口 | |
| 238 | + layer.msg("您没有退出编辑模式,请继续完成您未完成的操作!") | |
| 239 | + } | |
| 240 | + }); | |
| 241 | + }); | |
| 242 | + }, 500); | |
| 243 | + | |
| 244 | + } else { | |
| 245 | + | |
| 110 | 246 | // 缺少ID |
| 111 | - layer.confirm('【ID缺失,请点击返回,重新进行操作】', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){ | |
| 112 | - | |
| 247 | + layer.confirm('【ID缺失,请点击返回,重新进行操作】', { | |
| 248 | + btn : [ '返回' ], | |
| 249 | + icon : 3, | |
| 250 | + title : '提示' | |
| 251 | + }, function(index) { | |
| 252 | + | |
| 113 | 253 | // 关闭提示弹出层 |
| 114 | 254 | layer.close(index); |
| 115 | - | |
| 255 | + | |
| 116 | 256 | // 返回线路list页面 |
| 117 | 257 | loadPage('/pages/base/line/list.html'); |
| 118 | - | |
| 258 | + | |
| 119 | 259 | }); |
| 120 | - | |
| 260 | + | |
| 121 | 261 | } |
| 122 | - $('.green-seagreen dropdown-toggle').click(function(){ | |
| 123 | - $('.dropdown-menu').css("display", "block"); | |
| 124 | - }); | |
| 262 | + $('.green-seagreen dropdown-toggle').click(function() { | |
| 263 | + $('.dropdown-menu').css("display", "block"); | |
| 264 | + }); | |
| 125 | 265 | }); |
| 126 | 266 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
| ... | ... | @@ -31,11 +31,12 @@ var StationTreeData = function(){ |
| 31 | 31 | if(len<0) { |
| 32 | 32 | return; |
| 33 | 33 | } |
| 34 | + | |
| 34 | 35 | // 获取数据 |
| 35 | 36 | var stationData = treeOjb[0].original; |
| 36 | 37 | // 选中的节点类型 |
| 37 | 38 | var chaildredType_ = stationData.chaildredType; |
| 38 | - | |
| 39 | + | |
| 39 | 40 | if(chaildredType_ == "section") { |
| 40 | 41 | WorldsBMap.focusSection(stationData.sectionrouteId); |
| 41 | 42 | } else if(chaildredType_ == "station") { | ... | ... |
src/main/resources/static/pages/base/stationroute/list.html
| ... | ... | @@ -31,6 +31,12 @@ |
| 31 | 31 | <div class="caption"> |
| 32 | 32 | <!-- 途径站点 --> |
| 33 | 33 | </div> |
| 34 | + | |
| 35 | + <div class="versions" style="float:right;"> | |
| 36 | + <select id="versions" style="height:30px;width:200px;margin-top:5px;"> </select> | |
| 37 | + </div> | |
| 38 | + | |
| 39 | + | |
| 34 | 40 | <div class="match_station hidden"> |
| 35 | 41 | <!--<div class="match_station hidden">--> |
| 36 | 42 | <a class="match_station_bnt ">检测到外部站点行业编码有更新</a> |
| ... | ... | @@ -61,6 +67,7 @@ |
| 61 | 67 | <div class="portlet-body" id="uptreeMobal" style="display: none"> |
| 62 | 68 | <div class="table-toolbar"> |
| 63 | 69 | <div class="row"> |
| 70 | + | |
| 64 | 71 | <div class="col-md-6" style="float: right;"> |
| 65 | 72 | <div class="btn-group" style="float: right;"> |
| 66 | 73 | <div class="actions module_tools"> | ... | ... |
src/main/resources/static/pages/base/stationroute/tzzj.html
| ... | ... | @@ -105,6 +105,7 @@ $('#tzzj_mobal').on('tzzjMobal.show', function(e,map,gd,dir,lineid,pf,rd){ |
| 105 | 105 | submitHandler : function(f) { |
| 106 | 106 | // 获取表单内容,并序列化 |
| 107 | 107 | var params = form.serializeJSON(); |
| 108 | + params.status = $($("#versions").find("option:selected")[0]).attr("status"); | |
| 108 | 109 | $post('/stationroute/upddis',params,function(data) { |
| 109 | 110 | // 隐藏错误提示 |
| 110 | 111 | tzbcAlert.hide(); |
| ... | ... | @@ -117,10 +118,10 @@ $('#tzzj_mobal').on('tzzjMobal.show', function(e,map,gd,dir,lineid,pf,rd){ |
| 117 | 118 | // 刷新左边树 |
| 118 | 119 | pf.resjtreeDate(lineid,dir); |
| 119 | 120 | /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ |
| 120 | - gd.getSectionRouteInfo(lineid,dir,function(data) { | |
| 121 | - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 122 | - pf.linePanlThree(lineid,data,dir); | |
| 123 | - }); | |
| 121 | + //gd.getSectionRouteInfo(lineid,dir,function(data) { | |
| 122 | + // /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 123 | + // pf.linePanlThree(lineid,data,dir); | |
| 124 | + //}); | |
| 124 | 125 | }else { |
| 125 | 126 | // 弹出添加失败提示消息 |
| 126 | 127 | layer.msg('修改失败...'); | ... | ... |
src/main/resources/static/pages/mforms/shifdays/shifday.html
src/main/resources/static/real_control_v2/main.html
| 1 | -<!DOCTYPE html> | |
| 2 | -<html lang="zh-cn"> | |
| 3 | - | |
| 4 | -<head> | |
| 5 | - <meta charset="UTF-8"> | |
| 6 | - <title>线路调度 v2.0</title> | |
| 7 | - <!-- uikit core style--> | |
| 8 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/css/uikit.gradient.min.css" /> | |
| 9 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" merge="plugins"/> | |
| 10 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" merge="plugins"/> | |
| 11 | - <link rel="stylesheet" | |
| 12 | - href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" merge="plugins"/> | |
| 13 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.gradient.min.css" merge="plugins"/> | |
| 14 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css" merge="plugins"/> | |
| 15 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.gradient.min.css" merge="plugins"/> | |
| 16 | - | |
| 17 | - <!-- main style --> | |
| 18 | - <link rel="stylesheet" href="/real_control_v2/css/main.css" /> | |
| 19 | - <!-- north style --> | |
| 20 | - <link rel="stylesheet" href="/real_control_v2/css/north.css" merge="custom_style"/> | |
| 21 | - <!-- home style --> | |
| 22 | - <link rel="stylesheet" href="/real_control_v2/css/home.css" merge="custom_style"/> | |
| 23 | - <!-- line style --> | |
| 24 | - <link rel="stylesheet" href="/real_control_v2/css/line_schedule.css" merge="custom_style"/> | |
| 25 | - <link rel="stylesheet" href="/real_control_v2/css/line_schedule_table.css" merge="custom_style"/> | |
| 26 | - | |
| 27 | - <link rel="stylesheet" href="/real_control_v2/css/sch_autocomp_result.css" merge="custom_style"/> | |
| 28 | - <!-- custom table --> | |
| 29 | - <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" merge="custom_style"/> | |
| 30 | - <!-- jquery contextMenu style --> | |
| 31 | - <link rel="stylesheet" href="/real_control_v2/assets/css/jquery.contextMenu.min.css" merge="plugins"/> | |
| 32 | - <!-- formvalidation style --> | |
| 33 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/formvalidation/formValidation.min.css" merge="plugins"/> | |
| 34 | - <!-- js tree --> | |
| 35 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/jstree/default/style.css" merge="plugins"/> | |
| 36 | - <!-- tooltip css--> | |
| 37 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" merge="plugins"/> | |
| 38 | - <link rel="stylesheet" href="/real_control_v2/css/pace.css" merge="plugins"/> | |
| 39 | - | |
| 40 | - <link rel="stylesheet" href="/real_control_v2/css/modal_extend.css" merge="custom_style"/> | |
| 41 | - <!-- perfect-scrollbar style --> | |
| 42 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" merge="plugins"/> | |
| 43 | - <!-- layer 3.0.3 --> | |
| 44 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/default/layer.css" merge="plugins"/> | |
| 45 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/moon/style.css" merge="plugins"/> | |
| 46 | - | |
| 47 | - <!-- flatpickr --> | |
| 48 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css" merge="plugins"> | |
| 49 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/themes/airbnb.css" merge="plugins"> | |
| 50 | -</head> | |
| 51 | - | |
| 52 | -<body> | |
| 53 | -<div class="north uk-width-1-1 uk-panel-box"> | |
| 54 | - <div class="uk-grid uk-grid-match"> | |
| 55 | - <div class="uk-width-4-10"> | |
| 56 | - <div class="uk-panel"> | |
| 57 | - <h2 class="north-logo"> | |
| 58 | - <!--<i class="uk-icon-life-ring"></i>--> 浦东公交线路调度 | |
| 59 | - </h2> | |
| 60 | - </div> | |
| 61 | - </div> | |
| 62 | - <div class="uk-width-6-10"> | |
| 63 | - <div class="uk-panel uk-width north-toolbar"></div> | |
| 64 | - </div> | |
| 65 | - </div> | |
| 66 | - <div class="north-tabs"></div> | |
| 67 | -</div> | |
| 68 | - | |
| 69 | -<div class="main-container"> | |
| 70 | - <div class="load-panel"> | |
| 71 | - <i class="uk-icon-spinner uk-icon-spin"></i> | |
| 72 | - 正在加载数据 | |
| 73 | - </div> | |
| 74 | -</div> | |
| 75 | - | |
| 76 | -<script> | |
| 77 | -/* var gb_beforeunload_fun = function (e) { | |
| 78 | - var confirmationMessage = "\o/"; | |
| 79 | - (e || window.event).returnValue = confirmationMessage; | |
| 80 | - return confirmationMessage; | |
| 81 | - } | |
| 82 | - window.addEventListener("beforeunload", gb_beforeunload_fun);*/ | |
| 83 | - | |
| 84 | - delete window.exports; | |
| 85 | - delete window.module; | |
| 86 | - | |
| 87 | - var ipcMain; | |
| 88 | - //是否处于electron环境下 | |
| 89 | - var isElectron = (function () { | |
| 90 | - try { | |
| 91 | - if (process.versions.electron) | |
| 92 | - return true; | |
| 93 | - else | |
| 94 | - return false; | |
| 95 | - } | |
| 96 | - catch (e) { | |
| 97 | - return false; | |
| 98 | - } | |
| 99 | - })(); | |
| 100 | - | |
| 101 | - if (isElectron) { | |
| 102 | - var link = document.createElement("link"); | |
| 103 | - link.type = "text/css"; | |
| 104 | - link.rel = "stylesheet"; | |
| 105 | - link.href = "/real_control_v2/css/electron.css"; | |
| 106 | - document.getElementsByTagName("head")[0].appendChild(link); | |
| 107 | - | |
| 108 | - ipcMain = require('electron').ipcRenderer; | |
| 109 | - } | |
| 110 | -</script> | |
| 111 | - | |
| 112 | -<!-- 地图相关 --> | |
| 113 | -<script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> | |
| 114 | -<script src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script> | |
| 115 | -<script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script> | |
| 116 | -<script src="/assets/js/TransGPS.js" merge="plugins"></script> | |
| 117 | -<!-- 高德 --> | |
| 118 | -<script src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> | |
| 119 | -<!-- jquery --> | |
| 120 | -<script src="/real_control_v2/assets/js/jquery.min.js"></script> | |
| 121 | -<!-- jquery actual --> | |
| 122 | -<script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> | |
| 123 | -<!-- jquery.serializejson JSON序列化插件 --> | |
| 124 | -<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script> | |
| 125 | -<!-- moment.js 日期处理类库 --> | |
| 126 | -<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | |
| 127 | -<script src="/real_control_v2/assets/plugins/moment/zh-cn.js"></script> | |
| 128 | -<!-- jquery.pageinator 分页 --> | |
| 129 | -<script src="/assets/plugins/jqPaginator.min.js"></script> | |
| 130 | - | |
| 131 | -<!-- flatpickr --> | |
| 132 | -<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" merge="plugins"></script> | |
| 133 | -<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" merge="plugins"></script> | |
| 134 | - | |
| 135 | -<!-- perfect-scrollbar --> | |
| 136 | -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 137 | -<!-- common js --> | |
| 138 | -<script src="/real_control_v2/js/common.js"></script> | |
| 139 | -<!-- art-template 模版引擎 --> | |
| 140 | -<script src="/assets/plugins/template.js" merge="plugins"></script> | |
| 141 | -<!-- d3 --> | |
| 142 | -<script src="/assets/js/d3.min.js"></script> | |
| 143 | -<!-- EventProxy --> | |
| 144 | -<script src="/assets/js/eventproxy.js"></script> | |
| 145 | -<!-- main js --> | |
| 146 | -<script src="/real_control_v2/js/main.js"></script> | |
| 147 | -<!-- uikit core --> | |
| 148 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/uikit.min.js" merge="uikit_js"></script> | |
| 149 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.min.js" merge="uikit_js"></script> | |
| 150 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/pagination.min.js" merge="uikit_js"></script> | |
| 151 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js" merge="uikit_js"></script> | |
| 152 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js" merge="uikit_js"></script> | |
| 153 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.min.js" merge="uikit_js"></script> | |
| 154 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/timepicker.min.js" merge="uikit_js"></script> | |
| 155 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/lightbox.min.js" merge="uikit_js"></script> | |
| 156 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.min.js" merge="uikit_js"></script> | |
| 157 | - | |
| 158 | - | |
| 159 | -<!-- jquery contextMenu --> | |
| 160 | -<script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" merge="plugins"></script> | |
| 161 | -<script src="/real_control_v2/assets/js/jquery.ui.position.min.js" merge="plugins"></script> | |
| 162 | -<!-- formvalidation- --> | |
| 163 | -<script src="/real_control_v2/assets/plugins/formvalidation/formValidation.min.js" merge="plugins"></script> | |
| 164 | -<script src="/real_control_v2/assets/plugins/formvalidation/zh_CN.js" merge="plugins"></script> | |
| 165 | -<script src="/real_control_v2/assets/plugins/formvalidation/uikit.min.js" merge="plugins"></script> | |
| 166 | -<!-- js tree --> | |
| 167 | -<script src="/real_control_v2/assets/plugins/jstree/jstree.min.js" merge="plugins"></script> | |
| 168 | -<!-- simple pinyin --> | |
| 169 | -<script src="/assets/plugins/pinyin.js" merge="plugins"></script> | |
| 170 | -<!-- qtip --> | |
| 171 | -<script src="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.js" merge="plugins"></script> | |
| 172 | -<!-- layer 3.0.3 --> | |
| 173 | -<script src="/real_control_v2/assets/plugins/layer3.0.3/layer.js" merge="plugins"></script> | |
| 174 | - | |
| 175 | -<!-- 数据 --> | |
| 176 | -<script src="/real_control_v2/js/data/data_basic.js" merge="custom_js"></script> | |
| 177 | -<script src="/real_control_v2/js/data/data_gps.js" merge="custom_js"></script> | |
| 178 | -<script src="/real_control_v2/js/data/gps_abnormal.js" merge="custom_js"></script> | |
| 179 | -<script src="/real_control_v2/js/data/data_line_config.js" merge="custom_js"></script> | |
| 180 | -<!-- 线路模拟图 --> | |
| 181 | -<script src="/real_control_v2/js/utils/svg_chart.js" merge="custom_js"></script> | |
| 182 | -<script src="/real_control_v2/js/utils/svg_data_convert.js" merge="custom_js"></script> | |
| 183 | -<script src="/real_control_v2/js/utils/svg_chart_tooltip.js" merge="custom_js"></script> | |
| 184 | -<script src="/real_control_v2/js/utils/svg_chart_map.js" merge="custom_js"></script> | |
| 185 | - | |
| 186 | -<!-- custom table js --> | |
| 187 | -<script src="/real_control_v2/js/utils/ct_table.js" merge="custom_js"></script> | |
| 188 | -<!-- north js --> | |
| 189 | -<script src="/real_control_v2/js/north/toolbar.js" merge="custom_js"></script> | |
| 190 | -<script src="/real_control_v2/js/north/tabs.js" merge="custom_js"></script> | |
| 191 | -<script src="/real_control_v2/js/north/second_timer.js" merge="custom_js"></script> | |
| 192 | -<!-- home js --> | |
| 193 | -<script src="/real_control_v2/js/home/layout.js" merge="custom_js"></script> | |
| 194 | -<script src="/real_control_v2/js/home/line_panel.js" merge="custom_js"></script> | |
| 195 | -<script src="/real_control_v2/js/home/context_menu.js" merge="custom_js"></script> | |
| 196 | -<!-- line schedule js --> | |
| 197 | -<script src="/real_control_v2/js/line_schedule/legend.js" merge="custom_js"></script> | |
| 198 | -<script src="/real_control_v2/js/line_schedule/layout.js" merge="custom_js"></script> | |
| 199 | -<script src="/real_control_v2/js/line_schedule/sch_table.js" merge="custom_js"></script> | |
| 200 | -<script src="/real_control_v2/js/line_schedule/context_menu.js" merge="custom_js"></script> | |
| 201 | -<script src="/real_control_v2/js/line_schedule/dbclick.js" merge="custom_js"></script> | |
| 202 | -<script src="/real_control_v2/js/line_schedule/search.js" merge="custom_js"></script> | |
| 203 | -<script src="/real_control_v2/js/line_schedule/badge_tooltip.js" merge="custom_js"></script> | |
| 204 | -<script src="/real_control_v2/js/line_schedule/mileage_count.js" merge="custom_js"></script> | |
| 205 | - | |
| 206 | -<!-- 字典相关 --> | |
| 207 | -<script src="/assets/js/dictionary.js" merge="custom_js"></script> | |
| 208 | -<!-- websocket --> | |
| 209 | -<script src="/real_control_v2/assets/plugins/sockjs-client/sockjs.min.js"></script> | |
| 210 | -<script src="/real_control_v2/js/websocket/sch_websocket.js" merge="custom_js"></script> | |
| 211 | -<!-- tts --> | |
| 212 | -<script src="/real_control_v2/js/utils/tts.js" merge="custom_js"></script> | |
| 213 | - | |
| 214 | -<!-- echart --> | |
| 215 | -<script src="/real_control_v2/assets/echarts-3/echarts.js" merge="plugins"></script> | |
| 216 | -<!-- Geolib --> | |
| 217 | -<script src="/real_control_v2/geolib/geolib.js" merge="plugins"></script> | |
| 218 | - | |
| 219 | -<script src="/real_control_v2/js/signal_state/signal_state.js" merge="custom_js"></script> | |
| 220 | -<script src="/real_control_v2/js/utils/dispatch_pattern.js" merge="custom_js"></script> | |
| 221 | - | |
| 222 | -<!-- 处理表单片段嵌入问题 --> | |
| 223 | -<script src="/real_control_v2/js/forms/form_embed.js" merge="custom_js"></script> | |
| 224 | -<!-- 模态框扩展 --> | |
| 225 | -<script src="/real_control_v2/js/modal_extend.js" merge="custom_js"></script> | |
| 226 | - | |
| 227 | -<!-- #### 安全驾驶 start ### --> | |
| 228 | -<div class="safe_driv_pop_wrap" ></div> | |
| 229 | -<script id="safe_driv_item-temp" type="text/html"> | |
| 230 | - <div class="safe_driv_pop uk-animation-slide-bottom" data-nbbm="{{clzbh}}" data-type="{{yczltype}}" data-title="{{clzbh}} {{timeStr}} {{ycztText}}" data-url="{{url}}" data-ts="{{ts}}"> | |
| 231 | - <div> | |
| 232 | - <span class="title">异常 {{clzbh}}</span> | |
| 233 | - <span class="text"> {{timeStr}} 出现违规驾驶({{ycztText}})</span> | |
| 234 | - <span class="desc">--安全驾驶监管平台</span> | |
| 235 | - </div> | |
| 236 | - </div> | |
| 237 | -</script> | |
| 238 | - | |
| 239 | -<script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> | |
| 240 | -<!-- #### 安全驾驶 end ### --> | |
| 241 | - | |
| 242 | -<!-- 打电话 --> | |
| 243 | -<script src="http://114.80.178.12:9003/forward/voip/callCenterJs"></script> | |
| 244 | -<script src="http://114.80.178.12:9003/forward/voip/phonePluginJs"></script> | |
| 245 | -<script src="/real_control_v2/js/safe_driv/call_phone.js" ></script> | |
| 246 | - | |
| 247 | -<script id="voip_call_info_panel-temp" type="text/html"> | |
| 248 | - <div class="voip_call_info_panel" style="{{style}}"> | |
| 249 | - <p class="_title">VOIP</p> | |
| 250 | - <form class="uk-form uk-form-horizontal"> | |
| 251 | - | |
| 252 | - <div class="uk-form-row"> | |
| 253 | - <label class="uk-form-label" >工号:</label> | |
| 254 | - <div class="uk-form-controls"> | |
| 255 | - <input type="text" name="agentID" value="1002" disabled> | |
| 256 | - </div> | |
| 257 | - </div> | |
| 258 | - <div class="uk-form-row"> | |
| 259 | - <label class="uk-form-label" ">分机号:</label> | |
| 260 | - <div class="uk-form-controls"> | |
| 261 | - <input type="text" name="dn" value="" > | |
| 262 | - </div> | |
| 263 | - </div> | |
| 264 | - <div class="uk-form-row"> | |
| 265 | - <label class="uk-form-label" >自编号:</label> | |
| 266 | - <div class="uk-form-controls"> | |
| 267 | - <input type="text" value="{{nbbm}}" disabled> | |
| 268 | - </div> | |
| 269 | - </div> | |
| 270 | - <div class="uk-form-row"> | |
| 271 | - <label class="uk-form-label" >SIM号:</label> | |
| 272 | - <div class="uk-form-controls"> | |
| 273 | - <input type="text" name="simNo" disabled> | |
| 274 | - </div> | |
| 275 | - </div> | |
| 276 | - <hr> | |
| 277 | - <h4 class="state_txt"> | |
| 278 | - <button class="uk-button uk-button-large" type="button" disabled>获取SIM卡号...</button> | |
| 279 | - </h4> | |
| 280 | - </form> | |
| 281 | - </div> | |
| 282 | -</script> | |
| 283 | -</body> | |
| 284 | - | |
| 285 | -</html> | |
| 1 | +<!DOCTYPE html> | |
| 2 | +<html lang="zh-cn"> | |
| 3 | + | |
| 4 | +<head> | |
| 5 | + <meta charset="UTF-8"> | |
| 6 | + <title>线路调度 v2.0</title> | |
| 7 | + <!-- uikit core style--> | |
| 8 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/css/uikit.gradient.min.css" /> | |
| 9 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" merge="plugins"/> | |
| 10 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" merge="plugins"/> | |
| 11 | + <link rel="stylesheet" | |
| 12 | + href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" merge="plugins"/> | |
| 13 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.gradient.min.css" merge="plugins"/> | |
| 14 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css" merge="plugins"/> | |
| 15 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.gradient.min.css" merge="plugins"/> | |
| 16 | + | |
| 17 | + <!-- main style --> | |
| 18 | + <link rel="stylesheet" href="/real_control_v2/css/main.css" /> | |
| 19 | + <!-- north style --> | |
| 20 | + <link rel="stylesheet" href="/real_control_v2/css/north.css" merge="custom_style"/> | |
| 21 | + <!-- home style --> | |
| 22 | + <link rel="stylesheet" href="/real_control_v2/css/home.css" merge="custom_style"/> | |
| 23 | + <!-- line style --> | |
| 24 | + <link rel="stylesheet" href="/real_control_v2/css/line_schedule.css" merge="custom_style"/> | |
| 25 | + <link rel="stylesheet" href="/real_control_v2/css/line_schedule_table.css" merge="custom_style"/> | |
| 26 | + | |
| 27 | + <link rel="stylesheet" href="/real_control_v2/css/sch_autocomp_result.css" merge="custom_style"/> | |
| 28 | + <!-- custom table --> | |
| 29 | + <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" merge="custom_style"/> | |
| 30 | + <!-- jquery contextMenu style --> | |
| 31 | + <link rel="stylesheet" href="/real_control_v2/assets/css/jquery.contextMenu.min.css" merge="plugins"/> | |
| 32 | + <!-- formvalidation style --> | |
| 33 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/formvalidation/formValidation.min.css" merge="plugins"/> | |
| 34 | + <!-- js tree --> | |
| 35 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/jstree/default/style.css" merge="plugins"/> | |
| 36 | + <!-- tooltip css--> | |
| 37 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" merge="plugins"/> | |
| 38 | + <link rel="stylesheet" href="/real_control_v2/css/pace.css" merge="plugins"/> | |
| 39 | + | |
| 40 | + <link rel="stylesheet" href="/real_control_v2/css/modal_extend.css" merge="custom_style"/> | |
| 41 | + <!-- perfect-scrollbar style --> | |
| 42 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" merge="plugins"/> | |
| 43 | + <!-- layer 3.0.3 --> | |
| 44 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/default/layer.css" merge="plugins"/> | |
| 45 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/moon/style.css" merge="plugins"/> | |
| 46 | + | |
| 47 | + <!-- flatpickr --> | |
| 48 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css" merge="plugins"> | |
| 49 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/themes/airbnb.css" merge="plugins"> | |
| 50 | +</head> | |
| 51 | + | |
| 52 | +<body> | |
| 53 | +<div class="north uk-width-1-1 uk-panel-box"> | |
| 54 | + <div class="uk-grid uk-grid-match"> | |
| 55 | + <div class="uk-width-4-10"> | |
| 56 | + <div class="uk-panel"> | |
| 57 | + <h2 class="north-logo"> | |
| 58 | + <!--<i class="uk-icon-life-ring"></i>--> 浦东公交线路调度 | |
| 59 | + </h2> | |
| 60 | + </div> | |
| 61 | + </div> | |
| 62 | + <div class="uk-width-6-10"> | |
| 63 | + <div class="uk-panel uk-width north-toolbar"></div> | |
| 64 | + </div> | |
| 65 | + </div> | |
| 66 | + <div class="north-tabs"></div> | |
| 67 | +</div> | |
| 68 | + | |
| 69 | +<div class="main-container"> | |
| 70 | + <div class="load-panel"> | |
| 71 | + <i class="uk-icon-spinner uk-icon-spin"></i> | |
| 72 | + 正在加载数据 | |
| 73 | + </div> | |
| 74 | +</div> | |
| 75 | + | |
| 76 | +<script> | |
| 77 | +/* var gb_beforeunload_fun = function (e) { | |
| 78 | + var confirmationMessage = "\o/"; | |
| 79 | + (e || window.event).returnValue = confirmationMessage; | |
| 80 | + return confirmationMessage; | |
| 81 | + } | |
| 82 | + window.addEventListener("beforeunload", gb_beforeunload_fun);*/ | |
| 83 | + | |
| 84 | + delete window.exports; | |
| 85 | + delete window.module; | |
| 86 | + | |
| 87 | + var ipcMain; | |
| 88 | + //是否处于electron环境下 | |
| 89 | + var isElectron = (function () { | |
| 90 | + try { | |
| 91 | + if (process.versions.electron) | |
| 92 | + return true; | |
| 93 | + else | |
| 94 | + return false; | |
| 95 | + } | |
| 96 | + catch (e) { | |
| 97 | + return false; | |
| 98 | + } | |
| 99 | + })(); | |
| 100 | + | |
| 101 | + if (isElectron) { | |
| 102 | + var link = document.createElement("link"); | |
| 103 | + link.type = "text/css"; | |
| 104 | + link.rel = "stylesheet"; | |
| 105 | + link.href = "/real_control_v2/css/electron.css"; | |
| 106 | + document.getElementsByTagName("head")[0].appendChild(link); | |
| 107 | + | |
| 108 | + ipcMain = require('electron').ipcRenderer; | |
| 109 | + } | |
| 110 | +</script> | |
| 111 | + | |
| 112 | +<!-- 地图相关 --> | |
| 113 | +<script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> | |
| 114 | +<script src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script> | |
| 115 | +<script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script> | |
| 116 | +<script src="/assets/js/TransGPS.js" merge="plugins"></script> | |
| 117 | +<!-- 高德 --> | |
| 118 | +<script src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> | |
| 119 | +<!-- jquery --> | |
| 120 | +<script src="/real_control_v2/assets/js/jquery.min.js"></script> | |
| 121 | +<!-- jquery actual --> | |
| 122 | +<script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> | |
| 123 | +<!-- jquery.serializejson JSON序列化插件 --> | |
| 124 | +<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script> | |
| 125 | +<!-- moment.js 日期处理类库 --> | |
| 126 | +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | |
| 127 | +<script src="/real_control_v2/assets/plugins/moment/zh-cn.js"></script> | |
| 128 | +<!-- jquery.pageinator 分页 --> | |
| 129 | +<script src="/assets/plugins/jqPaginator.min.js"></script> | |
| 130 | + | |
| 131 | +<!-- flatpickr --> | |
| 132 | +<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" merge="plugins"></script> | |
| 133 | +<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" merge="plugins"></script> | |
| 134 | + | |
| 135 | +<!-- perfect-scrollbar --> | |
| 136 | +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 137 | +<!-- common js --> | |
| 138 | +<script src="/real_control_v2/js/common.js"></script> | |
| 139 | +<!-- art-template 模版引擎 --> | |
| 140 | +<script src="/assets/plugins/template.js" merge="plugins"></script> | |
| 141 | +<!-- d3 --> | |
| 142 | +<script src="/assets/js/d3.min.js"></script> | |
| 143 | +<!-- EventProxy --> | |
| 144 | +<script src="/assets/js/eventproxy.js"></script> | |
| 145 | +<!-- main js --> | |
| 146 | +<script src="/real_control_v2/js/main.js"></script> | |
| 147 | +<!-- uikit core --> | |
| 148 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/uikit.min.js" merge="uikit_js"></script> | |
| 149 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.min.js" merge="uikit_js"></script> | |
| 150 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/pagination.min.js" merge="uikit_js"></script> | |
| 151 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js" merge="uikit_js"></script> | |
| 152 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js" merge="uikit_js"></script> | |
| 153 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.min.js" merge="uikit_js"></script> | |
| 154 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/timepicker.min.js" merge="uikit_js"></script> | |
| 155 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/lightbox.min.js" merge="uikit_js"></script> | |
| 156 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.min.js" merge="uikit_js"></script> | |
| 157 | + | |
| 158 | + | |
| 159 | +<!-- jquery contextMenu --> | |
| 160 | +<script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" merge="plugins"></script> | |
| 161 | +<script src="/real_control_v2/assets/js/jquery.ui.position.min.js" merge="plugins"></script> | |
| 162 | +<!-- formvalidation- --> | |
| 163 | +<script src="/real_control_v2/assets/plugins/formvalidation/formValidation.min.js" merge="plugins"></script> | |
| 164 | +<script src="/real_control_v2/assets/plugins/formvalidation/zh_CN.js" merge="plugins"></script> | |
| 165 | +<script src="/real_control_v2/assets/plugins/formvalidation/uikit.min.js" merge="plugins"></script> | |
| 166 | +<!-- js tree --> | |
| 167 | +<script src="/real_control_v2/assets/plugins/jstree/jstree.min.js" merge="plugins"></script> | |
| 168 | +<!-- simple pinyin --> | |
| 169 | +<script src="/assets/plugins/pinyin.js" merge="plugins"></script> | |
| 170 | +<!-- qtip --> | |
| 171 | +<script src="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.js" merge="plugins"></script> | |
| 172 | +<!-- layer 3.0.3 --> | |
| 173 | +<script src="/real_control_v2/assets/plugins/layer3.0.3/layer.js" merge="plugins"></script> | |
| 174 | + | |
| 175 | +<!-- 数据 --> | |
| 176 | +<script src="/real_control_v2/js/data/data_basic.js" merge="custom_js"></script> | |
| 177 | +<script src="/real_control_v2/js/data/data_gps.js" merge="custom_js"></script> | |
| 178 | +<script src="/real_control_v2/js/data/gps_abnormal.js" merge="custom_js"></script> | |
| 179 | +<script src="/real_control_v2/js/data/data_line_config.js" merge="custom_js"></script> | |
| 180 | +<!-- 线路模拟图 --> | |
| 181 | +<script src="/real_control_v2/js/utils/svg_chart.js" merge="custom_js"></script> | |
| 182 | +<script src="/real_control_v2/js/utils/svg_data_convert.js" merge="custom_js"></script> | |
| 183 | +<script src="/real_control_v2/js/utils/svg_chart_tooltip.js" merge="custom_js"></script> | |
| 184 | +<script src="/real_control_v2/js/utils/svg_chart_map.js" merge="custom_js"></script> | |
| 185 | + | |
| 186 | +<!-- custom table js --> | |
| 187 | +<script src="/real_control_v2/js/utils/ct_table.js" merge="custom_js"></script> | |
| 188 | +<!-- north js --> | |
| 189 | +<script src="/real_control_v2/js/north/toolbar.js" merge="custom_js"></script> | |
| 190 | +<script src="/real_control_v2/js/north/tabs.js" merge="custom_js"></script> | |
| 191 | +<script src="/real_control_v2/js/north/second_timer.js" merge="custom_js"></script> | |
| 192 | +<!-- home js --> | |
| 193 | +<script src="/real_control_v2/js/home/layout.js" merge="custom_js"></script> | |
| 194 | +<script src="/real_control_v2/js/home/line_panel.js" merge="custom_js"></script> | |
| 195 | +<script src="/real_control_v2/js/home/context_menu.js" merge="custom_js"></script> | |
| 196 | +<!-- line schedule js --> | |
| 197 | +<script src="/real_control_v2/js/line_schedule/legend.js" merge="custom_js"></script> | |
| 198 | +<script src="/real_control_v2/js/line_schedule/layout.js" merge="custom_js"></script> | |
| 199 | +<script src="/real_control_v2/js/line_schedule/sch_table.js" merge="custom_js"></script> | |
| 200 | +<script src="/real_control_v2/js/line_schedule/context_menu.js" merge="custom_js"></script> | |
| 201 | +<script src="/real_control_v2/js/line_schedule/dbclick.js" merge="custom_js"></script> | |
| 202 | +<script src="/real_control_v2/js/line_schedule/search.js" merge="custom_js"></script> | |
| 203 | +<script src="/real_control_v2/js/line_schedule/badge_tooltip.js" merge="custom_js"></script> | |
| 204 | +<script src="/real_control_v2/js/line_schedule/mileage_count.js" merge="custom_js"></script> | |
| 205 | + | |
| 206 | +<!-- 字典相关 --> | |
| 207 | +<script src="/assets/js/dictionary.js" merge="custom_js"></script> | |
| 208 | +<!-- websocket --> | |
| 209 | +<script src="/real_control_v2/assets/plugins/sockjs-client/sockjs.min.js"></script> | |
| 210 | +<script src="/real_control_v2/js/websocket/sch_websocket.js" merge="custom_js"></script> | |
| 211 | +<!-- tts --> | |
| 212 | +<script src="/real_control_v2/js/utils/tts.js" merge="custom_js"></script> | |
| 213 | + | |
| 214 | +<!-- echart --> | |
| 215 | +<script src="/real_control_v2/assets/echarts-3/echarts.js" merge="plugins"></script> | |
| 216 | +<!-- Geolib --> | |
| 217 | +<script src="/real_control_v2/geolib/geolib.js" merge="plugins"></script> | |
| 218 | + | |
| 219 | +<script src="/real_control_v2/js/signal_state/signal_state.js" merge="custom_js"></script> | |
| 220 | +<script src="/real_control_v2/js/utils/dispatch_pattern.js" merge="custom_js"></script> | |
| 221 | + | |
| 222 | +<!-- 处理表单片段嵌入问题 --> | |
| 223 | +<script src="/real_control_v2/js/forms/form_embed.js" merge="custom_js"></script> | |
| 224 | +<!-- 模态框扩展 --> | |
| 225 | +<script src="/real_control_v2/js/modal_extend.js" merge="custom_js"></script> | |
| 226 | + | |
| 227 | +<!-- #### 安全驾驶 start ### --> | |
| 228 | +<div class="safe_driv_pop_wrap" ></div> | |
| 229 | +<script id="safe_driv_item-temp" type="text/html"> | |
| 230 | + <div class="safe_driv_pop uk-animation-slide-bottom" data-nbbm="{{clzbh}}" data-type="{{yczltype}}" data-title="{{clzbh}} {{timeStr}} {{ycztText}}" data-url="{{url}}" data-ts="{{ts}}"> | |
| 231 | + <div> | |
| 232 | + <span class="title">异常 {{clzbh}}</span> | |
| 233 | + <span class="text"> {{timeStr}} 出现违规驾驶({{ycztText}})</span> | |
| 234 | + <span class="desc">--安全驾驶监管平台</span> | |
| 235 | + </div> | |
| 236 | + </div> | |
| 237 | +</script> | |
| 238 | + | |
| 239 | +<script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> | |
| 240 | +<!-- #### 安全驾驶 end ### --> | |
| 241 | + | |
| 242 | +<!-- 打电话 --> | |
| 243 | +<script src="http://114.80.178.12:9003/forward/voip/callCenterJs"></script> | |
| 244 | +<script src="http://114.80.178.12:9003/forward/voip/phonePluginJs"></script> | |
| 245 | +<script src="/real_control_v2/js/safe_driv/call_phone.js" ></script> | |
| 246 | + | |
| 247 | +<script id="voip_call_info_panel-temp" type="text/html"> | |
| 248 | + <div class="voip_call_info_panel" style="{{style}}"> | |
| 249 | + <p class="_title">VOIP</p> | |
| 250 | + <form class="uk-form uk-form-horizontal"> | |
| 251 | + | |
| 252 | + <div class="uk-form-row"> | |
| 253 | + <label class="uk-form-label" >工号:</label> | |
| 254 | + <div class="uk-form-controls"> | |
| 255 | + <input type="text" name="agentID" value="1002" disabled> | |
| 256 | + </div> | |
| 257 | + </div> | |
| 258 | + <div class="uk-form-row"> | |
| 259 | + <label class="uk-form-label" ">分机号:</label> | |
| 260 | + <div class="uk-form-controls"> | |
| 261 | + <input type="text" name="dn" value="" > | |
| 262 | + </div> | |
| 263 | + </div> | |
| 264 | + <div class="uk-form-row"> | |
| 265 | + <label class="uk-form-label" >自编号:</label> | |
| 266 | + <div class="uk-form-controls"> | |
| 267 | + <input type="text" value="{{nbbm}}" disabled> | |
| 268 | + </div> | |
| 269 | + </div> | |
| 270 | + <div class="uk-form-row"> | |
| 271 | + <label class="uk-form-label" >SIM号:</label> | |
| 272 | + <div class="uk-form-controls"> | |
| 273 | + <input type="text" name="simNo" disabled> | |
| 274 | + </div> | |
| 275 | + </div> | |
| 276 | + <hr> | |
| 277 | + <h4 class="state_txt"> | |
| 278 | + <button class="uk-button uk-button-large" type="button" disabled>获取SIM卡号...</button> | |
| 279 | + </h4> | |
| 280 | + </form> | |
| 281 | + </div> | |
| 282 | +</script> | |
| 283 | +</body> | |
| 284 | + | |
| 285 | +</html> | ... | ... |