Pause salary settlement and wallet outflows
This commit is contained in:
parent
ad73326eae
commit
35ceb5d80f
@ -60,9 +60,11 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RocketMqMessageListener(groupId = TeamBillSettleSink.INPUT, tag = TeamBillSettleSink.TAG)
|
@RocketMqMessageListener(groupId = TeamBillSettleSink.INPUT, tag = TeamBillSettleSink.TAG)
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class TeamBillSettleListener implements MessageListener {
|
public class TeamBillSettleListener implements MessageListener {
|
||||||
|
|
||||||
private final String tag = "团队账单";
|
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
|
||||||
|
|
||||||
|
private final String tag = "团队账单";
|
||||||
private final TeamProfileService teamProfileService;
|
private final TeamProfileService teamProfileService;
|
||||||
private final MessageEventProcess messageEventProcess;
|
private final MessageEventProcess messageEventProcess;
|
||||||
private final TeamBillCycleService teamBillCycleService;
|
private final TeamBillCycleService teamBillCycleService;
|
||||||
@ -76,9 +78,14 @@ public class TeamBillSettleListener implements MessageListener {
|
|||||||
private final SalaryDiamondRunningWaterClient salaryDiamondRunningWaterClient;
|
private final SalaryDiamondRunningWaterClient salaryDiamondRunningWaterClient;
|
||||||
private final BillDiamondBalanceService billDiamondBalanceService;
|
private final BillDiamondBalanceService billDiamondBalanceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Action consume(ConsumerMessage message) {
|
public Action consume(ConsumerMessage message) {
|
||||||
return messageEventProcess.consume(
|
if (SALARY_SETTLEMENT_PAUSED) {
|
||||||
|
log.warn("team_bill_settle_message skipped: salary settlement is temporarily paused");
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return messageEventProcess.consume(
|
||||||
MessageEventProcessDescribe.builder()
|
MessageEventProcessDescribe.builder()
|
||||||
.logTag(tag)
|
.logTag(tag)
|
||||||
.consumeMsgTimeoutMinute(30)
|
.consumeMsgTimeoutMinute(30)
|
||||||
|
|||||||
@ -77,9 +77,11 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RocketMqMessageListener(groupId = TeamSalaryPaymentSink.INPUT, tag = TeamSalaryPaymentSink.TAG)
|
@RocketMqMessageListener(groupId = TeamSalaryPaymentSink.INPUT, tag = TeamSalaryPaymentSink.TAG)
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class TeamSalaryPaymentListener implements MessageListener {
|
public class TeamSalaryPaymentListener implements MessageListener {
|
||||||
|
|
||||||
private final PropsSendCommon propsSendCommon;
|
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
|
||||||
|
|
||||||
|
private final PropsSendCommon propsSendCommon;
|
||||||
private final TeamMemberService teamMemberService;
|
private final TeamMemberService teamMemberService;
|
||||||
private final TeamProfileService teamProfileService;
|
private final TeamProfileService teamProfileService;
|
||||||
private final MessageEventProcess messageEventProcess;
|
private final MessageEventProcess messageEventProcess;
|
||||||
@ -95,9 +97,14 @@ public class TeamSalaryPaymentListener implements MessageListener {
|
|||||||
private final BillDiamondBalanceService billDiamondBalanceService;
|
private final BillDiamondBalanceService billDiamondBalanceService;
|
||||||
private final BillDiamondBalanceDetailsService billDiamondBalanceDetailsService;
|
private final BillDiamondBalanceDetailsService billDiamondBalanceDetailsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Action consume(ConsumerMessage message) {
|
public Action consume(ConsumerMessage message) {
|
||||||
return messageEventProcess.consume(
|
if (SALARY_SETTLEMENT_PAUSED) {
|
||||||
|
log.warn("team_salary_payment_message skipped: salary settlement is temporarily paused");
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return messageEventProcess.consume(
|
||||||
MessageEventProcessDescribe.builder()
|
MessageEventProcessDescribe.builder()
|
||||||
.logTag("满足政策的团队工资实时发送")
|
.logTag("满足政策的团队工资实时发送")
|
||||||
.consumeMsgTimeoutMinute(30)
|
.consumeMsgTimeoutMinute(30)
|
||||||
|
|||||||
@ -18,9 +18,11 @@ import org.springframework.stereotype.Component;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AdminSalarySettlementTask {
|
public class AdminSalarySettlementTask {
|
||||||
|
|
||||||
private final AdminSalarySettlementService adminSalarySettlementService;
|
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
|
||||||
|
|
||||||
|
private final AdminSalarySettlementService adminSalarySettlementService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每月1号2点执行上月整月结算.
|
* 每月1号2点执行上月整月结算.
|
||||||
@ -28,7 +30,12 @@ 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() {
|
||||||
long startTime = System.currentTimeMillis();
|
if (SALARY_SETTLEMENT_PAUSED) {
|
||||||
|
log.warn("admin_salary_settlement skipped: salary settlement is temporarily paused");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
log.warn("========== 管理员工资结算定时任务开始 ==========");
|
log.warn("========== 管理员工资结算定时任务开始 ==========");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -61,8 +68,13 @@ public class AdminSalarySettlementTask {
|
|||||||
/**
|
/**
|
||||||
* 测试方法(手动触发).
|
* 测试方法(手动触发).
|
||||||
*/
|
*/
|
||||||
public void processAdminSalarySettlementTest(Integer billBelong) {
|
public void processAdminSalarySettlementTest(Integer billBelong) {
|
||||||
String billTitle = TeamBillCycleUtils.parseBillBelongToDateRangeStr(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);
|
adminSalarySettlementService.processAllAdminSettlement(billBelong, billTitle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,9 +18,11 @@ import org.springframework.stereotype.Component;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class BdLeaderSalarySettlementTask {
|
public class BdLeaderSalarySettlementTask {
|
||||||
|
|
||||||
private final BdLeaderSalarySettlementService bdLeaderSalarySettlementService;
|
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
|
||||||
|
|
||||||
|
private final BdLeaderSalarySettlementService bdLeaderSalarySettlementService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每月1号1点执行上月整月结算.
|
* 每月1号1点执行上月整月结算.
|
||||||
@ -28,7 +30,12 @@ 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() {
|
||||||
long startTime = System.currentTimeMillis();
|
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工资结算定时任务开始 ==========");
|
log.warn("========== BD Leader工资结算定时任务开始 ==========");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -61,8 +68,13 @@ public class BdLeaderSalarySettlementTask {
|
|||||||
/**
|
/**
|
||||||
* 测试方法(手动触发).
|
* 测试方法(手动触发).
|
||||||
*/
|
*/
|
||||||
public void processBdLeaderSalarySettlementTest(Integer billBelong) {
|
public void processBdLeaderSalarySettlementTest(Integer billBelong) {
|
||||||
String billTitle = TeamBillCycleUtils.parseBillBelongToDateRangeStr(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);
|
bdLeaderSalarySettlementService.processAllBdLeaderSettlement(billBelong, billTitle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,9 +18,11 @@ import org.springframework.stereotype.Component;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class BdSalarySettlementTask {
|
public class BdSalarySettlementTask {
|
||||||
|
|
||||||
private final BdSalarySettlementService bdSalarySettlementService;
|
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
|
||||||
|
|
||||||
|
private final BdSalarySettlementService bdSalarySettlementService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每月1号0点30分执行上月整月结算.
|
* 每月1号0点30分执行上月整月结算.
|
||||||
@ -28,7 +30,12 @@ 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() {
|
||||||
long startTime = System.currentTimeMillis();
|
if (SALARY_SETTLEMENT_PAUSED) {
|
||||||
|
log.warn("bd_salary_settlement skipped: salary settlement is temporarily paused");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
log.warn("========== BD工资结算定时任务开始 ==========");
|
log.warn("========== BD工资结算定时任务开始 ==========");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -61,8 +68,13 @@ public class BdSalarySettlementTask {
|
|||||||
/**
|
/**
|
||||||
* 测试方法(手动触发).
|
* 测试方法(手动触发).
|
||||||
*/
|
*/
|
||||||
public void processBdSalarySettlementTest(Integer billBelong) {
|
public void processBdSalarySettlementTest(Integer billBelong) {
|
||||||
String billTitle = TeamBillCycleUtils.parseBillBelongToDateRangeStr(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);
|
bdSalarySettlementService.processAllBdSettlement(billBelong, billTitle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,9 +29,11 @@ import org.springframework.stereotype.Component;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TeamBillTask {
|
public class TeamBillTask {
|
||||||
|
|
||||||
private final TeamSalaryMqMessage otherMqMessage;
|
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
|
||||||
|
|
||||||
|
private final TeamSalaryMqMessage otherMqMessage;
|
||||||
private final TeamProfileService teamProfileService;
|
private final TeamProfileService teamProfileService;
|
||||||
private final TeamBillCycleService teamBillCycleService;
|
private final TeamBillCycleService teamBillCycleService;
|
||||||
private final GiftGiveRunningWaterService giftGiveRunningWaterService;
|
private final GiftGiveRunningWaterService giftGiveRunningWaterService;
|
||||||
@ -55,8 +57,13 @@ public class TeamBillTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void processTeamBill() {
|
private void processTeamBill() {
|
||||||
log.warn("开始执行账单处理:{},{}", ZonedDateTimeUtils.nowAsiaRiyadhToInt(), LocalDateTime.now());
|
if (SALARY_SETTLEMENT_PAUSED) {
|
||||||
|
log.warn("process_team_bill skipped: salary settlement is temporarily paused");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.warn("开始执行账单处理:{},{}", ZonedDateTimeUtils.nowAsiaRiyadhToInt(), LocalDateTime.now());
|
||||||
// 出单
|
// 出单
|
||||||
teamBillCycleService.billStatusPayOut();
|
teamBillCycleService.billStatusPayOut();
|
||||||
|
|
||||||
@ -65,10 +72,15 @@ public class TeamBillTask {
|
|||||||
log.warn("结束账单处理");
|
log.warn("结束账单处理");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processTeamBillRetry() {
|
public void processTeamBillRetry() {
|
||||||
// 创建本月账单,发出结算信号
|
if (SALARY_SETTLEMENT_PAUSED) {
|
||||||
consumeProcessPayOutBill();
|
log.warn("process_team_bill_retry skipped: salary settlement is temporarily paused");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建本月账单,发出结算信号
|
||||||
|
consumeProcessPayOutBill();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建本月账单,发出结算信号.
|
* 创建本月账单,发出结算信号.
|
||||||
|
|||||||
@ -24,10 +24,12 @@ import org.springframework.stereotype.Component;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TeamSalaryPaymentTask {
|
public class TeamSalaryPaymentTask {
|
||||||
|
|
||||||
private final TeamProfileService teamProfileService;
|
private static final boolean SALARY_SETTLEMENT_PAUSED = true;
|
||||||
private final TeamSalaryMqMessage teamSalaryMqMessage;
|
|
||||||
|
private final TeamProfileService teamProfileService;
|
||||||
|
private final TeamSalaryMqMessage teamSalaryMqMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每天凌晨0点过30秒执行一次,处理团队工资结算.
|
* 每天凌晨0点过30秒执行一次,处理团队工资结算.
|
||||||
@ -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");
|
||||||
|
|
||||||
@ -66,9 +73,13 @@ public class TeamSalaryPaymentTask {
|
|||||||
log.warn("exec team_salary_payment_task end with {}",System.currentTimeMillis()-startTime);
|
log.warn("exec team_salary_payment_task end with {}",System.currentTimeMillis()-startTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void teamSalaryPaymentTaskTest() {
|
public void teamSalaryPaymentTaskTest() {
|
||||||
|
if (SALARY_SETTLEMENT_PAUSED) {
|
||||||
log.warn("支付团队工资 start,时间:{}", TimestampUtils.now());
|
log.warn("team_salary_payment_task_test skipped: salary settlement is temporarily paused");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.warn("支付团队工资 start,时间:{}", TimestampUtils.now());
|
||||||
|
|
||||||
// 是否本月一号
|
// 是否本月一号
|
||||||
Boolean thisMonthFirstDay = Objects.equals(ZonedDateTimeUtils.nowAsiaRiyadhToInt(),
|
Boolean thisMonthFirstDay = Objects.equals(ZonedDateTimeUtils.nowAsiaRiyadhToInt(),
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.red.circle.wallet.app.service;
|
package com.red.circle.wallet.app.service;
|
||||||
|
|
||||||
import com.red.circle.framework.dto.PageResult;
|
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.SalaryExchangeGoldCmdExe;
|
||||||
import com.red.circle.wallet.app.command.salary.SalaryIssueCmdExe;
|
import com.red.circle.wallet.app.command.salary.SalaryIssueCmdExe;
|
||||||
import com.red.circle.wallet.app.command.salary.SalaryTransferGoldCmdExe;
|
import com.red.circle.wallet.app.command.salary.SalaryTransferGoldCmdExe;
|
||||||
@ -22,8 +24,10 @@ import java.util.Objects;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@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;
|
||||||
@ -52,15 +56,21 @@ public class SalaryAccountServiceImpl implements SalaryAccountService {
|
|||||||
return salaryRunningWaterQryExe.execute(cmd);
|
return salaryRunningWaterQryExe.execute(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserBankWithdrawResultCO transferGold(SalaryWithdrawCmd cmd) {
|
public UserBankWithdrawResultCO transferGold(SalaryWithdrawCmd cmd) {
|
||||||
return salaryTransferGoldCmdExe.execute(cmd);
|
rejectPausedSalaryWalletOut();
|
||||||
}
|
return salaryTransferGoldCmdExe.execute(cmd);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public UserBankExchangeGoldResultCO exchangeGold(SalaryWithdrawCmd cmd) {
|
@Override
|
||||||
return salaryExchangeGoldCmdExe.execute(cmd);
|
public UserBankExchangeGoldResultCO exchangeGold(SalaryWithdrawCmd cmd) {
|
||||||
}
|
rejectPausedSalaryWalletOut();
|
||||||
|
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) {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
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.common.business.dto.cmd.app.AppIdLongCmd;
|
import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd;
|
||||||
import com.red.circle.framework.core.dto.CommonCommand;
|
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||||
import com.red.circle.framework.dto.PageResult;
|
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.UserBankExchangeGoldCmdExe;
|
||||||
import com.red.circle.wallet.app.command.bank.query.UserBankCheckExchangeGoldQryExe;
|
import com.red.circle.wallet.app.command.bank.query.UserBankCheckExchangeGoldQryExe;
|
||||||
import com.red.circle.wallet.app.command.bank.query.UserBankCheckTransferQryExe;
|
import com.red.circle.wallet.app.command.bank.query.UserBankCheckTransferQryExe;
|
||||||
@ -29,8 +31,10 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@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;
|
||||||
@ -85,25 +89,33 @@ public class SalaryDiamondServiceImpl implements SalaryDiamondService {
|
|||||||
return userBankCheckTransferQryExe.executeDiamond(cmd);
|
return userBankCheckTransferQryExe.executeDiamond(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserBankExchangeGoldResultCO exchangeGold(UserBankExchangeGoldCmd cmd) {
|
public UserBankExchangeGoldResultCO exchangeGold(UserBankExchangeGoldCmd cmd) {
|
||||||
return userBankExchangeGoldCmdExe.executeDiamond(cmd);
|
rejectPausedSalaryExchange();
|
||||||
}
|
return userBankExchangeGoldCmdExe.executeDiamond(cmd);
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public UserBankExchangeGoldResultCO exchangeGoldYolo(UserBankExchangeGoldCmd cmd) {
|
@Override
|
||||||
return userBankExchangeGoldCmdExe.exchangeGoldYolo(cmd);
|
public UserBankExchangeGoldResultCO exchangeGoldYolo(UserBankExchangeGoldCmd cmd) {
|
||||||
}
|
rejectPausedSalaryExchange();
|
||||||
|
return userBankExchangeGoldCmdExe.exchangeGoldYolo(cmd);
|
||||||
@Override
|
}
|
||||||
public UserBankExchangeGoldResultCO agentBillExchangeGold(UserBillExchangeGoldCmd cmd) {
|
|
||||||
return userBankExchangeGoldCmdExe.agentBillExchangeGold(cmd);
|
@Override
|
||||||
}
|
public UserBankExchangeGoldResultCO agentBillExchangeGold(UserBillExchangeGoldCmd cmd) {
|
||||||
|
rejectPausedSalaryExchange();
|
||||||
@Override
|
return userBankExchangeGoldCmdExe.agentBillExchangeGold(cmd);
|
||||||
public UserBankExchangeGoldResultCO memberWorkExchangeGold(UserBillExchangeGoldCmd cmd) {
|
}
|
||||||
return userBankExchangeGoldCmdExe.memberWorkExchangeGold(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
|
@Override
|
||||||
public UserBankWithdrawResultCO withdraw(UserBankWithdrawCmd cmd) {
|
public UserBankWithdrawResultCO withdraw(UserBankWithdrawCmd cmd) {
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
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.dto.CommonCommand;
|
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||||
import com.red.circle.other.inner.model.dto.user.SysExchangeGoldTipDTO;
|
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.other.inner.model.dto.user.UserProfileDTO;
|
||||||
import com.red.circle.wallet.app.command.bank.*;
|
import com.red.circle.wallet.app.command.bank.*;
|
||||||
import com.red.circle.wallet.app.command.bank.query.UserBankCheckExchangeGoldQryExe;
|
import com.red.circle.wallet.app.command.bank.query.UserBankCheckExchangeGoldQryExe;
|
||||||
@ -37,8 +39,10 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@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;
|
||||||
@ -86,10 +90,15 @@ public class UserBankServiceImpl implements UserBankService {
|
|||||||
return userBankWithdrawTransferCmdExe.execute(cmd);
|
return userBankWithdrawTransferCmdExe.execute(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserBankWithdrawResultCO transferGold(UserBankWithdrawTransferCmd cmd) {
|
public UserBankWithdrawResultCO transferGold(UserBankWithdrawTransferCmd cmd) {
|
||||||
return userBankTransferGoldCmdExe.execute(cmd);
|
rejectPausedUserToCoinSellerTransfer();
|
||||||
}
|
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) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user