Merge branch 'dev' of http://120.76.84.145:10101/gitblit/r/java/JiaDianHuiShou into dev
| | |
| | | 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("余额不足"); |
| | | } |
| | |
| | | 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(); |
| | | } |
| | | } |
| | |
| | | |
| | | QueryWrapper<Order> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("server_id", workerId) |
| | | .in("state", 1, 2) |
| | | .in("state", 1, 2,7) |
| | | .eq("is_delete", Constants.ZERO) |
| | | .eq("DATE(time)", todayStr) // 添加这一行来筛选当天的订单 |
| | | .orderByAsc("CASE WHEN topSort IS NULL THEN 1 ELSE 0 END") |
| | |
| | | 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 |
| | |
| | | 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()); |
| | | |
| | |
| | | // 已通过 |
| | | 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("交易提现失败,请检查是否绑定微信!"); |
| | | // } |
| | |
| | | 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)); |
| | | // 回收服务列表 |
| | |
| | | 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()); |