| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | if ("SUCCESS".equals(dStatus)) { |
| | | walletBillRecordDO.setTransferState(Constants.SETTLEMENT_STATUS.COMPLETED.name()); |
| | | walletBillRecordDO.update("sys"); |
| | | walletBillRecordDO.setRemark("微信商户转账成功"); |
| | | walletBillRecordMapper.updateById(walletBillRecordDO); |
| | | //更新钱包 |
| | | // WalletDO walletDO = walletService.getOrCreateBySupplierId(walletBillRecordDO.getWalletId()); |
| | |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | //回写提现状态 |
| | | if (StringUtils.isEmpty(walletBillRecordDO.getWithdrawRecordId())) { |
| | | if (!StringUtils.isEmpty(walletBillRecordDO.getWithdrawRecordId())) { |
| | | WalletWithdrawRecordDO withdrawRecordDO = walletWithdrawRecordMapper.selectById(walletBillRecordDO.getWithdrawRecordId()); |
| | | withdrawRecordDO.setWithdrawState(Constants.BILL_WITHDRAW_TYPE.success.name()); |
| | | walletBillRecordDO.setRemark("微信商户转账成功"); |
| | |
| | | walletBillRecordDO2.setChangeAmount(walletBillRecordDO.getActualTransferAmount()); |
| | | walletBillRecordDO2.setBalance(walletDO.getWithdrawableAmount().add(walletBillRecordDO.getActualTransferAmount())); |
| | | walletBillRecordDO2.create(SecurityUtils.getUserId()); |
| | | walletBillRecordDO.setId(UUIDGenerator.getUUID()); |
| | | walletBillRecordDO.setRemark("微信商户转账失败,余额返还钱包"); |
| | | walletBillRecordDO2.setId(UUIDGenerator.getUUID()); |
| | | walletBillRecordDO2.setRemark("微信商户转账失败,余额返还钱包"); |
| | | walletBillRecordDO2.setApproveBy("sys"); |
| | | walletBillRecordDO2.setApproveTime(LocalDateTime.now()); |
| | | // 保存账单明细 |
| | | walletBillRecordService.save(walletBillRecordDO); |
| | | walletBillRecordService.save(walletBillRecordDO2); |
| | | //提现中金额:减少提现中金额 |
| | | walletDO.setWithdrawingAmount(walletDO.getWithdrawingAmount().subtract(walletBillRecordDO.getActualTransferAmount())); |
| | | //可提现金额:增加可提现金额 |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | //回写提现状态 |
| | | if (StringUtils.isEmpty(walletBillRecordDO.getWithdrawRecordId())) { |
| | | if (!StringUtils.isEmpty(walletBillRecordDO.getWithdrawRecordId())) { |
| | | WalletWithdrawRecordDO withdrawRecordDO = walletWithdrawRecordMapper.selectById(walletBillRecordDO.getWithdrawRecordId()); |
| | | withdrawRecordDO.setWithdrawState(Constants.BILL_WITHDRAW_TYPE.fail.name()); |
| | | walletBillRecordDO.setRemark("微信商户转账失败,余额返还钱包"); |
| | | walletWithdrawRecordMapper.updateById(withdrawRecordDO); |
| | | } |
| | | } |
| | |
| | | public void exportSupplierFinanceList(HttpServletResponse response, QueryWalletBillRecordDTO queryWalletBillRecordDTO) { |
| | | |
| | | List<WalletBillRecordVO> list = walletBillRecordMapper.queryWalletBillRecordList(queryWalletBillRecordDTO); |
| | | String[] rowsName = new String[]{"序号","供应商信息", "变动类型", "原金额", "变动金额", "现余额", "提交时间", "审核时间", "备注"}; |
| | | String[] rowsName = new String[]{"序号","供应商信息", "变动类型", "原金额", "变动金额", "现余额", "提交时间", "审核时间", "备注", "操作人"}; |
| | | List<Object[]> dataList = new ArrayList<>(); |
| | | int sn = 1; |
| | | for (WalletBillRecordVO o : list) { |
| | |
| | | objs[a++] = o.getSupplierName()+":"+o.getSupplierId(); // 供应商信息 |
| | | objs[a++] = o.getTypeName(); // 变动类型 |
| | | objs[a++] = o.getOriginalAmount(); // 原金额 |
| | | objs[a++] = o.getChangeAmount(); // 变动金额 |
| | | if (Constants.BILL_CHANGE_METHOD.reduce.name().equals(o.getMethod())) { |
| | | objs[a++] = "-" + o.getChangeAmount(); // 变动金额 |
| | | } else { |
| | | objs[a++] = "+" + o.getChangeAmount(); // 变动金额 |
| | | } |
| | | objs[a++] = o.getBalance(); //现余额 |
| | | objs[a++] = o.getCreateTime();//提交时间 |
| | | objs[a++] = o.getApproveTime(); // 审核时间 |
| | | objs[a++] = o.getRemark(); //备注 |
| | | objs[a++] = o.getApproveName(); //操作人 |
| | | dataList.add(objs); |
| | | sn++; |
| | | } |