Commit 8bb0fbb0768519f88754e3d53f17ef9a0bacfe94
1 parent
23c16f72
1
Showing
2 changed files
with
146 additions
and
62 deletions
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| @@ -661,20 +661,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -661,20 +661,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 661 | Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); | 661 | Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); |
| 662 | // 路段路由 | 662 | // 路段路由 |
| 663 | Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); | 663 | Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); |
| 664 | - SectionRoute resultS = routeRepository.findById(sectionRouteId).get(); | ||
| 665 | - int old_code = resultS.getSectionrouteCode(); | ||
| 666 | - // 是否修改路段序号标记 | ||
| 667 | - boolean type = false; | ||
| 668 | - if(sectionrouteCode!=null) { | ||
| 669 | - if(++sectionrouteCode == old_code) { | ||
| 670 | - type = true; | ||
| 671 | - } | ||
| 672 | - // 默认是最前面路段 | ||
| 673 | - }else { | ||
| 674 | - sectionrouteCode = 1; | ||
| 675 | - } | ||
| 676 | - if(!type) | ||
| 677 | - routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode); | 664 | + |
| 678 | // 限速 | 665 | // 限速 |
| 679 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | 666 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); |
| 680 | // 版本 | 667 | // 版本 |
| @@ -704,22 +691,70 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -704,22 +691,70 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 704 | String sectionType=""; | 691 | String sectionType=""; |
| 705 | // 更新 | 692 | // 更新 |
| 706 | repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); | 693 | repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); |
| 707 | - SectionRoute route = new SectionRoute(); | 694 | + |
| 708 | Line line = lineRepository.findById(sectionRouteLine).get(); | 695 | Line line = lineRepository.findById(sectionRouteLine).get(); |
| 709 | Section section = repository.findById(sectionId).get(); | 696 | Section section = repository.findById(sectionId).get(); |
| 710 | - route.setId(sectionRouteId); | ||
| 711 | - route.setSectionrouteCode(sectionrouteCode); | ||
| 712 | - route.setLineCode(lineCode); | ||
| 713 | - route.setSectionCode(sectionCode); | ||
| 714 | - route.setDirections(directions); | ||
| 715 | - route.setVersions(version); | ||
| 716 | - route.setDestroy(destroy); | ||
| 717 | - route.setCreateBy(createBy); | ||
| 718 | - route.setUpdateBy(updateBy); | ||
| 719 | - route.setLine(line); | ||
| 720 | - route.setSection(section); | ||
| 721 | - route.setIsRoadeSpeed(isRoadeSpeed); | ||
| 722 | - routeRepository.save(route); | 697 | + |
| 698 | + if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) == 1) { | ||
| 699 | + SectionRoute resultS = routeRepository.findById(sectionRouteId).get(); | ||
| 700 | + int old_code = resultS.getSectionrouteCode(); | ||
| 701 | + // 是否修改路段序号标记 | ||
| 702 | + boolean type = false; | ||
| 703 | + if(sectionrouteCode!=null) { | ||
| 704 | + if(++sectionrouteCode == old_code) { | ||
| 705 | + type = true; | ||
| 706 | + } | ||
| 707 | + // 默认是最前面路段 | ||
| 708 | + }else { | ||
| 709 | + sectionrouteCode = 1; | ||
| 710 | + } | ||
| 711 | + if(!type) | ||
| 712 | + routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode); | ||
| 713 | + SectionRoute route = new SectionRoute(); | ||
| 714 | + route.setId(sectionRouteId); | ||
| 715 | + route.setSectionrouteCode(sectionrouteCode); | ||
| 716 | + route.setLineCode(lineCode); | ||
| 717 | + route.setSectionCode(sectionCode); | ||
| 718 | + route.setDirections(directions); | ||
| 719 | + route.setVersions(version); | ||
| 720 | + route.setDestroy(destroy); | ||
| 721 | + route.setCreateBy(createBy); | ||
| 722 | + route.setUpdateBy(updateBy); | ||
| 723 | + route.setSection(section); | ||
| 724 | + route.setIsRoadeSpeed(isRoadeSpeed); | ||
| 725 | + route.setLine(line); | ||
| 726 | + routeRepository.save(route); | ||
| 727 | + }else if(Integer.parseInt(map.get("status").toString()) == 2) { | ||
| 728 | + | ||
| 729 | + LsSectionRoute resultS = lsRouteRepository.findById(sectionRouteId).get(); | ||
| 730 | + int old_code = resultS.getSectionrouteCode(); | ||
| 731 | + // 是否修改路段序号标记 | ||
| 732 | + boolean type = false; | ||
| 733 | + if(sectionrouteCode!=null) { | ||
| 734 | + if(++sectionrouteCode == old_code) { | ||
| 735 | + type = true; | ||
| 736 | + } | ||
| 737 | + // 默认是最前面路段 | ||
| 738 | + }else { | ||
| 739 | + sectionrouteCode = 1; | ||
| 740 | + } | ||
| 741 | + if(!type) | ||
| 742 | + lsRouteRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode); | ||
| 743 | + LsSectionRoute route = new LsSectionRoute(); | ||
| 744 | + route.setId(sectionRouteId); | ||
| 745 | + route.setSectionrouteCode(sectionrouteCode); | ||
| 746 | + route.setLineCode(lineCode); | ||
| 747 | + route.setSectionCode(sectionCode); | ||
| 748 | + route.setDirections(directions); | ||
| 749 | + route.setVersions(version); | ||
| 750 | + route.setDestroy(destroy); | ||
| 751 | + route.setCreateBy(createBy); | ||
| 752 | + route.setUpdateBy(updateBy); | ||
| 753 | + route.setSection(section); | ||
| 754 | + route.setIsRoadeSpeed(isRoadeSpeed); | ||
| 755 | + route.setLine(line); | ||
| 756 | + lsRouteRepository.save(route); | ||
| 757 | + } | ||
| 723 | resultMap.put("status", ResponseCode.SUCCESS); | 758 | resultMap.put("status", ResponseCode.SUCCESS); |
| 724 | } catch (Exception e) { | 759 | } catch (Exception e) { |
| 725 | resultMap.put("status", ResponseCode.ERROR); | 760 | resultMap.put("status", ResponseCode.ERROR); |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| @@ -18,6 +18,7 @@ import com.alibaba.fastjson.JSONObject; | @@ -18,6 +18,7 @@ import com.alibaba.fastjson.JSONObject; | ||
| 18 | import com.bsth.common.ResponseCode; | 18 | import com.bsth.common.ResponseCode; |
| 19 | import com.bsth.entity.Line; | 19 | import com.bsth.entity.Line; |
| 20 | import com.bsth.entity.LineInformation; | 20 | import com.bsth.entity.LineInformation; |
| 21 | +import com.bsth.entity.LsStationRoute; | ||
| 21 | import com.bsth.entity.Section; | 22 | import com.bsth.entity.Section; |
| 22 | import com.bsth.entity.SectionRoute; | 23 | import com.bsth.entity.SectionRoute; |
| 23 | import com.bsth.entity.SectionRouteCache; | 24 | import com.bsth.entity.SectionRouteCache; |
| @@ -27,6 +28,7 @@ import com.bsth.entity.StationRouteCache; | @@ -27,6 +28,7 @@ import com.bsth.entity.StationRouteCache; | ||
| 27 | import com.bsth.repository.LineInformationRepository; | 28 | import com.bsth.repository.LineInformationRepository; |
| 28 | import com.bsth.repository.LineRepository; | 29 | import com.bsth.repository.LineRepository; |
| 29 | import com.bsth.repository.LineVersionsRepository; | 30 | import com.bsth.repository.LineVersionsRepository; |
| 31 | +import com.bsth.repository.LsStationRouteRepository; | ||
| 30 | import com.bsth.repository.SectionRepository; | 32 | import com.bsth.repository.SectionRepository; |
| 31 | import com.bsth.repository.SectionRouteCacheRepository; | 33 | import com.bsth.repository.SectionRouteCacheRepository; |
| 32 | import com.bsth.repository.SectionRouteRepository; | 34 | import com.bsth.repository.SectionRouteRepository; |
| @@ -65,6 +67,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -65,6 +67,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 65 | 67 | ||
| 66 | @Autowired | 68 | @Autowired |
| 67 | private StationRouteRepository routeRepository; | 69 | private StationRouteRepository routeRepository; |
| 70 | + | ||
| 71 | + @Autowired | ||
| 72 | + private LsStationRouteRepository lsStationRouteRepository; | ||
| 68 | 73 | ||
| 69 | @Autowired | 74 | @Autowired |
| 70 | private StationRouteCacheRepository routeCacheRepository; | 75 | private StationRouteCacheRepository routeCacheRepository; |
| @@ -1136,23 +1141,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -1136,23 +1141,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 1136 | repository.stationUpdate(stationCod, zdmc, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPloygonGrid, gPloygonGrid, destroy, radius, shapesType, versions, descriptions, stationId); | 1141 | repository.stationUpdate(stationCod, zdmc, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPloygonGrid, gPloygonGrid, destroy, radius, shapesType, versions, descriptions, stationId); |
| 1137 | // 站点路由Id | 1142 | // 站点路由Id |
| 1138 | Integer stationRouteId = map.get("stationRouteId").equals("") ? null : Integer.parseInt(map.get("stationRouteId").toString()); | 1143 | Integer stationRouteId = map.get("stationRouteId").equals("") ? null : Integer.parseInt(map.get("stationRouteId").toString()); |
| 1139 | - StationRoute resultS = routeRepository.findById(stationRouteId).get(); | ||
| 1140 | - // 站点路由序号 | ||
| 1141 | - String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? null : map.get("stationRouteCode").toString(); | ||
| 1142 | - Integer stationRouteCode = null; | ||
| 1143 | - if(stationRouteCodeStr!=null) { | ||
| 1144 | - String stationRouteCodeAraay[] = stationRouteCodeStr.split("_"); | ||
| 1145 | - int old_code = resultS.getStationRouteCode(); | ||
| 1146 | - int new_code = Integer.parseInt(stationRouteCodeAraay[0].toString())+100; | ||
| 1147 | - if(new_code==old_code){ | ||
| 1148 | - stationRouteCode = new_code; | ||
| 1149 | - }else { | ||
| 1150 | - stationRouteCode = new_code-100+1; | ||
| 1151 | - } | ||
| 1152 | - }else { | ||
| 1153 | - stationRouteCode = resultS.getStationRouteCode(); | ||
| 1154 | - } | ||
| 1155 | - stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode; | 1144 | + |
| 1156 | Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString()); | 1145 | Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString()); |
| 1157 | String stationMark = map.get("stationMark").equals("") ? null : map.get("stationMark").toString(); | 1146 | String stationMark = map.get("stationMark").equals("") ? null : map.get("stationMark").toString(); |
| 1158 | Double distances = map.get("distances").equals("") ? 0.0d : Double.parseDouble(map.get("distances").toString()); | 1147 | Double distances = map.get("distances").equals("") ? 0.0d : Double.parseDouble(map.get("distances").toString()); |
| @@ -1160,23 +1149,83 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -1160,23 +1149,83 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 1160 | Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); | 1149 | Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); |
| 1161 | Station station = repository.findById(stationId).get(); | 1150 | Station station = repository.findById(stationId).get(); |
| 1162 | Line line = lineRepository.findById(LineId).get(); | 1151 | Line line = lineRepository.findById(LineId).get(); |
| 1163 | - StationRoute stationRoute = new StationRoute(); | ||
| 1164 | - stationRoute.setStationName(stationRouteName); | ||
| 1165 | - stationRoute.setId(stationRouteId); | ||
| 1166 | - stationRoute.setStationRouteCode(stationRouteCode); | ||
| 1167 | - stationRoute.setStation(station); | ||
| 1168 | - stationRoute.setStationCode(station.getStationCod()); | ||
| 1169 | - stationRoute.setIndustryCode(industryCode); | ||
| 1170 | - stationRoute.setLine(line); | ||
| 1171 | - stationRoute.setLineCode(line.getLineCode()); | ||
| 1172 | - stationRoute.setStationMark(stationMark); | ||
| 1173 | - stationRoute.setDistances(distances); | ||
| 1174 | - stationRoute.setToTime(toTime); | ||
| 1175 | - stationRoute.setDirections(directions); | ||
| 1176 | - stationRoute.setVersions(versions); | ||
| 1177 | - stationRoute.setDestroy(destroy); | ||
| 1178 | - stationRoute.setDescriptions(descriptions); | ||
| 1179 | - routeRepository.save(stationRoute); | 1152 | + |
| 1153 | + if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) == 1) { | ||
| 1154 | + StationRoute resultS = routeRepository.findById(stationRouteId).get(); | ||
| 1155 | + // 站点路由序号 | ||
| 1156 | + String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? null : map.get("stationRouteCode").toString(); | ||
| 1157 | + Integer stationRouteCode = null; | ||
| 1158 | + if(stationRouteCodeStr!=null) { | ||
| 1159 | + String stationRouteCodeAraay[] = stationRouteCodeStr.split("_"); | ||
| 1160 | + int old_code = resultS.getStationRouteCode(); | ||
| 1161 | + int new_code = Integer.parseInt(stationRouteCodeAraay[0].toString())+100; | ||
| 1162 | + if(new_code==old_code){ | ||
| 1163 | + stationRouteCode = new_code; | ||
| 1164 | + }else { | ||
| 1165 | + stationRouteCode = new_code-100+1; | ||
| 1166 | + } | ||
| 1167 | + }else { | ||
| 1168 | + stationRouteCode = resultS.getStationRouteCode(); | ||
| 1169 | + } | ||
| 1170 | + stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode; | ||
| 1171 | + | ||
| 1172 | + StationRoute stationRoute = new StationRoute(); | ||
| 1173 | + stationRoute.setStationName(stationRouteName); | ||
| 1174 | + stationRoute.setId(stationRouteId); | ||
| 1175 | + stationRoute.setStationRouteCode(stationRouteCode); | ||
| 1176 | + stationRoute.setStation(station); | ||
| 1177 | + stationRoute.setStationCode(station.getStationCod()); | ||
| 1178 | + stationRoute.setIndustryCode(industryCode); | ||
| 1179 | + stationRoute.setLine(line); | ||
| 1180 | + stationRoute.setLineCode(line.getLineCode()); | ||
| 1181 | + stationRoute.setStationMark(stationMark); | ||
| 1182 | + stationRoute.setDistances(distances); | ||
| 1183 | + stationRoute.setToTime(toTime); | ||
| 1184 | + stationRoute.setDirections(directions); | ||
| 1185 | + stationRoute.setVersions(versions); | ||
| 1186 | + stationRoute.setDestroy(destroy); | ||
| 1187 | + stationRoute.setDescriptions(descriptions); | ||
| 1188 | + routeRepository.save(stationRoute); | ||
| 1189 | + }else if(Integer.parseInt(map.get("status").toString()) == 2){ | ||
| 1190 | + | ||
| 1191 | + LsStationRoute resultS = lsStationRouteRepository.findById(stationRouteId).get(); | ||
| 1192 | + // 站点路由序号 | ||
| 1193 | + String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? null : map.get("stationRouteCode").toString(); | ||
| 1194 | + Integer stationRouteCode = null; | ||
| 1195 | + if(stationRouteCodeStr!=null) { | ||
| 1196 | + String stationRouteCodeAraay[] = stationRouteCodeStr.split("_"); | ||
| 1197 | + int old_code = resultS.getStationRouteCode(); | ||
| 1198 | + int new_code = Integer.parseInt(stationRouteCodeAraay[0].toString())+100; | ||
| 1199 | + if(new_code==old_code){ | ||
| 1200 | + stationRouteCode = new_code; | ||
| 1201 | + }else { | ||
| 1202 | + stationRouteCode = new_code-100+1; | ||
| 1203 | + } | ||
| 1204 | + }else { | ||
| 1205 | + stationRouteCode = resultS.getStationRouteCode(); | ||
| 1206 | + } | ||
| 1207 | + stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode; | ||
| 1208 | + | ||
| 1209 | + LsStationRoute stationRoute = new LsStationRoute(); | ||
| 1210 | + stationRoute.setStationName(stationRouteName); | ||
| 1211 | + stationRoute.setId(stationRouteId); | ||
| 1212 | + stationRoute.setStationRouteCode(stationRouteCode); | ||
| 1213 | + stationRoute.setStation(station); | ||
| 1214 | + stationRoute.setStationCode(station.getStationCod()); | ||
| 1215 | + stationRoute.setIndustryCode(industryCode); | ||
| 1216 | + stationRoute.setLine(line); | ||
| 1217 | + stationRoute.setLineCode(line.getLineCode()); | ||
| 1218 | + stationRoute.setStationMark(stationMark); | ||
| 1219 | + stationRoute.setDistances(distances); | ||
| 1220 | + stationRoute.setToTime(toTime); | ||
| 1221 | + stationRoute.setDirections(directions); | ||
| 1222 | + stationRoute.setVersions(versions); | ||
| 1223 | + stationRoute.setDestroy(destroy); | ||
| 1224 | + stationRoute.setDescriptions(descriptions); | ||
| 1225 | + lsStationRouteRepository.save(stationRoute); | ||
| 1226 | + } | ||
| 1227 | + | ||
| 1228 | + | ||
| 1180 | resultMap.put("status", ResponseCode.SUCCESS); | 1229 | resultMap.put("status", ResponseCode.SUCCESS); |
| 1181 | } catch (Exception e) { | 1230 | } catch (Exception e) { |
| 1182 | resultMap.put("status", ResponseCode.ERROR); | 1231 | resultMap.put("status", ResponseCode.ERROR); |