Commit cfedcce31930df556d4a14a6dc1b23aa9852d6c1

Authored by 廖磊
2 parents 277db0ee ac9f3a6e

Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control

into pudong
src/main/java/com/bsth/controller/schedule/TrafficManageController.java
... ... @@ -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 42 @RequestMapping(value = "/setCL", method = RequestMethod.GET)
34 43 public String setCL() throws Exception {
35 44 try {
... ...
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业务层实现接口)
... ... @@ -27,6 +25,13 @@ public interface TrafficManageService {
27 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 37 * @return 调用接口返回信息
... ...
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
... ... @@ -160,6 +160,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{
160 160 String[] idArray = ids.split(",");
161 161 try {
162 162 for (String id : idArray) {
  163 + if(id == null || id.trim().equals("")){
  164 + continue;
  165 + }
163 166 Map<String,Object> map = new HashMap<>();
164 167 map.put("lineCode_eq", id);
165 168 Line line ;
... ... @@ -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 275 @Override
... ... @@ -762,7 +795,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
762 795 // 判断XML是否以</BCList>结尾,如果不是,则加上
763 796 String regex = "^*</JHBC>$";
764 797 Pattern p = Pattern.compile(regex);
765   - java.util.regex.Matcher m = p.matcher(sBuffer);
  798 + Matcher m = p.matcher(sBuffer);
766 799 boolean isEndWithTrueFlag = false;
767 800 while (m.find()) {
768 801 isEndWithTrueFlag = true;
... ...