无关风月
2025-04-09 2ae88fdd57aca6abd2b9d3b158389f435127e3ca
提现代码
9个文件已修改
127 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/entity/WithdrawDetailVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/WithdrawController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/WxChatPayCallBack.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/entity/Order.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/task/TaskUtil.java 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/WithdrawDetailVO.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vx/TestWxPay.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-user/src/main/java/com/ruoyi/user/controller/RecoveryServeController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/entity/WithdrawDetailVO.java
@@ -20,6 +20,8 @@
    @ApiModelProperty("订单编号")
    private String orderNumber;
    @ApiModelProperty("拉起确认收款参数")
    private String packageInfo;
    @ApiModelProperty("下单用户id")
    private Integer userId;
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/WithdrawController.java
@@ -340,6 +340,7 @@
            withdrawDetailVO.setWithdrawalState(withdraw.getState());
            withdrawDetailVO.setWithdrawalTime(withdraw.getCreateTime());
        }
        withdrawDetailVO.setPackageInfo(order.getPackageInfo());
        withdrawDetailVO.setAddress(order.getAddress());
        if (null != serveRecord) {
            withdrawDetailVO.setPhoto(serveRecord.getPhoto());
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/WxChatPayCallBack.java
@@ -97,13 +97,17 @@
            System.err.println("微信解密的字符串信息"+decryptedData);
            JSONObject jsonInfo = (JSONObject) JSONObject.parse(decryptedData);
            String transferBillNo = jsonInfo.getString("transfer_bill_no");
            String outBillNo = jsonInfo.getString("out_bill_no");
            String state = jsonInfo.getString("state");
            WithdrawDetail withdrawDetail = withdrawDetailService.lambdaQuery().eq(WithdrawDetail::getOutBatchNo, transferBillNo).one();
            WithdrawDetail withdrawDetail = withdrawDetailService.lambdaQuery().eq(WithdrawDetail::getOutBatchNo, outBillNo).one();
            Withdraw withdraw = withdrawService.getById(withdrawDetail.getWithdrawId());
            Order order = orderService.getById(withdraw.getOrderId());
            UserDto data = userClient.getUser(order.getUserId()).getData();
            if (order.getIsWithdrawal()==3){
                return "SUCCESS";
            }
            if ("SUCCESS".equals(state)){
                order.setIsWithdrawal(1);
                order.setIsWithdrawal(3);
                withdrawDetail.setStatus("SUCCESS");
                withdrawDetailService.updateById(withdrawDetail);
                orderService.updateById(order);
@@ -148,14 +152,14 @@
            // 订单号
            String s = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
            postMap.put("out_bill_no", s);
            System.err.println("====="+postMap.get(WechatConstants.OUT_BATCH_NO));
            System.err.println("====="+postMap.get("out_bill_no"));
            postMap.put(WechatConstants.OPEN_ID, openId);
            // 转账金额
            postMap.put("transfer_amount", transferAmount);
            // 转账备注
            postMap.put("transfer_remark", transferAmount);
            postMap.put("transfer_remark", "二手回收提现确认收款");
            // 回调地址
            postMap.put("notify_url", transferAmount);
            postMap.put("notify_url", "https://hyhsbqgc.com/api/ruoyi-order/wx/wxChatPay");
            // 转账场景报备信息
            Map<String, Object> info = new HashMap<>();
            info.put("info_type","回收商品名称");
@@ -166,7 +170,7 @@
                    com.alibaba.fastjson2.JSONObject.toJSONString(postMap),
                    "7EEA04429B006E12AAA421C002EC48BBEED5BE94",
                    "1665330417",
                    "E:\\ershoucert\\apiclient_key.pem", WechatConstants.WE_CHAT_URL_SUF);
                    "/usr/local/vx/apiclient_key.pem", WechatConstants.WE_CHAT_URL_SUF);
            com.alibaba.fastjson2.JSONObject jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(result);
//            WithdrawDetail withdrawDetail = new WithdrawDetail();
//            withdrawDetail.setWithdrawId(withdrawId);
@@ -183,7 +187,7 @@
                    withdrawDetailService.updateById(one);
                    Order order = orderService.getById(withdraw.getOrderId());
                    order.setPackageInfo(string);
                    order.setIsWithdrawal(0);
                    order.setIsWithdrawal(2);
                    orderService.updateById(order);
                }
            } else {
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/entity/Order.java
@@ -147,7 +147,7 @@
    @TableField("subsidy")
    private BigDecimal subsidy;
    @ApiModelProperty("是否已提现(0:未提现,1:已提现)")
    @ApiModelProperty("是否已提现(0:未提现,1:审核中 2审核通过 3:已确认收款)")
    @TableField("is_withdrawal")
    private Integer isWithdrawal;
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java
@@ -372,28 +372,36 @@
            Map<String, Object> postMap = new HashMap<>(8);
            postMap.put(WechatConstants.APP_ID, "wx98563d0ec9cf21c8");
            // 订单号
            String s = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
            postMap.put("out_bill_no", s);
            System.err.println("====="+postMap.get(WechatConstants.OUT_BATCH_NO));
            postMap.put("out_bill_no", String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
            System.err.println("====="+postMap.get("out_bill_no"));
            postMap.put(WechatConstants.OPEN_ID, openId);
            // 转账金额
            postMap.put("transfer_amount", transferAmount);
            postMap.put("transfer_scene_id", "1010");
            // 转账备注
            postMap.put("transfer_remark", transferAmount);
            postMap.put("transfer_remark", "二手回收提现确认收款");
            // 回调地址
            postMap.put("notify_url", transferAmount);
            postMap.put("notify_url", "https://hyhsbqgc.com/api/ruoyi-order/wx/wxChatPay");
            // 转账场景报备信息
            List<Map<String, Object>> list = new ArrayList<>();
            Map<String, Object> info = new HashMap<>();
            info.put("info_type","回收商品名称");
            info.put("info_content",serverName);
            postMap.put("transfer_scene_report_infos", JSONObject.toJSONString(info));
            list.add(info);
            postMap.put("transfer_scene_report_infos", list);
            String result = HttpUtil.postTransBatRequest(
                    WechatConstants.WE_CHAT_PAY_URL_PRE,
                    JSONObject.toJSONString(postMap),
                    "7EEA04429B006E12AAA421C002EC48BBEED5BE94",
                    "1665330417",
                    "E:\\ershoucert\\apiclient_key.pem", WechatConstants.WE_CHAT_URL_SUF);
                    "/usr/local/vx/apiclient_key.pem", "/v3/fund-app/mch-transfer/transfer-bills");
            JSONObject jsonObject = JSONObject.parseObject(result);
//            WithdrawDetail withdrawDetail = new WithdrawDetail();
//            withdrawDetail.setWithdrawId(withdrawId);
//            withdrawDetail.setMoney(transferAmount);
//            withdrawDetail.setOutBatchNo((String) postMap.get(WechatConstants.OUT_BATCH_NO));
//            withdrawDetailService.save(withdrawDetail);
            System.err.println(jsonObject);
//            WithdrawDetail withdrawDetail = new WithdrawDetail();
//            withdrawDetail.setWithdrawId(withdrawId);
//            withdrawDetail.setMoney(transferAmount);
@@ -404,6 +412,7 @@
                Withdraw withdraw = this.getById(withdrawId);
                Order order = orderService.getById(withdraw.getOrderId());
                order.setIsWithdrawal(2);
                order.setPackageInfo(string);
                orderService.updateById(order);
                // 转账成功
@@ -411,7 +420,7 @@
                WithdrawDetail withdrawDetail = new WithdrawDetail();
                withdrawDetail.setWithdrawId(withdrawId);
                withdrawDetail.setMoney(transferAmount);
                withdrawDetail.setOutBatchNo(s);
                withdrawDetail.setOutBatchNo(postMap.get("out_bill_no")+"");
                withdrawDetailService.save(withdrawDetail);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/task/TaskUtil.java
@@ -22,40 +22,40 @@
    private WithdrawDetailService withdrawDetailService;
    /**
     * 每隔一分钟去处理的定时任务
     */
    @Scheduled(fixedRate = 10000 * 60)
    public void taskMinute(){
        try {
            List<WithdrawDetail> list = withdrawDetailService.lambdaQuery().ne(WithdrawDetail::getStatus, "SUCCESS").ne(WithdrawDetail::getStatus, "FAIL").list();
            for (WithdrawDetail withdrawDetail : list) {
                String s = GetTransferBatchByOutNo.checkStatus(withdrawDetail.getOutBatchNo());
                if (s.equals("SUCCESS")) {
                    withdrawDetail.setStatus("SUCCESS");
                    withdrawDetailService.updateById(withdrawDetail);
                    //执行订单提现成功,增加提现成功金额
                    //查询订单
                    //增加已提现金额
                } else if (s.equals("FAIL")) {
                    withdrawDetail.setStatus("FAIL");
                    withdrawDetailService.updateById(withdrawDetail);
                }else {
                    withdrawDetail.setStatus(s);
                    withdrawDetailService.updateById(withdrawDetail);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
//    /**
//     * 每隔一分钟去处理的定时任务
//     */
//    @Scheduled(fixedRate = 10000 * 60)
//    public void taskMinute(){
//        try {
//
//            List<WithdrawDetail> list = withdrawDetailService.lambdaQuery().ne(WithdrawDetail::getStatus, "SUCCESS").ne(WithdrawDetail::getStatus, "FAIL").list();
//
//            for (WithdrawDetail withdrawDetail : list) {
//                String s = GetTransferBatchByOutNo.checkStatus(withdrawDetail.getOutBatchNo());
//                if (s.equals("SUCCESS")) {
//                    withdrawDetail.setStatus("SUCCESS");
//                    withdrawDetailService.updateById(withdrawDetail);
//                    //执行订单提现成功,增加提现成功金额
//                    //查询订单
//
//                    //增加已提现金额
//
//
//                } else if (s.equals("FAIL")) {
//                    withdrawDetail.setStatus("FAIL");
//                    withdrawDetailService.updateById(withdrawDetail);
//                }else {
//                    withdrawDetail.setStatus(s);
//                    withdrawDetailService.updateById(withdrawDetail);
//                }
//
//            }
//
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/WithdrawDetailVO.java
@@ -17,7 +17,8 @@
    @ApiModelProperty("订单id")
    private String orderId;
    @ApiModelProperty("拉起确认收款参数")
    private String packageInfo;
    @ApiModelProperty("订单编号")
    private String orderNumber;
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vx/TestWxPay.java
@@ -40,7 +40,7 @@
            // 转账备注
            postMap.put("transfer_remark", "二手回收提现确认收款");
            // 回调地址
            postMap.put("notify_url", "https://y6cgd7wo3ooa.guyubao.com/order/wx/wxChatPay");
            postMap.put("notify_url", "https://hyhsbqgc.com/api/ruoyi-order/wx/wxChatPay");
            // 转账场景报备信息
            List<Map<String, Object>> list = new ArrayList<>();
            Map<String, Object> info = new HashMap<>();
@@ -53,7 +53,7 @@
                    JSONObject.toJSONString(postMap),
                    "7EEA04429B006E12AAA421C002EC48BBEED5BE94",
                    "1665330417",
                    "E:\\ershoucert\\apiclient_key.pem", "/v3/fund-app/mch-transfer/transfer-bills");
                    "/usr/local/vx/apiclient_key.pem", "/v3/fund-app/mch-transfer/transfer-bills");
            JSONObject jsonObject = JSONObject.parseObject(result);
//            WithdrawDetail withdrawDetail = new WithdrawDetail();
//            withdrawDetail.setWithdrawId(withdrawId);
ruoyi-service/ruoyi-user/src/main/java/com/ruoyi/user/controller/RecoveryServeController.java
@@ -161,7 +161,9 @@
        UserRecipient userRecipient = userRecipientService.lambdaQuery()
                .eq(UserRecipient::getIsDefault, Constants.ONE)
                .eq(UserRecipient::getUserId, loginUser.getUserid())
                .eq(UserRecipient::getIsDelete, Constants.ZERO).one();
                .eq(UserRecipient::getIsDelete, Constants.ZERO)
                .last("limit 1")
                .one();
        return R.ok(new ServeDetailVO(recoveryServe, userRecipient));
    }