|
@@ -1,6 +1,7 @@
|
|
|
package com.usoftchina.uas.office.qywx.manage.service;
|
|
package com.usoftchina.uas.office.qywx.manage.service;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
|
|
import com.usoftchina.qywx.sdk.DevSDK;
|
|
import com.usoftchina.qywx.sdk.DevSDK;
|
|
|
import com.usoftchina.qywx.sdk.ScheduleSdk;
|
|
import com.usoftchina.qywx.sdk.ScheduleSdk;
|
|
|
import com.usoftchina.qywx.sdk.dto.GetProviderTokenResp;
|
|
import com.usoftchina.qywx.sdk.dto.GetProviderTokenResp;
|
|
@@ -22,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -57,20 +59,28 @@ public class QywxCallbackService extends AbstractService {
|
|
|
return callBackStr;
|
|
return callBackStr;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public String callBack(String messageXml){
|
|
|
|
|
|
|
+ public String callBack(String msgSignature, Integer timestamp, String nonce, String messageXml){
|
|
|
//TODO 获取参数回调配置
|
|
//TODO 获取参数回调配置
|
|
|
String decryptMsg = null;
|
|
String decryptMsg = null;
|
|
|
|
|
+ QywxCallback qywxCallback =null;
|
|
|
|
|
+ logger.info(messageXml);
|
|
|
|
|
+ try {
|
|
|
|
|
+ qywxCallback = new XmlMapper().readValue(messageXml, QywxCallback.class);
|
|
|
|
|
+ logger.info(qywxCallback.toString());
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
logger.info("企业微信CallBack POST ");
|
|
logger.info("企业微信CallBack POST ");
|
|
|
- /*try {
|
|
|
|
|
|
|
+ try {
|
|
|
WXBizJsonMsgCrypt wxcpt = new WXBizJsonMsgCrypt(providerConfig.getToken(), providerConfig.getEncodingAESKey(), getCropId());
|
|
WXBizJsonMsgCrypt wxcpt = new WXBizJsonMsgCrypt(providerConfig.getToken(), providerConfig.getEncodingAESKey(), getCropId());
|
|
|
- decryptMsg = wxcpt.DecryptMsg(msgSignature, timestamp, nonce, jsonMsg);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ decryptMsg = wxcpt.DecryptMsg(msgSignature, String.valueOf(timestamp), nonce, qywxCallback.getEncrypt());
|
|
|
logger.info("企业微信CallBack POST {}", decryptMsg);
|
|
logger.info("企业微信CallBack POST {}", decryptMsg);
|
|
|
JSON.parseObject(decryptMsg);
|
|
JSON.parseObject(decryptMsg);
|
|
|
|
|
|
|
|
} catch (AesException e) {
|
|
} catch (AesException e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
- }*/
|
|
|
|
|
- logger.info(messageXml);
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|