Przeglądaj źródła

开学报到导出调整

dzx 9 miesięcy temu
rodzic
commit
b57550d650

+ 2 - 1
src/main/java/com/xjrsoft/module/job/StudentReportPlanTask.java

@@ -8,6 +8,7 @@ import com.xjrsoft.module.student.entity.StudentReportPlan;
 import com.xjrsoft.module.student.service.IBaseStudentService;
 import com.xjrsoft.module.student.service.IStudentReportPlanService;
 import lombok.extern.slf4j.Slf4j;
+import org.hamcrest.core.Is;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -39,7 +40,7 @@ public class StudentReportPlanTask {
         List<StudentReportPlan> list = planService.getWillBeginData();
 
         for (StudentReportPlan studentReportPlan : list) {
-            planService.release(studentReportPlan);
+            planService.release(planService.getByIdDeep(studentReportPlan.getId()));
         }
 
         //查询已发布已结束的,自动结束

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

@@ -154,7 +154,7 @@ public class StudentReportPlanServiceImpl extends MPJBaseServiceImpl<StudentRepo
                 insertList.add(
                         new StudentReportRecord(){{
                             setCreateDate(createDate);
-                            setCreateUserId(StpUtil.getLoginIdAsLong());
+                            setCreateUserId(studentReportPlan.getCreateUserId());
                             setUserId(Long.parseLong(student.getId()));
                             setBaseSemesterId(studentReportPlan.getSemesterId());
                             setStudentReportPlanId(studentReportPlan.getId());

+ 57 - 0
src/test/java/com/xjrsoft/module/job/StudentReportPlanTaskTest.java

@@ -0,0 +1,57 @@
+package com.xjrsoft.module.job;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.enums.EnabledMark;
+import com.xjrsoft.module.student.entity.StudentReportPlan;
+import com.xjrsoft.module.student.service.IStudentReportPlanService;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+
+/**
+ * @author dzx
+ * @date 2025/2/10
+ */
+
+@SpringBootTest
+class StudentReportPlanTaskTest {
+
+    @Autowired
+    private IStudentReportPlanService planService;
+
+
+    @Test
+    public void execute() {
+        doExecute();
+    }
+
+
+    public void doExecute(){
+        //查询已发布未开始的,自动开始
+        LocalDateTime now = LocalDateTime.now();
+        List<StudentReportPlan> list = planService.getWillBeginData();
+
+        for (StudentReportPlan studentReportPlan : list) {
+            planService.release(planService.getByIdDeep(studentReportPlan.getId()));
+        }
+
+        //查询已发布已结束的,自动结束
+        List<StudentReportPlan> endList = planService.list(
+                new QueryWrapper<StudentReportPlan>().lambda()
+                        .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(StudentReportPlan::getStatus, 1)
+                        .eq(StudentReportPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
+                        .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .le(StudentReportPlan::getEndTime, now)
+        );
+        for (StudentReportPlan studentReportPlan : endList) {
+            studentReportPlan.setStatus(2);
+            planService.updateById(studentReportPlan);
+        }
+    }
+}