change %!s(int64=4) %!d(string=hai) anos
pai
achega
8421175697

+ 4 - 40
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserPlanServiceImpl.java

@@ -406,45 +406,6 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
             int i = baseMapper.updateById(userPlan);
         }else {
             //自定义学习计划,自动生成计划
-            if (bo.getCourseId() != null && bo.getStudyCount() == null) {
-                UserPlanVo userPlanVo = generateSelf(userPlanQueryBo);
-                if (bo.getStatus() != null) {
-                    UserPlan userPlan = new UserPlan();
-                    String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
-                    String s1 = JSON.toJSONString(userPlanVo.getStudyCount());
-                    userPlan.setUpdateTime(DateUtils.getNowTime());
-                    userPlan.setStudyDay(bo.getStudyDay());
-                    userPlan.setStudyCount(s1);
-                    userPlan.setUserId(bo.getUserId());
-                    userPlan.setSchedule(s);
-                    userPlan.setPitchNum(userPlanVo.getPitchNum());
-                    userPlan.setStudyNum(0L);
-                    userPlan.setCreateTime(DateUtils.getNowTime());
-                    userPlan.setUpdateTime(DateUtils.getNowTime());
-                    if (bo.getStatus() != null) {
-                        userPlan.setStatus(bo.getStatus());
-                    }
-                    if (bo.getStatus() == 1) {
-                        boolean save = this.save(userPlan);
-                        for (CoursePlanVo coursePlanVo : userPlanVo.getCoursePlanVo()) {
-                            coursePlanVo.setPlanId(userPlan.getPlanId());
-                            baseMapper.insertSource(coursePlanVo);
-                        }
-                    }
-                    if (bo.getStatus() == 2) {
-                        userPlan.setPlanId(bo.getPlanId());
-                        userPlan.setStatus(1);
-                        boolean save = this.updateById(userPlan);
-                        LambdaQueryWrapper<UserPlanCource> lqw = Wrappers.lambdaQuery();
-                        lqw.eq(bo.getPlanId() != null,UserPlanCource::getPlanId,bo.getPlanId());
-                        userPlanCourceService.remove(lqw);
-                        for (CoursePlanVo coursePlanVo : userPlanVo.getCoursePlanVo()) {
-                            coursePlanVo.setPlanId(userPlan.getPlanId());
-                            baseMapper.insertSource(coursePlanVo);
-                        }
-                    }
-                }
-            } else {
                 UserPlanVo userPlanVo = generateSelfBo(userPlanQueryBo);
                 if (bo.getStatus() != null) {
                     UserPlan userPlan = new UserPlan();
@@ -486,7 +447,6 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
                             baseMapper.insertSource(coursePlanVo);
                         }
                     }
-                }
             }
 
         }
@@ -1047,7 +1007,11 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
         List<CoursePlanVo> coursePlanVo = baseMapper.selectByListCourse(bo);
 
         UserPlanVo userPlanVo1 = null;
+        Long category=coursePlanVo.get(0).getCategoryId();
         for (CoursePlanVo planVo : coursePlanVo) {
+            if (!category.equals(planVo.getCategoryId())){
+                throw new IllegalArgumentException("课程类型不符合同一类型");
+            }
             if (userPlanVo1 == null) {
                 userPlanVo1 = generateList(bo, planVo);
             }else {