|
@@ -110,10 +110,10 @@ public class ActivityAdminService {
|
|
|
public void submitForReview(Long id) {
|
|
public void submitForReview(Long id) {
|
|
|
Activity activity = activityMapper.selectById(id);
|
|
Activity activity = activityMapper.selectById(id);
|
|
|
if (activity == null) {
|
|
if (activity == null) {
|
|
|
- throw new RuntimeException("活动不存在");
|
|
|
|
|
|
|
+ throw new IllegalStateException("活动不存在");
|
|
|
}
|
|
}
|
|
|
if (!"draft".equals(activity.getStatus())) {
|
|
if (!"draft".equals(activity.getStatus())) {
|
|
|
- throw new RuntimeException("仅草稿状态可提交审核");
|
|
|
|
|
|
|
+ throw new IllegalStateException("仅草稿状态可提交审核");
|
|
|
}
|
|
}
|
|
|
activity.setStatus("pending");
|
|
activity.setStatus("pending");
|
|
|
activity.setAuditStatus("pending");
|
|
activity.setAuditStatus("pending");
|
|
@@ -124,13 +124,13 @@ public class ActivityAdminService {
|
|
|
public void auditActivity(Long id, String action, String auditReason, Long adminId) {
|
|
public void auditActivity(Long id, String action, String auditReason, Long adminId) {
|
|
|
Activity activity = activityMapper.selectById(id);
|
|
Activity activity = activityMapper.selectById(id);
|
|
|
if (activity == null) {
|
|
if (activity == null) {
|
|
|
- throw new RuntimeException("活动不存在");
|
|
|
|
|
|
|
+ throw new IllegalStateException("活动不存在");
|
|
|
}
|
|
}
|
|
|
if (!"pending".equals(activity.getStatus())) {
|
|
if (!"pending".equals(activity.getStatus())) {
|
|
|
- throw new RuntimeException("仅待审核状态可审核");
|
|
|
|
|
|
|
+ throw new IllegalStateException("仅待审核状态可审核");
|
|
|
}
|
|
}
|
|
|
if (!"approved".equals(action) && !"rejected".equals(action)) {
|
|
if (!"approved".equals(action) && !"rejected".equals(action)) {
|
|
|
- throw new RuntimeException("审核操作无效");
|
|
|
|
|
|
|
+ throw new IllegalStateException("审核操作无效");
|
|
|
}
|
|
}
|
|
|
if ("approved".equals(action)) {
|
|
if ("approved".equals(action)) {
|
|
|
activity.setStatus("published");
|
|
activity.setStatus("published");
|
|
@@ -149,10 +149,10 @@ public class ActivityAdminService {
|
|
|
public void withdraw(Long id) {
|
|
public void withdraw(Long id) {
|
|
|
Activity activity = activityMapper.selectById(id);
|
|
Activity activity = activityMapper.selectById(id);
|
|
|
if (activity == null) {
|
|
if (activity == null) {
|
|
|
- throw new RuntimeException("活动不存在");
|
|
|
|
|
|
|
+ throw new IllegalStateException("活动不存在");
|
|
|
}
|
|
}
|
|
|
if (!"published".equals(activity.getStatus())) {
|
|
if (!"published".equals(activity.getStatus())) {
|
|
|
- throw new RuntimeException("仅发布中的活动可撤回");
|
|
|
|
|
|
|
+ throw new IllegalStateException("仅发布中的活动可撤回");
|
|
|
}
|
|
}
|
|
|
activity.setStatus("withdrawn");
|
|
activity.setStatus("withdrawn");
|
|
|
activityMapper.updateById(activity);
|
|
activityMapper.updateById(activity);
|
|
@@ -162,10 +162,12 @@ public class ActivityAdminService {
|
|
|
public void reDraft(Long id) {
|
|
public void reDraft(Long id) {
|
|
|
Activity activity = activityMapper.selectById(id);
|
|
Activity activity = activityMapper.selectById(id);
|
|
|
if (activity == null) {
|
|
if (activity == null) {
|
|
|
- throw new RuntimeException("活动不存在");
|
|
|
|
|
|
|
+ throw new IllegalStateException("活动不存在");
|
|
|
}
|
|
}
|
|
|
- if (!"rejected".equals(activity.getStatus())) {
|
|
|
|
|
- throw new RuntimeException("仅已驳回的活动可重新编辑");
|
|
|
|
|
|
|
+ // 已驳回/已撤回/已发布的活动均可退回草稿重新编辑
|
|
|
|
|
+ String status = activity.getStatus();
|
|
|
|
|
+ if (!"rejected".equals(status) && !"withdrawn".equals(status) && !"published".equals(status)) {
|
|
|
|
|
+ throw new IllegalStateException("当前状态不可退回草稿");
|
|
|
}
|
|
}
|
|
|
activity.setStatus("draft");
|
|
activity.setStatus("draft");
|
|
|
activity.setAuditStatus(null);
|
|
activity.setAuditStatus(null);
|