BAOLH
2025-02-19 031eca402975d8f3811d431590698474465d319c
企微审批状态回调记录API返回值变更
3 files modified
27 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/temp/Temp.java 4 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/temp/service/WechatSendHistoryService.java 2 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/temp/service/impl/WechatSendHistoryServiceImpl.java 21 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/temp/Temp.java
@@ -52,9 +52,9 @@
    @AnonymousGetMapping(value = "/wechat/approval/back")
    @Log("企业微信验证回调URL")
    @ApiOperation("企业微信验证回调URL")
    public ResponseEntity<Object> approvalBack(@RequestParam(value = "msg_signature") String msgSignature, @RequestParam(value = "timestamp") String timestamp,
    public void approvalBack(@RequestParam(value = "msg_signature") String msgSignature, @RequestParam(value = "timestamp") String timestamp,
                                               @RequestParam(value = "nonce") String nonce, @RequestParam(value = "echostr") String echostr, HttpServletResponse response){
        return new ResponseEntity<>(wechatSendHistoryService.approvalBack(msgSignature, timestamp, nonce, echostr, response), HttpStatus.OK);
        wechatSendHistoryService.approvalBack(msgSignature, timestamp, nonce, echostr, response);
    }
    @AnonymousPostMapping(value = "/wechat/approval/back")
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/temp/service/WechatSendHistoryService.java
@@ -91,7 +91,7 @@
     * @param response 响应
     * @return String
     */
    String approvalBack(String msgSignature, String timestamp, String nonce, String echostr, HttpServletResponse response);
    void approvalBack(String msgSignature, String timestamp, String nonce, String echostr, HttpServletResponse response);
    /**
     * 处理企业微信审批回调事件
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/temp/service/impl/WechatSendHistoryServiceImpl.java
@@ -15,10 +15,8 @@
*/
package me.zhengjie.modules.temp.service.impl;
import ch.ethz.ssh2.crypto.digest.SHA1;
import me.zhengjie.modules.temp.domain.WechatSendHistory;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.*;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.temp.repository.WechatSendHistoryRepository;
import me.zhengjie.modules.temp.service.WechatSendHistoryService;
@@ -30,11 +28,10 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
@@ -111,14 +108,22 @@
    }
    @Override
    public String approvalBack(String msgSignature, String timestamp, String nonce, String echostr, HttpServletResponse response) {
    public void approvalBack(String msgSignature, String timestamp, String nonce, String echostr, HttpServletResponse response) {
        try {
            WXBizJsonMsgCrypt wxcpt = new WXBizJsonMsgCrypt(TOKEN, ENCODING_AES_KEY, CORP_ID);
            return wxcpt.VerifyURL(msgSignature, timestamp, nonce, echostr);
            // 设置响应内容类型为纯文本
            response.setContentType("text/plain; charset=UTF-8");
            // 获取PrintWriter对象
            PrintWriter out = response.getWriter();
            // 直接返回
            String message = wxcpt.VerifyURL(msgSignature, timestamp, nonce, echostr);
            out.print(message);
            // 刷新并关闭PrintWriter
            out.flush();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    @Override