Commit ac9f3a6ea95c8fdeeb3c62ef3726deebc5058821

Authored by zlz
1 parent 42779d5c

批量上传线路站级数据

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