Commit cd110d9c4454cc9d9c341ee9d9844961dca038ba
1 parent
03284b4a
选择历史版本,在线路里查看历史版本修改当前和待更新版本
Showing
14 changed files
with
1043 additions
and
23 deletions
Too many changes to show.
To preserve performance only 14 of 37 files are displayed.
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 | ... | ... |