Bläddra i källkod

开学报到调整

dzx 10 månader sedan
förälder
incheckning
a1dd301ae1

+ 16 - 0
src/main/java/com/xjrsoft/module/student/controller/StudentReportPlanController.java

@@ -6,6 +6,7 @@ import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
@@ -39,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -129,6 +131,20 @@ public class StudentReportPlanController {
         if(reportPlan == null){
             throw new MyException("未能找到计划信息");
         }
+        LocalDateTime now = LocalDateTime.now();
+        List<StudentReportPlan> list = studentReportPlanService.list(
+                new QueryWrapper<StudentReportPlan>().lambda()
+                        .ne(StudentReportPlan::getId, reportPlan.getId())
+                        .eq(StudentReportPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
+                        .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(StudentReportPlan::getStatus, 1)
+                        .eq(StudentReportPlan::getSemesterId, 1)
+                        .le(StudentReportPlan::getStartTime, now)
+                        .ge(StudentReportPlan::getEndTime, now)
+        );
+        if(!list.isEmpty()){
+            throw new MyException("已存在正在进行的计划,无法发布");
+        }
         //如果发布,需要先验证计划中的班级是否在其他生效的计划内
         if(dto.getStatus() != null && dto.getStatus() == 1){
             if(reportPlan.getStudentReportPlanClassRelationList() == null || reportPlan.getStudentReportPlanClassRelationList().isEmpty()){

+ 1 - 0
src/main/java/com/xjrsoft/module/student/service/impl/StudentReportPlanServiceImpl.java

@@ -207,6 +207,7 @@ public class StudentReportPlanServiceImpl extends MPJBaseServiceImpl<StudentRepo
                         .eq(teacherId != null, BaseClass::getTeacherId, teacherId)
                         .eq(classId != null, BaseClass::getId, classId)
                         .eq(StudentReportPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
+                        .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
                         .eq(StudentReportPlan::getStatus, 1)
                         .le(StudentReportPlan::getStartTime, now)
                         .ge(StudentReportPlan::getEndTime, now)