|
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
import kd.bos.exception.KDBizException;
|
|
import kd.bos.exception.KDBizException;
|
|
|
|
+import kd.bos.ext.fi.plugin.ArApConvert.util.EmptyUtils;
|
|
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;
|
|
@@ -30,7 +31,7 @@ public class SyncSapFIUtils {
|
|
* @return SAP系统的响应结果,以字符串形式返回
|
|
* @return SAP系统的响应结果,以字符串形式返回
|
|
* @throws KDBizException 如果请求失败,抛出业务异常
|
|
* @throws KDBizException 如果请求失败,抛出业务异常
|
|
*/
|
|
*/
|
|
- public static String postDataToSAP( String jsonData)
|
|
|
|
|
|
+ public static String postDataToSAP(String urlType, String jsonData)
|
|
{
|
|
{
|
|
try {
|
|
try {
|
|
Map<String, String> mapentity = CommonHelperUtils.getCommonParams("SAP");
|
|
Map<String, String> mapentity = CommonHelperUtils.getCommonParams("SAP");
|
|
@@ -38,11 +39,22 @@ public class SyncSapFIUtils {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
String param_voucher_url = mapentity.get("voucher_url");
|
|
String param_voucher_url = mapentity.get("voucher_url");
|
|
|
|
+ String param_voucher_archive_url = mapentity.get("voucher_archive_url");
|
|
String param_username = mapentity.get("username");
|
|
String param_username = mapentity.get("username");
|
|
String param_password = mapentity.get("password");
|
|
String param_password = mapentity.get("password");
|
|
|
|
|
|
|
|
+ String post_url = null;
|
|
|
|
+ switch (urlType) {
|
|
|
|
+ case "voucher":
|
|
|
|
+ post_url = param_voucher_url;break;
|
|
|
|
+ case "voucherArchive":
|
|
|
|
+ post_url = param_voucher_archive_url;break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
if( StringUtils.isEmpty(param_username) || StringUtils.isEmpty(param_password)
|
|
if( StringUtils.isEmpty(param_username) || StringUtils.isEmpty(param_password)
|
|
- || StringUtils.isEmpty(param_voucher_url) ){
|
|
|
|
|
|
+ || StringUtils.isEmpty(post_url) ){
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -51,7 +63,7 @@ public class SyncSapFIUtils {
|
|
header.put("Content-Type", "application/json; charset=UTF-8");
|
|
header.put("Content-Type", "application/json; charset=UTF-8");
|
|
header.put("Authorization", "Basic " + encoded);
|
|
header.put("Authorization", "Basic " + encoded);
|
|
|
|
|
|
- String result = KHttpClientUtils.postjson(param_voucher_url, header, jsonData);
|
|
|
|
|
|
+ String result = KHttpClientUtils.postjson(post_url, header, jsonData);
|
|
return result;
|
|
return result;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
throw new KDBizException("请求SAP接口失败:" + e.getMessage());
|
|
throw new KDBizException("请求SAP接口失败:" + e.getMessage());
|
|
@@ -331,7 +343,21 @@ public class SyncSapFIUtils {
|
|
return "0";
|
|
return "0";
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ public static String getVoucherArchiveData(String companyCode,String year)
|
|
|
|
+ {
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+ json.put("BUKRS", EmptyUtils.isNotEmpty(companyCode) ? companyCode : "");
|
|
|
|
+ json.put("GJAHR", year);
|
|
|
|
+ json.put("BELNR", "");
|
|
|
|
+ JSONObject itemMap = new JSONObject();
|
|
|
|
+ itemMap.put("BUKRS", "");
|
|
|
|
+ itemMap.put("GJAHR", "");
|
|
|
|
+ itemMap.put("BELNR", "");
|
|
|
|
+ JSONObject etMap = new JSONObject();
|
|
|
|
+ etMap.put("item", itemMap);
|
|
|
|
+ json.put("ET_ITEM", etMap);
|
|
|
|
+ return json.toString();
|
|
|
|
+ }
|
|
|
|
|
|
public static String getVoucherFieldForQuery() {
|
|
public static String getVoucherFieldForQuery() {
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|