企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
package cn.wellsign.web; /** * Hello world! * */ import net.sf.json.JSONObject; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; public class App { public static void main( String[] args ) { //登陆接口: String loginUrl = "https://open.wellsign.cn/dandanqian/api/index.php/Conv/User/login"; String loginParam = "accessKey=test&accessSecret=test&clientId=clientId&clientType=PC"; String loginSuccess = HttpRequest.sendPost(loginUrl,loginParam); JSONObject jsonLogin = JSONObject.fromObject(loginSuccess); System.out.print(jsonLogin); //登陆成功后纪录token String token = jsonLogin.getString("access_token"); //请生成签字链接 String signUrl = "https://open.wellsign.cn/dandanqian/api/Conv/Pdf2write/Sync/file/v0.1"; //本地PDF文件地址,本地调试的话换成你自己的 String pdfPath = "/Users/wangweiguo/Desktop/test.pdf"; Map<String, String> textMap = new HashMap<String, String>(); textMap.put("access_token",token); textMap.put("return_expires","30"); textMap.put("sign_url_expires","72000"); Map<String, String> fileMap = new HashMap<String, String>(); fileMap.put("file", pdfPath); String signSuccess = HttpRequest.sendPostFile(signUrl,textMap,fileMap); JSONObject jsonSign = JSONObject.fromObject(signSuccess); System.out.print(jsonSign); String signLinkUrl = jsonSign.getString("sign_url")+"?sequence_id="+jsonSign.getString("sequence_id"); System.out.print("签字链接:"+signLinkUrl); } }