doc:电子用印接口文档(草稿)

This commit is contained in:
FCL
2025-10-30 18:06:28 +08:00
parent b75c389b84
commit 3782b3a7c6
5 changed files with 534 additions and 14 deletions

View File

@@ -5,7 +5,9 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zt.plat.framework.common.util.security.CryptoSignatureUtils;
import org.springframework.util.StringUtils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URI;
@@ -15,13 +17,13 @@ import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.Duration;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
import java.util.*;
public class DatabusApiInvocationExample {
public static final String TIMESTAMP = Long.toString(System.currentTimeMillis());
@@ -85,14 +87,12 @@ public class DatabusApiInvocationExample {
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", "1968843568287817730");
jsonObject.put("sampleName", "545(委检样)");
jsonObject.put("materialName", "ff");
jsonObject.put("materialId", "123");
jsonObject.put("dictionaryBusinessId", "1965289399255388162");
jsonObject.put("id", "1983446576685985794");
jsonObject.put("remark", "");
long extraTimestamp = 1761556157185L;
String bodyJson = String.format(jsonObject.toJSONString(), extraTimestamp);
// long extraTimestamp = 1761556157185L;
// String bodyJson = String.format(jsonObject.toJSONString(), extraTimestamp);
String bodyJson = jsonObject.toJSONString();
Map<String, Object> bodyParams = parseBodyJson(bodyJson);
String signature = generateSignature(queryParams, bodyParams);
@@ -109,10 +109,8 @@ public class DatabusApiInvocationExample {
.header(ZT_TIMESTAMP, TIMESTAMP)
.header(ZT_NONCE, nonce)
.header(ZT_SIGNATURE, signature)
.header(ZT_AUTH_TOKEN, "843304444f65423f901a3efe2f252a75")
.header(ZT_AUTH_TOKEN, "82e5c281ddfa4386988fa4074e8794d7")
.header(CONTENT_TYPE, "application/json")
.header("visit-company-id", "101")
.header("visit-dept-id", "103")
.POST(HttpRequest.BodyPublishers.ofString(cipherBody, StandardCharsets.UTF_8))
.build();