diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java index d1d0ab7a..15ce8757 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java @@ -218,6 +218,11 @@ public enum TeamErrorCode implements IResponseErrorCode { */ 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; diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamUserApplyQuitExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamUserApplyQuitExe.java index 5b5f2a19..23642789 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamUserApplyQuitExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamUserApplyQuitExe.java @@ -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.TeamApplicationType; 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.wallet.inner.endpoint.wallet.WalletGoldClient; 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.enums.GoldOrigin; import java.math.BigDecimal; +import java.time.LocalDate; import java.util.Objects; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -56,6 +58,11 @@ public class TeamUserApplyQuitExe { 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( userProfileGateway.getByUserId(cmd.getReqUserId())); ResponseAssert.notNull(CommonErrorCode.NOT_FOUND_RECORD_INFO, userProfile);