Pause salary settlement and wallet outflows

This commit is contained in:
hy001 2026-05-20 01:29:31 +08:00
parent ad73326eae
commit 35ceb5d80f
10 changed files with 196 additions and 92 deletions

View File

@ -62,6 +62,8 @@ import lombok.extern.slf4j.Slf4j;
@RequiredArgsConstructor @RequiredArgsConstructor
public class TeamBillSettleListener implements MessageListener { public class TeamBillSettleListener implements MessageListener {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private final String tag = "团队账单"; private final String tag = "团队账单";
private final TeamProfileService teamProfileService; private final TeamProfileService teamProfileService;
private final MessageEventProcess messageEventProcess; private final MessageEventProcess messageEventProcess;
@ -78,6 +80,11 @@ public class TeamBillSettleListener implements MessageListener {
@Override @Override
public Action consume(ConsumerMessage message) { public Action consume(ConsumerMessage message) {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("team_bill_settle_message skipped: salary settlement is temporarily paused");
return Action.SUCCESS;
}
return messageEventProcess.consume( return messageEventProcess.consume(
MessageEventProcessDescribe.builder() MessageEventProcessDescribe.builder()
.logTag(tag) .logTag(tag)

View File

@ -79,6 +79,8 @@ import lombok.extern.slf4j.Slf4j;
@RequiredArgsConstructor @RequiredArgsConstructor
public class TeamSalaryPaymentListener implements MessageListener { public class TeamSalaryPaymentListener implements MessageListener {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private final PropsSendCommon propsSendCommon; private final PropsSendCommon propsSendCommon;
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final TeamProfileService teamProfileService; private final TeamProfileService teamProfileService;
@ -97,6 +99,11 @@ public class TeamSalaryPaymentListener implements MessageListener {
@Override @Override
public Action consume(ConsumerMessage message) { public Action consume(ConsumerMessage message) {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("team_salary_payment_message skipped: salary settlement is temporarily paused");
return Action.SUCCESS;
}
return messageEventProcess.consume( return messageEventProcess.consume(
MessageEventProcessDescribe.builder() MessageEventProcessDescribe.builder()
.logTag("满足政策的团队工资实时发送") .logTag("满足政策的团队工资实时发送")

View File

@ -20,6 +20,8 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor @RequiredArgsConstructor
public class AdminSalarySettlementTask { public class AdminSalarySettlementTask {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private final AdminSalarySettlementService adminSalarySettlementService; private final AdminSalarySettlementService adminSalarySettlementService;
/** /**
@ -28,6 +30,11 @@ public class AdminSalarySettlementTask {
@Scheduled(cron = "0 0 2 1 * ?", zone = "Asia/Riyadh") @Scheduled(cron = "0 0 2 1 * ?", zone = "Asia/Riyadh")
@TaskCacheLock(key = "ADMIN_SALARY_SETTLEMENT", expireSecond = 86400) @TaskCacheLock(key = "ADMIN_SALARY_SETTLEMENT", expireSecond = 86400)
public void processAdminSalarySettlement() { public void processAdminSalarySettlement() {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("admin_salary_settlement skipped: salary settlement is temporarily paused");
return;
}
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
log.warn("========== 管理员工资结算定时任务开始 =========="); log.warn("========== 管理员工资结算定时任务开始 ==========");
@ -62,6 +69,11 @@ public class AdminSalarySettlementTask {
* 测试方法手动触发. * 测试方法手动触发.
*/ */
public void processAdminSalarySettlementTest(Integer billBelong) { public void processAdminSalarySettlementTest(Integer billBelong) {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("admin_salary_settlement_test skipped: salary settlement is temporarily paused");
return;
}
String billTitle = TeamBillCycleUtils.parseBillBelongToDateRangeStr(billBelong); String billTitle = TeamBillCycleUtils.parseBillBelongToDateRangeStr(billBelong);
adminSalarySettlementService.processAllAdminSettlement(billBelong, billTitle); adminSalarySettlementService.processAllAdminSettlement(billBelong, billTitle);
} }

View File

@ -20,6 +20,8 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor @RequiredArgsConstructor
public class BdLeaderSalarySettlementTask { public class BdLeaderSalarySettlementTask {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private final BdLeaderSalarySettlementService bdLeaderSalarySettlementService; private final BdLeaderSalarySettlementService bdLeaderSalarySettlementService;
/** /**
@ -28,6 +30,11 @@ public class BdLeaderSalarySettlementTask {
@Scheduled(cron = "0 0 1 1 * ?", zone = "Asia/Riyadh") @Scheduled(cron = "0 0 1 1 * ?", zone = "Asia/Riyadh")
@TaskCacheLock(key = "BD_LEADER_SALARY_SETTLEMENT", expireSecond = 86400) @TaskCacheLock(key = "BD_LEADER_SALARY_SETTLEMENT", expireSecond = 86400)
public void processBdLeaderSalarySettlement() { public void processBdLeaderSalarySettlement() {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("bd_leader_salary_settlement skipped: salary settlement is temporarily paused");
return;
}
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
log.warn("========== BD Leader工资结算定时任务开始 =========="); log.warn("========== BD Leader工资结算定时任务开始 ==========");
@ -62,6 +69,11 @@ public class BdLeaderSalarySettlementTask {
* 测试方法手动触发. * 测试方法手动触发.
*/ */
public void processBdLeaderSalarySettlementTest(Integer billBelong) { public void processBdLeaderSalarySettlementTest(Integer billBelong) {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("bd_leader_salary_settlement_test skipped: salary settlement is temporarily paused");
return;
}
String billTitle = TeamBillCycleUtils.parseBillBelongToDateRangeStr(billBelong); String billTitle = TeamBillCycleUtils.parseBillBelongToDateRangeStr(billBelong);
bdLeaderSalarySettlementService.processAllBdLeaderSettlement(billBelong, billTitle); bdLeaderSalarySettlementService.processAllBdLeaderSettlement(billBelong, billTitle);
} }

View File

@ -20,6 +20,8 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor @RequiredArgsConstructor
public class BdSalarySettlementTask { public class BdSalarySettlementTask {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private final BdSalarySettlementService bdSalarySettlementService; private final BdSalarySettlementService bdSalarySettlementService;
/** /**
@ -28,6 +30,11 @@ public class BdSalarySettlementTask {
@Scheduled(cron = "0 30 0 1 * ?", zone = "Asia/Riyadh") @Scheduled(cron = "0 30 0 1 * ?", zone = "Asia/Riyadh")
@TaskCacheLock(key = "BD_SALARY_SETTLEMENT", expireSecond = 86400) @TaskCacheLock(key = "BD_SALARY_SETTLEMENT", expireSecond = 86400)
public void processBdSalarySettlement() { public void processBdSalarySettlement() {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("bd_salary_settlement skipped: salary settlement is temporarily paused");
return;
}
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
log.warn("========== BD工资结算定时任务开始 =========="); log.warn("========== BD工资结算定时任务开始 ==========");
@ -62,6 +69,11 @@ public class BdSalarySettlementTask {
* 测试方法手动触发. * 测试方法手动触发.
*/ */
public void processBdSalarySettlementTest(Integer billBelong) { public void processBdSalarySettlementTest(Integer billBelong) {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("bd_salary_settlement_test skipped: salary settlement is temporarily paused");
return;
}
String billTitle = TeamBillCycleUtils.parseBillBelongToDateRangeStr(billBelong); String billTitle = TeamBillCycleUtils.parseBillBelongToDateRangeStr(billBelong);
bdSalarySettlementService.processAllBdSettlement(billBelong, billTitle); bdSalarySettlementService.processAllBdSettlement(billBelong, billTitle);
} }

View File

@ -31,6 +31,8 @@ import org.springframework.stereotype.Component;
@AllArgsConstructor @AllArgsConstructor
public class TeamBillTask { public class TeamBillTask {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private final TeamSalaryMqMessage otherMqMessage; private final TeamSalaryMqMessage otherMqMessage;
private final TeamProfileService teamProfileService; private final TeamProfileService teamProfileService;
private final TeamBillCycleService teamBillCycleService; private final TeamBillCycleService teamBillCycleService;
@ -56,6 +58,11 @@ public class TeamBillTask {
private void processTeamBill() { private void processTeamBill() {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("process_team_bill skipped: salary settlement is temporarily paused");
return;
}
log.warn("开始执行账单处理:{},{}", ZonedDateTimeUtils.nowAsiaRiyadhToInt(), LocalDateTime.now()); log.warn("开始执行账单处理:{},{}", ZonedDateTimeUtils.nowAsiaRiyadhToInt(), LocalDateTime.now());
// 出单 // 出单
teamBillCycleService.billStatusPayOut(); teamBillCycleService.billStatusPayOut();
@ -66,6 +73,11 @@ public class TeamBillTask {
} }
public void processTeamBillRetry() { public void processTeamBillRetry() {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("process_team_bill_retry skipped: salary settlement is temporarily paused");
return;
}
// 创建本月账单发出结算信号 // 创建本月账单发出结算信号
consumeProcessPayOutBill(); consumeProcessPayOutBill();
} }

View File

@ -26,6 +26,8 @@ import org.springframework.stereotype.Component;
@AllArgsConstructor @AllArgsConstructor
public class TeamSalaryPaymentTask { public class TeamSalaryPaymentTask {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private final TeamProfileService teamProfileService; private final TeamProfileService teamProfileService;
private final TeamSalaryMqMessage teamSalaryMqMessage; private final TeamSalaryMqMessage teamSalaryMqMessage;
@ -35,6 +37,11 @@ public class TeamSalaryPaymentTask {
@Scheduled(cron = "30 1 0 * * ?", zone = "Asia/Riyadh") @Scheduled(cron = "30 1 0 * * ?", zone = "Asia/Riyadh")
@TaskCacheLock(key = "TEAM_SALARY_PAYMENT_TASK", expireSecond = 10800) @TaskCacheLock(key = "TEAM_SALARY_PAYMENT_TASK", expireSecond = 10800)
public void teamSalaryPaymentTask() { public void teamSalaryPaymentTask() {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("team_salary_payment_task skipped: salary settlement is temporarily paused");
return;
}
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
log.warn("exec team_salary_payment_task start"); log.warn("exec team_salary_payment_task start");
@ -67,6 +74,10 @@ public class TeamSalaryPaymentTask {
} }
public void teamSalaryPaymentTaskTest() { public void teamSalaryPaymentTaskTest() {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("team_salary_payment_task_test skipped: salary settlement is temporarily paused");
return;
}
log.warn("支付团队工资 start时间:{}", TimestampUtils.now()); log.warn("支付团队工资 start时间:{}", TimestampUtils.now());

View File

@ -1,5 +1,7 @@
package com.red.circle.wallet.app.service; package com.red.circle.wallet.app.service;
import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.core.response.CommonErrorCode;
import com.red.circle.framework.dto.PageResult; import com.red.circle.framework.dto.PageResult;
import com.red.circle.wallet.app.command.salary.SalaryExchangeGoldCmdExe; import com.red.circle.wallet.app.command.salary.SalaryExchangeGoldCmdExe;
import com.red.circle.wallet.app.command.salary.SalaryIssueCmdExe; import com.red.circle.wallet.app.command.salary.SalaryIssueCmdExe;
@ -24,6 +26,8 @@ import java.util.Objects;
@RequiredArgsConstructor @RequiredArgsConstructor
public class SalaryAccountServiceImpl implements SalaryAccountService { public class SalaryAccountServiceImpl implements SalaryAccountService {
private static final boolean SALARY_WALLET_OUT_PAUSED = true;
private final SalaryAccountBalanceQryExe salaryAccountBalanceQryExe; private final SalaryAccountBalanceQryExe salaryAccountBalanceQryExe;
private final SalaryRunningWaterQryExe salaryRunningWaterQryExe; private final SalaryRunningWaterQryExe salaryRunningWaterQryExe;
private final SalaryIssueCmdExe salaryIssueCmdExe; private final SalaryIssueCmdExe salaryIssueCmdExe;
@ -54,14 +58,20 @@ public class SalaryAccountServiceImpl implements SalaryAccountService {
@Override @Override
public UserBankWithdrawResultCO transferGold(SalaryWithdrawCmd cmd) { public UserBankWithdrawResultCO transferGold(SalaryWithdrawCmd cmd) {
rejectPausedSalaryWalletOut();
return salaryTransferGoldCmdExe.execute(cmd); return salaryTransferGoldCmdExe.execute(cmd);
} }
@Override @Override
public UserBankExchangeGoldResultCO exchangeGold(SalaryWithdrawCmd cmd) { public UserBankExchangeGoldResultCO exchangeGold(SalaryWithdrawCmd cmd) {
rejectPausedSalaryWalletOut();
return salaryExchangeGoldCmdExe.execute(cmd); return salaryExchangeGoldCmdExe.execute(cmd);
} }
private void rejectPausedSalaryWalletOut() {
ResponseAssert.isTrue(CommonErrorCode.SYSTEM_IS_DOWN, !SALARY_WALLET_OUT_PAUSED);
}
@Override @Override
public BigDecimal getTotalIncome(Long userId, String salaryType, String salaryEvent, String startTime, String endTime) { public BigDecimal getTotalIncome(Long userId, String salaryType, String salaryEvent, String startTime, String endTime) {
return salaryTotalIncomeQryExe.execute(userId, Objects.requireNonNull(SalaryType.of(salaryType)), salaryEvent, startTime, endTime); return salaryTotalIncomeQryExe.execute(userId, Objects.requireNonNull(SalaryType.of(salaryType)), salaryEvent, startTime, endTime);

View File

@ -2,7 +2,9 @@ package com.red.circle.wallet.app.service;
import com.red.circle.common.business.dto.cmd.AppExtCommand; import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd; import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd;
import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.core.dto.CommonCommand; import com.red.circle.framework.core.dto.CommonCommand;
import com.red.circle.framework.core.response.CommonErrorCode;
import com.red.circle.framework.dto.PageResult; import com.red.circle.framework.dto.PageResult;
import com.red.circle.wallet.app.command.bank.UserBankExchangeGoldCmdExe; import com.red.circle.wallet.app.command.bank.UserBankExchangeGoldCmdExe;
import com.red.circle.wallet.app.command.bank.query.UserBankCheckExchangeGoldQryExe; import com.red.circle.wallet.app.command.bank.query.UserBankCheckExchangeGoldQryExe;
@ -31,6 +33,8 @@ import java.util.List;
@RequiredArgsConstructor @RequiredArgsConstructor
public class SalaryDiamondServiceImpl implements SalaryDiamondService { public class SalaryDiamondServiceImpl implements SalaryDiamondService {
private static final boolean SALARY_EXCHANGE_PAUSED = true;
private final UserBillAgentSalaryDiamondCheckExchangeGoldQryExe userBillAgentSalaryDiamondCheckExchangeGoldQryExe; private final UserBillAgentSalaryDiamondCheckExchangeGoldQryExe userBillAgentSalaryDiamondCheckExchangeGoldQryExe;
private final UserSalaryDiamondBalanceQryExe userSalaryDiamondBalanceQryExe; private final UserSalaryDiamondBalanceQryExe userSalaryDiamondBalanceQryExe;
private final UserSalaryDiamondRunningWaterQryExe userSalaryDiamondRunningWaterQryExe; private final UserSalaryDiamondRunningWaterQryExe userSalaryDiamondRunningWaterQryExe;
@ -87,24 +91,32 @@ public class SalaryDiamondServiceImpl implements SalaryDiamondService {
@Override @Override
public UserBankExchangeGoldResultCO exchangeGold(UserBankExchangeGoldCmd cmd) { public UserBankExchangeGoldResultCO exchangeGold(UserBankExchangeGoldCmd cmd) {
rejectPausedSalaryExchange();
return userBankExchangeGoldCmdExe.executeDiamond(cmd); return userBankExchangeGoldCmdExe.executeDiamond(cmd);
} }
@Override @Override
public UserBankExchangeGoldResultCO exchangeGoldYolo(UserBankExchangeGoldCmd cmd) { public UserBankExchangeGoldResultCO exchangeGoldYolo(UserBankExchangeGoldCmd cmd) {
rejectPausedSalaryExchange();
return userBankExchangeGoldCmdExe.exchangeGoldYolo(cmd); return userBankExchangeGoldCmdExe.exchangeGoldYolo(cmd);
} }
@Override @Override
public UserBankExchangeGoldResultCO agentBillExchangeGold(UserBillExchangeGoldCmd cmd) { public UserBankExchangeGoldResultCO agentBillExchangeGold(UserBillExchangeGoldCmd cmd) {
rejectPausedSalaryExchange();
return userBankExchangeGoldCmdExe.agentBillExchangeGold(cmd); return userBankExchangeGoldCmdExe.agentBillExchangeGold(cmd);
} }
@Override @Override
public UserBankExchangeGoldResultCO memberWorkExchangeGold(UserBillExchangeGoldCmd cmd) { public UserBankExchangeGoldResultCO memberWorkExchangeGold(UserBillExchangeGoldCmd cmd) {
rejectPausedSalaryExchange();
return userBankExchangeGoldCmdExe.memberWorkExchangeGold(cmd); return userBankExchangeGoldCmdExe.memberWorkExchangeGold(cmd);
} }
private void rejectPausedSalaryExchange() {
ResponseAssert.isTrue(CommonErrorCode.SYSTEM_IS_DOWN, !SALARY_EXCHANGE_PAUSED);
}
@Override @Override
public UserBankWithdrawResultCO withdraw(UserBankWithdrawCmd cmd) { public UserBankWithdrawResultCO withdraw(UserBankWithdrawCmd cmd) {
return null; return null;

View File

@ -1,7 +1,9 @@
package com.red.circle.wallet.app.service; package com.red.circle.wallet.app.service;
import com.red.circle.common.business.dto.cmd.AppExtCommand; import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.core.dto.CommonCommand; import com.red.circle.framework.core.dto.CommonCommand;
import com.red.circle.framework.core.response.CommonErrorCode;
import com.red.circle.other.inner.model.dto.user.SysExchangeGoldTipDTO; import com.red.circle.other.inner.model.dto.user.SysExchangeGoldTipDTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.wallet.app.command.bank.*; import com.red.circle.wallet.app.command.bank.*;
@ -39,6 +41,8 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor @RequiredArgsConstructor
public class UserBankServiceImpl implements UserBankService { public class UserBankServiceImpl implements UserBankService {
private static final boolean USER_TO_COIN_SELLER_TRANSFER_PAUSED = true;
private final UserBankWaterQryExe userBankWaterQryExe; private final UserBankWaterQryExe userBankWaterQryExe;
private final UserBankBalanceQryExe userBankBalanceQryExe; private final UserBankBalanceQryExe userBankBalanceQryExe;
private final UserBankWithdrawCmdExe userBankWithdrawCmdExe; private final UserBankWithdrawCmdExe userBankWithdrawCmdExe;
@ -88,9 +92,14 @@ public class UserBankServiceImpl implements UserBankService {
@Override @Override
public UserBankWithdrawResultCO transferGold(UserBankWithdrawTransferCmd cmd) { public UserBankWithdrawResultCO transferGold(UserBankWithdrawTransferCmd cmd) {
rejectPausedUserToCoinSellerTransfer();
return userBankTransferGoldCmdExe.execute(cmd); return userBankTransferGoldCmdExe.execute(cmd);
} }
private void rejectPausedUserToCoinSellerTransfer() {
ResponseAssert.isTrue(CommonErrorCode.SYSTEM_IS_DOWN, !USER_TO_COIN_SELLER_TRANSFER_PAUSED);
}
@Override @Override
public UserBankWithdrawResultCO diamondTransfer(UserBankWithdrawTransferCmd cmd) { public UserBankWithdrawResultCO diamondTransfer(UserBankWithdrawTransferCmd cmd) {
return userBankDiamondWithdrawTransferCmdExe.execute(cmd); return userBankDiamondWithdrawTransferCmdExe.execute(cmd);