Commit ac9f3a6ea95c8fdeeb3c62ef3726deebc5058821

Authored by zlz
1 parent 42779d5c

批量上传线路站级数据

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业务层实现接口)
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -244,7 +244,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -244,7 +244,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
244 */ 244 */
245 @Override 245 @Override
246 public String setXLByInUse(String inUse) { 246 public String setXLByInUse(String inUse) {
247 - String result = "failure"; 247 + StringBuffer result = new StringBuffer();
248 try { 248 try {
249 Map<String,Object> map = new HashMap<>(); 249 Map<String,Object> map = new HashMap<>();
250 if(inUse != null && inUse.equals("1")){ 250 if(inUse != null && inUse.equals("1")){
@@ -253,26 +253,20 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -253,26 +253,20 @@ public class TrafficManageServiceImpl implements TrafficManageService{
253 List<Line> lines ; 253 List<Line> lines ;
254 Line line; 254 Line line;
255 lines = lineRepository.findAll(new CustomerSpecs<Line>(map)); 255 lines = lineRepository.findAll(new CustomerSpecs<Line>(map));
256 - String[] ids ;  
257 if(lines != null && lines.size() > 0){ 256 if(lines != null && lines.size() > 0){
258 - ids = new String[lines.size()];  
259 for(int i = 0 ; i < lines.size() ; i ++){ 257 for(int i = 0 ; i < lines.size() ; i ++){
260 line = lines.get(i); 258 line = lines.get(i);
261 if(line != null && line.getId() != null){ 259 if(line != null && line.getId() != null){
262 - ids[i] = String.valueOf(line.getId()); 260 + result.append(line.getLineCode()).append(":").append(setXL(line.getLineCode())).append(";");
263 } 261 }
264 } 262 }
265 - if(ids != null && ids.length > 0 ){  
266 - System.out.println(ids.length);  
267 - setXL(StringUtils.join(ids,","));  
268 - }  
269 } 263 }
270 } catch (Exception e) { 264 } catch (Exception e) {
271 - result = "failure"; 265 + result.append("failure");
272 logger.error("setXLByInUse:",e); 266 logger.error("setXLByInUse:",e);
273 e.printStackTrace(); 267 e.printStackTrace();
274 } 268 }
275 - return result; 269 + return result.toString();
276 } 270 }
277 271
278 /** 272 /**
@@ -801,7 +795,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -801,7 +795,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
801 // 判断XML是否以</BCList>结尾,如果不是,则加上 795 // 判断XML是否以</BCList>结尾,如果不是,则加上
802 String regex = "^*</JHBC>$"; 796 String regex = "^*</JHBC>$";
803 Pattern p = Pattern.compile(regex); 797 Pattern p = Pattern.compile(regex);
804 - java.util.regex.Matcher m = p.matcher(sBuffer); 798 + Matcher m = p.matcher(sBuffer);
805 boolean isEndWithTrueFlag = false; 799 boolean isEndWithTrueFlag = false;
806 while (m.find()) { 800 while (m.find()) {
807 isEndWithTrueFlag = true; 801 isEndWithTrueFlag = true;