企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
```/** * Created by wangweiguo on 18/12/14. */ import net.sf.json.JSONObject; import java.util.HashMap; import java.util.Map; public class App { public static void main(String[] args) { //登陆接口: String loginUrl = "https://dubbo.wellsign.cn/dandanqiantest/api/index.php/Conv/User/login"; String loginParam = "accessKey=test&accessSecret=test&clientId=zj1214&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://dubbo.wellsign.cn/dandanqiantest/api/Conv/reportToPdf/http/v0.1"; //本地PDF文件地址,本地调试的话换成你自己的 String pdfPath1 = "/Users/wangweiguo/Desktop/a.pdf"; String pdfPath2 = "/Users/wangweiguo/Desktop/b.pdf"; Map<String, String> textMap = new HashMap<String, String>(); textMap.put("access_token", token); textMap.put("element_info", "{\n" + "\t\"labelElements\": [{\n" + " \"labelName\": \"label-1-1\",\n" + " \"content\": \"1-1\"\n" + " }, {\n" + " \"labelName\": \"label-2-1\",\n" + " \"content\": \"2-1\"\n" + " }, {\n" + " \"labelName\": \"label-3-1\",\n" + " \"content\": \"3-1\"\n" + " }, {\n" + " \"labelName\": \"label-4-1\",\n" + " \"content\": \"4-1\"\n" + " }, {\n" + " \"labelName\": \"label-4-2\",\n" + " \"content\": \"4-2\"\n" + " }, {\n" + " \"labelName\": \"label-4-3\",\n" + " \"content\": \"4-3\"\n" + " },{\n" + " \"labelName\": \"label-5-1\",\n" + " \"content\": \"5-1\"\n" + " },{\n" + " \"labelName\": \"label-5-2\",\n" + " \"content\": \"5-2\"\n" + " },{\n" + " \"labelName\": \"label-5-3\",\n" + " \"content\": \"5-3\"\n" + " }]\n" + " }"); Map<String, String> fileMap = new HashMap<String, String>(); fileMap.put("multipartFile", pdfPath1); fileMap.put("multipartFile", pdfPath2); String signSuccess = HttpRequest.sendPostFile(signUrl, textMap, fileMap); JSONObject jsonSign = JSONObject.fromObject(signSuccess); System.out.print(jsonSign); String downloadUrl = jsonSign.getString("down_url"); System.out.print("合并文件地址:"+downloadUrl); System.out.print("\n"); } }```