函数设计
帐号及密码
- app_key: 请联系开发人员,进行配置
- AppSecret: 请联系开发人员,进行配置
sign生成调用
public static String SignTopRequest(Map<string, string> appParams, String secret)
throws IOException {
// 第一步:把字典按Key的字母顺序排序
Map<string, string> sortedParams = new TreeMap<string, string>();
if (appParams != null && appParams.size() > 0) {
sortedParams.putAll(appParams);
}
Set<entry <string, string>> paramSet = sortedParams.entrySet();
// 第二步:把所有参数名和参数值串在一起
StringBuilder query = new StringBuilder(secret);
for (Entry<string, string> param : paramSet) {
if ((!param.getKey().equals("")) && (!param.getValue().equals("")))
{
query.append(param.getKey()).append(param.getValue());
}
}
// 第三步:使用MD5加密
byte[] bytes = encryptMD5(query.toString());
// 第四步:把二进制转化为大写的十六进制
return byte2hex(bytes);
}
private static byte[] encryptMD5(String data)
throws IOException {
byte[] bytes = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
bytes = md.digest(data.getBytes("UTF-8"));
} catch (GeneralSecurityException gse) {
throw new IOException(gse);
}
return bytes;
}
private static String byte2hex(byte[] bytes) {
StringBuilder sign = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(bytes[i] & 0xFF);
if (hex.length() == 1) {
sign.append("0");
}
sign.append(hex.toUpperCase());
}
return sign.toString();
}
public static string SignApiRequest(IDictionary<string, string> parameters, string secret)
{
IDictionary<string, string> dictionary = new SortedDictionary<string, string>(parameters);
StringBuilder builder = new StringBuilder(secret);
foreach (var key in dictionary.Keys)
{
if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(dictionary[key]))
{builder.Append(key).Append(dictionary[key]);}
}
byte[] buffer = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(builder.ToString()));Console.WriteLine(builder.ToString());
StringBuilder builder2 = new StringBuilder();
for (int i = 0; i < buffer.Length; i++)
{
builder2.Append(buffer[i].ToString("X2"));
}
return builder2.ToString();
}
回执节点描述
| 序号 |
字段名 |
中文名称 |
| 1 |
StatusGuid |
GUID |
| 2 |
VesselName |
船名 |
| 3 |
VoyageNo |
航次 |
| 4 |
BillNo |
提单号 |
| 5 |
DivBillNo |
分提单号 |
| 6 |
SatusType |
状态类型 |
| 7 |
ContainerNo |
箱号 |
| 8 |
YardName |
堆场 |
| 9 |
StatusDate |
状态时间 |
| 10 |
Pier |
码头 |
| 11 |
PierResponse |
码头放行回执 |
| 12 |
SealNo |
封号 |
| 13 |
CustomsNo |
报关单号 |
| 14 |
CargoName |
英文品名 |
| 15 |
Pkgs |
件数 |
| 16 |
GrossWeight |
毛重 |
| 17 |
Measurement |
体积 |
| 18 |
CustomsResponse |
海关预配回执 |
| 19 |
BarCode |
条型码 |
| 20 |
SpareDate |
备用时间字段 |
| 21 |
Spare1 |
备用字段1 |
| 22 |
Spare2 |
备用字段2 |
| 23 |
Spare3 |
备用字段3 |
| 24 |
Spare4 |
备用字段4 |
| 25 |
Spare5 |
备用字段5 |
| 26 |
CreateDate |
创建日期 |
| 27 |
UpdateDate |
更新日期 |
| 28 |
VesselCode |
船舶UN代码 |
| 29 |
IEFlag |
进出口标记 |
| 30 |
CtnOperator |
箱经营人 |
| 31 |
PlaceCode |
地点代码 |
| 32 |
Place |
地点,对应地点代码中的中文 |
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。