package com.seeyon.apps.src_automatic.util;

/**
 * 生成soap xml
 */
public class SoapContent {
	
	// 增加客商
	public  static final String addCustomer =  "addCustomer";
	// 资产增加
	public static final String cardAdd = "cardAdd";
	
	// 资产变更
	public static final String cardAlter = "cardAlter";
	
	// 资产减少
	public static final String cardReduce = "cardReduce";
	
	// 收款结算
	public static final String fkjs = "addFkjsvo";

	/**
	 * <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:car="http://api.fa.itf.nc/CardOperationService">
   <soapenv:Header/>
   <soapenv:Body>
      <car:cardReduce>
         <!--Optional:-->
         <string>?</string>
      </car:cardReduce>
   </soapenv:Body>
</soapenv:Envelope>
	 */
	
	public static String getSoapXml(String method, String body) {
		StringBuffer soapXml = new StringBuffer();
        soapXml.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:car=\"http://api.fa.itf.nc/CardOperationService\">");
        soapXml.append("<soapenv:Header/>");
        soapXml.append("<soapenv:Body>");
        soapXml.append("<car:" + method + ">");
        soapXml.append("<string><![CDATA[" + body + "]]></string>");
        soapXml.append("</car:" + method + ">");
        soapXml.append("</soapenv:Body>");
        soapXml.append("</soapenv:Envelope>");
		return soapXml.toString();
	}
	
	public static void main(String[] args) {
		String body = "{\"bill_head\":[{\"card_code\":\"0000000933\",\"paydept_flag\":\"0\",\"reason\":\"ces \",\"recorder\":\"NCTEST\",\"bill_code\":\"JS2020090007\",\"source\":\"seeyon\",\"recorddate\":\"2020-09-04\",\"fk_mandept\":\"0403\",\"fk_usedept\":\"0307\",\"asset_code\":\"090182\",\"reducereason\":\"JTTZ09\",\"company\":\"201\",\"newcompany\":\"203\"}]}";
		System.out.println(getSoapXml(cardAlter, body));

	}

}
