Commit 82eb58f8e97b773e701dedb6304dfe6f792552eb
1 parent
816bbcd4
运管处路单上传BUG修改
Showing
1 changed file
with
30 additions
and
51 deletions
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -16,6 +16,7 @@ import com.bsth.repository.schedule.*; |
| 16 | 16 | import com.bsth.repository.traffic.SKBUploadLoggerRepository; |
| 17 | 17 | import com.bsth.security.util.SecurityUtils; |
| 18 | 18 | import com.bsth.service.TrafficManageService; |
| 19 | +import com.bsth.service.traffic.YgcBasicDataService; | |
| 19 | 20 | import com.bsth.util.TimeUtils; |
| 20 | 21 | import com.bsth.util.db.DBUtils_MS; |
| 21 | 22 | import com.bsth.webService.trafficManage.geotool.services.InternalPortType; |
| ... | ... | @@ -99,7 +100,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 99 | 100 | |
| 100 | 101 | // 线路站点repository |
| 101 | 102 | @Autowired |
| 102 | - private StationRepository stationRepository; | |
| 103 | + private YgcBasicDataService ygcBasicDataService; | |
| 103 | 104 | |
| 104 | 105 | |
| 105 | 106 | // 运管处接口 |
| ... | ... | @@ -122,11 +123,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 122 | 123 | DecimalFormat format = new DecimalFormat("0.00"); |
| 123 | 124 | |
| 124 | 125 | // 用户名 |
| 125 | - private final String userNameXl = "pudong"; | |
| 126 | - // 密码 | |
| 127 | - private final String passwordXl = "pudong123"; | |
| 128 | - | |
| 129 | - // 用户名 | |
| 130 | 126 | private final String userNameOther = "user"; |
| 131 | 127 | // 密码 |
| 132 | 128 | private final String passwordOther = "user"; |
| ... | ... | @@ -134,34 +130,25 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 134 | 130 | * 上传线路信息 |
| 135 | 131 | */ |
| 136 | 132 | @Override |
| 137 | - public String setXL(Map<String, Object> param) { | |
| 133 | + public String setXL(String ids) { | |
| 138 | 134 | String result = "failure"; |
| 139 | 135 | StringBuffer sBuffer = new StringBuffer(); |
| 136 | + String[] idArray = ids.split(","); | |
| 140 | 137 | try { |
| 141 | - Map<String,Object> map = new HashMap<String,Object>(); | |
| 142 | - map.put("lineCode_eq", param.get("xl.lineCode_like")+""); | |
| 143 | - Iterator<Line> lineIterator; | |
| 144 | - Line line = null; | |
| 145 | - if(param.get("xl.lineCode_like").equals("")){ | |
| 146 | - lineIterator = lineRepository.findAll().iterator(); | |
| 147 | - }else { | |
| 138 | + for (String id : idArray) { | |
| 139 | + Map<String,Object> map = new HashMap<>(); | |
| 140 | + map.put("lineCode_eq", id); | |
| 141 | + Line line ; | |
| 148 | 142 | line = lineRepository.findOne(new CustomerSpecs<Line>(map)); |
| 149 | - } | |
| 150 | - List<StationRoute> upStationsList = null;// 上行站点路由集 | |
| 151 | - List<StationRoute> downStationsList = null;// 下行站点路由集 | |
| 152 | - List<LineInformation> lineInformationsList = null; | |
| 153 | - LineInformation lineInformation = null; | |
| 154 | - sBuffer.append("<Data>"); | |
| 155 | - sBuffer.append("<RequestOrg>上海巴士拓华科技发展有限公司</RequestOrg>"); | |
| 156 | - sBuffer.append("<DataList>"); | |
| 157 | -// while(lineIterator.hasNext()){ | |
| 158 | -// line = lineIterator.next(); | |
| 159 | -// if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null | |
| 160 | -// || line.getInUse() == 0){ | |
| 161 | -// continue; | |
| 162 | -// } | |
| 163 | - if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null | |
| 164 | - || line.getInUse() == 0){ | |
| 143 | + if(line == null){ | |
| 144 | + continue; | |
| 145 | + } | |
| 146 | + List<StationRoute> upStationsList ;// 上行站点路由集 | |
| 147 | + List<StationRoute> downStationsList = null;// 下行站点路由集 | |
| 148 | + sBuffer.append("<Data>"); | |
| 149 | + sBuffer.append("<RequestOrg>上海巴士拓华科技发展有限公司</RequestOrg>"); | |
| 150 | + sBuffer.append("<DataList>"); | |
| 151 | + if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){ | |
| 165 | 152 | return result; |
| 166 | 153 | } |
| 167 | 154 | sBuffer.append("<LINE_ID>").append(line.getId()).append("</LINE_ID>"); |
| ... | ... | @@ -190,32 +177,24 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 190 | 177 | packagStationPointXml(downStationsList, sBuffer, startId); |
| 191 | 178 | } |
| 192 | 179 | sBuffer.append("</LinePointList>"); |
| 193 | -// } | |
| 194 | - sBuffer.append("</DataList>"); | |
| 195 | - sBuffer.append("</Data>"); | |
| 196 | - System.out.println(sBuffer.toString()); | |
| 197 | - if(sBuffer.indexOf("<XL>") != -1){ | |
| 198 | - portType = new Internal().getInternalHttpSoap11Endpoint(); | |
| 199 | - String portResult = portType.setXL(userNameXl, passwordXl, sBuffer.toString()); | |
| 200 | - String portArray[] = portResult.split("\n"); | |
| 201 | - if(portArray.length >= 4){ | |
| 202 | - // 返回数据的编码 | |
| 203 | - String returnCode = portArray[1].substring(portArray[1].indexOf(">")+1,portArray[1].indexOf("</")); | |
| 204 | - // 返回的信息 | |
| 205 | - String returnDescription = portArray[2].substring(portArray[2].indexOf(">")+1,portArray[2].indexOf("</")); | |
| 206 | - if(returnCode.equals("1")){ | |
| 207 | - result = "success"; | |
| 208 | - }else{ | |
| 209 | - result = returnDescription; | |
| 210 | - } | |
| 180 | + sBuffer.append("</DataList>"); | |
| 181 | + sBuffer.append("</Data>"); | |
| 182 | + // 调用上传方法 | |
| 183 | + result = ygcBasicDataService.invokeMethod("UpdateBusLineStation",sBuffer.toString()); | |
| 184 | + String str = "ReturnCode"; | |
| 185 | + // 解析返回值 | |
| 186 | + result = result.substring(result.indexOf(str)+str.length()+1,result.lastIndexOf(str)-2); | |
| 187 | + if(result.equals("1")){ | |
| 188 | + result = "success"; | |
| 189 | + }else{ | |
| 190 | + result = "failure"; | |
| 211 | 191 | } |
| 192 | + logger.info("setXL:"+sBuffer.toString()); | |
| 193 | + logger.info("setXL:"+result); | |
| 212 | 194 | } |
| 213 | 195 | } catch (Exception e) { |
| 214 | 196 | logger.error("setXL:",e); |
| 215 | 197 | e.printStackTrace(); |
| 216 | - }finally{ | |
| 217 | - logger.info("setXL:"+sBuffer.toString()); | |
| 218 | - logger.info("setXL:"+result); | |
| 219 | 198 | } |
| 220 | 199 | return result; |
| 221 | 200 | } | ... | ... |