bug
jiangqs
2023-08-17 b7c94458ce1c37cfc1b8797ebc38a9a03e305b1f
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/conslole/QYWXCallBackController.java
@@ -1,10 +1,15 @@
package com.ruoyi.system.controller.conslole;
import com.esotericsoftware.minlog.Log;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import me.chanjar.weixin.common.util.crypto.WxCryptUtil;
import org.apache.commons.io.IOUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -19,8 +24,11 @@
@Api(value = "企业微信通知控制", tags = "企业微信通知控制", description = "企业微信通知控制")
@RestController
@RequestMapping("/qywx")
@Log4j2
public class QYWXCallBackController {
    @Autowired
    private  WxCryptUtil wxCryptUtil;
    @ApiOperation(value = "消息与事件接收配置")
    @RequestMapping(value = "/qywxNotify",
@@ -35,7 +43,14 @@
        String msgSignature = request.getParameter("msg_signature");
        String encType =  request.getParameter("encrypt_type");
        String xml =  IOUtils.toString(request.getReader());
        Log.info("企业微信回调"+xml);
        log.info("企业微信回调参数nonce"+nonce);
        log.info("企业微信回调参数timestamp"+timestamp);
        log.info("企业微信回调参数signature"+signature);
        log.info("企业微信回调参数msgSignature"+msgSignature);
        log.info("企业微信回调参数encType"+encType);
        log.info("企业微信回调参数xml"+xml);
        String reponseStr = wxCryptUtil.decryptXml(msgSignature,timestamp,nonce,xml);
        log.info("企业微信回调参数xml解析"+reponseStr);
        return "SUCCESS";
    }
}