oa 发票附件推送

This commit is contained in:
刘鹏 2024-10-16 18:47:42 +08:00
parent a424ca805f
commit 359a860e79
9 changed files with 7288 additions and 72 deletions

View File

@ -135,6 +135,12 @@ public class AppflgConstant {
public static final String OA_FORMID = "oa_formId"; public static final String OA_FORMID = "oa_formId";
public static final String OA_USERID = "oa_userid"; public static final String OA_USERID = "oa_userid";
public static final String appId = "appId";
public static final String appSecret = "appSecret";
public static final String tenantid = "tenantid";
public static final String accountId = "accountId";
public static final String user = "user";
/** /**
* 系统编码 * 系统编码
*/ */

View File

@ -0,0 +1,38 @@
/**
* Copyright 2024 bejson.com
*/
package shkd.fi.fi.common.cosmic.accesstoken;
/**
* Auto-generated: 2024-10-14 13:57:45
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class AccessTokenResult {
private Data data;
private String state;
private boolean status;
public void setData(Data data) {
this.data = data;
}
public Data getData() {
return data;
}
public void setState(String state) {
this.state = state;
}
public String getState() {
return state;
}
public void setStatus(boolean status) {
this.status = status;
}
public boolean getStatus() {
return status;
}
}

View File

@ -0,0 +1,54 @@
/**
* Copyright 2024 bejson.com
*/
package shkd.fi.fi.common.cosmic.accesstoken;
/**
* Auto-generated: 2024-10-14 13:57:45
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class Data {
private String access_token;
private boolean success;
private String error_desc;
private long expire_time;
private String error_code;
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getAccess_token() {
return access_token;
}
public void setSuccess(boolean success) {
this.success = success;
}
public boolean getSuccess() {
return success;
}
public void setError_desc(String error_desc) {
this.error_desc = error_desc;
}
public String getError_desc() {
return error_desc;
}
public void setExpire_time(long expire_time) {
this.expire_time = expire_time;
}
public long getExpire_time() {
return expire_time;
}
public void setError_code(String error_code) {
this.error_code = error_code;
}
public String getError_code() {
return error_code;
}
}

View File

@ -0,0 +1,38 @@
/**
* Copyright 2024 bejson.com
*/
package shkd.fi.fi.common.cosmic.apptoken;
/**
* Auto-generated: 2024-10-14 13:39:2
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class AppTokenResult {
private Data data;
private String state;
private boolean status;
public void setData(Data data) {
this.data = data;
}
public Data getData() {
return data;
}
public void setState(String state) {
this.state = state;
}
public String getState() {
return state;
}
public void setStatus(boolean status) {
this.status = status;
}
public boolean getStatus() {
return status;
}
}

View File

@ -0,0 +1,54 @@
/**
* Copyright 2024 bejson.com
*/
package shkd.fi.fi.common.cosmic.apptoken;
/**
* Auto-generated: 2024-10-14 13:39:2
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class Data {
private String app_token;
private boolean success;
private String error_desc;
private long expire_time;
private String error_code;
public void setApp_token(String app_token) {
this.app_token = app_token;
}
public String getApp_token() {
return app_token;
}
public void setSuccess(boolean success) {
this.success = success;
}
public boolean getSuccess() {
return success;
}
public void setError_desc(String error_desc) {
this.error_desc = error_desc;
}
public String getError_desc() {
return error_desc;
}
public void setExpire_time(long expire_time) {
this.expire_time = expire_time;
}
public long getExpire_time() {
return expire_time;
}
public void setError_code(String error_code) {
this.error_code = error_code;
}
public String getError_code() {
return error_code;
}
}

View File

@ -0,0 +1,102 @@
/**
* ModeDateServiceCallbackHandler.java
*
* <p>This file was auto-generated from WSDL by the Apache Axis2 version: 1.8.0 Built on : Aug 01,
* 2021 (07:27:19 HST)
*/
package shkd.fi.fi.oa;
/**
* ModeDateServiceCallbackHandler Callback class, Users can extend this class and implement their
* own receiveResult and receiveError methods.
*/
public abstract class ModeDateServiceCallbackHandler {
protected Object clientData;
/**
* User can pass in any object that needs to be accessed once the NonBlocking Web service call is
* finished and appropriate method of this CallBack is called.
*
* @param clientData Object mechanism by which the user can pass in user data that will be
* avilable at the time this callback is called.
*/
public ModeDateServiceCallbackHandler(Object clientData) {
this.clientData = clientData;
}
/** Please use this constructor if you don't want to set any clientData */
public ModeDateServiceCallbackHandler() {
this.clientData = null;
}
/** Get the client data */
public Object getClientData() {
return clientData;
}
/**
* auto generated Axis2 call back method for deleteModeDataById method override this method for
* handling normal response from deleteModeDataById operation
*/
public void receiveResultdeleteModeDataById(
ModeDateServiceStub.DeleteModeDataByIdResponse result) {}
/**
* auto generated Axis2 Error handler override this method for handling error response from
* deleteModeDataById operation
*/
public void receiveErrordeleteModeDataById(Exception e) {}
/**
* auto generated Axis2 call back method for getModeDataByID method override this method for
* handling normal response from getModeDataByID operation
*/
public void receiveResultgetModeDataByID(
ModeDateServiceStub.GetModeDataByIDResponse result) {}
/**
* auto generated Axis2 Error handler override this method for handling error response from
* getModeDataByID operation
*/
public void receiveErrorgetModeDataByID(Exception e) {}
/**
* auto generated Axis2 call back method for getAllModeDataCount method override this method for
* handling normal response from getAllModeDataCount operation
*/
public void receiveResultgetAllModeDataCount(
ModeDateServiceStub.GetAllModeDataCountResponse result) {}
/**
* auto generated Axis2 Error handler override this method for handling error response from
* getAllModeDataCount operation
*/
public void receiveErrorgetAllModeDataCount(Exception e) {}
/**
* auto generated Axis2 call back method for saveModeData method override this method for handling
* normal response from saveModeData operation
*/
public void receiveResultsaveModeData(
ModeDateServiceStub.SaveModeDataResponse result) {}
/**
* auto generated Axis2 Error handler override this method for handling error response from
* saveModeData operation
*/
public void receiveErrorsaveModeData(Exception e) {}
/**
* auto generated Axis2 call back method for getAllModeDataList method override this method for
* handling normal response from getAllModeDataList operation
*/
public void receiveResultgetAllModeDataList(
ModeDateServiceStub.GetAllModeDataListResponse result) {}
/**
* auto generated Axis2 Error handler override this method for handling error response from
* getAllModeDataList operation
*/
public void receiveErrorgetAllModeDataList(Exception e) {}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
package shkd.fi.fi.oa;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import org.apache.axis2.context.ConfigurationContext;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
public class TestOA {
public static void main(String[] args) throws ServiceException, RemoteException, MalformedURLException {
ModeDateServiceStub stub = new ModeDateServiceStub("http://10.18.25.73//services/ModeDateService");
ModeDateServiceStub.SaveModeData saveModeData = new ModeDateServiceStub.SaveModeData();
StringBuffer xml = new StringBuffer();
xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ROOT><header><userid>1</userid><modeid>3281</modeid><id></id></header><search><condition /><right>Y</right></search><data id=\"\"><maintable><field><filedname>fphm</filedname><filedvalue>24312000000155251942</filedvalue></field><field><filedname>kpdw</filedname><filedvalue>上海海英格索兰压缩机有限公司</filedvalue></field><field><filedname>fpnr</filedname><filedvalue></filedvalue></field><field><filedname>fpze</filedname><filedvalue>922.0000000000</filedvalue></field><field><filedname>fplx</filedname><filedvalue>0</filedvalue></field><field><filedname>kprq</filedname><filedvalue>2024-05-30</filedvalue></field><field><filedname>zt</filedname><filedvalue>1</filedvalue></field><field><filedname>bhsje</filedname><filedvalue>815.9300000000</filedvalue></field><field><filedname>se</filedname><filedvalue>106.0700000000</filedvalue></field><field><filedname>shje</filedname><filedvalue>922.0000000000</filedvalue></field><field><filedname>sl</filedname><filedvalue>13</filedvalue></field><field><filedname>sfyf</filedname><filedvalue>1</filedvalue></field><field><filedname>fpsfdw</filedname><filedvalue>5621</filedvalue></field><field><filedname>sapkm</filedname><filedvalue></filedvalue></field><field><filedname>fj</filedname><filedvalue>http%3A%2F%2Finv.sh.coscoshipping.com%2Fierp%2FaccessTokenLogin.do%3Faccess_token%3D1977682080770822144_Uyz8kStlKYKs0K1beRlcd79RG3SLvvsTo2b516M8RR5uj4JLC39uu2gnp7f6uEm28gez9QDghOWS4TRJdTLhacFpEqxOcXxUnB42%26redirect%3Dhttp%3A%2F%2Finv.sh.coscoshipping.com%3A80%2Fierp%2Fattachment%2Fdownload.do%3Fpath%3D%2F1c6dd2b166004000%26kdedcba%3DVHBHRjZ5QnlYeUZGbldpNVhOZDFJQTJJSEo1Z0pxMU1GT0Y1eUg3dXF3QUZYQWFKeWd0bEZ6b0xyNjR5UzV1RH5%252BMTcyODg5ODg0NDIyMg%253D%253D%26accountId%3D1977682080770822144</filedvalue></field></maintable></data></ROOT>");
saveModeData.setIn0(xml.toString());
ModeDateServiceStub.SaveModeDataResponse saveModeDataResponse = stub.saveModeData(saveModeData);
String out = saveModeDataResponse.getOut();
System.out.println(out);
String s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
s+="<ROOT><return><id>10066604</id><returnnode>0</returnnode><returnmessage><![CDATA[操作成功!]]></returnmessage></return></ROOT>";
System.out.println(s);
if (s.contains("操作成功")) {
System.out.println("成功");
}else{
System.out.println("失败");
}
}
}

View File

@ -3,31 +3,28 @@ package shkd.fi.fi.task.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import kd.bos.context.RequestContext; import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.fileservice.FileServiceFactory;
import kd.bos.logging.Log; import kd.bos.logging.Log;
import kd.bos.logging.LogFactory; import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QCP; import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.AttachmentDto;
import kd.bos.servicehelper.AttachmentServiceHelper; import kd.bos.servicehelper.AttachmentServiceHelper;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.url.UrlService;
import kd.bos.util.HttpClientUtils; import kd.bos.util.HttpClientUtils;
import kd.bos.util.StringUtils; import kd.bos.util.StringUtils;
import org.apache.axis2.AxisFault;
import shkd.fi.fi.common.AppflgConstant; import shkd.fi.fi.common.AppflgConstant;
import shkd.fi.fi.common.chuli.InvoiceChuliReqBean; import shkd.fi.fi.common.cosmic.accesstoken.AccessTokenResult;
import shkd.fi.fi.common.chuli.InvoiceChuliResBean; import shkd.fi.fi.common.cosmic.apptoken.Data;
import shkd.fi.fi.opplugin.DzpzkOPPlugin; import shkd.fi.fi.common.cosmic.apptoken.AppTokenResult;
import shkd.fi.fi.oa.ModeDateServiceStub;
import shkd.fi.fi.util.DateUtils; import shkd.fi.fi.util.DateUtils;
import shkd.fi.fi.util.HttpUtils;
import shkd.fi.fi.util.LogBillUtils; import shkd.fi.fi.util.LogBillUtils;
import shkd.fi.fi.util.ParamsUtils; import shkd.fi.fi.util.ParamsUtils;
import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.rmi.RemoteException;
import java.util.*; import java.util.*;
/** /**
@ -51,11 +48,7 @@ public class OAInvoiceImpl {
filter4 = new QFilter("shkd_oastatus", QCP.not_equals, "1");//推送状态不等于已推送 filter4 = new QFilter("shkd_oastatus", QCP.not_equals, "1");//推送状态不等于已推送
} }
Map<String, String> paramsMap = ParamsUtils.getParamsMap(); Map<String, String> paramsMap = ParamsUtils.getParamsMap();
String oaurl = AppflgConstant.OA_INV_URL(paramsMap);
String oa_modeid = paramsMap.get(AppflgConstant.OA_MODEID);
String oa_formid = paramsMap.get(AppflgConstant.OA_FORMID);
String oa_userid = paramsMap.get(AppflgConstant.OA_USERID);
String domainContextUrl = paramsMap.get(AppflgConstant.KINGDEE_HOST);//UrlService.getDomainContextUrl();
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();
Map<Object, DynamicObject> gl_voucher = BusinessDataServiceHelper.loadFromCache("shkd_invoicereceipt", new QFilter[]{filter3.and(filter4)}); Map<Object, DynamicObject> gl_voucher = BusinessDataServiceHelper.loadFromCache("shkd_invoicereceipt", new QFilter[]{filter3.and(filter4)});
@ -64,44 +57,104 @@ public class OAInvoiceImpl {
for (Map.Entry<Object, DynamicObject> inoice : gl_voucher.entrySet()) { for (Map.Entry<Object, DynamicObject> inoice : gl_voucher.entrySet()) {
count = count + 1; count = count + 1;
DynamicObject inoiceObj = inoice.getValue(); DynamicObject inoiceObj = inoice.getValue();
result.append("").append(count).append("张单据,编号:").append(inoiceObj.getString("billno")).append(synData(domainContextUrl,oaurl,oa_userid,oa_modeid,oa_formid,inoiceObj,result)); result.append("").append(count).append("张单据,编号:").append(inoiceObj.getString("billno")).append(synData(paramsMap,inoiceObj,result));
} }
if(gl_voucher.isEmpty()){ if(gl_voucher.isEmpty()){
result.append("没有需要同步的数据"); result.append("没有需要同步的数据");
} }
LogBillUtils.SaveLogBill(AppflgConstant.OA_INV_URL(paramsMap), result.toString(), "推送OA发票池定时任务", "");
} }
public StringBuffer synData(String domainContextUrl,String oaurl, String oauserid,String oamodelid,String oaformid,DynamicObject invoiceBill,StringBuffer result) { public StringBuffer synData(Map<String, String> paramsMap,DynamicObject invoiceBill,StringBuffer result) {
DynamicObject shkd_refbill = invoiceBill.getDynamicObject("shkd_refbill"); DynamicObject shkd_refbill = invoiceBill.getDynamicObject("shkd_refbill");
DynamicObject ap_finapbill = BusinessDataServiceHelper.loadSingle(shkd_refbill.getPkValue(), "ap_finapbill"); DynamicObject ap_finapbill = BusinessDataServiceHelper.loadSingle(shkd_refbill.getPkValue(), "ap_finapbill");
DynamicObject org = ap_finapbill.getDynamicObject("org"); DynamicObject org = ap_finapbill.getDynamicObject("org");
String shkd_oa_orgid = org.getString("shkd_oa_orgid"); String shkd_oa_orgid = org.getString("shkd_oa_orgid");
List<Map<String, Object>> list = AttachmentServiceHelper.getAttachments("shkd_invoicereceipt", invoiceBill.getPkValue(), "attachmentpanel"); List<Map<String, Object>> list = AttachmentServiceHelper.getAttachments("shkd_invoicereceipt", invoiceBill.getPkValue(), "attachmentpanel");
String oa_url = AppflgConstant.OA_INV_URL(paramsMap);
String oa_modeid = paramsMap.get(AppflgConstant.OA_MODEID);
String oa_formid = paramsMap.get(AppflgConstant.OA_FORMID);
String oa_userid = paramsMap.get(AppflgConstant.OA_USERID);
String domainContextUrl = paramsMap.get(AppflgConstant.KINGDEE_HOST);//UrlService.getDomainContextUrl();
String getAppTokenUrl =domainContextUrl+"/ierp/api/getAppToken.do";
String getAccessTokenUrl =domainContextUrl+"/ierp/api/login.do";
String ssoDownloadUrl =domainContextUrl+"/ierp/accessTokenLogin.do?access_token=";
String access_token="";
String appToken="";
Map<String, String> header = new HashMap<>();
JSONObject body = new JSONObject();
body.put("appId",paramsMap.get(AppflgConstant.appId));
body.put("appSecret",paramsMap.get(AppflgConstant.appSecret));
body.put("tenantid",paramsMap.get(AppflgConstant.tenantid));
body.put("accountId",paramsMap.get(AppflgConstant.accountId));
body.put("language","zh_CN");
try {
String postjson = HttpClientUtils.postjson(getAppTokenUrl, header, body.toJSONString());
AppTokenResult getAppTokenResult = JSONObject.parseObject(postjson, AppTokenResult.class);
if(getAppTokenResult.getStatus()){
Data data = getAppTokenResult.getData();
appToken = data.getApp_token();
body = new JSONObject();
body.put("user",paramsMap.get(AppflgConstant.user));
body.put("apptoken",appToken);
body.put("tenantid",paramsMap.get(AppflgConstant.tenantid));
body.put("accountId",paramsMap.get(AppflgConstant.accountId));
body.put("usertype","Mobile");
String res = HttpClientUtils.postjson(getAccessTokenUrl, header, body.toJSONString());
AccessTokenResult accessTokenResult = JSONObject.parseObject(res, AccessTokenResult.class);
if(accessTokenResult.getStatus()){
shkd.fi.fi.common.cosmic.accesstoken.Data accessTokenResultData = accessTokenResult.getData();
access_token = accessTokenResultData.getAccess_token();
// ssoDownloadUrl= ssoDownloadUrl+access_token+"&redirect=";
// ssoDownloadUrl=URLEncoder.encode(ssoDownloadUrl);
log.info("ssoDownloadUrl:"+ssoDownloadUrl);
}else{
result.append("获取AccessToken失败不进行同步");
return result;
}
}else{
result.append("获取AppToken失败不进行同步");
return result;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
String url = ""; String url = "";
String filename="";
for (Map map : list) { for (Map map : list) {
url = map.get("url").toString(); url = map.get("url").toString();
log.info(url); filename = map.get("name").toString();
log.info("附件下载url"+url);
} }
if(StringUtils.isNotEmpty(url)){ if(StringUtils.isNotEmpty(url)){
if(url.contains("/ierp")){ if(url.contains("/ierp")){
url = url.substring(url.indexOf("/ierp")+5); url = url.substring(url.indexOf("/ierp"));
url = domainContextUrl+url; url = domainContextUrl+":80"+url;
log.info("域名下载:"+url);
} }
url= access_token+"&redirect="+url;//OA说参数后后面的值需要转义
log.info("url参数转义钱"+url);
url = URLEncoder.encode(url); url = URLEncoder.encode(url);
log.info("url参数转义后"+url);
url= ssoDownloadUrl+url;
log.info(url);
} }
StringBuffer xml = new StringBuffer(); StringBuffer xml = new StringBuffer();
xml.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:mod=\"http://localhost/services/ModeDateService\">"); // xml.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:mod=\"http://localhost/services/ModeDateService\">");
xml.append("<soapenv:Header/>"); // xml.append("<soapenv:Header/>");
xml.append("<soapenv:Body>"); // xml.append("<soapenv:Body>");
xml.append("<mod:saveModeData>"); // xml.append("<mod:saveModeData>");
xml.append("<mod:in0>"); // xml.append("<mod:in0>");
xml.append(" <![CDATA["); // xml.append(" <![CDATA[");
xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
xml.append("<ROOT><header><userid>").append(oauserid).append("</userid><modeid>").append(oamodelid).append("</modeid><id></id></header>"); xml.append("<ROOT><header><userid>").append(oa_userid).append("</userid><modeid>").append(oa_modeid).append("</modeid><id></id></header>");
xml.append("<search><condition /><right>Y</right></search>"); xml.append("<search><condition /><right>Y</right></search>");
xml.append("<data id=\"\">"); xml.append("<data id=\"\">");
xml.append("<maintable>"); xml.append("<maintable>");
@ -170,44 +223,35 @@ public class OAInvoiceImpl {
// xml.append("<filedvalue>\"\"</filedvalue>"); // xml.append("<filedvalue>\"\"</filedvalue>");
// xml.append("</field>"); // xml.append("</field>");
xml.append("<field>"); xml.append("<files>");
xml.append("<filedname>fj</filedname>"); xml.append("<filedname>fj</filedname>");
xml.append("<filedvalue>").append(url).append("</filedvalue>"); xml.append("<file>");
xml.append("</field>"); xml.append("<filename>").append(filename).append("</filename>");;
xml.append("<filecontent>").append(url).append("</filecontent>");
// xml.append("<filecontent><![CDATA[").append(url).append("]]</filecontent>");
xml.append("<filecontenttype></filecontenttype>");
xml.append("</file>");
xml.append("</files>");
xml.append("</maintable>"); xml.append("</maintable>");
xml.append("</data>"); xml.append("</data>");
xml.append("</ROOT>"); xml.append("</ROOT>");
xml.append("]]>"); // xml.append("]]>");
// xml.append("</mod:in0>");
// xml.append("</mod:saveModeData>");
xml.append("</mod:in0>"); // xml.append("</soapenv:Body>");
xml.append("</mod:saveModeData>"); // xml.append("</soapenv:Envelope>");
xml.append("</soapenv:Body>");
xml.append("</soapenv:Envelope>");
log.info("OA接口入参" + xml.toString()); log.info("OA接口入参" + xml.toString());
Map<String, Object> resultMap = HttpUtils.sendPostToOA(oaurl, xml.toString());
Integer status = (Integer)resultMap.get(HttpUtils.STATUS);
String respose = String.valueOf(resultMap.get(HttpUtils.RESPONSE_STRING));
log.info("OA接口返回结果status" + status);
log.info("OA接口返回结果respose" + respose);
LogBillUtils.SaveLogBill(oaurl, respose, AppflgConstant.OA_INV_URL_NAME, xml.toString());
if(200==status) {
invoiceBill.set("shkd_oastatus", "1");
SaveServiceHelper.save(new DynamicObject[]{invoiceBill});
result.append("成功").append("\r");
}else{
invoiceBill.set("shkd_oastatus", "2");
SaveServiceHelper.save(new DynamicObject[]{invoiceBill});
result.append("失败").append("\r");
}
/* if (s.contains("id&gt;") && s.contains("&lt;/id")) {
String id = s.substring(s.indexOf("id&gt;") + 6, s.indexOf("&lt;/id"));
try { try {
int i = Integer.parseInt(id); ModeDateServiceStub stub = new ModeDateServiceStub(oa_url);
if (i > 0) { ModeDateServiceStub.SaveModeData saveModeData = new ModeDateServiceStub.SaveModeData();
saveModeData.setIn0(xml.toString());
ModeDateServiceStub.SaveModeDataResponse saveModeDataResponse = stub.saveModeData(saveModeData);
String s = saveModeDataResponse.getOut();
log.info("OA接口返回结果" + xml.toString());
if (s.contains("操作成功")) {
invoiceBill.set("shkd_oastatus", "1"); invoiceBill.set("shkd_oastatus", "1");
SaveServiceHelper.save(new DynamicObject[]{invoiceBill}); SaveServiceHelper.save(new DynamicObject[]{invoiceBill});
result.append("成功").append("\r"); result.append("成功").append("\r");
@ -216,19 +260,22 @@ public class OAInvoiceImpl {
SaveServiceHelper.save(new DynamicObject[]{invoiceBill}); SaveServiceHelper.save(new DynamicObject[]{invoiceBill});
result.append("失败").append("\r"); result.append("失败").append("\r");
} }
} catch (NumberFormatException ex) {
invoiceBill.set("shkd_oastatus", "2");
SaveServiceHelper.save(new DynamicObject[]{invoiceBill});
log.error(ex.getMessage());
ex.printStackTrace();
result.append("失败").append("\r");
}
} else { LogBillUtils.SaveLogBill(oa_url, s, AppflgConstant.OA_INV_URL_NAME, xml.toString());
invoiceBill.set("shkd_oastatus", "2");
SaveServiceHelper.save(new DynamicObject[]{invoiceBill}); } catch (AxisFault e) {
// throw new RuntimeException(e);
result.append("失败").append("\r"); result.append("失败").append("\r");
}*/ log.error(e.getMessage());
e.printStackTrace();
LogBillUtils.SaveLogBill(oa_url, e.getMessage(), AppflgConstant.OA_INV_URL_NAME, xml.toString());
} catch (RemoteException e) {
// throw new RuntimeException(e);
result.append("失败").append("\r");
log.error(e.getMessage());
e.printStackTrace();
LogBillUtils.SaveLogBill(oa_url, e.getMessage(), AppflgConstant.OA_INV_URL_NAME, xml.toString());
}
return result; return result;