From fa677dec1c55db004a31beefb1e346e18c7858c2 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 20 二月 2025 18:41:29 +0800 Subject: [PATCH] bug修改 --- 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