/**
 * 官方 Java SDK 用法骨架
 * Maven: kingdee.bos.webapi（版本与星空环境匹配，以实施包为准）
 *
 * IdentifyInfo 构造后 new K3CloudApi(info) 即带会话；各方法传入 JSON 字符串。
 */
package com.example.integration.kingdee;

import com.kingdee.bos.webapi.entity.IdentifyInfo;
import com.kingdee.bos.webapi.sdk.K3CloudApi;

public class K3CloudSdkFactory {

    public static K3CloudApi create(String serverUrl, String dCid, String appId, String appSecret, String userName) {
        IdentifyInfo info = new IdentifyInfo();
        info.setServerUrl(serverUrl);
        info.setdCID(dCid);
        info.setAppId(appId);
        info.setAppSecret(appSecret);
        info.setUserName(userName);
        info.setlCID(2052);
        return new K3CloudApi(info);
    }

    // 查询：client.executeBillQuery(JSON.toJSONString(KingdeeQueryRequest.build(...)))
    // 保存：client.save("SAL_SaleOrder", JSON.toJSONString(kingdeeSaveRequest))
    // 提交：client.submit(formId, "{\"Ids\": 123}")
    // 下推：client.push("{source_form_id}", "{\"Ids\":\"...\",\"RuleId\":\"{configured_rule_id}\",...}")
    // 工作流：client.workflowAudit(json)
    // 撤销提交：client.cancelAssign(formId, "{\"Ids\":\"...\"}")
}