From 5af707003f4c7b26f09a554a4d3c75c1c6769ab2 Mon Sep 17 00:00:00 2001 From: Administrator <1101184511@qq.com> Date: 星期五, 25 四月 2025 00:11:10 +0800 Subject: [PATCH] 后台管理页面完成 --- src/main/java/com/taoke/autopay/service/impl/agent/ChannelAgentSettleServiceImpl.java | 77 ++++++++++++++++++++++++++++++++++---- 1 files changed, 69 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/taoke/autopay/service/impl/agent/ChannelAgentSettleServiceImpl.java b/src/main/java/com/taoke/autopay/service/impl/agent/ChannelAgentSettleServiceImpl.java index 6b5e0f6..b99b838 100644 --- a/src/main/java/com/taoke/autopay/service/impl/agent/ChannelAgentSettleServiceImpl.java +++ b/src/main/java/com/taoke/autopay/service/impl/agent/ChannelAgentSettleServiceImpl.java @@ -103,14 +103,16 @@ } ChannelAgent agent = channelAgentService.selectByPrimaryKey(agentId); - settle(ChannelAgentSettleRecord.builder() - .agentId(agentId) - .settleDay(day) - .settleMoney(totalMoney) - .alipayAccount(agent.getAlipayAccount()) - .alipayName(agent.getAlipayName()) - .detailList(detailList) - .build()); + if(agent!=null) { + settle(ChannelAgentSettleRecord.builder() + .agentId(agentId) + .settleDay(day) + .settleMoney(totalMoney) + .alipayAccount(agent.getAlipayAccount()) + .alipayName(agent.getAlipayName()) + .detailList(detailList) + .build()); + } } } @@ -164,4 +166,63 @@ } } + + @Transactional(rollbackFor = Exception.class) + @Override + public void processWithdraw(List<Long> ids, boolean pass) throws ChannelAgentSettleException { + for (Long id : ids) { + ChannelAgentSettleRecord old = channelAgentSettleRecordMapper.selectByPrimaryKeyForUpdate(id); + if (old.getStatus() != ChannelAgentSettleRecord.STATUS_WITHDRAWING) { + throw new ChannelAgentSettleException("鎻愮幇宸插鐞�"); + } + + channelAgentSettleRecordMapper.updateByPrimaryKeySelective(ChannelAgentSettleRecord.builder().id(id) + .status(pass ? ChannelAgentSettleRecord.STATUS_WITHDRAW_SUCCESS : ChannelAgentSettleRecord.STATUS_WITHDRAW_REJECTED) + .withDrawProcessTime(new Date()) + .updateTime(new Date()) + .payTime(pass ? new Date() : null).build()); + } + + + } + + @Override + public void actualSettle(Long id, BigDecimal money) throws ChannelAgentSettleException { + ChannelAgentSettleRecord old = channelAgentSettleRecordMapper.selectByPrimaryKeyForUpdate(id); + if (old == null) { + throw new ChannelAgentSettleException("缁撶畻ID涓虹┖"); + } + if (old.getStatus() != ChannelAgentSettleRecord.STATUS_NOT_SETTLE) { + throw new ChannelAgentSettleException("宸茬粡缁撶畻"); + } + + channelAgentSettleRecordMapper.updateByPrimaryKeySelective(ChannelAgentSettleRecord.builder() + .id(id) + .actualSettleMoney(money) + .settleTime(new Date()) + .status(ChannelAgentSettleRecord.STATUS_SETTLED) + .updateTime(new Date()) + .build()); + + + } + + @Override + public void applyWithdraw(Long id) throws ChannelAgentSettleException { + + ChannelAgentSettleRecord old = channelAgentSettleRecordMapper.selectByPrimaryKeyForUpdate(id); + if (old == null) { + throw new ChannelAgentSettleException("缁撶畻ID涓虹┖"); + } + if (old.getStatus() != ChannelAgentSettleRecord.STATUS_SETTLED) { + throw new ChannelAgentSettleException("澶勪簬涓嶅彲鎻愮幇鐘舵��"); + } + channelAgentSettleRecordMapper.updateByPrimaryKeySelective(ChannelAgentSettleRecord.builder() + .id(id) + .withDrawApplyTime(new Date()) + .settleTime(new Date()) + .status(ChannelAgentSettleRecord.STATUS_WITHDRAWING) + .updateTime(new Date()) + .build()); + } } -- Gitblit v1.8.0