erp修改
This commit is contained in:
@@ -21,7 +21,7 @@ public class ErpSubmitReqDTO {
|
||||
* "bskey": 调用系统业务单据编号,必须,在外部系统唯一,用于关联
|
||||
* "usrid": 外部系统用户id
|
||||
* "usrnm": 外部系统用户名
|
||||
* "sign": 签名,uuid+srcsys+密码,MD5 32位小写签名,密码另行约定
|
||||
* "sign": 签名,uuid+srcsys+密码,MD5 32位小写签名,秘钥另行约定
|
||||
* "req": {具体参数,参见RFC功能列表}
|
||||
*/
|
||||
@Schema(description = "接口编号,必须,参见RFC功能列表,可调用接口编号范围051-900")
|
||||
@@ -40,7 +40,7 @@ public class ErpSubmitReqDTO {
|
||||
@NotBlank(message = "外部系统用户名不能为空")
|
||||
private String usrnm;
|
||||
|
||||
@Schema(description = "签名,uuid+srcsys+密码,MD5 32位小写签名,密码另行约定")
|
||||
@Schema(description = "签名,uuid+srcsys+密码,MD5 32位小写签名,秘钥另行约定")
|
||||
private String sign;
|
||||
|
||||
@Schema(description = "具体参数,参见RFC功能列表")
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.zt.plat.module.erp.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpEntity;
|
||||
@@ -13,6 +15,7 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -29,6 +32,9 @@ public class ErpConfig {
|
||||
@Value("${erp.sapsys:}")
|
||||
private String sapsys;
|
||||
|
||||
@Value("${erp.secretKey:}")
|
||||
private String secretKey;
|
||||
|
||||
/**
|
||||
* 调用ERP接口获取erp数据
|
||||
*/
|
||||
@@ -110,7 +116,11 @@ public class ErpConfig {
|
||||
requestBody.put("usrid", reqDTO.getUsrid());
|
||||
requestBody.put("usrnm", reqDTO.getUsrnm());
|
||||
// todo 密码另行约定
|
||||
//requestBody.put("sign", StrUtil.(uuid + sapsys + "密码另行约定"));
|
||||
if (StringUtils.isBlank(reqDTO.getSign())) {
|
||||
requestBody.put("sign", DigestUtil.md5Hex(uuid + "DSC" + secretKey, StandardCharsets.UTF_8));
|
||||
} else {
|
||||
requestBody.put("sign", reqDTO.getSign());
|
||||
}
|
||||
if (reqDTO.getReq() != null) {
|
||||
requestBody.put("req", reqDTO.getReq());
|
||||
}
|
||||
@@ -166,4 +176,5 @@ public class ErpConfig {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user