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
public class TeamBillSettleListener implements MessageListener {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private final String tag = "团队账单";
private final TeamProfileService teamProfileService;
private final MessageEventProcess messageEventProcess;
@ -78,6 +80,11 @@ public class TeamBillSettleListener implements MessageListener {
@Override
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(
MessageEventProcessDescribe.builder()
.logTag(tag)

View File

@ -79,6 +79,8 @@ import lombok.extern.slf4j.Slf4j;
@RequiredArgsConstructor
public class TeamSalaryPaymentListener implements MessageListener {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private final PropsSendCommon propsSendCommon;
private final TeamMemberService teamMemberService;
private final TeamProfileService teamProfileService;
@ -97,6 +99,11 @@ public class TeamSalaryPaymentListener implements MessageListener {
@Override
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(
MessageEventProcessDescribe.builder()
.logTag("满足政策的团队工资实时发送")

View File

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

View File

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

View File

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

View File

@ -31,6 +31,8 @@ import org.springframework.stereotype.Component;
@AllArgsConstructor
public class TeamBillTask {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private final TeamSalaryMqMessage otherMqMessage;
private final TeamProfileService teamProfileService;
private final TeamBillCycleService teamBillCycleService;
@ -56,6 +58,11 @@ public class TeamBillTask {
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());
// 出单
teamBillCycleService.billStatusPayOut();
@ -66,6 +73,11 @@ public class TeamBillTask {
}
public void processTeamBillRetry() {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("process_team_bill_retry skipped: salary settlement is temporarily paused");
return;
}
// 创建本月账单发出结算信号
consumeProcessPayOutBill();
}

View File

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

View File

@ -1,5 +1,7 @@
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.wallet.app.command.salary.SalaryExchangeGoldCmdExe;
import com.red.circle.wallet.app.command.salary.SalaryIssueCmdExe;
@ -24,6 +26,8 @@ import java.util.Objects;
@RequiredArgsConstructor
public class SalaryAccountServiceImpl implements SalaryAccountService {
private static final boolean SALARY_WALLET_OUT_PAUSED = true;
private final SalaryAccountBalanceQryExe salaryAccountBalanceQryExe;
private final SalaryRunningWaterQryExe salaryRunningWaterQryExe;
private final SalaryIssueCmdExe salaryIssueCmdExe;
@ -54,14 +58,20 @@ public class SalaryAccountServiceImpl implements SalaryAccountService {
@Override
public UserBankWithdrawResultCO transferGold(SalaryWithdrawCmd cmd) {
rejectPausedSalaryWalletOut();
return salaryTransferGoldCmdExe.execute(cmd);
}
@Override
public UserBankExchangeGoldResultCO exchangeGold(SalaryWithdrawCmd cmd) {
rejectPausedSalaryWalletOut();
return salaryExchangeGoldCmdExe.execute(cmd);
}
private void rejectPausedSalaryWalletOut() {
ResponseAssert.isTrue(CommonErrorCode.SYSTEM_IS_DOWN, !SALARY_WALLET_OUT_PAUSED);
}
@Override
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);

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

View File

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