|
|
@@ -3,14 +3,23 @@ package com.usoftchina.uas.office.qywx.manage.service;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.usoftchina.qywx.sdk.weixin.AesException;
|
|
|
import com.usoftchina.qywx.sdk.weixin.WXBizJsonMsgCrypt;
|
|
|
+import com.usoftchina.uas.office.dto.Result;
|
|
|
+import com.usoftchina.uas.office.entity.DataCenter;
|
|
|
+import com.usoftchina.uas.office.jdbc.DataSourceHolder;
|
|
|
import com.usoftchina.uas.office.service.AbstractService;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@Service
|
|
|
public class QywxCallbackService extends AbstractService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ @Lazy
|
|
|
+ private QywxSettingService settingService;
|
|
|
+
|
|
|
private final Logger logger = LoggerFactory.getLogger(QywxCallbackService.class);
|
|
|
|
|
|
public String verifyURL(String msgSignature, Integer timestamp, String nonce, String echostr){
|
|
|
@@ -18,8 +27,16 @@ public class QywxCallbackService extends AbstractService {
|
|
|
String sToken = "fD8frpMuXpkPLUM";
|
|
|
String sEncodingAESKey = "73euRc0KW5IbOPNmD6IRFqGAYhcCBRUBrIloAPBLvsR";
|
|
|
String sCorpID = "wwbb7e27c4decb7872";
|
|
|
+ DataCenter dataCenter = DataCenter.INSTANCE;
|
|
|
+ try {
|
|
|
+ DataSourceHolder.set(dataCenter);
|
|
|
+ sCorpID = settingService.find().getCorpId();
|
|
|
+ } finally {
|
|
|
+ DataSourceHolder.clear();
|
|
|
+ }
|
|
|
String callBackStr = null;
|
|
|
try {
|
|
|
+ logger.info("企业微信MsgCrypt sToken {} sEncodingAESKey{} sCorpID{}", sToken, sEncodingAESKey, sCorpID);
|
|
|
WXBizJsonMsgCrypt wxcpt = new WXBizJsonMsgCrypt(sToken, sEncodingAESKey, sCorpID);
|
|
|
callBackStr = wxcpt.VerifyURL(msgSignature, String.valueOf(timestamp),
|
|
|
nonce, echostr);
|