Commit cfedcce31930df556d4a14a6dc1b23aa9852d6c1
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control
into pudong
Showing
3 changed files
with
50 additions
and
3 deletions
src/main/java/com/bsth/controller/schedule/TrafficManageController.java
| @@ -30,6 +30,15 @@ public class TrafficManageController { | @@ -30,6 +30,15 @@ public class TrafficManageController { | ||
| 30 | } | 30 | } |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | + @RequestMapping(value = "/setXLByInUse", method = RequestMethod.GET) | ||
| 34 | + public String setXLByInUse(@RequestParam("inUse") String inUse) throws Exception { | ||
| 35 | + try { | ||
| 36 | + return trManageService.setXLByInUse(inUse); | ||
| 37 | + } catch (Exception exp) { | ||
| 38 | + throw new Exception(exp.getCause()); | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + | ||
| 33 | @RequestMapping(value = "/setCL", method = RequestMethod.GET) | 42 | @RequestMapping(value = "/setCL", method = RequestMethod.GET) |
| 34 | public String setCL() throws Exception { | 43 | public String setCL() throws Exception { |
| 35 | try { | 44 | try { |
src/main/java/com/bsth/service/TrafficManageService.java
| 1 | package com.bsth.service; | 1 | package com.bsth.service; |
| 2 | 2 | ||
| 3 | -import java.util.Map; | ||
| 4 | - | ||
| 5 | /** | 3 | /** |
| 6 | * | 4 | * |
| 7 | * @Interface: LineService(线路service业务层实现接口) | 5 | * @Interface: LineService(线路service业务层实现接口) |
| @@ -27,6 +25,13 @@ public interface TrafficManageService { | @@ -27,6 +25,13 @@ public interface TrafficManageService { | ||
| 27 | String setXL(String ids); | 25 | String setXL(String ids); |
| 28 | 26 | ||
| 29 | /** | 27 | /** |
| 28 | + * 上传线路信息 | ||
| 29 | + * | ||
| 30 | + * @return 调用接口返回信息 | ||
| 31 | + */ | ||
| 32 | + String setXLByInUse(String ids); | ||
| 33 | + | ||
| 34 | + /** | ||
| 30 | * 上传车辆信息 | 35 | * 上传车辆信息 |
| 31 | * | 36 | * |
| 32 | * @return 调用接口返回信息 | 37 | * @return 调用接口返回信息 |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| @@ -160,6 +160,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -160,6 +160,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 160 | String[] idArray = ids.split(","); | 160 | String[] idArray = ids.split(","); |
| 161 | try { | 161 | try { |
| 162 | for (String id : idArray) { | 162 | for (String id : idArray) { |
| 163 | + if(id == null || id.trim().equals("")){ | ||
| 164 | + continue; | ||
| 165 | + } | ||
| 163 | Map<String,Object> map = new HashMap<>(); | 166 | Map<String,Object> map = new HashMap<>(); |
| 164 | map.put("lineCode_eq", id); | 167 | map.put("lineCode_eq", id); |
| 165 | Line line ; | 168 | Line line ; |
| @@ -237,6 +240,36 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -237,6 +240,36 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 237 | } | 240 | } |
| 238 | 241 | ||
| 239 | /** | 242 | /** |
| 243 | + * 上传线路信息(按in_use上传) | ||
| 244 | + */ | ||
| 245 | + @Override | ||
| 246 | + public String setXLByInUse(String inUse) { | ||
| 247 | + StringBuffer result = new StringBuffer(); | ||
| 248 | + try { | ||
| 249 | + Map<String,Object> map = new HashMap<>(); | ||
| 250 | + if(inUse != null && inUse.equals("1")){ | ||
| 251 | + map.put("inUse_eq", inUse); | ||
| 252 | + } | ||
| 253 | + List<Line> lines ; | ||
| 254 | + Line line; | ||
| 255 | + lines = lineRepository.findAll(new CustomerSpecs<Line>(map)); | ||
| 256 | + if(lines != null && lines.size() > 0){ | ||
| 257 | + for(int i = 0 ; i < lines.size() ; i ++){ | ||
| 258 | + line = lines.get(i); | ||
| 259 | + if(line != null && line.getId() != null){ | ||
| 260 | + result.append(line.getLineCode()).append(":").append(setXL(line.getLineCode())).append(";"); | ||
| 261 | + } | ||
| 262 | + } | ||
| 263 | + } | ||
| 264 | + } catch (Exception e) { | ||
| 265 | + result.append("failure"); | ||
| 266 | + logger.error("setXLByInUse:",e); | ||
| 267 | + e.printStackTrace(); | ||
| 268 | + } | ||
| 269 | + return result.toString(); | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + /** | ||
| 240 | * 上传车辆信息 | 273 | * 上传车辆信息 |
| 241 | */ | 274 | */ |
| 242 | @Override | 275 | @Override |
| @@ -762,7 +795,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -762,7 +795,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 762 | // 判断XML是否以</BCList>结尾,如果不是,则加上 | 795 | // 判断XML是否以</BCList>结尾,如果不是,则加上 |
| 763 | String regex = "^*</JHBC>$"; | 796 | String regex = "^*</JHBC>$"; |
| 764 | Pattern p = Pattern.compile(regex); | 797 | Pattern p = Pattern.compile(regex); |
| 765 | - java.util.regex.Matcher m = p.matcher(sBuffer); | 798 | + Matcher m = p.matcher(sBuffer); |
| 766 | boolean isEndWithTrueFlag = false; | 799 | boolean isEndWithTrueFlag = false; |
| 767 | while (m.find()) { | 800 | while (m.find()) { |
| 768 | isEndWithTrueFlag = true; | 801 | isEndWithTrueFlag = true; |