|
|
|
@ -16,13 +16,13 @@ import static com.zdxt.code.utils.ServiceInvocation.httpRequest; |
|
|
|
@Service |
|
|
|
public class MssqApiServiceImpl implements MssqApiService { |
|
|
|
|
|
|
|
// @Value("${mssq.apiUrl}")
|
|
|
|
@Value("${mssq.apiUrl}") |
|
|
|
private String mssqUrl; |
|
|
|
|
|
|
|
// @Value("${mssq.appId}")
|
|
|
|
@Value("${mssq.appId}") |
|
|
|
private String appId; |
|
|
|
|
|
|
|
// @Value("${mssq.appKey}")
|
|
|
|
@Value("${mssq.appKey}") |
|
|
|
private String appKey; |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -35,6 +35,8 @@ public class MssqApiServiceImpl implements MssqApiService { |
|
|
|
mssqAddOrder.setGatewaySig(mssqToken.getGatewaySig()); |
|
|
|
//请求时间戳
|
|
|
|
mssqAddOrder.setGatewayRtime(mssqToken.getGatewayRtime()); |
|
|
|
//请求类型
|
|
|
|
mssqAddOrder.setInvokingServiceRequestMethod("POST"); |
|
|
|
String s = JSONObject.toJSONString(mssqAddOrder); |
|
|
|
log.info("民生诉求token:{}",JSONObject.toJSONString(mssqToken)); |
|
|
|
log.info("民生诉求工单新增,上传参数:{}",s); |
|
|
|
@ -61,15 +63,19 @@ public class MssqApiServiceImpl implements MssqApiService { |
|
|
|
String tokenSign = gatewaySignEncode(appId, appKey, currTime); |
|
|
|
// 2.调用获取token接口
|
|
|
|
JSONObject jsonObject = httpRequest(mssqUrl + "/auth/token", "POST", "", appId, currTime, tokenSign); |
|
|
|
log.info("民生诉求获取auth:{}",jsonObject.toJSONString()); |
|
|
|
JSONObject jsonObjectBody = JSONObject.parseObject(jsonObject.getString("body")); |
|
|
|
// log.info("民生诉求获取token接口:{}",jsonObject);
|
|
|
|
if (jsonObjectBody != null) { |
|
|
|
String accessToken = jsonObjectBody.getString("access_token"); |
|
|
|
log.info("民生诉求获取token:{}",accessToken); |
|
|
|
// 3.在获得服务调用秘钥access_token后,根据自己的appKey使用AES解密算法对返回值进行解密,最终获取签名密钥secretKey
|
|
|
|
String secretKey = ServiceInvocation.gatewayAesDecode(appKey, accessToken); |
|
|
|
log.info("民生诉求获取secretKey:{}",secretKey); |
|
|
|
// 4.获取本地签名
|
|
|
|
String sign = gatewaySignEncode(appId, secretKey, currTime); |
|
|
|
mssqBaseDomain.setAccessToken(accessToken); |
|
|
|
log.info("民生诉求获取sign:{}",sign); |
|
|
|
//签名
|
|
|
|
mssqBaseDomain.setGatewaySig(sign); |
|
|
|
} |
|
|
|
|