From e0a7b836464d6fcc037d46f845b8faf39cb5b13e Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 07 四月 2026 14:58:02 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/gtzxinglijicun

---
 server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java |  244 ------------------------------------------------
 1 files changed, 0 insertions(+), 244 deletions(-)

diff --git a/server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java b/server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java
index 1c2656f..d719e4b 100644
--- a/server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java
+++ b/server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java
@@ -53,248 +53,4 @@
     @Autowired
     private WithdrawalOrdersService withdrawalOrdersService;
 
-    /**
-     * 銆愬井淇℃敮浠樸�戝紓姝ラ�氱煡
-     *
-     * @return
-     */
-    @PostMapping("/web/wxPayNotify")
-    public ApiResponse wxPay_notify(HttpServletRequest request) {
-        log.error("寰俊鏀粯鍥炶皟缁撴灉寮�濮�===========" );
-        try {
-            ServletInputStream inputStream = request.getInputStream();
-            StringBuffer stringBuffer = new StringBuffer();
-            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
-            String s;
-            //璇诲彇鍥炶皟璇锋眰浣�
-            while ((s = bufferedReader.readLine()) != null) {
-                stringBuffer.append(s);
-            }
-            String body = stringBuffer.toString();
-            String timestamp = request.getHeader("Wechatpay-Timestamp");
-            String nonce = request.getHeader("Wechatpay-Nonce");
-            String signType = request.getHeader("Wechatpay-Signature-Type");
-            String serialNo = request.getHeader("wechatpay-Serial");
-            String signature = request.getHeader("Wechatpay-Signature");
-            RequestParam requestParam = new RequestParam.Builder()
-                    .serialNumber(serialNo)
-                    .nonce(nonce)
-                    .signType(signType)
-                    .signature(signature)
-                    .timestamp(String.valueOf(timestamp))
-                    .body(body)
-                    .build();
-
-            NotificationConfig config = new RSAPublicKeyConfig.Builder()
-                    .merchantId(WxMiniConfig.wxProperties.getMchId())
-                    .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath())
-                    .publicKeyFromPath(WxMiniConfig.wxProperties.getPubKeyPath())
-                    .publicKeyId(WxMiniConfig.wxProperties.getPayPublicKeyId())
-                    .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer())
-                    .apiV3Key(WxMiniConfig.wxProperties.getApiV3Key())
-                    .build();
-
-
-            NotificationParser parser = new NotificationParser(config);
-
-
-            Transaction result = parser.parse(requestParam, Transaction.class);
-            log.error("鏀粯鍥炶皟淇℃伅锛歿}"+ JSONObject.toJSONString(result));
-            //鑷畾涔夎鍗曞彿
-            String outTradeNo = result.getOutTradeNo();
-            //寰俊璁㈠崟鍙�
-            String paymentNo = result.getTransactionId();
-            if ("SUCCESS".equals(result.getTradeState().name())) {
-                // 鏀粯鎴愬姛ge
-                switch (result.getAttach()) {
-                    //鏀粯璁㈠崟鍥炶皟
-                    case "createOrder": {
-                        ordersService.payNotify(outTradeNo,paymentNo);
-                        break;
-                    }
-                }
-            } else {
-                // 鏀粯澶辫触
-                switch (result.getAttach()) {
-                    case "createOrder": {
-                        break;
-                    }
-                }
-            }
-            log.error("寰俊鏀粯鍥炶皟缁撴灉缁撴潫===========" );
-            return ApiResponse.success("澶勭悊鎴愬姛!");
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("寰俊鍥炶皟缁撴灉寮傚父,寮傚父鍘熷洜{}", e.getLocalizedMessage());
-            return ApiResponse.failed("");
-        }
-    }
-    @PostMapping("/web/wxRefundNotify")
-    public ApiResponse wxRefundNotify(HttpServletRequest request) {
-        log.error("寰俊閫�娆惧洖璋冪粨鏋滃紑濮�===========" );
-        try {
-            DefaultSecurityManager securityManager = new DefaultSecurityManager();
-            SecurityUtils.setSecurityManager(securityManager);
-            ServletInputStream inputStream = request.getInputStream();
-            StringBuffer stringBuffer = new StringBuffer();
-            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
-            String s;
-            //璇诲彇鍥炶皟璇锋眰浣�
-            while ((s = bufferedReader.readLine()) != null) {
-                stringBuffer.append(s);
-            }
-            String body = stringBuffer.toString();
-            String timestamp = request.getHeader("Wechatpay-Timestamp");
-            String nonce = request.getHeader("Wechatpay-Nonce");
-            String signType = request.getHeader("Wechatpay-Signature-Type");
-            String serialNo = request.getHeader("wechatpay-Serial");
-            String signature = request.getHeader("Wechatpay-Signature");
-            RequestParam requestParam = new RequestParam.Builder()
-                    .serialNumber(serialNo)
-                    .nonce(nonce)
-                    .signType(signType)
-                    .signature(signature)
-                    .timestamp(String.valueOf(timestamp))
-                    .body(body)
-                    .build();
-
-            NotificationConfig config = /*new RSAAutoCertificateConfig.Builder()
-                    .merchantId(WxMiniConfig.wxProperties.getMchId())
-                    .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath())
-                    .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer())
-                    .apiV3Key(WxMiniConfig.wxProperties.getApiV3Key())
-                    .build();*/
-            new RSAPublicKeyConfig.Builder()
-                    .merchantId(WxMiniConfig.wxProperties.getMchId())
-                    .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath())
-                    .publicKeyFromPath(WxMiniConfig.wxProperties.getPubKeyPath())
-                    .publicKeyId(WxMiniConfig.wxProperties.getPayPublicKeyId())
-                    .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer())
-                    .apiV3Key(WxMiniConfig.wxProperties.getApiV3Key())
-                    .build();
-
-            NotificationParser parser = new NotificationParser(config);
-            RefundNotification result = parser.parse(requestParam, RefundNotification.class);
-//            if ("SUCCESS".equals(result.getRefundStatus().name())) {
-                // 鏀粯鎴愬姛ge
-                     ordersService.refundCallback(result);
-//            }
-            return ApiResponse.success("澶勭悊鎴愬姛");
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("寰俊鍥炶皟缁撴灉寮傚父,寮傚父鍘熷洜{}", e.getLocalizedMessage());
-            return ApiResponse.failed("");
-        }
-    }
-
-
-
-
-    /**
-     * 寰俊鍟嗘埛闆剁嚎杞处 - 鍥炶皟閫氱煡
-     * @Context娉ㄨВ  鎶奌TTP璇锋眰涓婁笅鏂囧璞℃敞鍏ヨ繘鏉ワ紝HttpServletRequest銆丠ttpServletResponse銆乁riInfo 绛�
-     * @return
-     */
-    @PostMapping(value = "/web/wechat/transferNotify")
-    public ApiResponse transferNotify( HttpServletRequest request) {
-        Map<String,String> errMap = new HashMap<>();
-        try {
-            log.error("寰俊鍟嗘埛闆剁嚎杞处 - 鍥炶皟閫氱煡 /wxpay/callback");
-
-            Config config = new RSAPublicKeyConfig.Builder()
-                .merchantId(WxMiniConfig.wxProperties.getSubMchId()) //寰俊鏀粯鐨勫晢鎴峰彿
-                .privateKeyFromPath(WxMiniConfig.wxProperties.getWechatPrivateKeyPath()) // 鍟嗘埛API璇佷功绉侀挜鐨勫瓨鏀捐矾寰�
-                .publicKeyFromPath(WxMiniConfig.wxProperties.getWechatPubKeyPath()) //寰俊鏀粯鍏挜鐨勫瓨鏀捐矾寰�
-                .publicKeyId(WxMiniConfig.wxProperties.getWechatPayPublicKeyId()) //寰俊鏀粯鍏挜ID
-                .merchantSerialNumber(WxMiniConfig.wxProperties.getWechatSerialNumer()) //鍟嗘埛API璇佷功搴忓垪鍙�
-                .apiV3Key(WxMiniConfig.wxProperties.getWechatApiV3Key()) //APIv3瀵嗛挜
-                .build();
-
-            TransferDetailEntityNew entity = wxSuccessCallback(request,config);
-            log.error("transfer ok.{}",entity);
-            //鍥炶皟鎴愬姛鍚庡鐞嗚嚜宸辩殑涓氬姟
-            if(entity != null){
-                if((entity.getState().equals(Constants.SUCCESS)
-                        || entity.getState().equals(Constants.CANCELLED)
-                        || entity.getState().equals(Constants.FAIL))
-                        && StringUtils.isNotBlank(entity.getOutBillNo())){
-                    withdrawalOrdersService.transferSuccess(entity.getOutBillNo(),entity.getState().equals(Constants.SUCCESS)?true:false);
-                }
-            }
-            return ApiResponse.success("澶勭悊鎴愬姛");
-        } catch (Exception e) {
-            log.error("寰俊鍟嗘埛闆剁嚎杞处 - 鍥炶皟閫氱煡 /wxpay/callback锛氬紓甯革紒", e);
-            errMap.put("code", "FAIL");
-            errMap.put("message", "鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
-            return ApiResponse.failed("澶勭悊澶辫触");
-        }
-    }
-
-    public TransferDetailEntityNew wxSuccessCallback(HttpServletRequest request,Config config) throws IOException {
-        String requestBody = getBodyString(request, "UTF-8");
-        //璇佷功搴忓垪鍙凤紙寰俊骞冲彴锛�   楠岀鐨勨�滃井淇℃敮浠樺钩鍙拌瘉涔︹�濇墍瀵瑰簲鐨勫钩鍙拌瘉涔﹀簭鍒楀彿
-        String wechatPaySerial = request.getHeader("Wechatpay-Serial");
-        //寰俊浼犻�掕繃鏉ョ殑绛惧悕   楠岀鐨勭鍚嶅��
-        String wechatSignature = request.getHeader("Wechatpay-Signature");
-        //楠岀鐨勬椂闂存埑
-        String wechatTimestamp = request.getHeader("Wechatpay-Timestamp");
-        //楠岀鐨勯殢鏈哄瓧绗︿覆
-        String wechatpayNonce = request.getHeader("Wechatpay-Nonce");
-        // 1. 鏋勯�� RequestParam
-        RequestParam requestParam = new RequestParam.Builder()
-                .serialNumber(wechatPaySerial)
-                .nonce(wechatpayNonce)
-                .signature(wechatSignature)
-                .timestamp(wechatTimestamp)
-                .body(requestBody)
-                .build();
-        // 2. 鏋勫缓Config RSAPublicKeyConfig
-//        Config config = new RSAPublicKeyConfig.Builder()
-//                        .merchantId(WxMiniConfig.wxProperties.getMchId()) //寰俊鏀粯鐨勫晢鎴峰彿
-//                        .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath()) // 鍟嗘埛API璇佷功绉侀挜鐨勫瓨鏀捐矾寰�
-//                        .publicKeyFromPath(WxMiniConfig.wxProperties.getWechatPubKeyPath()) //寰俊鏀粯鍏挜鐨勫瓨鏀捐矾寰�
-//                        .publicKeyId(WxMiniConfig.wxProperties.getWechatPayPublicKeyId()) //寰俊鏀粯鍏挜ID
-//                        .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer()) //鍟嗘埛API璇佷功搴忓垪鍙�
-//                        .apiV3Key("") //APIv3瀵嗛挜
-//                        .build();
-        log.info("WxPayService.wxPaySuccessCallback request : wechatPaySerial is [{}]  , wechatSignature is [{}] , wechatTimestamp is [{}] , wechatpayNonce  is [{}] , requestBody is [{}]",wechatPaySerial,wechatSignature,wechatTimestamp,wechatpayNonce,requestBody);
-        // 3. 鍒濆鍖� NotificationParser
-        NotificationParser parser = new NotificationParser((NotificationConfig) config);
-        try {
-            TransferDetailEntityNew entity = parser.parse(requestParam, TransferDetailEntityNew.class);
-            log.info("WxPayService.wxPaySuccessCallback responseBody: {}", entity != null ? JSON.toJSONString(entity) : null);
-            return entity;
-        } catch (Exception e) {
-            log.error("Exception occurred while processing", e);
-            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"绯荤粺鍐呴儴閿欒");
-        }
-    }
-
-    /**
-     * 鑾峰彇post璇锋眰涓殑Body
-     *
-     * @param request httpRequest
-     * @return body瀛楃涓�
-     */
-    public static String getBodyString(HttpServletRequest request, String charSet) throws IOException {
-        StringBuilder sb = new StringBuilder();
-        InputStream inputStream = null;
-        BufferedReader reader = null;
-        try {
-            inputStream = request.getInputStream();
-            //璇诲彇娴佸苟灏嗘祦鍐欏嚭鍘�,閬垮厤鏁版嵁娴佷腑鏂�;
-            reader = new BufferedReader(new InputStreamReader(inputStream, charSet));
-            String line;
-            while ((line = reader.readLine()) != null) {
-                sb.append(line);
-            }
-        } catch (IOException e) {
-            log.error("鑾峰彇requestBody寮傚父", e);
-        } finally {
-            inputStream.close();
-            reader.close();
-        }
-        return sb.toString();
-    }
-
 }

--
Gitblit v1.9.3