新增退出团队校验

This commit is contained in:
tianfeng 2025-10-13 19:30:26 +08:00
parent 258d857026
commit aabd9cbaac
2 changed files with 12 additions and 0 deletions

View File

@ -218,6 +218,11 @@ public enum TeamErrorCode implements IResponseErrorCode {
*/ */
ADMIN_PERMISSION_INSUFFICIENT(6050, "Administrator permission insufficient"), ADMIN_PERMISSION_INSUFFICIENT(6050, "Administrator permission insufficient"),
/**
* 退出日期无效
*/
QUIT_DATE_INVALID(6051, "The host can only leave the current agent on the 1st and 16th of each month"),
; ;
private final Integer code; private final Integer code;

View File

@ -24,6 +24,7 @@ import com.red.circle.other.inner.enums.team.TeamAppProcessReason;
import com.red.circle.other.inner.enums.team.TeamApplicationProcessStatus; import com.red.circle.other.inner.enums.team.TeamApplicationProcessStatus;
import com.red.circle.other.inner.enums.team.TeamApplicationType; import com.red.circle.other.inner.enums.team.TeamApplicationType;
import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.tool.core.date.TimestampUtils;
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
import com.red.circle.tool.core.sequence.IdWorkerUtils; import com.red.circle.tool.core.sequence.IdWorkerUtils;
import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient; import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient;
import com.red.circle.wallet.inner.error.WalletErrorCode; import com.red.circle.wallet.inner.error.WalletErrorCode;
@ -31,6 +32,7 @@ import com.red.circle.wallet.inner.model.cmd.GoldReceiptCmd;
import com.red.circle.wallet.inner.model.dto.WalletReceiptResDTO; import com.red.circle.wallet.inner.model.dto.WalletReceiptResDTO;
import com.red.circle.wallet.inner.model.enums.GoldOrigin; import com.red.circle.wallet.inner.model.enums.GoldOrigin;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Objects; import java.util.Objects;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -56,6 +58,11 @@ public class TeamUserApplyQuitExe {
public String execute(TeamUserApplyCmd cmd) { public String execute(TeamUserApplyCmd cmd) {
// 校验退出日期只有每月1号和16号可以退出
LocalDate now = ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate();
int dayOfMonth = now.getDayOfMonth();
ResponseAssert.isTrue(TeamErrorCode.QUIT_DATE_INVALID, dayOfMonth == 1 || dayOfMonth == 16);
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO( UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(cmd.getReqUserId())); userProfileGateway.getByUserId(cmd.getReqUserId()));
ResponseAssert.notNull(CommonErrorCode.NOT_FOUND_RECORD_INFO, userProfile); ResponseAssert.notNull(CommonErrorCode.NOT_FOUND_RECORD_INFO, userProfile);