Commit 035cd2c5bf4b47f1e1d923685e45c48cb3fd4217

Authored by 李强
1 parent 2460355e

站点与路段基础数据编辑功能修订.

src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
... ... @@ -241,6 +241,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ
241 241 Integer toDir = map.get("toDir")==null ? null : Integer.parseInt(map.get("toDir").toString());
242 242 if(line!=null && dir!=null) {
243 243 List<Object[]> list = repository.getSectionRoute(line, dir);
  244 + int src = repository.sectionRouteCodeMaxId();
244 245 for(int i = 0 ; i<list.size() ; i++) {
245 246 int sectionId = Integer.parseInt(String.valueOf(repository2.sectionMaxId())) + 1 ;
246 247 String sectionCode = String.valueOf(sectionId);
... ... @@ -270,10 +271,9 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
270 271 SectionRoute sr = new SectionRoute();
271 272 Line lineObject = lineRepository.findOne(line);
272 273 Section section = repository2.findOne(sectionId);
273   - int src = repository.sectionRouteCodeMaxId();
274   - src = src == 0 ? list.size() : src - (list.size()-i)*10 ;
  274 + Integer xh = (src == 0 ? (toDir ==1? (list.size()-i)*10 : (list.size()+i)*10) : toDir==1? (src + (list.size()-i)*10) : (src + (list.size()+i)*10)) ;
275 275 sr.setId(sectionRouteId);
276   - sr.setSectionrouteCode(src);
  276 + sr.setSectionrouteCode(xh);
277 277 sr.setLineCode(lineObject.getLineCode());
278 278 sr.setSectionCode(sectionCode);
279 279 sr.setDirections(toDir);
... ...