Browse Source

提交民生诉求对接代码

v2
chenrui 2 years ago
parent
commit
fc2321b046
  1. 14
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/application.yml
  2. 12
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/MssqApiServiceImpl.java

14
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/application.yml

@ -208,7 +208,7 @@ security:
allowed: allowed:
servernames: 10.76.108.1,10.76.108.3,10.132.108.3,139.186.135.156,jdm.szssfj.cn,58.250.157.161,127.0.0.1 servernames: 10.76.108.1,10.76.108.3,10.132.108.3,139.186.135.156,jdm.szssfj.cn,58.250.157.161,127.0.0.1,localhost
excel: excel:
export: true export: true
@ -268,12 +268,16 @@ srnwg:
# paasToken: e64638a4483e8bcfc33d935c3cbdf546 # paasToken: e64638a4483e8bcfc33d935c3cbdf546
mssq: #mssq:
appId: 67a83c8a136346cd98f844359902a23c # appId: 67a83c8a136346cd98f844359902a23c
appkey: NjdhODNjOGExMzYzNDZjZDk4Zjg0NDM1OTkwMmEyM2M6TXNzcTIwMjQ= # appkey: NjdhODNjOGExMzYzNDZjZDk4Zjg0NDM1OTkwMmEyM2M6TXNzcTIwMjQ=
apiUrl: http://10.224.158.64:8282/proxy/api # apiUrl: http://10.224.158.64:8282/proxy/api
mssq:
appId: 67a83c8a136346cd98f844359902a23c
appKey: NjdhODNjOGExMzYzNDZjZDk4Zjg0NDM1OTkwMmEyM2M6TXNzcTIwMjQ=
apiUrl: http://10.224.158.64:8282/proxy
#短信平台 #短信平台
sms: sms:
account: 122 account: 122

12
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/MssqApiServiceImpl.java

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

Loading…
Cancel
Save