ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/AppFranchiseeController.java
@@ -72,6 +72,7 @@ if (franchisee.getBalance().subtract(dto.getMoney()).compareTo(BigDecimal.ZERO)>=0){ BigDecimal subtract = franchisee.getBalance().subtract(dto.getMoney()); franchisee.setBalance(subtract); franchiseeService.updateById(franchisee); }else{ return R.fail("余额不足"); } @@ -186,6 +187,22 @@ franchiseeWithdraw.setHandle(byId.getNickName()); franchiseeWithdraw.setUpdateTime(new Date()); franchiseeWithdrawService.updateById(franchiseeWithdraw); Franchisee franchisee = franchiseeService.getById(byId.getFranchiseeId()); if (auditFranchiseeWithdrawDTO.getStatus()==3){ // 回退运营商余额 TFranchiseeBalanceChange balanceChange = new TFranchiseeBalanceChange(); balanceChange.setAmount(franchiseeWithdraw.getMoney()); balanceChange.setIs_pay(1); balanceChange.setFranchiseeName(franchisee.getName()); balanceChange.setFranchiseeId(franchisee.getId()+""); balanceChange.setRemark("余额提现回退"); balanceChange.setType(4); balanceChange.setIsDelete(0); franchiseeBalanceChangeService.save(balanceChange); BigDecimal add = franchisee.getBalance().add(franchiseeWithdraw.getMoney()); franchisee.setBalance(add); franchiseeService.updateById(franchisee); } return R.ok(); } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java
@@ -138,7 +138,7 @@ throw new GlobalException("当前订单提现申请已通过!"); } return weChatPay(order.getOrderMoney(), openId,list.get(0).getId(),order.getServeName()); return weChatPay(order.getSubsidy()!=null?order.getSubsidy().add(order.getOrderMoney()):order.getOrderMoney(), openId,list.get(0).getId(),order.getServeName()); } @Override @@ -242,7 +242,7 @@ withdraw.setUserId(userId); withdraw.setUserPhone(userPhone); withdraw.setApplyForTime(new Date()); withdraw.setApplyForMoney(order.getOrderMoney()); withdraw.setApplyForMoney(order.getSubsidy()!=null?order.getSubsidy().add(order.getOrderMoney()):order.getOrderMoney()); withdraw.setOrderId(orderId); withdraw.setCityCode(order.getCityCode()); @@ -252,7 +252,7 @@ // 已通过 withdraw.setState(Constants.ONE); // 商家微信打款至微信零钱 boolean update = weChatPay(order.getOrderMoney(), openId,withdraw.getId(),order.getServerName()); boolean update = weChatPay(order.getSubsidy()!=null?order.getSubsidy().add(order.getOrderMoney()):order.getOrderMoney(), openId,withdraw.getId(),order.getServerName()); // if (!update) { // throw new GlobalException("交易提现失败,请检查是否绑定微信!"); // } ruoyi-service/ruoyi-user/src/main/java/com/ruoyi/user/service/impl/WithdrawServiceImpl.java
@@ -53,12 +53,20 @@ if (!orderList.getRecords().isEmpty()) { // 总金额 totalMoney = orderList.getRecords().stream().map(Order::getOrderMoney).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal reduce = orderList.getRecords().stream().map(Order::getSubsidy).reduce(BigDecimal.ZERO, BigDecimal::add); totalMoney = reduce.add(totalMoney); // 未提现金额withdrawn withdrawn = orderList.getRecords().stream().filter(data -> Constants.ZERO.equals(data.getIsWithdrawal())) .map(Order::getOrderMoney).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal reduce1 = orderList.getRecords().stream().filter(data -> Constants.ZERO.equals(data.getIsWithdrawal())) .map(Order::getSubsidy).reduce(BigDecimal.ZERO, BigDecimal::add); withdrawn = reduce1.add(withdrawn); // 已提现金额 undelivered = orderList.getRecords().stream().filter(data -> Constants.ONE.equals(data.getIsWithdrawal())) .map(Order::getOrderMoney).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal reduce2 = orderList.getRecords().stream().filter(data -> Constants.ONE.equals(data.getIsWithdrawal())) .map(Order::getSubsidy).reduce(BigDecimal.ZERO, BigDecimal::add); undelivered = reduce2.add(undelivered); } withdrawList.setMoneyCount(new WithdrawMoneyVO(totalMoney, undelivered, withdrawn)); // 回收服务列表 @@ -81,7 +89,7 @@ withdrawOrder.setCover(recoveryServe.getCover()); withdrawOrder.setCompleteTime(order.getCreateTime()); withdrawOrder.setIsWithdrawal(order.getIsWithdrawal()); withdrawOrder.setMoney(order.getOrderMoney()); withdrawOrder.setMoney(order.getSubsidy()!=null?order.getSubsidy().add(order.getOrderMoney()):order.getOrderMoney()); withdrawOrder.setPackageInfo(order.getPackageInfo()); if (order.getAddress()!=null) { withdrawOrder.setAddress(order.getReservationAddress() + order.getAddress());