Bläddra i källkod

学习计划保存调整

mingfu 1 månad sedan
förälder
incheckning
82f270fcf4

+ 15 - 15
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontStudentController.java

@@ -188,24 +188,24 @@ public class FrontStudentController extends BaseController {
     @PostMapping("plan")
     public AjaxResult savePlan(@RequestBody LearnPlan plan)
     {
-        plan.setStudentId(SecurityUtils.getLoginUser().getUserId());
-
         LearnPlan curr = getCurrLearnPlan();
         Date today = DateUtils.truncate(new Date(), Calendar.DATE);
-        if(curr.getStatus().equals(1)) {
-            if(DateUtils.isSameDay(curr.getBeginTime(), today)) { // 当天的更新计划
-                curr.setVideoTime(plan.getVideoTime());
-                curr.setQuestionCnt(plan.getQuestionCnt());
-            } else {
-                curr.setStatus(0);
+        if(null != curr) {
+            if(curr.getStatus().equals(1)) {
+                if(DateUtils.isSameDay(curr.getBeginTime(), today)) { // 当天的更新计划
+                    curr.setVideoTime(plan.getVideoTime());
+                    curr.setQuestionCnt(plan.getQuestionCnt());
+                } else {
+                    curr.setStatus(0);
+                }
+                curr.setStudentId(null);
+                curr.setBeginTime(null);
+                curr.setStats(null);
+                learnPlanService.updateLearnPlan(plan);
+            }
+            if(curr.getStatus().equals(1)) {
+                return AjaxResult.success();
             }
-            curr.setStudentId(null);
-            curr.setBeginTime(null);
-            curr.setStats(null);
-            learnPlanService.updateLearnPlan(plan);
-        }
-        if(curr.getStatus().equals(1)) {
-            return AjaxResult.success();
         }
         plan.setStudentId(SecurityUtils.getLoginUser().getUserId());
         plan.setBeginTime(today);