Sfoglia il codice sorgente

计划生成修改

change 4 anni fa
parent
commit
3f62000140

+ 0 - 5
zhongzheng-api/src/main/java/com/zhongzheng/controller/activity/PlanController.java

@@ -73,9 +73,4 @@ public class PlanController extends BaseController {
         bo.setUserId(loginUser.getUser().getUserId());
         return toAjax(userPlanService.updateGenerate(bo) ? 1 : 0);
     }
-
-
-
-
-
 }

+ 7 - 6
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -14,6 +14,8 @@ import com.zhongzheng.modules.user.bo.UserEditBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.service.IUserService;
+import com.zhongzheng.modules.user.vo.RanKingUser;
+import com.zhongzheng.modules.user.vo.UserBankRecordVo;
 import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
 import com.zhongzheng.modules.user.vo.UserVo;
 import io.swagger.annotations.Api;
@@ -73,16 +75,15 @@ public class UserController extends BaseController {
     }
 
     /**
-     * 收藏数等数据
+     * 排行榜
      */
-    @ApiOperation("收藏数等数据")
+    @ApiOperation("排行榜")
     @GetMapping("/rankingList")
-    public TableDataInfo<UserVo> rankingList(UserQueryBo bo) {
+    public AjaxResult<RanKingUser> rankingList(UserQueryBo bo) {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
-        startPage();
-        List<UserVo> list = iUserService.rankingList(bo);
-        return getDataTable(list);
+        RanKingUser list = iUserService.rankingList(bo);
+        return AjaxResult.success(list);
     }
 
 }

+ 6 - 2
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -19,9 +19,11 @@ import com.zhongzheng.modules.user.bo.UserAddBo;
 import com.zhongzheng.modules.user.bo.UserEditBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.domain.User;
+import com.zhongzheng.modules.user.domain.UserBankRecord;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.mapper.UserMapper;
 import com.zhongzheng.modules.user.service.IUserService;
+import com.zhongzheng.modules.user.vo.RanKingUser;
 import com.zhongzheng.modules.user.vo.UserVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -163,7 +165,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     }
 
     @Override
-    public List<UserVo> rankingList(UserQueryBo bo) {
-        return null;
+    public RanKingUser rankingList(UserQueryBo bo) {
+        RanKingUser ranKingUser = new RanKingUser();
+        return ranKingUser;
+
     }
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserPlan.java

@@ -66,6 +66,7 @@ private static final long serialVersionUID=1L;
     private Long studyNum;
 
     /** $column.columnComment */
+    @TableId(value = "plan_id")
     private Long planId;
 
 }

+ 0 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserPlanCource.java

@@ -25,7 +25,6 @@ private static final long serialVersionUID=1L;
 
 
     /** 计划id */
-    @TableId(value = "plan_id")
     private Long planId;
 
     /** 课程或题库学习计划 */

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserPlanMapper.java

@@ -4,6 +4,7 @@ import com.zhongzheng.modules.exam.vo.ExamArrangementTimeVo;
 import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
 import com.zhongzheng.modules.user.domain.UserPlan;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.user.domain.UserPlanCource;
 import com.zhongzheng.modules.user.vo.CoursePlanVo;
 
 import java.util.List;
@@ -23,4 +24,8 @@ public interface UserPlanMapper extends BaseMapper<UserPlan> {
     List<CoursePlanVo> selectByListCourse(UserPlanQueryBo bo);
 
     UserPlan selectByUserPlan(UserPlanQueryBo bo);
+
+    void insertSource(CoursePlanVo coursePlanVo);
+
+    List<UserPlanCource> selectCourse(Long planId);
 }

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.user.service;
 
 import com.zhongzheng.modules.user.domain.User;
+import com.zhongzheng.modules.user.vo.RanKingUser;
 import com.zhongzheng.modules.user.vo.UserVo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.bo.UserAddBo;
@@ -57,5 +58,5 @@ public interface IUserService extends IService<User> {
 
 	Integer getCollectTotal(Long userId);
 
-    List<UserVo> rankingList(UserQueryBo bo);
+	RanKingUser rankingList(UserQueryBo bo);
 }

+ 32 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserPlanServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.google.gson.JsonArray;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.exam.vo.ExamArrangementTimeVo;
+import com.zhongzheng.modules.user.domain.UserPlanCource;
 import com.zhongzheng.modules.user.vo.CalendarStudyVo;
 import com.zhongzheng.modules.user.vo.CoursePlanVo;
 import com.zhongzheng.modules.user.vo.DayStudyVo;
@@ -143,10 +144,18 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
                 }
                 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());
                     boolean save = this.updateById(userPlan);
+                    for (CoursePlanVo coursePlanVo : userPlanVo.getCoursePlanVo()) {
+                        coursePlanVo.setPlanId(userPlan.getPlanId());
+                        baseMapper.insertSource(coursePlanVo);
+                    }
                 }
             }
             return userPlanVo;
@@ -175,10 +184,18 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
                 }
                 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());
                     boolean save = this.updateById(userPlan);
+                    for (CoursePlanVo coursePlanVo : userPlanVo.getCoursePlanVo()) {
+                        coursePlanVo.setPlanId(userPlan.getPlanId());
+                        baseMapper.insertSource(coursePlanVo);
+                    }
                 }
             }
             return userPlanVo;
@@ -197,6 +214,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
         userPlanVo.setEndTime(userPlan.getEndTime());
         userPlanVo.setPitchNum(userPlan.getPitchNum());
         userPlanVo.setStudyNum(userPlan.getStudyNum());
+        userPlanVo.setPlanId(userPlan.getPlanId());
 
         List<CalendarStudyVo> calendarStudyVos = JSONObject.parseArray(userPlan.getSchedule(), CalendarStudyVo.class);
         List<Long> cont = JSONObject.parseArray(userPlan.getStudyCount(), Long.class);
@@ -205,7 +223,18 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
         userPlanVo.setCalendarStudyVo(calendarStudyVos);
         userPlanVo.setStudyCount(strings);
         userPlanVo.setCoursePlanVo(null);
+        List<UserPlanCource> userPlanClsList = baseMapper.selectCourse(userPlan.getPlanId());
 
+        //初始化需要得到的数组
+        Integer[] array = new Integer[userPlanClsList.size()];
+
+        //使用for循环得到数组
+        for(int i = 0; i < userPlanClsList.size();i++){
+            array[i] = Convert.toInt(userPlanClsList.get(i).getSourceId());
+        }
+        bo.setCourseId(array);
+        List<CoursePlanVo> coursePlanVo = baseMapper.selectByListCourse(bo);
+        userPlanVo.setCoursePlanVo(coursePlanVo);
         return userPlanVo;
     }
 
@@ -389,7 +418,9 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
         userPlanVo1.setUserId(bo.getUserId());
         userPlanVo1.setStudyDay(0L);
         userPlanVo1.setPitchNum(Convert.toLong(sectionNum)+userPlanVo1.getPitchNum());
-        userPlanVo1.setPitchNum(Convert.toLong(sectionNum)+userPlanVo1.getPitchNum());
+        List<CoursePlanVo> coursePlanVo = userPlanVo1.getCoursePlanVo();
+        coursePlanVo.add(planVo);
+        userPlanVo1.setCoursePlanVo(coursePlanVo);
         return userPlanVo1;
     }
 

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/CoursePlanVo.java

@@ -41,6 +41,11 @@ public class CoursePlanVo {
 	@ApiModelProperty("当天学习的节数")
 	private String sectionDayNum;
 
+	/** 计划Id */
+	@Excel(name = "计划Id")
+	@ApiModelProperty("计划Id")
+	private Long planId;
+
 
 
 

+ 8 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/RanKingUser.java

@@ -7,7 +7,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import java.util.Date;
-
+import java.util.List;
 
 
 /**
@@ -17,7 +17,7 @@ import java.util.Date;
  * @date 2021-05-25
  */
 @Data
-@ApiModel("用户视图对象")
+@ApiModel("排行榜获得")
 public class RanKingUser {
     private static final long serialVersionUID = 1L;
 
@@ -150,6 +150,12 @@ public class RanKingUser {
     @ApiModelProperty("头像")
     private String avatar;
 
+
+    /** 排行榜 */
+    @Excel(name = "排行榜")
+    @ApiModelProperty("排行榜")
+    private List<UserVo> userVo;
+
     public void setNull(){
         this.setOpenId(null);
         this.setIdCardImg1(null);

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserPlanVo.java

@@ -20,6 +20,10 @@ import java.util.List;
 public class UserPlanVo {
 	private static final long serialVersionUID = 1L;
 
+
+	/** 计划ID */
+	@ApiModelProperty("计划ID")
+	private Long planId;
 	/** 用户id */
 	@ApiModelProperty("用户id")
 	private Long userId;

+ 19 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserPlanMapper.xml

@@ -95,4 +95,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT * FROM user_plan where 1=1 AND `status` =1
                                   AND user_id = #{userId}
     </select>
+
+    <insert id="insertSource" parameterType="map" useGeneratedKeys="true" keyProperty="id" >
+        insert into user_plan_cource (
+        plan_id,
+        source_id
+        )values
+
+            (#{planId},
+            #{courseId})
+
+    </insert>
+    <resultMap type="com.zhongzheng.modules.user.domain.UserPlanCource" id="UserPlanCourceResult">
+        <result property="planId" column="plan_id"/>
+        <result property="sourceId" column="source_id"/>
+    </resultMap>
+    <select id="selectCourse" parameterType="Long"  resultMap="UserPlanCourceResult">
+        SELECT * FROM user_plan_cource where 1=1 AND plan_id=#{planId}
+    </select>
+
 </mapper>