Commit b555b8302956c24a22c2e4b3bff7af779461288f

Authored by 王通
1 parent 2e50893e

1.路单、基础信息上传接口加入备用链路

src/main/java/com/bsth/common/SystemParamKeys.java
@@ -52,4 +52,26 @@ public class SystemParamKeys { @@ -52,4 +52,26 @@ public class SystemParamKeys {
52 public static final String URL_HTTP_DVR = "url.http.dvr"; 52 public static final String URL_HTTP_DVR = "url.http.dvr";
53 53
54 public static final String URL_HTTP_DVR_PWD = "url.http.dvr.pwd"; 54 public static final String URL_HTTP_DVR_PWD = "url.http.dvr.pwd";
  55 +
  56 + public static final String DR_SYS_CITY_INTERFACE_URL = "dr.sys.city.interface.url";
  57 +
  58 + public static final String DR_SYS_CITY_INTERFACE_URL1 = "dr.sys.city.interface.url1";
  59 +
  60 + public static final String DR_SYS_CITY_INTERFACE_USER = "dr.sys.city.interface.user";
  61 +
  62 + public static final String DR_SYS_CITY_INTERFACE_PASSWORD = "dr.sys.city.interface.password";
  63 +
  64 + public static final String DR_SYS_AREA_INTERFACE_URL = "dr.sys.area.interface.url";
  65 +
  66 + public static final String DR_SYS_AREA_INTERFACE_USER = "dr.sys.area.interface.user";
  67 +
  68 + public static final String DR_SYS_AREA_INTERFACE_PASSWORD = "dr.sys.area.interface.password";
  69 +
  70 + public static final String DR_SYS_CITY_INTERFACE_BAK_URL = "dr.sys.city.interface.bak.url";
  71 +
  72 + public static final String DR_SYS_CITY_INTERFACE_BAK_URL1 = "dr.sys.city.interface.bak.url1";
  73 +
  74 + public static final String DR_SYS_CITY_INTERFACE_BAK_USER = "dr.sys.city.interface.bak.user";
  75 +
  76 + public static final String DR_SYS_CITY_INTERFACE_BAK_PASSWORD = "dr.sys.city.interface.bak.password";
55 } 77 }
56 \ No newline at end of file 78 \ No newline at end of file
src/main/java/com/bsth/data/SystemParamCache.java
@@ -113,6 +113,50 @@ public class SystemParamCache implements InitializingBean { @@ -113,6 +113,50 @@ public class SystemParamCache implements InitializingBean {
113 return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DVR_PWD); 113 return systemParamService1.getValue(SystemParamKeys.URL_HTTP_DVR_PWD);
114 } 114 }
115 115
  116 + public static String getDrSysCityInterfaceUrl() {
  117 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_CITY_INTERFACE_URL);
  118 + }
  119 +
  120 + public static String getDrSysCityInterfaceUrl1() {
  121 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_CITY_INTERFACE_URL1);
  122 + }
  123 +
  124 + public static String getDrSysCityInterfaceUser() {
  125 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_CITY_INTERFACE_USER);
  126 + }
  127 +
  128 + public static String getDrSysCityInterfacePassword() {
  129 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_CITY_INTERFACE_PASSWORD);
  130 + }
  131 +
  132 + public static String getDrSysAreaInterfaceUrl() {
  133 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_AREA_INTERFACE_URL);
  134 + }
  135 +
  136 + public static String getDrSysAreaInterfaceUser() {
  137 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_AREA_INTERFACE_USER);
  138 + }
  139 +
  140 + public static String getDrSysAreaInterfacePassword() {
  141 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_AREA_INTERFACE_PASSWORD);
  142 + }
  143 +
  144 + public static String getDrSysCityInterfaceBakUrl() {
  145 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_CITY_INTERFACE_BAK_URL);
  146 + }
  147 +
  148 + public static String getDrSysCityInterfaceBakUrl1() {
  149 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_CITY_INTERFACE_BAK_URL1);
  150 + }
  151 +
  152 + public static String getDrSysCityInterfaceBakUser() {
  153 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_CITY_INTERFACE_BAK_USER);
  154 + }
  155 +
  156 + public static String getDrSysCityInterfaceBakPassword() {
  157 + return systemParamService1.getValue(SystemParamKeys.DR_SYS_CITY_INTERFACE_BAK_PASSWORD);
  158 + }
  159 +
116 @Override 160 @Override
117 public void afterPropertiesSet() throws Exception { 161 public void afterPropertiesSet() throws Exception {
118 systemParamService1 = systemParamService; 162 systemParamService1 = systemParamService;
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
3 import com.bsth.data.BasicData; 3 import com.bsth.data.BasicData;
  4 +import com.bsth.data.SystemParamCache;
4 import com.bsth.email.SendEmailController; 5 import com.bsth.email.SendEmailController;
5 import com.bsth.email.entity.EmailBean; 6 import com.bsth.email.entity.EmailBean;
6 import com.bsth.entity.*; 7 import com.bsth.entity.*;
@@ -22,10 +23,9 @@ import com.bsth.service.traffic.YgcBasicDataService; @@ -22,10 +23,9 @@ import com.bsth.service.traffic.YgcBasicDataService;
22 import com.bsth.util.IpUtils; 23 import com.bsth.util.IpUtils;
23 import com.bsth.util.TimeUtils; 24 import com.bsth.util.TimeUtils;
24 import com.bsth.util.db.DBUtils_MS; 25 import com.bsth.util.db.DBUtils_MS;
25 -import com.bsth.webService.trafficManage.org.tempuri.Results;  
26 -import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;  
27 -import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;  
28 -import com.bsth.webService.trafficManage.qp.WebServiceSoap_PortType; 26 +import com.bsth.webService.trafficManage.up.org.tempuri.Results;
  27 +import com.bsth.webService.trafficManage.up.org.tempuri.WebServiceLocator;
  28 +import com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap;
29 import org.apache.commons.lang.StringEscapeUtils; 29 import org.apache.commons.lang.StringEscapeUtils;
30 import org.apache.commons.lang.StringUtils; 30 import org.apache.commons.lang.StringUtils;
31 import org.apache.commons.lang.time.DateUtils; 31 import org.apache.commons.lang.time.DateUtils;
@@ -134,20 +134,38 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -134,20 +134,38 @@ public class TrafficManageServiceImpl implements TrafficManageService{
134 private LineVersionsRepository lineVersionsRepository; 134 private LineVersionsRepository lineVersionsRepository;
135 135
136 // 运管处上传接口 136 // 运管处上传接口
137 - private com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap webServiceSoapUp;  
138 - private WebServiceSoap ssop ;  
139 - {  
140 - try {  
141 - ssop = new WebServiceLocator().getWebServiceSoap();  
142 - } catch (Exception e) {  
143 - e.printStackTrace();  
144 - }  
145 - } 137 + private WebServiceSoap ssop,ssop1;
  138 + private WebServiceSoap ssopBak,ssopBak1;
146 // 青浦接口 139 // 青浦接口
147 - private WebServiceSoap_PortType qp_ssop; 140 + private WebServiceSoap qp_ssop;
148 { 141 {
149 try { 142 try {
150 - qp_ssop = new com.bsth.webService.trafficManage.qp.WebServiceLocator().getWebServiceSoap(); 143 + WebServiceLocator locator = new WebServiceLocator();
  144 + String url = SystemParamCache.getDrSysCityInterfaceUrl();
  145 + if (StringUtils.isNotEmpty(url)) {
  146 + locator.setWebServiceSoapEndpointAddress(url);
  147 + ssop = locator.getWebServiceSoap();
  148 + }
  149 + url = SystemParamCache.getDrSysCityInterfaceUrl1();
  150 + if (StringUtils.isNotEmpty(url)) {
  151 + locator.setWebServiceSoapEndpointAddress(url);
  152 + ssop1 = locator.getWebServiceSoap();
  153 + }
  154 + url = SystemParamCache.getDrSysCityInterfaceBakUrl();
  155 + if (StringUtils.isNotEmpty(url)) {
  156 + locator.setWebServiceSoapEndpointAddress(url);
  157 + ssopBak = locator.getWebServiceSoap();
  158 + }
  159 + url = SystemParamCache.getDrSysCityInterfaceBakUrl1();
  160 + if (StringUtils.isNotEmpty(url)) {
  161 + locator.setWebServiceSoapEndpointAddress(url);
  162 + ssopBak1 = locator.getWebServiceSoap();
  163 + }
  164 + url = SystemParamCache.getDrSysAreaInterfaceUrl();
  165 + if (StringUtils.isNotEmpty(url)) {
  166 + locator.setWebServiceSoapEndpointAddress(url);
  167 + qp_ssop = locator.getWebServiceSoap();
  168 + }
151 } catch (Exception e) { 169 } catch (Exception e) {
152 e.printStackTrace(); 170 e.printStackTrace();
153 } 171 }
@@ -161,19 +179,19 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -161,19 +179,19 @@ public class TrafficManageServiceImpl implements TrafficManageService{
161 // 数字格式化 179 // 数字格式化
162 DecimalFormat format = new DecimalFormat("0.00"); 180 DecimalFormat format = new DecimalFormat("0.00");
163 181
164 - // 用户名  
165 - private final String userNameOther = "user";  
166 - // 密码  
167 - private final String passwordOther = "user"; 182 + private final String userNameOther = SystemParamCache.getDrSysCityInterfaceUser();
  183 +
  184 + private final String passwordOther = SystemParamCache.getDrSysCityInterfacePassword();
  185 +
  186 + private final String userNameUp = SystemParamCache.getDrSysCityInterfaceBakUser();
  187 +
  188 + private final String passwordUp = SystemParamCache.getDrSysCityInterfaceBakPassword();
168 189
169 - private final String userNameOther_qp = "china317"; 190 + private final String userNameOther_qp = SystemParamCache.getDrSysAreaInterfaceUser();
  191 +
  192 + private final String passwordOther_qp = SystemParamCache.getDrSysAreaInterfacePassword();
170 193
171 - private final String passwordOther_qp = "china317";  
172 194
173 - // 用户名  
174 - private final String userNameUp = "user";  
175 - // 密码  
176 - private final String passwordUp = "user";  
177 195
178 // 接收邮件人 196 // 接收邮件人
179 @Value("${waybill.emails}") 197 @Value("${waybill.emails}")
@@ -182,17 +200,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -182,17 +200,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{
182 // 记录路单上线的成功、失败线路数 200 // 记录路单上线的成功、失败线路数
183 private Integer countSuccess,countFailure; 201 private Integer countSuccess,countFailure;
184 202
185 - private synchronized com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap getWebServiceSoapUp(){  
186 - try {  
187 - if(webServiceSoapUp == null){  
188 - webServiceSoapUp = new com.bsth.webService.trafficManage.up.org.tempuri.WebServiceLocator().getWebServiceSoap();  
189 - }  
190 - }catch (Exception e){  
191 - e.printStackTrace();  
192 - }finally {  
193 - return webServiceSoapUp;  
194 - }  
195 - }  
196 /** 203 /**
197 * 上传线路信息 204 * 上传线路信息
198 */ 205 */
@@ -272,11 +279,16 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -272,11 +279,16 @@ public class TrafficManageServiceImpl implements TrafficManageService{
272 return "0"; 279 return "0";
273 } 280 }
274 // 调用上传方法 281 // 调用上传方法
275 - if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,sBuffer.toString()).isSuccess()){ 282 + if(ssop1.setXL(userNameOther,passwordOther,sBuffer.toString()).isSuccess()){
276 result = "success"; 283 result = "success";
277 }else{ 284 }else{
278 result = "failure"; 285 result = "failure";
279 } 286 }
  287 + if (ssopBak1.setXL(userNameOther,passwordOther,sBuffer.toString()).isSuccess()) {
  288 + result += ",success";
  289 + } else {
  290 + result += ",failure";
  291 + }
280 logger.info("setXL:"+sBuffer.toString()); 292 logger.info("setXL:"+sBuffer.toString());
281 logger.info("setXL:"+result); 293 logger.info("setXL:"+result);
282 } 294 }
@@ -369,6 +381,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -369,6 +381,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{
369 if(ssop.setCL(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ 381 if(ssop.setCL(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
370 result = "success"; 382 result = "success";
371 } 383 }
  384 + if (ssopBak != null && ssopBak.setCL(userNameOther, passwordOther, sBuffer.toString()).isSuccess()) {
  385 + result += ",success";
  386 + }
372 } catch (Exception e) { 387 } catch (Exception e) {
373 logger.error("setCL:",e); 388 logger.error("setCL:",e);
374 e.printStackTrace(); 389 e.printStackTrace();
@@ -406,7 +421,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -406,7 +421,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{
406 sBuffer.append("</SJs>"); 421 sBuffer.append("</SJs>");
407 if(ssop.setSJ(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ 422 if(ssop.setSJ(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
408 result = "success"; 423 result = "success";
409 - }; 424 + }
  425 + if (ssopBak != null && ssopBak.setSJ(userNameOther, passwordOther, sBuffer.toString()).isSuccess()) {
  426 + result += ",success";
  427 + }
410 } catch (Exception e) { 428 } catch (Exception e) {
411 logger.error("setSJ:",e); 429 logger.error("setSJ:",e);
412 e.printStackTrace(); 430 e.printStackTrace();
@@ -448,6 +466,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -448,6 +466,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
448 String str = "", xlbm = null, oldXlbm = null; 466 String str = "", xlbm = null, oldXlbm = null;
449 List<Map<String,Object>> listGroup = null; 467 List<Map<String,Object>> listGroup = null;
450 int scount = 0, ccount = 0; 468 int scount = 0, ccount = 0;
  469 + int scount1 = 0, ccount1 = 0;
451 long start = System.currentTimeMillis(); 470 long start = System.currentTimeMillis();
452 try { 471 try {
453 // 计数器 472 // 计数器
@@ -489,6 +508,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -489,6 +508,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
489 Line line = code2line.get(lineCode); 508 Line line = code2line.get(lineCode);
490 if(line == null || line.getInUse() == null || line.getInUse() == 0){ 509 if(line == null || line.getInUse() == null || line.getInUse() == 0){
491 ccount++; 510 ccount++;
  511 + ccount1++;
492 continue; 512 continue;
493 } 513 }
494 if(counter % per == 0){ 514 if(counter % per == 0){
@@ -567,7 +587,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -567,7 +587,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
567 sf.append("</DLDS>"); 587 sf.append("</DLDS>");
568 // 去掉'号 588 // 去掉'号
569 str = sf.toString().replace("'",""); 589 str = sf.toString().replace("'","");
570 - scount += invokeSetLD(str, counter); 590 + scount += invokeSetLD(ssop, str, counter, "master");
  591 + scount1 += invokeSetLD(ssopBak, str, counter, "slave");
571 counter = 0; 592 counter = 0;
572 } 593 }
573 } 594 }
@@ -576,7 +597,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -576,7 +597,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{
576 sf.append("</DLDS>"); 597 sf.append("</DLDS>");
577 // 去掉'号 598 // 去掉'号
578 str = sf.toString().replace("'",""); 599 str = sf.toString().replace("'","");
579 - scount += invokeSetLD(str, counter); 600 + scount += invokeSetLD(ssop, str, counter, "master");
  601 + if (ssopBak != null) {
  602 + scount1 += invokeSetLD(ssopBak, str, counter, "slave");
  603 + }
580 } 604 }
581 } catch (Exception e) { 605 } catch (Exception e) {
582 e.printStackTrace(); 606 e.printStackTrace();
@@ -587,7 +611,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -587,7 +611,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
587 //发送邮件 611 //发送邮件
588 EmailBean mail = new EmailBean(); 612 EmailBean mail = new EmailBean();
589 mail.setSubject(IpUtils.getLocalIpAddress() +":路单日志数据"+date); 613 mail.setSubject(IpUtils.getLocalIpAddress() +":路单日志数据"+date);
590 - mail.setContent("总数:" + (listGroup == null ? 0 : listGroup.size()) + "<br/>成功数:" + scount + "<br/>跳过数:" + ccount + "<br/>耗时:" + (System.currentTimeMillis() - start)); 614 + mail.setContent("总数:" + (listGroup == null ? 0 : listGroup.size()) + "<br/>成功数:" + scount + "," + scount1 + "<br/>跳过数:" + ccount + "," + ccount1 + "<br/>耗时:" + (System.currentTimeMillis() - start));
591 sendEmailController.sendMail(email, mail); 615 sendEmailController.sendMail(email, mail);
592 } 616 }
593 logger.info("setLD-sendMail:邮件发送成功!"); 617 logger.info("setLD-sendMail:邮件发送成功!");
@@ -605,21 +629,24 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -605,21 +629,24 @@ public class TrafficManageServiceImpl implements TrafficManageService{
605 * @param counter 分组数 629 * @param counter 分组数
606 * @return 成功返回counter 失败返回0 630 * @return 成功返回counter 失败返回0
607 */ 631 */
608 - private int invokeSetLD(String xml, int counter) { 632 + private int invokeSetLD(WebServiceSoap ssop, String xml, int counter, String flag) {
  633 + if ("slave".equals(flag)) {
  634 + System.out.println("slave");
  635 + }
609 for (int i = 0;i < 10;i++) { 636 for (int i = 0;i < 10;i++) {
610 try { 637 try {
611 Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(xml)); 638 Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(xml));
612 if (results.isSuccess()) { 639 if (results.isSuccess()) {
613 - logger.info("setLD: " + xml); 640 + logger.info("{} setLD: {}", flag, xml);
614 logger.info("setLD: 成功"); 641 logger.info("setLD: 成功");
615 return counter; 642 return counter;
616 } else if (i == 9) { 643 } else if (i == 9) {
617 - logger.error("setLD: " + xml); 644 + logger.error("{} setLD: {}", flag, xml);
618 logger.error("setLD: 失败," + results.getMessage()); 645 logger.error("setLD: 失败," + results.getMessage());
619 } 646 }
620 Thread.sleep(2000); 647 Thread.sleep(2000);
621 } catch (Exception e) { 648 } catch (Exception e) {
622 - logger.error("运管处接口调用异常", e); 649 + logger.error("{} 运管处接口调用异常", flag, e);
623 try { 650 try {
624 Thread.sleep(2000); 651 Thread.sleep(2000);
625 } catch (InterruptedException ex) { 652 } catch (InterruptedException ex) {
@@ -666,8 +693,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -666,8 +693,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
666 ygsXml.append("</DLDS>"); 693 ygsXml.append("</DLDS>");
667 try { 694 try {
668 logger.info("xml:"+StringEscapeUtils.unescapeHtml(ygsXml.toString().replace("'",""))); 695 logger.info("xml:"+StringEscapeUtils.unescapeHtml(ygsXml.toString().replace("'","")));
669 - com.bsth.webService.trafficManage.qp.Results res  
670 - = qp_ssop.setLD(userNameOther_qp,passwordOther_qp,StringEscapeUtils.unescapeHtml(ygsXml.toString().replace("'",""))); 696 + Results res = qp_ssop.setLD(userNameOther_qp,passwordOther_qp,StringEscapeUtils.unescapeHtml(ygsXml.toString().replace("'","")));
671 logger.info("青浦路单是否上传成功:"+res.isSuccess()); 697 logger.info("青浦路单是否上传成功:"+res.isSuccess());
672 }catch (Exception e){ 698 }catch (Exception e){
673 logger.error("青浦路单上传异常", e); 699 logger.error("青浦路单上传异常", e);
@@ -758,8 +784,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -758,8 +784,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
758 // 发送到青浦运管所 784 // 发送到青浦运管所
759 try { 785 try {
760 logger.info("xml:"+StringEscapeUtils.unescapeHtml(ygsXml.toString().replace("'",""))); 786 logger.info("xml:"+StringEscapeUtils.unescapeHtml(ygsXml.toString().replace("'","")));
761 - com.bsth.webService.trafficManage.qp.Results res  
762 - = qp_ssop.setLD(userNameOther_qp,passwordOther_qp,StringEscapeUtils.unescapeHtml(ygsXml.toString().replace("'",""))); 787 + Results res = qp_ssop.setLD(userNameOther_qp,passwordOther_qp,StringEscapeUtils.unescapeHtml(ygsXml.toString().replace("'","")));
763 logger.info("青浦路单是否上传成功1:"+res.isSuccess()); 788 logger.info("青浦路单是否上传成功1:"+res.isSuccess());
764 }catch (Exception e){ 789 }catch (Exception e){
765 logger.error("青浦路单上传异常1", e); 790 logger.error("青浦路单上传异常1", e);
@@ -772,7 +797,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -772,7 +797,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{
772 for (StackTraceElement traceElement : e.getStackTrace()){ 797 for (StackTraceElement traceElement : e.getStackTrace()){
773 logFailure.append("\r\t").append(traceElement); 798 logFailure.append("\r\t").append(traceElement);
774 } 799 }
775 - e.printStackTrace();  
776 } 800 }
777 801
778 return result; 802 return result;
@@ -838,6 +862,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -838,6 +862,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{
838 if(rss.isSuccess()){ 862 if(rss.isSuccess()){
839 result = "success"; 863 result = "success";
840 } 864 }
  865 + if (ssopBak != null && ssopBak.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(tmp)).isSuccess()) {
  866 + result += ",success";
  867 + }
841 } catch (Exception e) { 868 } catch (Exception e) {
842 logger.error("setLD:",e); 869 logger.error("setLD:",e);
843 e.printStackTrace(); 870 e.printStackTrace();
@@ -939,6 +966,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -939,6 +966,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{
939 if(ssop.setLCYH(userNameOther, passwordOther, sf.toString()).isSuccess()){ 966 if(ssop.setLCYH(userNameOther, passwordOther, sf.toString()).isSuccess()){
940 result = "success"; 967 result = "success";
941 } 968 }
  969 + if (ssopBak != null && ssopBak.setLCYH(userNameOther, passwordOther, sf.toString()).isSuccess()) {
  970 + result += ",success";
  971 + }
942 } catch (Exception e) { 972 } catch (Exception e) {
943 logger.error("setLCYH:",e); 973 logger.error("setLCYH:",e);
944 e.printStackTrace(); 974 e.printStackTrace();
@@ -1043,6 +1073,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1043,6 +1073,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1043 if(ssop.setDDRB(userNameOther, passwordOther, sf.toString()).isSuccess()){ 1073 if(ssop.setDDRB(userNameOther, passwordOther, sf.toString()).isSuccess()){
1044 result = "success"; 1074 result = "success";
1045 } 1075 }
  1076 + if (ssopBak != null && ssopBak.setDDRB(userNameOther, passwordOther, sf.toString()).isSuccess()) {
  1077 + result += ",success";
  1078 + }
1046 } catch (Exception e) { 1079 } catch (Exception e) {
1047 logger.error("setDDRB:",e); 1080 logger.error("setDDRB:",e);
1048 e.printStackTrace(); 1081 e.printStackTrace();
@@ -1161,6 +1194,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1161,6 +1194,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1161 if(ssop.setJHBC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ 1194 if(ssop.setJHBC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
1162 result = "success"; 1195 result = "success";
1163 } 1196 }
  1197 + if (ssopBak != null && ssopBak.setJHBC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()) {
  1198 + result += ",success";
  1199 + }
1164 } catch (Exception e) { 1200 } catch (Exception e) {
1165 logger.error("setJHBC:",e); 1201 logger.error("setJHBC:",e);
1166 e.printStackTrace(); 1202 e.printStackTrace();
@@ -1351,6 +1387,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1351,6 +1387,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1351 result = "上传失败"; 1387 result = "上传失败";
1352 state = "0"; 1388 state = "0";
1353 } 1389 }
  1390 + if (ssopBak != null) {
  1391 + if (ssopBak.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()) {
  1392 + result += ",上传成功";
  1393 + } else {
  1394 + result += ",上传失败";
  1395 + }
  1396 + }
1354 logger.info("xml:" + sBuffer.toString()); 1397 logger.info("xml:" + sBuffer.toString());
1355 logger.info("上传结果:" + result); 1398 logger.info("上传结果:" + result);
1356 // 保存运管处上传记录 1399 // 保存运管处上传记录
@@ -1497,6 +1540,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1497,6 +1540,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1497 if(ssop.setXLPC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ 1540 if(ssop.setXLPC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
1498 result = "success"; 1541 result = "success";
1499 } 1542 }
  1543 + if (ssopBak != null && ssopBak.setXLPC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()) {
  1544 + result += ",success";
  1545 + }
1500 } catch (Exception e) { 1546 } catch (Exception e) {
1501 logger.error("setXLPC:",e); 1547 logger.error("setXLPC:",e);
1502 e.printStackTrace(); 1548 e.printStackTrace();
@@ -1557,6 +1603,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1557,6 +1603,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1557 if(ssop.setCS(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ 1603 if(ssop.setCS(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
1558 result = "success"; 1604 result = "success";
1559 } 1605 }
  1606 + if (ssopBak != null && ssopBak.setCS(userNameOther, passwordOther, sBuffer.toString()).isSuccess()) {
  1607 + result += ",success";
  1608 + }
1560 } catch (Exception e) { 1609 } catch (Exception e) {
1561 logger.error("setCS:",e); 1610 logger.error("setCS:",e);
1562 e.printStackTrace(); 1611 e.printStackTrace();
src/main/resources/static/pages/trafficManage/js/lineStationUpload.js
1 -/**  
2 - *  
3 - * @JSName : common.js(运管功能公共js)  
4 - *  
5 - * @Author : bsth@lq  
6 - *  
7 - * @Description : TODO(运管功能公共js)  
8 - *  
9 - * @Data : 2016年6月29日 上午9:21:17  
10 - *  
11 - * @Version 公交调度系统BS版 0.1  
12 - *  
13 - */  
14 -  
15 -(function(){  
16 - function getComp(cb) {  
17 - $.get('/user/companyData',null,function(rs) {  
18 - return cb && cb(rs);  
19 - });  
20 - }  
21 -  
22 - initLineSelect2();  
23 -  
24 - function initLineSelect2(compD) {  
25 - getComp(function(rs) {  
26 - var params = {};  
27 - if(rs.length>0) {  
28 - var compA = new Array();  
29 - for(var c = 0 ; c<rs.length;c++) {  
30 - var comC = rs[c].companyCode;  
31 - var child = rs[c].children;  
32 - if(child.length>0) {  
33 - for(var d = 0 ;d< child.length;d++) {  
34 - compA.push(comC + '_' + child[d].code);  
35 - }  
36 - }else {  
37 - compA.push(comC);  
38 - }  
39 - }  
40 - params.cgsbm_in = compA.toString();  
41 - }  
42 - params["remove_ne"] = 1;  
43 - // 填充线路拉框选择值  
44 - $get('/line/all', params, function(array){  
45 - var len_ = array.length,paramsD = new Array();  
46 - if(len_>0) {  
47 - $.each(array, function(i, g){  
48 - if(g.name!='' || g.name != null) {  
49 - paramsD.push({'id':g.id ,'text':g.name});  
50 - }  
51 - });  
52 - initPinYinSelect2($('#line'),paramsD,function(selector) {  
53 - selector.select2("val", storage.xlName_AgursData);  
54 - });  
55 - }  
56 - });  
57 - });  
58 - }  
59 -  
60 - // 绑定查询事件  
61 - $("#search").click(searchM);  
62 - // 绑定上传事件  
63 - $("#upload").click(uploadM);  
64 - // 绑定全部移到右边事件  
65 - $("#to_right").click(function(){  
66 - $("#left_div tbody tr:not(.muted)").click();  
67 - });  
68 - // 绑定全部移到左边事件  
69 - $("#to_left").click(function(){  
70 - $("#right_div tbody tr:not(.muted)").click();  
71 - });  
72 - // 查询方法  
73 - function searchM() {  
74 - // 清空已选定列表  
75 - $("#right_div table tbody").empty();  
76 - var params = {};  
77 - // 取得输入框的值  
78 - var inputs = $(".param input,select");  
79 - // 遍历数组  
80 - $.each(inputs, function(i, element) {  
81 - params[$(element).attr("name")] = $(element).val();  
82 - });  
83 - var i = layer.load(2);  
84 - $get('/line', params, function(data) {  
85 - var bodyHtm = template('lineStation_list_temp', {  
86 - list : data.content  
87 - });  
88 - $("#left_div table tbody").empty();  
89 - $("#left_div table tbody").append(bodyHtm);  
90 - $("#left_div tbody tr:not(.muted)").click(_click);  
91 - layer.close(i);  
92 - });  
93 - }  
94 -  
95 - // 上传方法  
96 - function uploadM() {  
97 - // 取得输入框的值  
98 - var trs = $("#right_div tbody tr input");  
99 - if (trs.length == 0) {  
100 - alert("请选择线路");  
101 - return;  
102 - }else if(trs.length > 1){  
103 - alert("一次只能上传一条线路");  
104 - return;  
105 - }  
106 - var ids ="0,";  
107 - // 遍历数组  
108 - $.each(trs, function(i, element) {  
109 - ids +=$(element).val()+",";  
110 - });  
111 - var params = {"ids":ids};  
112 - $.ajax({  
113 - type: 'get',url: '/trmg/setXL',  
114 - data: params ,dataType:'text',  
115 - success:function(data) {  
116 - if(data == 'success'){  
117 - alert("上传成功");  
118 - }else if(data == '0'){  
119 - alert("上传失败,线路编号有0");  
120 - }else{  
121 - alert("上传失败");  
122 - }  
123 -  
124 - }, error : function() {  
125 - alert("操作失败");  
126 - }  
127 -  
128 - });  
129 - }  
130 -  
131 - // 表格行的单击事件  
132 - function _click() {  
133 - var tmpTr = $(this).clone();  
134 - tmpTr.unbind("click").click(_click);  
135 - // 判断父DIV的ID  
136 - if ($(this).closest(".table-container").attr("id") == "left_div") {  
137 - // 把要移动行的class=".seq"的HTML的内容设成另一分类的最后一个序号  
138 - $(".seq",tmpTr).html($("#right_div tbody tr:not(.muted)").length + 1);  
139 - $("#right_div tbody").append(tmpTr);  
140 - nextAllChildSeqMinusOne($(this));  
141 - } else {  
142 - // 把要移动行的class=".seq"的HTML的内容设成另一分类的最后一个序号  
143 - $(".seq",tmpTr).html($("#left_div tbody tr:not(.muted)").length + 1);  
144 - $("#left_div tbody").append(tmpTr);  
145 - nextAllChildSeqMinusOne($(this));  
146 - }  
147 - $(this).remove();  
148 - }  
149 -  
150 - // 后面所有兄弟节点的中class=".seq"的HTML的内容自减 1  
151 - function nextAllChildSeqMinusOne(theElement){  
152 - $.each(theElement.nextAll(),function(i,e){  
153 - $(".seq",e).html($(".seq",e).html() - 1);  
154 - });  
155 - }  
156 - // 保存左边空表格  
157 - var leftDivTemplate = $("#left_div table").clone(true);  
158 - // 把左边表格的格式复制到右边  
159 - $("#right_div").append(leftDivTemplate);  
160 - 1 +/**
  2 + *
  3 + * @JSName : common.js(运管功能公共js)
  4 + *
  5 + * @Author : bsth@lq
  6 + *
  7 + * @Description : TODO(运管功能公共js)
  8 + *
  9 + * @Data : 2016年6月29日 上午9:21:17
  10 + *
  11 + * @Version 公交调度系统BS版 0.1
  12 + *
  13 + */
  14 +
  15 +(function(){
  16 + function getComp(cb) {
  17 + $.get('/user/companyData',null,function(rs) {
  18 + return cb && cb(rs);
  19 + });
  20 + }
  21 +
  22 + initLineSelect2();
  23 +
  24 + function initLineSelect2(compD) {
  25 + getComp(function(rs) {
  26 + var params = {};
  27 + if(rs.length>0) {
  28 + var compA = new Array();
  29 + for(var c = 0 ; c<rs.length;c++) {
  30 + var comC = rs[c].companyCode;
  31 + var child = rs[c].children;
  32 + if(child.length>0) {
  33 + for(var d = 0 ;d< child.length;d++) {
  34 + compA.push(comC + '_' + child[d].code);
  35 + }
  36 + }else {
  37 + compA.push(comC);
  38 + }
  39 + }
  40 + params.cgsbm_in = compA.toString();
  41 + }
  42 + params["remove_ne"] = 1;
  43 + // 填充线路拉框选择值
  44 + $get('/line/all', params, function(array){
  45 + var len_ = array.length,paramsD = new Array();
  46 + if(len_>0) {
  47 + $.each(array, function(i, g){
  48 + if(g.name!='' || g.name != null) {
  49 + paramsD.push({'id':g.id ,'text':g.name});
  50 + }
  51 + });
  52 + initPinYinSelect2($('#line'),paramsD,function(selector) {
  53 + selector.select2("val", storage.xlName_AgursData);
  54 + });
  55 + }
  56 + });
  57 + });
  58 + }
  59 +
  60 + // 绑定查询事件
  61 + $("#search").click(searchM);
  62 + // 绑定上传事件
  63 + $("#upload").click(uploadM);
  64 + // 绑定全部移到右边事件
  65 + $("#to_right").click(function(){
  66 + $("#left_div tbody tr:not(.muted)").click();
  67 + });
  68 + // 绑定全部移到左边事件
  69 + $("#to_left").click(function(){
  70 + $("#right_div tbody tr:not(.muted)").click();
  71 + });
  72 + // 查询方法
  73 + function searchM() {
  74 + // 清空已选定列表
  75 + $("#right_div table tbody").empty();
  76 + var params = {};
  77 + // 取得输入框的值
  78 + var inputs = $(".param input,select");
  79 + // 遍历数组
  80 + $.each(inputs, function(i, element) {
  81 + params[$(element).attr("name")] = $(element).val();
  82 + });
  83 + var i = layer.load(2);
  84 + $get('/line', params, function(data) {
  85 + var bodyHtm = template('lineStation_list_temp', {
  86 + list : data.content
  87 + });
  88 + $("#left_div table tbody").empty();
  89 + $("#left_div table tbody").append(bodyHtm);
  90 + $("#left_div tbody tr:not(.muted)").click(_click);
  91 + layer.close(i);
  92 + });
  93 + }
  94 +
  95 + // 上传方法
  96 + function uploadM() {
  97 + // 取得输入框的值
  98 + var trs = $("#right_div tbody tr input");
  99 + if (trs.length == 0) {
  100 + alert("请选择线路");
  101 + return;
  102 + }else if(trs.length > 1){
  103 + alert("一次只能上传一条线路");
  104 + return;
  105 + }
  106 + var ids ="0,";
  107 + // 遍历数组
  108 + $.each(trs, function(i, element) {
  109 + ids +=$(element).val()+",";
  110 + });
  111 + var params = {"ids":ids};
  112 + $.ajax({
  113 + type: 'get',url: '/trmg/setXL',
  114 + data: params ,dataType:'text',
  115 + success:function(data) {
  116 + if(data.indexOf('success,') > -1){
  117 + alert("上传成功");
  118 + }else if(data == '0'){
  119 + alert("上传失败,线路编号有0");
  120 + }else{
  121 + alert("上传失败");
  122 + }
  123 +
  124 + }, error : function() {
  125 + alert("操作失败");
  126 + }
  127 +
  128 + });
  129 + }
  130 +
  131 + // 表格行的单击事件
  132 + function _click() {
  133 + var tmpTr = $(this).clone();
  134 + tmpTr.unbind("click").click(_click);
  135 + // 判断父DIV的ID
  136 + if ($(this).closest(".table-container").attr("id") == "left_div") {
  137 + // 把要移动行的class=".seq"的HTML的内容设成另一分类的最后一个序号
  138 + $(".seq",tmpTr).html($("#right_div tbody tr:not(.muted)").length + 1);
  139 + $("#right_div tbody").append(tmpTr);
  140 + nextAllChildSeqMinusOne($(this));
  141 + } else {
  142 + // 把要移动行的class=".seq"的HTML的内容设成另一分类的最后一个序号
  143 + $(".seq",tmpTr).html($("#left_div tbody tr:not(.muted)").length + 1);
  144 + $("#left_div tbody").append(tmpTr);
  145 + nextAllChildSeqMinusOne($(this));
  146 + }
  147 + $(this).remove();
  148 + }
  149 +
  150 + // 后面所有兄弟节点的中class=".seq"的HTML的内容自减 1
  151 + function nextAllChildSeqMinusOne(theElement){
  152 + $.each(theElement.nextAll(),function(i,e){
  153 + $(".seq",e).html($(".seq",e).html() - 1);
  154 + });
  155 + }
  156 + // 保存左边空表格
  157 + var leftDivTemplate = $("#left_div table").clone(true);
  158 + // 把左边表格的格式复制到右边
  159 + $("#right_div").append(leftDivTemplate);
  160 +
161 })(); 161 })();
162 \ No newline at end of file 162 \ No newline at end of file