Commit 9a3b3e7428bbf94fa5e90a646775bcddf2138e50
1 parent
4c817fe2
运管处路单上传BUG修改
Showing
1 changed file
with
9 additions
and
2 deletions
src/main/java/com/bsth/service/traffic/impl/YgcBasicDataServiceImpl.java
| @@ -68,7 +68,7 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ | @@ -68,7 +68,7 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ | ||
| 68 | String flag = "failure"; | 68 | String flag = "failure"; |
| 69 | try { | 69 | try { |
| 70 | // 调用接口下载基础数据 | 70 | // 调用接口下载基础数据 |
| 71 | - if(download(userName, DigestUtils.md5Hex(passWord), saveFile)){ | 71 | + if(download(userName, passWord, saveFile)){ |
| 72 | // 读取基础数据zip | 72 | // 读取基础数据zip |
| 73 | StringBuffer sb = readZipFile(saveFile); | 73 | StringBuffer sb = readZipFile(saveFile); |
| 74 | // 解析xml | 74 | // 解析xml |
| @@ -99,10 +99,11 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ | @@ -99,10 +99,11 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ | ||
| 99 | * @param saveFile | 99 | * @param saveFile |
| 100 | * @return | 100 | * @return |
| 101 | */ | 101 | */ |
| 102 | - private boolean download(String userName, String password, String saveFile) | 102 | + public boolean download(String userName, String password, String saveFile) |
| 103 | { | 103 | { |
| 104 | try | 104 | try |
| 105 | { | 105 | { |
| 106 | + password = DigestUtils.md5Hex(password); | ||
| 106 | OMElement data = buildDownloadEnvelope(userName, password); | 107 | OMElement data = buildDownloadEnvelope(userName, password); |
| 107 | ServiceClient sender = new ServiceClient(); | 108 | ServiceClient sender = new ServiceClient(); |
| 108 | Options options = sender.getOptions(); | 109 | Options options = sender.getOptions(); |
| @@ -123,6 +124,12 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ | @@ -123,6 +124,12 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ | ||
| 123 | while ((read = is.read(buffer)) != -1) { | 124 | while ((read = is.read(buffer)) != -1) { |
| 124 | imageOutStream.write(buffer, 0, read); | 125 | imageOutStream.write(buffer, 0, read); |
| 125 | } | 126 | } |
| 127 | + if(is != null){ | ||
| 128 | + is.close(); | ||
| 129 | + } | ||
| 130 | + if(imageOutStream != null){ | ||
| 131 | + imageOutStream.close(); | ||
| 132 | + } | ||
| 126 | return true; | 133 | return true; |
| 127 | } catch (Exception e) { | 134 | } catch (Exception e) { |
| 128 | e.printStackTrace(); | 135 | e.printStackTrace(); |