Commit 4dbf2667d75071b0f2ea7cc455c61bac560f7691

Authored by 游瑞烽
1 parent 135aed2f

1.ftp上传换成站点路由名称,

2.线路版本更新是带上站点行业编码
src/main/java/com/bsth/repository/SectionRouteRepository.java
... ... @@ -30,11 +30,11 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int
30 30  
31 31 // 查询最大ID
32 32 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_sectionroute) k" , nativeQuery=true)
33   - public long sectionRouteMaxId();
  33 + long sectionRouteMaxId();
34 34  
35 35 // 查询最大ID
36 36 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(sectionroute_code) as num FROM bsth_c_sectionroute where line_code = 601010 and directions = 1 and destroy = 0) k" , nativeQuery=true)
37   - public int sectionRouteCodeMaxId();
  37 + int sectionRouteCodeMaxId();
38 38  
39 39 /**
40 40 * @Description :TODO(查询路段信息)
... ... @@ -173,15 +173,15 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int
173 173  
174 174 @Modifying
175 175 @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+1) where line = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true)
176   - public void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod);
  176 + void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod);
177 177  
178 178 @Modifying
179 179 @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+1) where line_code = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true)
180   - public void sectionUpdSectionRouteCode(String lineCode,Integer dir,int routeCod);
  180 + void sectionUpdSectionRouteCode(String lineCode,Integer dir,int routeCod);
181 181  
182 182 @Modifying
183 183 @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true)
184   - public void sectionRouteIsDestroyUpdBatch(Integer id);
  184 + void sectionRouteIsDestroyUpdBatch(Integer id);
185 185  
186 186 /**
187 187 * 更新路线前撤销线路原有路段
... ... @@ -191,22 +191,22 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int
191 191 */
192 192 @Modifying
193 193 @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where line = ?1 and directions = ?2", nativeQuery=true)
194   - public void sectionRouteUpdDestroy(Integer line,Integer dir);
  194 + void sectionRouteUpdDestroy(Integer line,Integer dir);
195 195  
196 196 @Modifying
197 197 @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true)
198   - public void sectionRouteDir(Integer line);
  198 + void sectionRouteDir(Integer line);
199 199  
200 200 // 更具线路批量撤销
201 201 @Modifying
202 202 @Query(value="UPDATE SectionRoute sr set sr.destroy = 1 where sr.line.id = ?1 and sr.lineCode = ?2")
203   - public void batchUpdate(Integer lineId, String lineCode);
  203 + void batchUpdate(Integer lineId, String lineCode);
204 204  
205 205 // 批量删除
206 206 @Modifying
207   - @Query(value="delete from SectionRoute sr where sr.line.id = ?1 and sr.lineCode = ?2")
208   - public void batchDelete(Integer lineId, String lineCode);
  207 + @Query(value="delete from SectionRoute sr where sr.lineCode = ?1")
  208 + void batchDelete(String lineCode);
209 209  
210 210 @Query("select r from SectionRoute r where r.line.id=?1 and r.directions=?2 and r.destroy=0 order by r.sectionrouteCode")
211   - public List<SectionRoute> findByLine(Integer lineId, Integer dir);
  211 + List<SectionRoute> findByLine(Integer lineId, Integer dir);
212 212 }
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java
... ... @@ -229,12 +229,13 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
229 229 "a.station_route_code," +
230 230 "b.station_cod," +
231 231 "a.distances,"+
232   - "s.station_name," +
  232 + "a.station_name," +
233 233 "a.directions FROM (SELECT " +
234 234 "s.station_mark," +
235 235 "s.station_route_code," +
236 236 "s.directions," +
237 237 "s.distances,"+
  238 + "s.station_name," +
238 239 "s.station FROM bsth_c_stationroute s where s.line = ?1 and s.destroy=0) a " +
239 240 "LEFT JOIN bsth_c_station b " +
240 241 " on a.station = b.id ORDER BY a.directions ASC ) k ORDER BY k.directions,k.station_route_code ASC", nativeQuery=true)
... ... @@ -499,8 +500,8 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
499 500  
500 501 // 批量删除
501 502 @Modifying
502   - @Query(value="delete from StationRoute sr where sr.line.id = ?1 and sr.lineCode = ?2")
503   - void batchDelete(Integer lineId, String lineCode);
  503 + @Query(value="delete from StationRoute sr where sr.lineCode = ?1")
  504 + void batchDelete(String lineCode);
504 505  
505 506  
506 507 // 批量修改站点行业编码
... ...
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java
... ... @@ -13,6 +13,8 @@ import com.bsth.repository.LineRepository;
13 13 import com.bsth.repository.LineVersionsRepository;
14 14 import com.bsth.repository.LsSectionRouteRepository;
15 15 import com.bsth.repository.LsStationRouteRepository;
  16 +import com.bsth.repository.SectionRouteRepository;
  17 +import com.bsth.repository.StationRouteRepository;
16 18 import com.bsth.service.LineVersionsService;
17 19 import com.bsth.service.SectionRouteService;
18 20 import com.bsth.service.StationRouteService;
... ... @@ -59,12 +61,12 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
59 61  
60 62 @Autowired
61 63 StationRouteService stationRouteService;
62   -
  64 +
63 65 @Autowired
64   - com.bsth.repository.SectionRouteRepository sectionRouteRepository ;
65   -
  66 + SectionRouteRepository sectionRouteRepository ;
  67 +
66 68 @Autowired
67   - com.bsth.repository.StationRouteRepository stationRouteRepository ;
  69 + StationRouteRepository stationRouteRepository ;
68 70  
69 71 @Autowired
70 72 LsSectionRouteRepository lsSectionRouteRepository ;
... ... @@ -136,18 +138,16 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
136 138 List<LsStationRoute> lsStationRoutes = lsStationRouteRepository.findupdated(lineId, lineCode, versions);
137 139 if (lsSectionRoutes.size() != 0 && lsStationRoutes.size() != 0) {
138 140 // 更新
139   - final List<SectionRoute> sectionRoutes = JSONArray.parseArray(JSON.toJSONString(lsSectionRoutes), SectionRoute.class);
140   - final List<StationRoute> stationRoutes = JSONArray.parseArray(JSON.toJSONString(lsStationRoutes), StationRoute.class);
141   - //sectionRouteService.batchUpdate(lineId, lineCode);
142   - //sectionRouteRepository.batchDelete(lineId, lineCode);
143   -
  141 + final List<StationRoute> stationRoutes = JSONArray.parseArray(JSON.toJSONString(lsStationRoutes), StationRoute.class);
  142 + final List<SectionRoute> sectionRoutes = JSONArray.parseArray(JSON.toJSONString(lsSectionRoutes), SectionRoute.class);
  143 +
  144 + // 只能使用jdbc插入,应为历史表同步到当前表的时候,带有id,用jpa会报错
144 145 jdbcTemplate.update("delete from bsth_c_stationroute where line = ? and line_code = ?", lineId, lineCode);
145   -
146 146 String stationSql ="insert into bsth_c_stationroute(id,line,station,station_name,station_route_code,"
147 147 + "line_code,station_code,station_mark,directions,distances,to_time,destroy,versions,"
148   - + "create_date,update_date) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  148 + + "create_date,update_date,industry_code) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
149 149 jdbcTemplate.batchUpdate(stationSql, new BatchPreparedStatementSetter() {
150   -
  150 +
151 151 @Override
152 152 public void setValues(PreparedStatement ps, int i) throws SQLException {
153 153 StationRoute sRoute = stationRoutes.get(i);
... ... @@ -166,9 +166,10 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
166 166 ps.setInt(12, sRoute.getDestroy());
167 167 ps.setInt(13, sRoute.getVersions());
168 168 ps.setDate(14, new java.sql.Date(sRoute.getCreateDate().getTime()));
169   - ps.setDate(15, new java.sql.Date(sRoute.getUpdateDate().getTime()));
  169 + ps.setDate(15, new java.sql.Date(sRoute.getUpdateDate().getTime()));
  170 + ps.setString(16,sRoute.getIndustryCode());
170 171 }
171   -
  172 +
172 173 @Override
173 174 public int getBatchSize() {
174 175 // TODO Auto-generated method stub
... ... @@ -176,12 +177,12 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
176 177 }
177 178 } );
178 179 jdbcTemplate.update("delete from bsth_c_sectionroute where line = ? and line_code = ?", lineId, lineCode);
179   -
  180 +
180 181 String sectionSql ="insert into bsth_c_sectionroute(id,line_code,section_code,sectionroute_code,"
181 182 + "directions,line,section,create_date,update_date,versions,"
182 183 + "destroy) values(?,?,?,?,?,?,?,?,?,?,?)";
183 184 jdbcTemplate.batchUpdate(sectionSql, new BatchPreparedStatementSetter() {
184   -
  185 +
185 186 @Override
186 187 public void setValues(PreparedStatement ps, int i) throws SQLException {
187 188 SectionRoute sRoute = sectionRoutes.get(i);
... ... @@ -197,7 +198,7 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
197 198 ps.setInt(10, sRoute.getVersions());
198 199 ps.setInt(11, sRoute.getDestroy());
199 200 }
200   -
  201 +
201 202 @Override
202 203 public int getBatchSize() {
203 204 // TODO Auto-generated method stub
... ...