From 45d51d79f9ae7ec4982e1d09034250ef426537e0 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期三, 09 四月 2025 18:26:47 +0800 Subject: [PATCH] 11.6 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java | 74 ++++++++++++++++++++++++++++-------- 1 files changed, 57 insertions(+), 17 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java index 0efa71c..6e13280 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java @@ -100,8 +100,8 @@ return userWithdrawRecordVOPage; } @Override - public Page<UserWithdrawRecordVO> withdrawPage1(List<String> cityList,List<Integer> userIds,String nickname, String userPhone, String applyForTime, Integer state, Page<UserWithdrawRecordVO> page) { - Page<UserWithdrawRecordVO> userWithdrawRecordVOPage = baseMapper.withdrawPage1(cityList,userIds,nickname, userPhone, applyForTime, state, page); + public Page<UserWithdrawRecordVO> withdrawPage1(List<String> cityList,List<Integer> userIds,String nickname, String userPhone, String applyForTime, Integer state, Page<UserWithdrawRecordVO> page,List<String> siteIds) { + Page<UserWithdrawRecordVO> userWithdrawRecordVOPage = baseMapper.withdrawPage1(cityList,userIds,nickname, userPhone, applyForTime, state, page,siteIds); return userWithdrawRecordVOPage; } @@ -155,15 +155,18 @@ String startDateStr = String.valueOf(startDate); String endDateStr = String.valueOf(endDate); BigDecimal withdrawalTotalMoney; + if (request.getSiteIds()==null){ + request.setSiteIds(new ArrayList<>()); + } if (OrderConstants.QUARTER.equals(type)) { // 用户提现总额 - withdrawalTotalMoney = baseMapper.withdrawalTotalMoney(cityList, startDateStr, endDateStr); + withdrawalTotalMoney = baseMapper.withdrawalTotalMoney(cityList, startDateStr, endDateStr,request.getSiteIds()); } else if (OrderConstants.YEAR.equals(type)) { // 用户提现总额 - withdrawalTotalMoney = baseMapper.withdrawalTotalMoneyByYear(cityList); + withdrawalTotalMoney = baseMapper.withdrawalTotalMoneyByYear(cityList,request.getSiteIds()); } else if (OrderConstants.MONTH.equals(type)) { // 用户提现总额 - withdrawalTotalMoney = baseMapper.withdrawalTotalMoneyByMonth(cityList); + withdrawalTotalMoney = baseMapper.withdrawalTotalMoneyByMonth(cityList,request.getSiteIds()); } else { // 数量初始化 withdrawalTotalMoney = BigDecimal.ZERO; @@ -202,8 +205,8 @@ } @Override - public Page<UserWithdrawRecordVO> withdrawList1(List<String> cityList,Integer userId, Page<UserWithdrawRecordVO> page) { - Page<UserWithdrawRecordVO> userWithdrawRecordVOPage = baseMapper.withdrawList1(cityList,userId, page); + public Page<UserWithdrawRecordVO> withdrawList1(List<String> cityList,Integer userId, Page<UserWithdrawRecordVO> page,List<String> siteIds) { + Page<UserWithdrawRecordVO> userWithdrawRecordVOPage = baseMapper.withdrawList1(cityList,userId, page,siteIds); for (UserWithdrawRecordVO record : userWithdrawRecordVOPage.getRecords()) { R<UserDto> user = userClient.getUser(record.getUserId()); System.err.println("==="+user.getData()); @@ -228,7 +231,8 @@ .eq(Withdraw::getOrderId, orderId).list(); List<Integer> stateList = list.stream().map(Withdraw::getState).collect(Collectors.toList()); if (stateList.contains(Constants.ZERO)) { - throw new GlobalException("当前订单已提交提现申请,请等待审核!"); + return false; +// throw new GlobalException("当前订单已提交提现申请,请等待审核!"); } else if (stateList.contains(Constants.ONE)) { throw new GlobalException("当前订单已完成提现,请勿重复提现!"); } @@ -249,9 +253,9 @@ withdraw.setState(Constants.ONE); // 商家微信打款至微信零钱 boolean update = weChatPay(order.getOrderMoney(), openId,withdraw.getId()); - if (!update) { - throw new GlobalException("交易提现失败,请检查是否绑定微信!"); - } +// if (!update) { +// throw new GlobalException("交易提现失败,请检查是否绑定微信!"); +// } } else { // 待审核 withdraw.setState(Constants.ZERO); @@ -318,28 +322,64 @@ JSONObject.toJSONString(postMap), "7EEA04429B006E12AAA421C002EC48BBEED5BE94", "1665330417", - "D:\\study\\JiaDianHuiShou\\ruoyi-service\\ruoyi-order\\src\\main\\java\\com\\ruoyi\\order\\vx\\apiclient_key.pem", WechatConstants.WE_CHAT_URL_SUF); + "/usr/local/vx/apiclient_key.pem", WechatConstants.WE_CHAT_URL_SUF); 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); + if (jsonObject.containsKey(WechatConstants.CREATE_TIME)) { // 转账成功 //保存转账明细 - WithdrawDetail withdrawDetail = new WithdrawDetail(); - withdrawDetail.setWithdrawId(withdrawId); - withdrawDetail.setMoney(transferAmount); - withdrawDetail.setOutBatchNo((String) postMap.get(WechatConstants.OUT_BATCH_NO)); - withdrawDetailService.save(withdrawDetail); +// WithdrawDetail withdrawDetail = new WithdrawDetail(); +// withdrawDetail.setWithdrawId(withdrawId); +// withdrawDetail.setMoney(transferAmount); +// withdrawDetail.setOutBatchNo((String) postMap.get(WechatConstants.OUT_BATCH_NO)); +// withdrawDetailService.save(withdrawDetail); } else { allTransfersSuccessful = false; break; } + } return allTransfersSuccessful; } + public static void main(String[] args) { + Map<String, Object> postMap = new HashMap<>(8); + postMap.put(WechatConstants.APP_ID, "wx98563d0ec9cf21c8"); + postMap.put(WechatConstants.OUT_BATCH_NO, String.valueOf(UUID.randomUUID()).replaceAll("-", "")); + System.err.println("====="+postMap.get(WechatConstants.OUT_BATCH_NO)); + postMap.put(WechatConstants.BATCH_NAME, "二手回收提现"); + postMap.put(WechatConstants.BATCH_REMARK, "二手回收提现"); + postMap.put(WechatConstants.TOTAL_AMOUNT, 1); + postMap.put(WechatConstants.TOTAL_NUM, Constants.ONE); + + List<Map<String, Object>> list = new ArrayList<>(); + Map<String, Object> subMap = new HashMap<>(4); + subMap.put(WechatConstants.OUT_DETAIL_NO, String.valueOf(SNOW_FLAKE_ID_WORKER.nextId())); + subMap.put(WechatConstants.TRANSFER_AMOUNT, 1); + subMap.put(WechatConstants.TRANSFER_REMARK, "二手回收提现到账"); + subMap.put(WechatConstants.OPEN_ID, "ouqOk6-Bp6PnNnlHoQSV-6lzoVoU"); + list.add(subMap); + postMap.put(WechatConstants.TRANSFER_DETAIL_LIST, list); + String result = HttpUtil.postTransBatRequest( + WechatConstants.WE_CHAT_URL_PRE, + JSONObject.toJSONString(postMap), + "7EEA04429B006E12AAA421C002EC48BBEED5BE94", + "1665330417", + "E:\\ershoucert\\apiclient_key.pem", WechatConstants.WE_CHAT_URL_SUF); + + JSONObject jsonObject = JSONObject.parseObject(result); + System.err.println(jsonObject); + } /** * 根据当前月份获取当前季度的开始月份 -- Gitblit v1.7.1