fix: keep bill cycle switch while salary paused

This commit is contained in:
hy001 2026-06-01 10:44:13 +08:00
parent e3be12cd8b
commit 3c920ee208
2 changed files with 26 additions and 23 deletions

View File

@ -132,10 +132,10 @@ public class TestRestController extends BaseController {
teamSalaryPaymentTask.teamSalaryPaymentTaskTest();
}
@PostMapping("/processTeamMonthBill")
public void processTeamMonthBill() {
teamBillTask.processTeamBillRetry();
}
@PostMapping("/processTeamMonthBill")
public void processTeamMonthBill() {
teamBillTask.processTeamMonthBillTest();
}
@PostMapping("/activity/send/game")
public void activitySendGame(@RequestBody RewardPoolCmd cmd) {

View File

@ -32,6 +32,7 @@ import org.springframework.stereotype.Component;
public class TeamBillTask {
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
private static final boolean BILL_CYCLE_SWITCH_PAUSED = false;
private final TeamSalaryMqMessage otherMqMessage;
private final TeamProfileService teamProfileService;
@ -58,23 +59,21 @@ public class TeamBillTask {
private void processTeamBill() {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("process_team_bill skipped: salary settlement is temporarily paused");
if (BILL_CYCLE_SWITCH_PAUSED) {
log.warn("process_team_bill skipped: bill cycle switch is temporarily paused");
return;
}
log.warn("开始执行账单处理:{},{}", ZonedDateTimeUtils.nowAsiaRiyadhToInt(), LocalDateTime.now());
// 出单
teamBillCycleService.billStatusPayOut();
// 创建本月账单发出结算信号
consumeProcessPayOutBill();
log.warn("结束账单处理");
}
log.warn("开始执行账期切换:{},{}", ZonedDateTimeUtils.nowAsiaRiyadhToInt(), LocalDateTime.now());
// 只创建新月账期上月账单保留原状态后续由后台人工结算
consumeProcessPayOutBill();
log.warn("结束账期切换");
}
public void processTeamBillRetry() {
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("process_team_bill_retry skipped: salary settlement is temporarily paused");
if (BILL_CYCLE_SWITCH_PAUSED) {
log.warn("process_team_bill_retry skipped: bill cycle switch is temporarily paused");
return;
}
@ -138,12 +137,16 @@ public class TeamBillTask {
.setOperationTime(TimestampUtils.now())
.setOperationBackUser(teamProfile.getCreateUser());
teamBillCycleService.createIfAbsent(cmd);
otherMqMessage.teamBillSettle(new TeamBillSettleEvent()
.setTeamId(teamProfile.getId()));
success.incrementAndGet();
teamBillCycleService.createIfAbsent(cmd);
if (SALARY_SETTLEMENT_PAUSED) {
log.warn("团队账单结算消息暂停发送: teamId={}", teamProfile.getId());
} else {
otherMqMessage.teamBillSettle(new TeamBillSettleEvent()
.setTeamId(teamProfile.getId()));
}
success.incrementAndGet();
} catch (Exception e) {
fail.incrementAndGet();