Browse Source

企业微信推送信息接受

zhouy 1 year ago
parent
commit
07670584cd

+ 4 - 3
uas-office-qywx/src/main/java/com/usoftchina/uas/office/qywx/manage/controller/QywxCallbackController.java

@@ -2,6 +2,7 @@ package com.usoftchina.uas.office.qywx.manage.controller;
 
 import com.usoftchina.qywx.sdk.util.HttpUtils;
 import com.usoftchina.uas.office.dto.Result;
+import com.usoftchina.uas.office.qywx.manage.entity.QywxCallback;
 import com.usoftchina.uas.office.qywx.manage.service.QywxCallbackService;
 import com.usoftchina.uas.office.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -40,9 +41,9 @@ public class QywxCallbackController {
      * 消息接收
      * */
     @PostMapping(path = "/qywx/Callback")
-    public String  receiveMessage(@PathVariable("msg_signature") String msg_signature, @PathVariable("timestamp") String timestamp,
-                                 @PathVariable("nonce") String nonce, @RequestBody String jsonMsg ){
-        return  qywxCallbackService.callBack(msg_signature, timestamp, nonce, jsonMsg);
+    public String  receiveMessage(@RequestBody QywxCallback qywxCallback ){
+        qywxCallbackService.callBack(qywxCallback);
+        return  "success";
     }
 }
 

+ 50 - 0
uas-office-qywx/src/main/java/com/usoftchina/uas/office/qywx/manage/entity/QywxCallback.java

@@ -0,0 +1,50 @@
+package com.usoftchina.uas.office.qywx.manage.entity;
+
+public class QywxCallback {
+    private String SuiteId;
+    private String InfoType;
+    private String SuiteTicket;
+    private String msg_signature;
+
+    public String getSuiteId() {
+        return SuiteId;
+    }
+
+    public void setSuiteId(String suiteId) {
+        SuiteId = suiteId;
+    }
+
+    public String getInfoType() {
+        return InfoType;
+    }
+
+    public void setInfoType(String infoType) {
+        InfoType = infoType;
+    }
+
+    public String getSuiteTicket() {
+        return SuiteTicket;
+    }
+
+    public void setSuiteTicket(String suiteTicket) {
+        SuiteTicket = suiteTicket;
+    }
+
+    public String getMsg_signature() {
+        return msg_signature;
+    }
+
+    public void setMsg_signature(String msg_signature) {
+        this.msg_signature = msg_signature;
+    }
+
+    @Override
+    public String toString() {
+        return "QywxCallback{" +
+                "SuiteId='" + SuiteId + '\'' +
+                ", InfoType='" + InfoType + '\'' +
+                ", SuiteTicket='" + SuiteTicket + '\'' +
+                ", msg_signature='" + msg_signature + '\'' +
+                '}';
+    }
+}

+ 5 - 3
uas-office-qywx/src/main/java/com/usoftchina/uas/office/qywx/manage/service/QywxCallbackService.java

@@ -11,6 +11,7 @@ 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.qywx.config.ProviderConfig;
+import com.usoftchina.uas.office.qywx.manage.entity.QywxCallback;
 import com.usoftchina.uas.office.service.AbstractService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -56,11 +57,11 @@ public class QywxCallbackService extends AbstractService {
         return callBackStr;
     }
 
-    public String callBack(String msgSignature, String timestamp, String nonce, String jsonMsg){
+    public String callBack(QywxCallback qywxCallback){
         //TODO 获取参数回调配置
         String decryptMsg = null;
         logger.info("企业微信CallBack POST ");
-        try {
+        /*try {
             WXBizJsonMsgCrypt wxcpt = new WXBizJsonMsgCrypt(providerConfig.getToken(), providerConfig.getEncodingAESKey(), getCropId());
             decryptMsg = wxcpt.DecryptMsg(msgSignature, timestamp, nonce, jsonMsg);
             logger.info("企业微信CallBack POST {}", decryptMsg);
@@ -68,7 +69,8 @@ public class QywxCallbackService extends AbstractService {
 
         } catch (AesException e) {
             e.printStackTrace();
-        }
+        }*/
+        logger.info(qywxCallback.toString());
 
         return null;
     }