rk
2026-04-02 d0c2a04e6ec9f07f84aaaa864362358423dda83b
代码初始化提交
已添加1个文件
已删除1个文件
已修改11个文件
1152 ■■■■ 文件已修改
server/.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java 244 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/config/wx/TransferToUser.java 330 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/config/wx/WxMiniConfig.java 125 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/config/wx/WxMiniUtilService.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/config/wx/WxPayProperties.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/core/constants/Constants.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/dao/vo/PayResponse.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/service/business/WithdrawalOrdersService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/service/business/impl/WithdrawalOrdersServiceImpl.java 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/resources/application-dev.yml 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/api/web/UserApi.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/.gitignore
@@ -24,3 +24,4 @@
# Package Files #
*.jar
*.war
/CLAUDE.md
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注解  æŠŠHTTP请求上下文对象注入进来,HttpServletRequest、HttpServletResponse、UriInfo ç­‰
     * @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();
    }
}
server/services/src/main/java/com/doumee/config/wx/TransferToUser.java
ÎļþÒÑɾ³ý
server/services/src/main/java/com/doumee/config/wx/WxMiniConfig.java
@@ -33,13 +33,11 @@
    /********微信小程序服务**********/
    public static WxMaService wxMaService;
    /********微信小程序支付**********/
    public static JsapiService wxPayService;
//    public static WxPayService wxPayV2Service;
    public static RefundService refundService;
    public static JsapiServiceExtension jsapiExtService;
    public static BillDownloadService billDownloadService;
    public static WxPayProperties wxProperties;
    public static  TransferToUser transferToUser;
    public static WxPayService wxPayService;
    /********微信APP支付**********/
    public static WxPayService wxAppPayService;
    @Autowired
    private WxPayProperties wxPayProperties;
@@ -51,23 +49,15 @@
    void init() {
        this.load_WxMaService();
        this.load_wxPayService();
//        this.load_wxPayV2Service();
        this.load_transferToUser();
        this.wxProperties = wxPayProperties;
//        this.load_wxAppPayService();
    }
    /**
     * åˆå§‹åŒ–微信小程序
     */
    public void load_WxMaService() {
        WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
        if(wxPayProperties.getExistsSub() ==1){
            //如果是服务商支付,取子商户信息
            config.setAppid(StringUtils.trimToNull(wxPayProperties.getSubAppId()));
            config.setSecret(StringUtils.trimToNull(wxPayProperties.getSubAppSecret()));
        }else {
//            config.setAppid(StringUtils.trimToNull(wxPayProperties.getAppId()));
//            config.setSecret(StringUtils.trimToNull(wxPayProperties.getAppSecret()));
        }
        config.setAppid(StringUtils.trimToNull(wxPayProperties.getAppId()));
        config.setSecret(StringUtils.trimToNull(wxPayProperties.getAppSecret()));
        config.setMsgDataFormat("JSON");
        //config.setToken("");
        //config.setAesKey("");
@@ -79,98 +69,37 @@
    /**
     * åˆå§‹åŒ–微信小程序支付
     */
    public void load_wxPayService()   {
        try {
            Config config =
                    new RSAPublicKeyConfig.Builder()
                            .merchantId(wxPayProperties.getMchId())
                            .privateKeyFromPath(wxPayProperties.getPrivateKeyPath())
                            .publicKeyFromPath(wxPayProperties.getPubKeyPath())
                            .publicKeyId(wxPayProperties.getPayPublicKeyId())
                            .merchantSerialNumber(wxPayProperties.getSerialNumer())
                            .apiV3Key(wxPayProperties.getApiV3Key())
                            .build();
//            Config config =
//                    new RSAAutoCertificateConfig.Builder()
//                            .merchantId(wxPayProperties.getMchId())
//                            .privateKeyFromPath(wxPayProperties.getPrivateKeyPath())
////                            .publicKeyFromPath(wxPayProperties.getPubKeyPath())
////                            .publicKeyId("PUB_KEY_ID_0117000719222024112700219100000508")
//                            .merchantSerialNumber(wxPayProperties.getSerialNumer())
//                            .apiV3Key(wxPayProperties.getApiV3Key())
//                            .build();
//            this.wxPayService =  new JsapiService.Builder().config(config).build();
            this.jsapiExtService =  new JsapiServiceExtension.Builder().config(config).build();
            this.refundService = new RefundService.Builder().config(config).build();
            this.billDownloadService = new BillDownloadService.Builder().config(config).build();
        }catch (Exception e){
            e.printStackTrace();
        }
    public void load_wxPayService() {
        WxPayConfig payConfig = new WxPayConfig();
        payConfig.setTradeType(WxPayConstants.TradeType.JSAPI);
        payConfig.setSignType(WxPayConstants.SignType.MD5);
        payConfig.setAppId(StringUtils.trimToNull(wxPayProperties.getAppId()));
        payConfig.setMchId(StringUtils.trimToNull(wxPayProperties.getMchId()));
        payConfig.setMchKey(StringUtils.trimToNull(wxPayProperties.getMchKey()));
        payConfig.setKeyPath(StringUtils.trimToNull(wxPayProperties.getKeyPath()));
        payConfig.setNotifyUrl(StringUtils.trimToNull(wxPayProperties.getNotifyUrl()));
        WxPayService wxPayService = new WxPayServiceImpl();
        wxPayService.setConfig(payConfig);
        this.wxPayService = wxPayService;
    }
    /**
     * åˆå§‹åŒ–微信小程序支付
     */
//    public void load_wxPayV2Service()
//    {
//        WxPayConfig payConfig = new WxPayConfig();
//        payConfig.setTradeType(WxPayConstants.TradeType.JSAPI);
//        payConfig.setSignType(WxPayConstants.SignType.MD5);
//        payConfig.setAppId(StringUtils.trimToNull(wxPayProperties.getAppId()));
//        payConfig.setSubAppId(StringUtils.trimToNull(wxPayProperties.getSubAppId()));
//        payConfig.setMchId(StringUtils.trimToNull(wxPayProperties.getMchId()));
//        payConfig.setSubMchId(StringUtils.trimToNull(wxPayProperties.getSubMchId()));
//        payConfig.setMchKey(StringUtils.trimToNull(wxPayProperties.getMchKey()));
////        payConfig.setKeyPath(StringUtils.trimToNull(wxPayProperties.getKeyPath()));
//        payConfig.setNotifyUrl(StringUtils.trimToNull(wxPayProperties.getNotifyUrl()));
//        WxPayService wxPayService = new WxPayServiceImpl();
//        wxPayService.setConfig(payConfig);
//        this.wxPayV2Service = wxPayService;
//    }
    /**
     * åˆå§‹åŒ–微信小程序支付
     */
//    public void load_wxPayService() {
//    /**
//     * åˆå§‹åŒ–App支付
//     */
//    public void load_wxAppPayService() {
//        WxPayConfig payConfig = new WxPayConfig();
//        payConfig.setTradeType(WxPayConstants.TradeType.JSAPI);
//        payConfig.setTradeType(WxPayConstants.TradeType.APP);
//        payConfig.setSignType(WxPayConstants.SignType.MD5);
//        payConfig.setAppId(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_AppID.getCode())));
//        payConfig.setAppId("");
//        payConfig.setMchId(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_MchId.getCode())));
//        payConfig.setMchKey(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_MchKey.getCode())));
//        payConfig.setKeyPath(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_KeyPath.getCode())));
//        payConfig.setNotifyUrl(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_NotifyUrl.getCode())));
//        WxPayService wxPayService = new WxPayServiceImpl();
//        wxPayService.setConfig(payConfig);
//        this.wxPayService = wxPayService;
//        this.wxAppPayService = wxPayService;
//    }
    //转账业务
    public void load_transferToUser()
    {
        TransferToUser transferToUser = new TransferToUser(
                StringUtils.trimToNull(wxPayProperties.getSubMchId()), //商户id
                StringUtils.trimToNull(wxPayProperties.getWechatSerialNumer()), //商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013053053
                StringUtils.trimToNull(wxPayProperties.getWechatPrivateKeyPath()), // å•†æˆ·API证书私钥文件路径,本地文件路径
                StringUtils.trimToNull(wxPayProperties.getWechatPayPublicKeyId()),   // å¾®ä¿¡æ”¯ä»˜å…¬é’¥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013038816
                StringUtils.trimToNull(wxPayProperties.getWechatPubKeyPath()) // å¾®ä¿¡æ”¯ä»˜å…¬é’¥æ–‡ä»¶è·¯å¾„,本地文件路径
        );
//        TransferToUser client = new TransferToUser(
//                "1229817002",                    // å•†æˆ·å·ï¼Œæ˜¯ç”±å¾®ä¿¡æ”¯ä»˜ç³»ç»Ÿç”Ÿæˆå¹¶åˆ†é…ç»™æ¯ä¸ªå•†æˆ·çš„唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/merchant/4013070756
//                "3FE90C2F3D40A56E1C51926F31B8A8D22426CCE0",         // å•†æˆ·API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013053053
//                "d://wechatApiclient_key.pem",    // å•†æˆ·API证书私钥文件路径,本地文件路径
//                "PUB_KEY_ID_0112298170022025071700291836000600",      // å¾®ä¿¡æ”¯ä»˜å…¬é’¥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013038816
//                "d://pub_key.pem"          // å¾®ä¿¡æ”¯ä»˜å…¬é’¥æ–‡ä»¶è·¯å¾„,本地文件路径
//        );
        this.transferToUser = transferToUser;
    }
}
server/services/src/main/java/com/doumee/config/wx/WxMiniUtilService.java
@@ -49,33 +49,34 @@
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
    public boolean wxRefund(WithdrawalOrders withdrawalOrders,Orders orders) {
        // å‘送退款请求
        withdrawalOrders.setCreateTime(new Date());
        withdrawalOrdersMapper.insert(withdrawalOrders);
        CreateRequest request = new CreateRequest();
        request.setOutTradeNo(orders.getOutTradeNo());
        request.setOutRefundNo(withdrawalOrders.getId().toString());
        request.setSubMchid(WxMiniConfig.wxProperties.getSubMchId());
        request.setNotifyUrl(WxMiniConfig.wxProperties.getRefundNotifyUrl());
        AmountReq amountReq = new AmountReq();
        amountReq.setTotal(1L);//withdrawalOrders.getAmount());
        amountReq.setRefund(1L);//withdrawalOrders.getAmount());
        amountReq.setCurrency("CNY");
        request.setAmount(amountReq);
        try {
            log.error("=============="+JSONObject.toJSONString(request));
            com.wechat.pay.java.service.refund.model.Refund response = WxMiniConfig.refundService.create(request);
            log.error("=============="+JSONObject.toJSONString(response));
            if ("SUCCESS".equals(response.getStatus().name())
                    || "PROCESSING".equals(response.getStatus().name()) ) {
                return  true;
            }else{
                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,退款申请失败哦!");
            }
        }catch (Exception e){
            e.printStackTrace();
            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,退款申请失败!");
        }
//        // å‘送退款请求
//        withdrawalOrders.setCreateTime(new Date());
//        withdrawalOrdersMapper.insert(withdrawalOrders);
//        CreateRequest request = new CreateRequest();
//        request.setOutTradeNo(orders.getOutTradeNo());
//        request.setOutRefundNo(withdrawalOrders.getId().toString());
//        request.setSubMchid(WxMiniConfig.wxProperties.getSubMchId());
//        request.setNotifyUrl(WxMiniConfig.wxProperties.getRefundNotifyUrl());
//        AmountReq amountReq = new AmountReq();
//        amountReq.setTotal(1L);//withdrawalOrders.getAmount());
//        amountReq.setRefund(1L);//withdrawalOrders.getAmount());
//        amountReq.setCurrency("CNY");
//        request.setAmount(amountReq);
//        try {
//            log.error("=============="+JSONObject.toJSONString(request));
//            com.wechat.pay.java.service.refund.model.Refund response = WxMiniConfig.wxPayService.refund(request);
//            log.error("=============="+JSONObject.toJSONString(response));
//            if ("SUCCESS".equals(response.getStatus().name())
//                    || "PROCESSING".equals(response.getStatus().name()) ) {
//                return  true;
//            }else{
//                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,退款申请失败哦!");
//            }
//        }catch (Exception e){
//            e.printStackTrace();
//            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,退款申请失败!");
//        }
        return false;
    }
server/services/src/main/java/com/doumee/config/wx/WxPayProperties.java
@@ -15,11 +15,11 @@
@Data
public class WxPayProperties {
    /**
     * AppID
     */
    private String appId;
    private String apiV3Key;
    /**
     * AppSecret
@@ -35,44 +35,15 @@
     * æ”¯ä»˜API密钥
     */
    private String mchKey;
    /**
     * æ”¯ä»˜API密钥
     */
//    private String subMchKey;
    /**
     * æ”¯ä»˜å›žè°ƒåœ°å€
     */
    private String notifyUrl;
    /**
     * é€€æ¬¾å›žè°ƒåœ°å€
     */
    private String refundNotifyUrl;
    /**
     * æ”¯ä»˜è¯ä¹¦(p12)
     */
    private String keyPath;
    private String serialNumer;
    private int existsSub;// true
    private String subAppId;//wxcd2b89fd2ff065f8
    private String subMchId;// 1229817002
    private String subAppSecret;// 1229817002
    private String typeId;// gybike
    private String privateKeyPath ;
    private String privateCertPath;// gybike
    private String pubKeyPath;//
    private String payPublicKeyId;//
    private String wechatSerialNumer;
    private String wechatPayPublicKeyId; // å¾®ä¿¡æ”¯ä»˜å…¬é’¥ID
    private String wechatPubKeyPath; //微信支付公钥文件路径
    private String wechatPrivateKeyPath;
    private String wechatNotifyUrl;
    private String wechatApiV3Key;
//    private String wechatPlatformPubKeyPath;
}
server/services/src/main/java/com/doumee/core/constants/Constants.java
@@ -3,8 +3,13 @@
import com.doumee.dao.business.model.Orders;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
/**
@@ -753,5 +758,44 @@
    }
    public  static String getIpAddr() {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        String ipAddress = null;
        try {
            ipAddress = request.getHeader("x-forwarded-for");
            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
                ipAddress = request.getHeader("Proxy-Client-IP");
            }
            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
                ipAddress = request.getHeader("WL-Proxy-Client-IP");
            }
            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
                ipAddress = request.getRemoteAddr();
                if (ipAddress.equals("127.0.0.1")) {
                    // æ ¹æ®ç½‘卡取本机配置的IP
                    InetAddress inet = null;
                    try {
                        inet = InetAddress.getLocalHost();
                    } catch (UnknownHostException e) {
                        e.printStackTrace();
                    }
                    ipAddress = inet.getHostAddress();
                }
            }
            // å¯¹äºŽé€šè¿‡å¤šä¸ªä»£ç†çš„æƒ…况,第一个IP为客户端真实IP,多个IP按照','分割
            if (ipAddress != null && ipAddress.length() > 15) { // "***.***.***.***".length()
                // = 15
                if (ipAddress.indexOf(",") > 0) {
                    ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
                }
            }
        } catch (Exception e) {
            ipAddress = "127.0.0.1";
        }
        // ipAddress = this.getRequest().getRemoteAddr();
        return ipAddress;
    }
}
server/services/src/main/java/com/doumee/dao/vo/PayResponse.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.doumee.dao.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2023/3/23 9:50
 */
@Data
@ApiModel("支付相应类")
public class PayResponse implements Serializable {
    @ApiModelProperty(value = "支付订单主键")
    private Integer orderId;
    @ApiModelProperty(value = "支付类型:0=现金支付;1=纯积分支付")
    private Integer payType;
    @ApiModelProperty(value = "微信调起业务")
    private Object response;
    @ApiModelProperty(value = "锁定编号",hidden = true)
    private String lockKey;
}
server/services/src/main/java/com/doumee/service/business/WithdrawalOrdersService.java
@@ -1,6 +1,5 @@
package com.doumee.service.business;
import com.doumee.config.wx.TransferToUser;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.WithdrawalOrders;
@@ -98,9 +97,6 @@
     */
    long count(WithdrawalOrders withdrawalOrders);
    TransferToUser.TransferToUserResponse  applyWithdrawal(WithdrawalDTO withdrawalDTO);
    void cancelTransfer(TransferToUser.CancelTransferRequest request);
    void transferSuccess(String outBillNo,Boolean isSuccess);
server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java
@@ -19,12 +19,16 @@
import com.doumee.dao.business.model.*;
import com.doumee.dao.dto.*;
import com.doumee.dao.vo.OrderReleaseVO;
import com.doumee.dao.vo.PayResponse;
import com.doumee.service.business.AliSmsService;
import com.doumee.service.business.OrdersService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.wechat.pay.java.service.partnerpayments.jsapi.model.Amount;
import com.wechat.pay.java.service.partnerpayments.jsapi.model.Payer;
@@ -44,10 +48,15 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -194,30 +203,32 @@
        return orderReleaseVO;
    }
    private Object getWxPayResponse(Orders orders,String openid){
        Object response = null;
        //调起支付
        PrepayRequest request = new PrepayRequest();
        request.setAttach("createOrder");
        request.setDescription("近快订单支付");
        request.setSpMchid(WxMiniConfig.wxProperties.getMchId());
        request.setSpAppid(WxMiniConfig.wxProperties.getAppId());
        request.setSubMchid(WxMiniConfig.wxProperties.getSubMchId());
        request.setSubAppid(WxMiniConfig.wxProperties.getSubAppId());
    private PayResponse getWxPayResponse(Orders orders,String openid){
        try {
            Object response = null;
            //调起支付
            WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest();
            request.setAttach("createOrder");
            request.setAttach("订单支付");
            request.setOutTradeNo(orders.getOutTradeNo());
            request.setTotalFee(BaseWxPayRequest.yuanToFen(orders.getPrice().toString()));
        Payer payer = new Payer();
        payer.setSubOpenid(openid);
        request.setPayer(payer);
        request.setOutTradeNo(orders.getOutTradeNo());
        request.setNotifyUrl(WxMiniConfig.wxProperties.getNotifyUrl());//这个回调url必须是https开头的
        Amount amount = new Amount();
        amount.setTotal(orders.getPayAccount().intValue());
        request.setAmount(amount);
//        PrepayResponse res = WxMiniConfig.wxPayService.prepay(request);
        // è·Ÿä¹‹å‰ä¸‹å•示例一样,填充预下单参数
        PrepayWithRequestPaymentResponse resParam =  WxMiniConfig.jsapiExtService.prepayWithRequestPayment(request,WxMiniConfig.wxProperties.getSubAppId());
        response =resParam;
        return response;
            request.setTimeStart(DateUtil.DateToString(new Date(), "yyyyMMddHHmmss"));
            request.setSpbillCreateIp(Constants.getIpAddr());
            //微信小程序
            request.setOpenid(openid);
            response = WxMiniConfig.wxPayService.createOrder(request);
            PayResponse payResponse = new PayResponse();
            payResponse.setResponse(response);
            payResponse.setOrderId(orders.getId());
            payResponse.setPayType(Constants.ZERO);
            return payResponse;
        } catch (WxPayException e) {
            e.printStackTrace();
        }
        throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"支付失败!");
    }
    /**
@@ -2089,7 +2100,6 @@
        //更新缓存
        redisTemplate.opsForValue().set(Constants.RedisKeys.ORDER_CODE,0);
    }
}
server/services/src/main/java/com/doumee/service/business/impl/WithdrawalOrdersServiceImpl.java
@@ -2,7 +2,6 @@
import com.alibaba.fastjson.JSONObject;
import com.doumee.config.wx.SendWxMessage;
import com.doumee.config.wx.TransferToUser;
import com.doumee.config.wx.WXPayUtility;
import com.doumee.config.wx.WxMiniConfig;
import com.doumee.core.constants.Constants;
@@ -179,77 +178,7 @@
    /************************************移动端接口*******************************************/
    /**
     * æçŽ°ç”³è¯·
     * @param withdrawalDTO
     */
    @Override
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
    public TransferToUser.TransferToUserResponse  applyWithdrawal(WithdrawalDTO withdrawalDTO){
        if(Objects.isNull(withdrawalDTO)
        || Objects.isNull(withdrawalDTO.getAmount())
        || org.apache.commons.lang3.StringUtils.isBlank(withdrawalDTO.getName())
        || withdrawalDTO.getAmount().compareTo(BigDecimal.ZERO)<=Constants.ZERO
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        Member member = memberMapper.selectById(withdrawalDTO.getMember().getId());
        if(Objects.isNull(member)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"用户信息异常,请联系管理员");
        }
        if(member.getAmount() < withdrawalDTO.getAmount().multiply(new BigDecimal("100")).intValue()){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,可提现余额不足。");
        }
        if(StringUtils.isEmpty(member.getName())){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"请先去维护真实姓名后进行提现申请");
        }
        WithdrawalOrders withdrawalOrders = new WithdrawalOrders();
        withdrawalOrders.setCreateTime(new Date());
        withdrawalOrders.setMemberId(member.getId());
        withdrawalOrders.setOutBillNo(UUID.randomUUID().toString().replace("-",""));
        withdrawalOrders.setAmount((withdrawalDTO.getAmount().multiply(new BigDecimal("100"))).longValue());
        withdrawalOrders.setStatus(Constants.ZERO);
        withdrawalOrders.setType(Constants.ZERO);
        withdrawalOrders.setDeleted(Constants.ZERO);
        //发起提现申请
        TransferToUser.TransferToUserRequest transferToUserRequest = new TransferToUser.TransferToUserRequest();
        transferToUserRequest.openid = member.getOpenid();
        transferToUserRequest.outBillNo =  withdrawalOrders.getOutBillNo();
        transferToUserRequest.transferAmount = withdrawalOrders.getAmount();
        transferToUserRequest.transferRemark = "提现申请";
        try {
            TransferToUser.TransferToUserResponse response =  WxMiniConfig.transferToUser.run(transferToUserRequest,withdrawalDTO.getName());
            withdrawalOrders.setRemark(JSONObject.toJSONString(response));
            if(response.state.name().equals("WAIT_USER_CONFIRM") || response.state.name().equals("ACCEPTED")){
                withdrawalOrders.setWxExternalNo(response.transferBillNo);
            }
            withdrawalOrdersMapper.insert(withdrawalOrders);
            //更新用户余额
            memberMapper.update(new UpdateWrapper<Member>().lambda().setSql(" AMOUNT = AMOUNT -  " + withdrawalOrders.getAmount() ).eq(Member::getId,member.getId()));
            //存储流水记录
            MemberRevenue memberRevenue = new MemberRevenue();
            memberRevenue.setCreateTime(new Date());
            memberRevenue.setTransactionNo(withdrawalOrders.getOutBillNo());
            memberRevenue.setDeleted(Constants.ZERO);
            memberRevenue.setMemberId(member.getId());
            memberRevenue.setType(Constants.THREE);
            memberRevenue.setOptType(-Constants.ONE);
            memberRevenue.setBeforeAmount(member.getAmount());
            memberRevenue.setAmount(withdrawalOrders.getAmount());
            memberRevenue.setAfterAmount(member.getAmount() - withdrawalOrders.getAmount());
            memberRevenue.setObjId(withdrawalOrders.getId());
            memberRevenue.setRemark(Constants.RevenueType.getInfo(memberRevenue.getType()));
            memberRevenue.setObjType(Constants.ONE);
            memberRevenue.setDeleted(Constants.ZERO);
            memberRevenue.setStatus(Constants.TWO);
            memberRevenueMapper.insert(memberRevenue);
            return response;
        } catch (WXPayUtility.ApiException e) {
            String message = JSONObject.parseObject(e.getBody()).getString("message");
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),message);
        }
    }
    @Override
@@ -305,60 +234,6 @@
                memberRevenue.setStatus(Constants.ZERO);
                memberRevenueMapper.insert(memberRevenue);
            }
        }
    }
    @Override
    public void cancelTransfer(TransferToUser.CancelTransferRequest request){
        if(Objects.isNull(request)
        || StringUtils.isEmpty(request.outBillNo)){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        WithdrawalOrders withdrawalOrders = withdrawalOrdersMapper.selectOne(new QueryWrapper<WithdrawalOrders>().lambda().eq(WithdrawalOrders::getOutBillNo,request.outBillNo).last("limit 1"));
        if(Objects.isNull(withdrawalOrders)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        Member member = memberMapper.selectById(withdrawalOrders.getMemberId());
        if(Objects.isNull(member)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        try {
            TransferToUser.CancelTransferResponse response =  WxMiniConfig.transferToUser.cancelRun(request);
            if(response.state.equals("CANCELING")){
                //标记提现失败 åŠ å›žå¯¹åº”çš„æçŽ°é‡‘é¢
                withdrawalOrdersMapper.update(new UpdateWrapper<WithdrawalOrders>()
                        .lambda().set(WithdrawalOrders::getStatus,Constants.TWO)
                        .eq(WithdrawalOrders::getId,withdrawalOrders.getId()));
                memberRevenueMapper.update(new UpdateWrapper<MemberRevenue>().lambda().set(MemberRevenue::getStatus,Constants.ONE)
                                .set(MemberRevenue::getUpdateTime,new Date())
                        .eq(MemberRevenue::getObjId,withdrawalOrders.getId()))
                ;
                //更新用户余额
                memberMapper.update(new UpdateWrapper<Member>().lambda().setSql(" AMOUNT = AMOUNT + " + withdrawalOrders.getAmount() ).eq(Member::getId,withdrawalOrders.getMemberId()));
                //存储流水记录
                MemberRevenue memberRevenue = new MemberRevenue();
                memberRevenue.setCreateTime(new Date());
                memberRevenue.setMemberId(withdrawalOrders.getMemberId());
                memberRevenue.setType(Constants.FOUR);
                memberRevenue.setOptType(Constants.ONE);
                memberRevenue.setBeforeAmount(member.getAmount());
                memberRevenue.setAmount(withdrawalOrders.getAmount());
                memberRevenue.setAfterAmount(member.getAmount() + withdrawalOrders.getAmount());
                memberRevenue.setObjId(withdrawalOrders.getId());
                memberRevenue.setObjType(Constants.ONE);
                memberRevenue.setDeleted(Constants.ZERO);
                memberRevenue.setStatus(Constants.ZERO);
                memberRevenueMapper.insert(memberRevenue);
            }
            System.out.println(JSONObject.toJSONString(response));
        } catch (WXPayUtility.ApiException e) {
            String message = JSONObject.parseObject(e.getBody()).getString("message");
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),message);
        }
    }
server/services/src/main/resources/application-dev.yml
@@ -83,82 +83,13 @@
########################微信支付相关配置########################
wx:
  pay:
    #服务商---------start------- å‚数详解地址 https://pay.weixin.qq.com/doc/v3/partner/4013080340
    mchId: 1700071922    #服务商在微信支付侧的唯一身份标识
    appId: wx6cc1087ca79db7f6    #服务商在微信开放平台(移动应用)或公众平台(公众号/小程序)上申请的一个唯一标识
    apiV3Key: 0a056faa107c2b2944b9d6a9aa6d4142 #7tG4Vk9Zp2L8dXw5Jq0N3hR6yE1sF3cB
    serialNumer: 6696086F6EFB8D6A4F821BD47DDBAF75C3BC1209 #38495CE0137D90E4DC4F64F7ECDE035A35470BE3 #服务商证书序列号
    payPublicKeyId: PUB_KEY_ID_0117000719222024112700219100000508 #商户/平台支付公钥id
    #mchKey: W97N53Q71326D6JZ2E9HY5M4VT4BAC8S
    notifyUrl: https://test.doumee.cn/jinkuai_admin/web/wxPayNotify
    refundNotifyUrl: https://test.doumee.cn/jinkuai_admin/web/wxRefundNotify
    keyPath: D://jinkuaiPayFile/apiclient_cert.p12
    privateCertPath: D://jinkuaiPayFile/apiclient_cert.pem
    privateKeyPath: D://jinkuaiPayFile/apiclient_key.pem
    pubKeyPath: D://jinkuaiPayFile/pub_key.pem #商户支付公钥
    appId: wxcd2b89fd2ff065f8
    appSecret: 3462fa186da7cb06c544df8d8664b63a
    mchId: 1229817002
    mchKey: u4TSNtv0wFP7WRfnxBgijYOtRhS9FvlM
    notifyUrl: https://test.doumee.cn/dmmall_web_api/web/api/wxPayNotify
    keyPath: D:\DouMee\dmkjWxcert\apiclient_cert.p12
    #服务商-------------end---
    #商户信息
    wechatSerialNumer: 12C0F0DD0F3D2B565B45586D3FEA225EBF723BEC
    wechatPayPublicKeyId: PUB_KEY_ID_0117233260692025072500181939000603 #商户/平台支付公钥id
    wechatPubKeyPath: D://jinkuaiPayFile/shanghu/pub_key.pem #商户支付公钥
    wechatPrivateKeyPath: D://jinkuaiPayFile/shanghu/apiclient_key.pem #商户私钥
    wechatNotifyUrl: https://test.doumee.cn/jinkuai_admin/web/wechat/transferNotify #商户转账回调地址
    wechatApiV3Key: 7tG4Vk9Zp2L8dXw5Jq0N3hR6yE1sF3cB
    existsSub: 1
    appSecret:
    #子商户------------start----
    subMchId: 1723326069    #子商户号
    subAppId: wx332441ae5b12be7d #小程序id
    subAppSecret: add86d6406f5c14501ac5bbb1a60e004 #小程序秘钥
    #子商户------------end----
    #      mchKey: u4TSNtv0wFP7WRfnxBgijYOtRhS9FvlM
    typeId: jinkuai
#wx:
#  pay:
#    #服务商---------start-------
#    appId: wx48fd8faa35cc8277
#    mchId: 1661770902
#    apiV3Key: iF3kC8pL8dZ9iU3hN5fX9zI6eF4xQ6fT
#    serialNumer: 368B835A194384FD583B83B77977B84127D2F655
#    mchKey: W97N53Q71326D6JZ2E9HY5M4VT4BAC8S
#    notifyUrl: https://test.doumee.cn/jinkuai_admin/web/wxPayNotify
#    refundNotifyUrl: https://test.doumee.cn/jinkuai_admin/web/wxRefundNotify
##    notifyUrl: https://dmtest.ahapp.net/bike_h5_api/api/wxPayNotify
##    refundNotifyUrl: https://dmtest.ahapp.net/bike_h5_api/api/wxRefundNotify
#    #keyPath: /usr/local/aliConfig/bike/apiclient_cert.p12
#    #privateCertPath: /usr/local/aliConfig/bike/apiclient_cert.pem
#    #privateKeyPath: /usr/local/aliConfig/bike/apiclient_key.pem
#    keyPath: /usr/local/zhengshu/apiclient_cert.p12 #d://apiclient_cert.p12
#    privateCertPath: /usr/local/zhengshu/apiclient_cert.pem #d://apiclient_cert.pem
#    privateKeyPath: /usr/local/zhengshu/apiclient_key.pem #d://apiclient_key.pem
#
#
#    #商户信息
#    wechatSerialNumer: 3C9A32FB6CD453FAAAF97F9737ECAEA9D6625727
#    wechatPayPublicKeyId: 47E172124E73E8098A565E971064C20ACDE7C911 # PUB_KEY_ID_0116617720032025071800291849000801 #商户/平台支付公钥id
#    wechatPubKeyPath: /usr/local/zhengshu/pub_key.pem #d://pub_key.pem #商户支付公钥
#    #wechatPlatformPubKeyPath: d:/wechatpay_47E172124E73E8098A565E971064C20ACDE7C911.pem  #平台支付公钥
#    wechatPrivateKeyPath: /usr/local/zhengshu/wechatApiclient_key.pem #d://wechatApiclient_key.pem #商户私钥
#    wechatNotifyUrl: https://test.doumee.cn/jinkuai_admin/web/wechat/transferNotify #商户转账回调地址
#    #wechatApiV3Key: V4PRKUBTK2BKNKJAD9NSI9YFG2Q0EOT1 #商户APIV3Key
#
#
#    #服务商-------------end---
#    existsSub: 1
#    appSecret: 1ceb7c9dff3c4330d653adc3ca55ea24
#    #子商户------------start----
#    subAppId: wxcd2b89fd2ff065f8 #wxcd2b89fd2ff065f8
#    subAppSecret: 3462fa186da7cb06c544df8d8664b63a #3336812504c830b1c3c5243f9ece407a
#    subMchId: 1661772003
#    subMchKey: EVM8E15TKXE0OEMJFC0V6UFVIOZ5CSQS
#    #子商户------------end----
#    #      mchKey: u4TSNtv0wFP7WRfnxBgijYOtRhS9FvlM
#    typeId: gybike
upload:
  type: ftp
server/web/src/main/java/com/doumee/api/web/UserApi.java
@@ -1,6 +1,5 @@
package com.doumee.api.web;
import com.doumee.config.wx.TransferToUser;
import com.doumee.core.annotation.LoginRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
@@ -159,29 +158,7 @@
        return ApiResponse.success(memberRevenueService.findPage(pageWrap));
    }
    @LoginRequired
    @ApiOperation("提现申请")
    @PostMapping("/applyWithdrawal")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
    })
    public ApiResponse<TransferToUser.TransferToUserResponse> applyWithdrawal (@RequestBody WithdrawalDTO withdrawalDTO) {
        withdrawalDTO.setMember(this.getMemberResponse());
        return ApiResponse.success("操作成功",withdrawalOrdersService.applyWithdrawal(withdrawalDTO));
    }
    @LoginRequired
    @ApiOperation("撤销提现申请")
    @PostMapping("/cancelTransfer")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
    })
    public ApiResponse cancelTransfer (@RequestBody TransferToUser.CancelTransferRequest request) {
        withdrawalOrdersService.cancelTransfer(request);
        return ApiResponse.success("操作成功");
    }
}