- 部分注释修改

This commit is contained in:
Weasley J
2023-07-15 23:54:27 +08:00
parent 693c279bb8
commit 50ba92f269
8 changed files with 315 additions and 120 deletions
@@ -6,6 +6,7 @@ import cn.alphahub.eport.signature.entity.UkeyRequest;
import cn.alphahub.eport.signature.entity.UkeyResponse.Args;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,6 +17,8 @@ import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import static cn.alphahub.eport.signature.core.CertificateHandler.SING_DATA_METHOD;
/**
* 电子口岸X509证书
*
@@ -29,6 +32,8 @@ public class EportCertController {
@Autowired
private SignHandler signHandler;
@Autowired
private CertificateHandler certificateHandler;
/**
* 下载证书
@@ -38,11 +43,14 @@ public class EportCertController {
*/
@GetMapping("/cert/download")
public void downloadX509Certificate(HttpServletResponse response) throws IOException {
String x509Certificate = certificateHandler.getX509Certificate(SING_DATA_METHOD);
if (StringUtils.isBlank(x509Certificate)) {
Args certPEMArgs = signHandler.getUkeyResponseArgs(new UkeyRequest("cus-sec_SpcGetSignCertAsPEM", new HashMap<>()));
x509Certificate = certPEMArgs.getData().get(0);
}
Args certNoArgs = signHandler.getUkeyResponseArgs(new UkeyRequest("cus-sec_SpcGetCertNo", new HashMap<>()));
Args certPEMArgs = signHandler.getUkeyResponseArgs(new UkeyRequest("cus-sec_SpcGetSignCertAsPEM", new HashMap<>()));
String certName = certNoArgs.getData().get(0);
String certPomOfUkey = certPEMArgs.getData().get(0);
String certificate = CertificateHandler.buildX509CertificateWithHeader(certPomOfUkey);
String certificate = CertificateHandler.buildX509CertificateWithHeader(x509Certificate);
response.setContentType("application/x-x509-ca-cert");
response.setHeader("Content-Disposition", "attachment; filename=\"" + certName + ".cer\"");
OutputStream stream = response.getOutputStream();
@@ -8,10 +8,10 @@ import cn.alphahub.eport.signature.entity.SignRequest;
import cn.alphahub.eport.signature.entity.SignResult;
import cn.alphahub.eport.signature.support.CommandClient;
import cn.hutool.json.JSONUtil;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -33,83 +33,81 @@ import static org.springframework.http.HttpStatus.NOT_FOUND;
@RequestMapping("/rpc/eport/test")
public class EportTestController {
@Resource
@Autowired
private SignHandler signHandler;
/**
* 海关总署XML数据加签
*
* @return 签结果
* @return 数据加签结果
* @apiNote 非正式调用API,只为了让你看到海关总署XML加密的数据返回格式
*/
@GetMapping("/cebmessage/signature")
public Result<SignResult> signCebMessage() {
String sourceXml = """
<ceb:CEB621Message xmlns:ceb="http://www.chinaport.gov.cn/ceb" guid="CEB621_HNZB_FXJK_20220208175054_0034" version="v1.0">
<ceb:Inventory>
<ceb:InventoryHead>
<ceb:guid>CEB621_HNZB_FXJK_20220208175055_0035</ceb:guid>
<ceb:appType>1</ceb:appType>
<ceb:appTime>20220208175055</ceb:appTime>
<ceb:appStatus>2</ceb:appStatus>
<ceb:orderNo>48037605991776256</ceb:orderNo>
<ceb:ebpCode>46121601BC</ceb:ebpCode>
<ceb:ebpName>海南星创互联网医药有限公司</ceb:ebpName>
<ceb:ebcCode>46121601BC</ceb:ebcCode>
<ceb:ebcName>海南星创互联网医药有限公司</ceb:ebcName>
<ceb:logisticsNo>2222222</ceb:logisticsNo>
<ceb:logisticsCode>4101986180</ceb:logisticsCode>
<ceb:logisticsName>圆通</ceb:logisticsName>
<ceb:copNo>4101W68006</ceb:copNo>
<ceb:assureCode>4101960AGP</ceb:assureCode>
<ceb:ieFlag>I</ceb:ieFlag>
<ceb:declTime>20220208</ceb:declTime>
<ceb:customsCode>4601</ceb:customsCode>
<ceb:portCode>4601</ceb:portCode>
<ceb:ieDate>20220208</ceb:ieDate>
<ceb:buyerIdType>1</ceb:buyerIdType>
<ceb:buyerIdNumber>612326199005306719</ceb:buyerIdNumber>
<ceb:buyerName>用户_15150368</ceb:buyerName>
<ceb:buyerTelephone>18209182500</ceb:buyerTelephone>
<ceb:consigneeAddress>哈布斯堡</ceb:consigneeAddress>
<ceb:agentCode>46121601BC</ceb:agentCode>
<ceb:agentName>海南星创互联网医药有限公司</ceb:agentName>
<ceb:tradeMode>9610</ceb:tradeMode>
<ceb:trafMode>W</ceb:trafMode>
<ceb:country>142</ceb:country>
<ceb:freight>0.00</ceb:freight>
<ceb:insuredFee>0</ceb:insuredFee>
<ceb:currency>142</ceb:currency>
<ceb:packNo>1</ceb:packNo>
<ceb:grossWeight>0.07</ceb:grossWeight>
<ceb:netWeight>0.06</ceb:netWeight>
</ceb:InventoryHead>
<ceb:InventoryList>
<ceb:gnum>1</ceb:gnum>
<ceb:itemRecordNo>0797776159482</ceb:itemRecordNo>
<ceb:itemNo>HNGGKJ00000057</ceb:itemNo>
<ceb:itemName>通用铁剂胶囊</ceb:itemName>
<ceb:gcode>2106909090</ceb:gcode>
<ceb:gname>ACTIVE IRON</ceb:gname>
<ceb:gmodel>4|3|乳清蛋白(牛奶)65%,胶囊壳(羟苯基甲基纤维素)21%,硫酸亚铁1.2%,酸度调节剂2%,填充剂 10.8%|30粒/盒|无中文名称/ACTIVE IRON</ceb:gmodel>
<ceb:country>306</ceb:country>
<ceb:currency>142</ceb:currency>
<ceb:qty>1</ceb:qty>
<ceb:unit>140</ceb:unit>
<ceb:qty1>0.06</ceb:qty1>
<ceb:unit1>035</ceb:unit1>
<ceb:price>0.01</ceb:price>
<ceb:totalPrice>0.01</ceb:totalPrice>
</ceb:InventoryList>
</ceb:Inventory>
<ceb:BaseTransfer>
<ceb:copCode>46121601BC</ceb:copCode>
<ceb:copName>海南星创互联网医药有限公司</ceb:copName>
<ceb:dxpMode>DXP</ceb:dxpMode>
<ceb:dxpId>DXPENT0000458763</ceb:dxpId>
</ceb:BaseTransfer>
</ceb:CEB621Message>
""";
@SuppressWarnings("all") String sourceXml = "<ceb:CEB621Message xmlns:ceb=\"http://www.chinaport.gov.cn/ceb\" guid=\"CEB621_HNZB_FXJK_20220208175054_0034\" version=\"v1.0\">\n" +
" <ceb:Inventory>\n" +
" <ceb:InventoryHead>\n" +
" <ceb:guid>CEB621_HNZB_FXJK_20220208175055_0035</ceb:guid>\n" +
" <ceb:appType>1</ceb:appType>\n" +
" <ceb:appTime>20220208175055</ceb:appTime>\n" +
" <ceb:appStatus>2</ceb:appStatus>\n" +
" <ceb:orderNo>48037605991776256</ceb:orderNo>\n" +
" <ceb:ebpCode>46121601BC</ceb:ebpCode>\n" +
" <ceb:ebpName>海南星创互联网医药有限公司</ceb:ebpName>\n" +
" <ceb:ebcCode>46121601BC</ceb:ebcCode>\n" +
" <ceb:ebcName>海南星创互联网医药有限公司</ceb:ebcName>\n" +
" <ceb:logisticsNo>2222222</ceb:logisticsNo>\n" +
" <ceb:logisticsCode>4101986180</ceb:logisticsCode>\n" +
" <ceb:logisticsName>圆通</ceb:logisticsName>\n" +
" <ceb:copNo>4101W68006</ceb:copNo>\n" +
" <ceb:assureCode>4101960AGP</ceb:assureCode>\n" +
" <ceb:ieFlag>I</ceb:ieFlag>\n" +
" <ceb:declTime>20220208</ceb:declTime>\n" +
" <ceb:customsCode>4601</ceb:customsCode>\n" +
" <ceb:portCode>4601</ceb:portCode>\n" +
" <ceb:ieDate>20220208</ceb:ieDate>\n" +
" <ceb:buyerIdType>1</ceb:buyerIdType>\n" +
" <ceb:buyerIdNumber>612326199005306719</ceb:buyerIdNumber>\n" +
" <ceb:buyerName>用户_15150368</ceb:buyerName>\n" +
" <ceb:buyerTelephone>18209182500</ceb:buyerTelephone>\n" +
" <ceb:consigneeAddress>哈布斯堡</ceb:consigneeAddress>\n" +
" <ceb:agentCode>46121601BC</ceb:agentCode>\n" +
" <ceb:agentName>海南星创互联网医药有限公司</ceb:agentName>\n" +
" <ceb:tradeMode>9610</ceb:tradeMode>\n" +
" <ceb:trafMode>W</ceb:trafMode>\n" +
" <ceb:country>142</ceb:country>\n" +
" <ceb:freight>0.00</ceb:freight>\n" +
" <ceb:insuredFee>0</ceb:insuredFee>\n" +
" <ceb:currency>142</ceb:currency>\n" +
" <ceb:packNo>1</ceb:packNo>\n" +
" <ceb:grossWeight>0.07</ceb:grossWeight>\n" +
" <ceb:netWeight>0.06</ceb:netWeight>\n" +
" </ceb:InventoryHead>\n" +
" <ceb:InventoryList>\n" +
" <ceb:gnum>1</ceb:gnum>\n" +
" <ceb:itemRecordNo>0797776159482</ceb:itemRecordNo>\n" +
" <ceb:itemNo>HNGGKJ00000057</ceb:itemNo>\n" +
" <ceb:itemName>通用铁剂胶囊</ceb:itemName>\n" +
" <ceb:gcode>2106909090</ceb:gcode>\n" +
" <ceb:gname>ACTIVE IRON</ceb:gname>\n" +
" <ceb:gmodel>4|3|乳清蛋白(牛奶)65%,胶囊壳(羟苯基甲基纤维素)21%,硫酸亚铁1.2%,酸度调节剂2%,填充剂 10.8%|30粒/盒|无中文名称/ACTIVE IRON</ceb:gmodel>\n" +
" <ceb:country>306</ceb:country>\n" +
" <ceb:currency>142</ceb:currency>\n" +
" <ceb:qty>1</ceb:qty>\n" +
" <ceb:unit>140</ceb:unit>\n" +
" <ceb:qty1>0.06</ceb:qty1>\n" +
" <ceb:unit1>035</ceb:unit1>\n" +
" <ceb:price>0.01</ceb:price>\n" +
" <ceb:totalPrice>0.01</ceb:totalPrice>\n" +
" </ceb:InventoryList>\n" +
" </ceb:Inventory>\n" +
" <ceb:BaseTransfer>\n" +
" <ceb:copCode>46121601BC</ceb:copCode>\n" +
" <ceb:copName>海南星创互联网医药有限公司</ceb:copName>\n" +
" <ceb:dxpMode>DXP</ceb:dxpMode>\n" +
" <ceb:dxpId>DXPENT0000458763</ceb:dxpId>\n" +
" </ceb:BaseTransfer>\n" +
" </ceb:CEB621Message>";
SignRequest request = new SignRequest(sourceXml);
String payload = signHandler.getSignDataParameter(request);
SignResult signed = signHandler.sign(request, payload);
@@ -123,14 +121,12 @@ public class EportTestController {
/**
* 海关179数据抓取加签
*
* @return 签结果
* @return 数据加签结果
* @apiNote 非正式调用API,只为了让你看到179加密的数据返回格式
*/
@GetMapping("/179/signature")
public Result<SignResult> sign179Report() {
String sign179String = """
"sessionID":"ad2254-8hewyf32-55616249"||"payExchangeInfoHead":"{"guid":"9D55BA71-22DE-41F4-8B50-C36C83B3B530","initalRequest":"原始请求","initalResponse":"ok","ebpCode":"4404840022","payCode":"312226T001","payTransactionId":"2018121222001354081010726129","totalAmount":100,"currency":"142","verDept":"3","payType":"1","tradingTime":"20181212041803","note":"批量订单,测试订单优化,生成多个so订单"}"||"payExchangeInfoLists":"[{"orderNo":"SO1710301150602574003","goodsInfo":[{"gname":"lhy-gnsku3","itemLink":"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453"},{"gname":"lhy-gnsku2","itemLink":"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999760&shopId=453"}],"recpAccount":"OSA571908863132601","recpCode":"","recpName":"YUNJIHONGKONGLIMITED"}]"||"serviceTime":"1544519952469"
""";
String sign179String = "\"sessionID\":\"ad2254-8hewyf32-55616249\"||\"payExchangeInfoHead\":\"{\"guid\":\"9D55BA71-22DE-41F4-8B50-C36C83B3B530\",\"initalRequest\":\"原始请求\",\"initalResponse\":\"ok\",\"ebpCode\":\"4404840022\",\"payCode\":\"312226T001\",\"payTransactionId\":\"2018121222001354081010726129\",\"totalAmount\":100,\"currency\":\"142\",\"verDept\":\"3\",\"payType\":\"1\",\"tradingTime\":\"20181212041803\",\"note\":\"批量订单,测试订单优化,生成多个so订单\"}\"||\"payExchangeInfoLists\":\"[{\"orderNo\":\"SO1710301150602574003\",\"goodsInfo\":[{\"gname\":\"lhy-gnsku3\",\"itemLink\":\"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453\"},{\"gname\":\"lhy-gnsku2\",\"itemLink\":\"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999760&shopId=453\"}],\"recpAccount\":\"OSA571908863132601\",\"recpCode\":\"\",\"recpName\":\"YUNJIHONGKONGLIMITED\"}]\"||\"serviceTime\":\"1544519952469\"";
SignRequest request = new SignRequest(sign179String);
String payload = signHandler.getSignDataParameter(request);
SignResult signed = signHandler.sign(request, payload);
@@ -148,8 +144,7 @@ public class EportTestController {
*/
@GetMapping("/endpoint/exec")
public void execute(@RequestParam("cmd") String cmd, HttpServletResponse response) throws IOException {
if (ObjectUtils.isNotEmpty(SpringUtil.getActiveProfiles()) &&
Set.of(SpringUtil.getActiveProfiles()).contains("prod")) {
if (ObjectUtils.isNotEmpty(SpringUtil.getActiveProfiles()) && Set.of(SpringUtil.getActiveProfiles()).contains("prod")) {
throw new SignException(NOT_FOUND.getReasonPhrase(), NOT_FOUND.value());
}
log.info("执行脚本: {}", cmd);
@@ -36,7 +36,7 @@ public class SignRequest implements Serializable {
* <b>支持的加签数据类型</b>
* <li>1. 不带ds:Signature节点的CEBXxxMessage.xml原文;<a href='http://tool.qdhuaxun.cn/ceb/CEB311Message.xml'>待加签xml报文样例</a></li>
* <li>2. 海关179加签数据; 数据格式请传符合「海关179数据规范」的标准字符串,入参示例:
* <pre>"sessionID":"ad2254-8hewyf32-55616249"||"payExchangeInfoHead":"{"guid":"9D55BA71-22DE-41F4-8B50-C36C83B3B530","initalRequest":"原始请求","initalResponse":"ok","ebpCode":"4404840022","payCode":"312226T001","payTransactionId":"2018121222001354081010726129","totalAmount":100,"currency":"142","verDept":"3","payType":"1","tradingTime":"20181212041803","note":"批量订单,测试订单优化,生成多个so订单"}"||"payExchangeInfoLists":"[{"orderNo":"SO1710301150602574003","goodsInfo":[{"gname":"lhy-gnsku3","itemLink":"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453"},{"gname":"lhy-gnsku2","itemLink":"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999760&shopId=453"}],"recpAccount":"OSA571908863132601","recpCode":"","recpName":"YUNJIHONGKONGLIMITED"}]"||"serviceTime":"1544519952469"</pre>
* <code><pre>"sessionID":"ad2254-8hewyf32-55616249"||"payExchangeInfoHead":"{"guid":"9D55BA71-22DE-41F4-8B50-C36C83B3B530","initalRequest":"原始请求","initalResponse":"ok","ebpCode":"4404840022","payCode":"312226T001","payTransactionId":"2018121222001354081010726129","totalAmount":100,"currency":"142","verDept":"3","payType":"1","tradingTime":"20181212041803","note":"批量订单,测试订单优化,生成多个so订单"}"||"payExchangeInfoLists":"[{"orderNo":"SO1710301150602574003","goodsInfo":[{"gname":"lhy-gnsku3","itemLink":"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453"},{"gname":"lhy-gnsku2","itemLink":"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999760&shopId=453"}],"recpAccount":"OSA571908863132601","recpCode":"","recpName":"YUNJIHONGKONGLIMITED"}]"||"serviceTime":"1544519952469"</pre></code>
* </li>
* </ul>
*/
@@ -34,10 +34,7 @@ public class SignResult implements Serializable {
*/
private String x509Certificate;
/**
* xml的数字摘要,先对不包含Signature节点的原始报文,进行C14n格式化,然后取shal二进制摘要,然后对sha1的值进行base64编码
* <ul>
* <li><a href='http://tool.qdhuaxun.cn/ceb/CEB311Message.xml'>待加签报文样例</a></li>
* </ul>
* XML报文的数字摘要
*/
private String digestValue;
/**
@@ -45,8 +42,8 @@ public class SignResult implements Serializable {
*/
private String signatureValue;
/**
* 签名的XML节点
* <li>用来组装{@code <ds:SignedInfo>}节点</li>
* XML报文的签名节点
* <li>用来组装 ds:SignedInfo 节点</li>
*/
private String signatureNode;
}
@@ -52,7 +52,7 @@
},
{
"version": "1.1.0",
"revisionTime": "2023-07-13 15:36",
"revisionTime": "2023-07-15 15:36",
"status": "编辑",
"author": "Weasley J",
"remarks": "补充API文档"
File diff suppressed because one or more lines are too long
@@ -6,13 +6,38 @@ api.push({
list: []
})
api[0].list.push({
alias: 'UkeyHealthController',
alias: 'EportTestController',
order: '1',
link: '电子口岸报文加签测试',
desc: '电子口岸报文加签测试',
list: []
})
api[0].list[0].list.push({
order: '1',
deprecated: 'false',
url: 'http://localhost:8080/rpc/eport/test/cebmessage/signature',
desc: '海关总署XML数据加签',
});
api[0].list[0].list.push({
order: '2',
deprecated: 'false',
url: 'http://localhost:8080/rpc/eport/test/179/signature',
desc: '海关179数据抓取加签',
});
api[0].list[0].list.push({
order: '3',
deprecated: 'false',
url: 'http://localhost:8080/rpc/eport/test/endpoint/exec',
desc: '执行脚本命令',
});
api[0].list.push({
alias: 'UkeyHealthController',
order: '2',
link: 'ukey健康状态恢复',
desc: 'Ukey健康状态恢复',
list: []
})
api[0].list[0].list.push({
api[0].list[1].list.push({
order: '1',
deprecated: 'false',
url: 'http://localhost:8080/rpc/eport/ukey/health/endpoint/{command}',
@@ -20,18 +45,18 @@ api[0].list[0].list.push({
});
api[0].list.push({
alias: 'EportUploadController',
order: '2',
order: '3',
link: '电子口岸报文推送',
desc: '电子口岸报文推送',
list: []
})
api[0].list[1].list.push({
api[0].list[2].list.push({
order: '1',
deprecated: 'false',
url: 'http://localhost:8080/rpc/eport/upload/CEBMessage',
desc: '推送CEBMessage报文',
});
api[0].list[1].list.push({
api[0].list[2].list.push({
order: '2',
deprecated: 'false',
url: 'http://localhost:8080/rpc/eport/upload/179/data',
@@ -39,12 +64,12 @@ api[0].list[1].list.push({
});
api[0].list.push({
alias: 'EportCertController',
order: '3',
order: '4',
link: '电子口岸x509证书',
desc: '电子口岸X509证书',
list: []
})
api[0].list[2].list.push({
api[0].list[3].list.push({
order: '1',
deprecated: 'false',
url: 'http://localhost:8080/rpc/eport/cert/download',
@@ -52,12 +77,12 @@ api[0].list[2].list.push({
});
api[0].list.push({
alias: 'EportSignController',
order: '4',
order: '5',
link: '电子口岸报文加签',
desc: '电子口岸报文加签',
list: []
})
api[0].list[3].list.push({
api[0].list[4].list.push({
order: '1',
deprecated: 'false',
url: 'http://localhost:8080/rpc/eport/signature',
+157 -14
View File
@@ -4,10 +4,157 @@
|---------|-------------|--------|--------|-------------|
|1.0.0|2022-02-16 10:30|创建|Weasley J|创建API文档|
|1.0.9|2023-06-11 15:36|编辑|Weasley J|更新API文档|
|1.1.0|2023-07-13 15:36|编辑|Weasley J|完善API文档|
|1.1.0|2023-07-15 15:36|编辑|Weasley J|补充API文档|
## 电子口岸报文加签测试
### 海关总署XML数据加签
**URL:** http://localhost:8080/rpc/eport/test/cebmessage/signature
**Type:** GET
**Author:** lwj
**Content-Type:** application/x-www-form-urlencoded;charset=UTF-8
**Description:** 非正式调用API,只为了让你看到海关总署XML加密的数据返回格式
**Request-headers:**
| Header | Type | Required | Description | Since |
|--------|------|----------|-------------|-------|
|x-auth-token-eport-sign|string|true|客户端加签时携带的请求头,token值必须和配置文件里面配置鉴权token相等|v1.1.0|
**Request-example:**
```
curl -X GET -H 'x-auth-token-eport-sign:DefaultAuthToken' -i http://localhost:8080/rpc/eport/test/cebmessage/signature
```
**Response-fields:**
| Field | Type | Description | Since |
|-------|------|-------------|-------|
|message|string|返回消息|-|
|success|boolean|是否成功|-|
|timestamp|string|响应时间戳|-|
|code|int32|状态码|-|
|data|object|响应数据|-|
|└─success|boolean|本次加签是否成功|-|
|└─certNo|string|签名的ukey的卡序列号|-|
|└─x509Certificate|string|签名的ukey证书|-|
|└─digestValue|string|XML报文的数字摘要|-|
|└─signatureValue|string|调用ukey获取的签名值|-|
|└─signatureNode|string|XML报文的签名节点<br/><li>用来组装 ds:SignedInfo 节点</li>|-|
**Response-example:**
```
{
"message": "",
"success": true,
"timestamp": "",
"code": 0,
"data": {
"success": true,
"certNo": "",
"x509Certificate": "",
"digestValue": "",
"signatureValue": "",
"signatureNode": ""
}
}
```
### 海关179数据抓取加签
**URL:** http://localhost:8080/rpc/eport/test/179/signature
**Type:** GET
**Author:** lwj
**Content-Type:** application/x-www-form-urlencoded;charset=UTF-8
**Description:** 非正式调用API,只为了让你看到179加密的数据返回格式
**Request-headers:**
| Header | Type | Required | Description | Since |
|--------|------|----------|-------------|-------|
|x-auth-token-eport-sign|string|true|客户端加签时携带的请求头,token值必须和配置文件里面配置鉴权token相等|v1.1.0|
**Request-example:**
```
curl -X GET -H 'x-auth-token-eport-sign:DefaultAuthToken' -i http://localhost:8080/rpc/eport/test/179/signature
```
**Response-fields:**
| Field | Type | Description | Since |
|-------|------|-------------|-------|
|message|string|返回消息|-|
|success|boolean|是否成功|-|
|timestamp|string|响应时间戳|-|
|code|int32|状态码|-|
|data|object|响应数据|-|
|└─success|boolean|本次加签是否成功|-|
|└─certNo|string|签名的ukey的卡序列号|-|
|└─x509Certificate|string|签名的ukey证书|-|
|└─digestValue|string|XML报文的数字摘要|-|
|└─signatureValue|string|调用ukey获取的签名值|-|
|└─signatureNode|string|XML报文的签名节点<br/><li>用来组装 ds:SignedInfo 节点</li>|-|
**Response-example:**
```
{
"message": "",
"success": true,
"timestamp": "",
"code": 0,
"data": {
"success": true,
"certNo": "",
"x509Certificate": "",
"digestValue": "",
"signatureValue": "",
"signatureNode": ""
}
}
```
### 执行脚本命令
**URL:** http://localhost:8080/rpc/eport/test/endpoint/exec
**Type:** GET
**Author:** lwj
**Content-Type:** application/x-www-form-urlencoded;charset=UTF-8
**Description:** 此接口测试环境、生产环境不对外开放,会在将终端输出同步写给浏览器
**Request-headers:**
| Header | Type | Required | Description | Since |
|--------|------|----------|-------------|-------|
|x-auth-token-eport-sign|string|true|客户端加签时携带的请求头,token值必须和配置文件里面配置鉴权token相等|v1.1.0|
**Query-parameters:**
| Parameter | Type | Required | Description | Since |
|-----------|------|----------|-------------|-------|
|cmd|string|true|No comments found.|-|
**Request-example:**
```
curl -X GET -H 'x-auth-token-eport-sign:DefaultAuthToken' -i http://localhost:8080/rpc/eport/test/endpoint/exec?cmd=
```
**Response-example:**
```
Return void.
```
## Ukey健康状态恢复
### ukey健康指令
**URL:** http://localhost:8080/rpc/eport/ukey/health/endpoint/{command}
@@ -18,8 +165,7 @@
**Content-Type:** application/x-www-form-urlencoded;charset=UTF-8
**Description:**
<ul>
**Description:** <ul>
支持command类型
<li>RESTART: 重启控件(较多使用)</li>
<li>START: 启动控件</li>
@@ -78,9 +224,7 @@ curl -X POST -H 'x-auth-token-eport-sign:DefaultAuthToken' -i http://localhost:8
**Content-Type:** application/json
**Description:**
<ul>
**Description:** <ul>
<b>支持JSON报文和XML报文</b>
<li>JSON报文: 无需组装XML结构报文</li>
<li>XML报文: 需组装XML结构的报文</li>
@@ -172,11 +316,8 @@ curl -X POST -H 'Content-Type: application/json' -H 'x-auth-token-eport-sign:Def
**Content-Type:** application/json
**Description:**
<ul>
**Description:** <ul>
JSON示例:
<pre>
{
"sessionID": "032C3F56-0EE6-4558-B548-6C7A3451F07D",
@@ -366,7 +507,6 @@ Return void.
**Content-Type:** application/json
**Description:** 此接口已经整合"海关总署XML"和"海关179数据抓取"的加签<br/>
<ul><b>支持的加签类型</b><li>1. 海关CEBXxxMessage XML数据加签</li><li>2. 海关179数据加签</li></ul>
**Request-headers:**
@@ -381,7 +521,7 @@ Return void.
| Parameter | Type | Required | Description | Since |
|-----------|------|----------|-------------|-------|
|id|int32|false|唯一id, 用来区分是哪一次发送的消息,默认值=1,从1开始,{@code int} 最大, 2<sup>31</sup>-1.|-|
|data|string|true|加签源数据<br/><ul><br/> <b>支持的加签数据类型</b><br/> <li>1. 不带ds:Signature节点的CEBXxxMessage.xml原文;<a href='http://tool.qdhuaxun.cn/ceb/CEB311Message.xml'>待加签xml报文样例</a></li><br/> <li>2. 海关179加签数据; 数据格式请传符合「海关179数据规范」的标准字符串,入参示例:<br/><pre>"sessionID":"ad2254-8hewyf32-55616249"||"payExchangeInfoHead":"{"guid":"9D55BA71-22DE-41F4-8B50-C36C83B3B530","initalRequest":"原始请求","initalResponse":"ok","ebpCode":"4404840022","payCode":"312226T001","payTransactionId":"2018121222001354081010726129","totalAmount":100,"currency":"142","verDept":"3","payType":"1","tradingTime":"20181212041803","note":"批量订单,测试订单优化,生成多个so订单"}"||"payExchangeInfoLists":"[{"orderNo":"SO1710301150602574003","goodsInfo":[{"gname":"lhy-gnsku3","itemLink":"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453"},{"gname":"lhy-gnsku2","itemLink":"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999760&shopId=453"}],"recpAccount":"OSA571908863132601","recpCode":"","recpName":"YUNJIHONGKONGLIMITED"}]"||"serviceTime":"1544519952469"</pre><br/> </li><br/></ul>|-|
|data|string|true|加签源数据<br/><ul><br/> <b>支持的加签数据类型</b><br/> <li>1. 不带ds:Signature节点的CEBXxxMessage.xml原文;<a href='http://tool.qdhuaxun.cn/ceb/CEB311Message.xml'>待加签xml报文样例</a></li><br/> <li>2. 海关179加签数据; 数据格式请传符合「海关179数据规范」的标准字符串,入参示例:<br/> <code><pre>"sessionID":"ad2254-8hewyf32-55616249"||"payExchangeInfoHead":"{"guid":"9D55BA71-22DE-41F4-8B50-C36C83B3B530","initalRequest":"原始请求","initalResponse":"ok","ebpCode":"4404840022","payCode":"312226T001","payTransactionId":"2018121222001354081010726129","totalAmount":100,"currency":"142","verDept":"3","payType":"1","tradingTime":"20181212041803","note":"批量订单,测试订单优化,生成多个so订单"}"||"payExchangeInfoLists":"[{"orderNo":"SO1710301150602574003","goodsInfo":[{"gname":"lhy-gnsku3","itemLink":"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453"},{"gname":"lhy-gnsku2","itemLink":"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999760&shopId=453"}],"recpAccount":"OSA571908863132601","recpCode":"","recpName":"YUNJIHONGKONGLIMITED"}]"||"serviceTime":"1544519952469"</pre></code><br/> </li><br/></ul>|-|
**Request-example:**
```
@@ -402,8 +542,9 @@ curl -X POST -H 'Content-Type: application/json' -H 'x-auth-token-eport-sign:Def
|└─success|boolean|本次加签是否成功|-|
|└─certNo|string|签名的ukey的卡序列号|-|
|└─x509Certificate|string|签名的ukey证书|-|
|└─digestValue|string|xml的数字摘要,先对不包含Signature节点的原始报文,进行C14n格式化,然后取shal二进制摘要,然后对sha1的值进行base64编码<br/><ul><br/> <li><a href='http://tool.qdhuaxun.cn/ceb/CEB311Message.xml'>待加签报文样例</a></li><br/></ul>|-|
|└─digestValue|string|XML报文的数字摘要|-|
|└─signatureValue|string|调用ukey获取的签名值|-|
|└─signatureNode|string|XML报文的签名节点<br/><li>用来组装 ds:SignedInfo 节点</li>|-|
**Response-example:**
```
@@ -417,8 +558,10 @@ curl -X POST -H 'Content-Type: application/json' -H 'x-auth-token-eport-sign:Def
"certNo": "",
"x509Certificate": "",
"digestValue": "",
"signatureValue": ""
"signatureValue": "",
"signatureNode": ""
}
}
```