周箭河 il y a 5 ans
Parent
commit
48cfd21ca2

+ 42 - 34
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/PracticeGroupDao.java

@@ -13,47 +13,48 @@ import java.util.Map;
 public interface PracticeGroupDao extends com.ym.mec.common.dal.BaseDAO<Long, PracticeGroup> {
 
     /**
+     * @param userId:    用户编号
+     * @param startDate: 开始时间
+     * @param endDate:   结束时间
+     * @return java.util.List<com.ym.mec.biz.dal.entity.PracticeGroup>
      * @describe 获取学生指定日期内预约的陪练课
      * @author Joburgess
      * @date 2020/1/31
-     * @param userId: 用户编号
-     * @param startDate: 开始时间
-     * @param endDate: 结束时间
-     * @return java.util.List<com.ym.mec.biz.dal.entity.PracticeGroup>
      */
     List<PracticeGroup> getUserPracticeCoursesWithDateRange(@Param("userId") Integer userId,
                                                             @Param("startDate") Date startDate,
                                                             @Param("endDate") Date endDate);
 
     /**
+     * @param userId:
+     * @return com.ym.mec.biz.dal.entity.PracticeGroup
      * @describe 获取学生的免费陪练课
      * @author Joburgess
      * @date 2020/2/24
-     * @param userId:
-     * @return com.ym.mec.biz.dal.entity.PracticeGroup
      */
     PracticeGroup getUserFreePracticeGroup(@Param("userId") Integer userId);
 
     /**
+     * @param groups:
+     * @return int
      * @describe 批量更新
      * @author Joburgess
      * @date 2020/2/23
-     * @param groups:
-     * @return int
      */
     int batchUpdate(@Param("groups") List<PracticeGroup> groups);
 
     /**
+     * @param userId:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.PracticeGroup>
      * @describe 统计用户的申请记录
      * @author Joburgess
      * @date 2020/2/3
-     * @param userId:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.PracticeGroup>
      */
     int countUserPracticeApplyRecord(@Param("userId") Integer userId);
 
     /**
      * count陪练课列表数量
+     *
      * @param params
      * @return
      */
@@ -61,6 +62,7 @@ public interface PracticeGroupDao extends com.ym.mec.common.dal.BaseDAO<Long, Pr
 
     /**
      * 获取陪练课列表
+     *
      * @param params
      * @return
      */
@@ -68,6 +70,7 @@ public interface PracticeGroupDao extends com.ym.mec.common.dal.BaseDAO<Long, Pr
 
     /**
      * 获取已上课程数量
+     *
      * @param practiceGroupIds
      * @return
      */
@@ -75,6 +78,7 @@ public interface PracticeGroupDao extends com.ym.mec.common.dal.BaseDAO<Long, Pr
 
     /**
      * 修改老师
+     *
      * @param practiceGroupId
      * @param teacherId
      */
@@ -82,95 +86,99 @@ public interface PracticeGroupDao extends com.ym.mec.common.dal.BaseDAO<Long, Pr
 
 
     /**
-     * @describe 获取学生指定的课程组
-     * @author Joburgess
-     * @date 2020/2/19
      * @param userId:
      * @param groupId:
      * @return com.ym.mec.biz.dal.entity.PracticeGroup
+     * @describe 获取学生指定的课程组
+     * @author Joburgess
+     * @date 2020/2/19
      */
     PracticeGroup findUserPracticeGroup(@Param("userId") Integer userId,
                                         @Param("groupId") Long groupId);
 
     /**
-     * @describe 获取学生指定的课程组
-     * @author Joburgess
-     * @date 2020/2/19
      * @param userId:
      * @param groupId:
      * @return com.ym.mec.biz.dal.entity.PracticeGroup
+     * @describe 获取学生指定的课程组
+     * @author Joburgess
+     * @date 2020/2/19
      */
     PracticeGroupDto findUserPracticeGroup2(@Param("userId") Integer userId,
-                                        @Param("groupId") Long groupId);
+                                            @Param("groupId") Long groupId);
 
     /**
+     * @param userId: 学生编号
+     * @return com.ym.mec.biz.dal.entity.PracticeGroup
      * @describe 获取学生最后一次购买的陪练课组
      * @author Joburgess
      * @date 2020/2/17
-     * @param userId: 学生编号
-     * @return com.ym.mec.biz.dal.entity.PracticeGroup
      */
     PracticeGroup findUserLatestPracticeGroup(@Param("userId") Integer userId);
 
     /**
+     * @param userId: 用户编号
+     * @return java.util.List<com.ym.mec.biz.dal.dto.PracticeCourseDto>
      * @describe 获取用户购买的陪练课
      * @author Joburgess
      * @date 2020/2/18
-     * @param userId: 用户编号
-     * @return java.util.List<com.ym.mec.biz.dal.dto.PracticeCourseDto>
      */
     List<PracticeCourseDto> findUserBuyPracticeGroups(@Param("userId") Integer userId);
 
 
     List<PracticeCourseDto> findUserBuyPracticeGroupsWithDate(@Param("userId") Integer userId,
-                                                          @Param("date") Date date);
+                                                              @Param("date") Date date);
 
     /**
+     * @return java.util.List<com.ym.mec.biz.dal.entity.PracticeGroup>
      * @describe 获取已经达到截至时间的陪练课程组
      * @author Joburgess
      * @date 2020/2/23
-     * @return java.util.List<com.ym.mec.biz.dal.entity.PracticeGroup>
      */
     List<PracticeGroup> findHistoryPracticeGroups();
 
     /**
+     * @param groupId:
+     * @return com.ym.mec.biz.dal.entity.PracticeGroup
      * @describe
      * @author Joburgess
      * @date 2020/2/24
-     * @param groupId:
-     * @return com.ym.mec.biz.dal.entity.PracticeGroup
      */
     PracticeGroup lockPracticeGroup(@Param("groupId") Integer groupId);
 
     /**
+     * @param userId:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.PracticeGroup>
      * @describe 获取用户指定状态的陪练课程组
      * @author Joburgess
      * @date 2020/2/26
-     * @param userId:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.PracticeGroup>
      */
     List<PracticeGroup> findUserStatusPracticeGroups(@Param("userId") Integer userId,
-                                                     @Param("groupStatus")GroupStatusEnum groupStatusEnum);
+                                                     @Param("groupStatus") GroupStatusEnum groupStatusEnum);
 
     /**
-     * @describe 获取用户指定日期的未成功订单
-     * @author Joburgess
-     * @date 2020/3/2
      * @param userId:
      * @param date:
      * @return java.util.List<com.ym.mec.biz.dal.entity.PracticeGroup>
+     * @describe 获取用户指定日期的未成功订单
+     * @author Joburgess
+     * @date 2020/3/2
      */
     List<PracticeGroup> findUserLockPracticeGroupWithDate(@Param("userId") Integer userId,
                                                           @Param("date") Date date);
 
     /**
-     * @describe 获取用户指定日期及之前的未成功订单
-     * @author Joburgess
-     * @date 2020/3/2
      * @param userId:
      * @param date:
      * @return java.util.List<com.ym.mec.biz.dal.entity.PracticeGroup>
+     * @describe 获取用户指定日期及之前的未成功订单
+     * @author Joburgess
+     * @date 2020/3/2
      */
     List<PracticeGroup> findUserLockPracticeGroupWithDateBefore(@Param("userId") Integer userId,
                                                                 @Param("date") Date date);
+
+    List<PracticeGroupDto> findPracticeGroupsReviews(Map<String, Object> params);
+
+    Integer countPracticeGroupReviews(Map<String, Object> params);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PracticeGroupDto.java

@@ -24,6 +24,8 @@ public class PracticeGroupDto extends PracticeGroup {
 
     private Integer studentNum;
 
+    private Integer evaluateId;
+
     public Integer getSubClassTimes() {
         return subClassTimes;
     }
@@ -95,4 +97,12 @@ public class PracticeGroupDto extends PracticeGroup {
     public void setSubjectName(String subjectName) {
         this.subjectName = subjectName;
     }
+
+    public Integer getEvaluateId() {
+        return evaluateId;
+    }
+
+    public void setEvaluateId(Integer evaluateId) {
+        this.evaluateId = evaluateId;
+    }
 }

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/PracticeGroupQueryInfo.java

@@ -14,6 +14,10 @@ public class PracticeGroupQueryInfo extends QueryInfo {
 
     private Long practiceId;
 
+    private String month;
+
+    private Integer isFree;
+
     private boolean isExport = false;
 
     public boolean getIsExport() {
@@ -47,4 +51,20 @@ public class PracticeGroupQueryInfo extends QueryInfo {
     public void setOrganId(String organId) {
         this.organId = organId;
     }
+
+    public String getMonth() {
+        return month;
+    }
+
+    public void setMonth(String month) {
+        this.month = month;
+    }
+
+    public Integer getIsFree() {
+        return isFree;
+    }
+
+    public void setIsFree(Integer isFree) {
+        this.isFree = isFree;
+    }
 }

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/PracticeGroupService.java

@@ -262,4 +262,12 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
 	 */
 	void pushStudyReport(Date expiredDate,String pushType);
 
+
+	/**
+	 * 获取陪练课列表
+	 * @param queryInfo
+	 * @return
+	 */
+	PageInfo<PracticeGroupDto> findPracticeGroupReviews(PracticeGroupQueryInfo queryInfo);
+
 }

+ 50 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -3445,4 +3445,54 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             courseScheduleEvaluateDao.update(report);
         }
     }
+
+    @Override
+    public PageInfo<PracticeGroupDto> findPracticeGroupReviews(PracticeGroupQueryInfo queryInfo) {
+        queryInfo.setMonth(queryInfo.getMonth() + "-01");
+        PageInfo pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+
+        List<PracticeGroupDto> dataList = null;
+        int count = practiceGroupDao.countPracticeGroupReviews(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = practiceGroupDao.findPracticeGroupsReviews(params);
+            if (dataList != null && dataList.size() > 0) {
+                List<Integer> subjectIds = dataList.stream().map(practiceGroup -> practiceGroup.getSubjectId()).distinct().collect(Collectors.toList());
+                Set<Integer> organIds = dataList.stream().map(practiceGroup -> practiceGroup.getOrganId()).collect(Collectors.toSet());
+                List<String> practiceGroupIds = dataList.stream().map(e -> String.valueOf(e.getId())).distinct().collect(Collectors.toList());
+
+                List<ClassGroup> classGroupsByVipGroups = classGroupDao
+                        .findByMusicGroupsAndType(practiceGroupIds.stream().map(groupId -> String.valueOf(groupId)).collect(Collectors.toList()),
+                                GroupType.PRACTICE.getCode());
+                Map<String, ClassGroup> vipGroupClassGroupMap = classGroupsByVipGroups.stream().collect(Collectors.toMap(ClassGroup::getMusicGroupId, classGroup -> classGroup));
+                //当前课时,总课时
+//                List<Map<Long, Integer>> countGroupOverCourse = courseScheduleDao.countGroupOverCourse(practiceGroupIds,GroupType.PRACTICE.getCode());
+                Map<String, Long> totalClassTimeMap = MapUtil.convertIntegerMap(courseScheduleDao.countTotalCourseScheduleNum(practiceGroupIds, GroupType.PRACTICE.getCode()));
+                Map<String, Long> currentClassTimeMap = MapUtil.convertIntegerMap(courseScheduleDao.countCourseScheduleNum(practiceGroupIds, GroupType.PRACTICE.getCode()));
+                //声部名称列表
+                Map<Long, String> subjectNames = MapUtil.convertMybatisMap(subjectDao.findBySubjecIds(StringUtils.join(subjectIds, ",")));
+                Map<Integer, String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMapList(organIds));
+                dataList.forEach(e -> {
+                    e.setSubjectName(subjectNames.get(e.getSubjectId().intValue()));
+                    e.setOrganName(organNames.get(e.getOrganId()));
+                    ClassGroup classGroup = vipGroupClassGroupMap.get(e.getId().toString());
+                    if (Objects.nonNull(classGroup)) {
+                        e.setStudentNum(classGroup.getStudentNum());
+                    }
+                    Long aLong = totalClassTimeMap.get(e.getId() + "");
+                    e.setTotalClassTimes(aLong == null ? 0 : aLong.intValue());
+                    Long aLong1 = currentClassTimeMap.get(e.getId() + "");
+                    e.setCurrentClassTimes(aLong1 == null ? 0 : aLong1.intValue());
+                });
+            }
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
 }

+ 44 - 0
mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml

@@ -46,6 +46,7 @@
 		<result column="memo_" property="memo" />
 		<result column="subject_name_" property="subjectName" />
 		<result column="teacher_name_" property="teacherName" />
+		<result column="evaluate_id_" property="evaluateId" />
 	</resultMap>
 	<update id="updateUserId">
 		UPDATE practice_group SET user_id_ = #{teacherId},update_time_ = NOW()
@@ -219,4 +220,47 @@
 	<select id="findUserLockPracticeGroupWithDateBefore" resultMap="PracticeGroup">
 		SELECT * FROM practice_group WHERE student_id_=#{userId} AND courses_start_date_&lt;=#{date} AND group_status_='LOCK'
 	</select>
+
+	<sql id="practiceGroupReviewsQueryCondition">
+		<where>
+			pg.group_status_='NORMAL'
+			<if test="search!=null and search!=''">
+				AND (pg.name_ LIKE CONCAT('%',#{search},'%') OR pg.id_= #{search})
+			</if>
+			<if test="teacherId!=null">
+				AND pg.user_id_=#{teacherId}
+			</if>
+			<if test="organId != null">
+				AND FIND_IN_SET(pg.organ_id_,#{organId})
+			</if>
+			<if test="month != null">
+				AND pg.courses_expire_date_ >= #{month}
+			</if>
+			<if test='isFree !=null and isFree=="0"'>
+				AND pg.buy_months_ > 0
+			</if>
+			<if test='isFree !=null and isFree=="1"'>
+				AND pg.buy_months_ IS NULL
+			</if>
+		</where>
+	</sql>
+
+	<select id="findPracticeGroupsReviews" resultMap="PracticeGroupDto">
+		SELECT pg.*,cse.id_ evaluate_id_,
+		su.real_name_ teacher_name_
+		FROM
+		practice_group pg
+		LEFT JOIN sys_user su ON pg.user_id_ = su.id_
+		LEFT JOIN course_schedule_evaluate cse ON pg.id_=cse.music_group_id_ AND DATE_FORMAT(cse.create_time_, '%Y%m') = DATE_FORMAT(#{month},'%Y%m')
+		<include refid="practiceGroupReviewsQueryCondition"/>
+		ORDER BY pg.id_ DESC
+		<include refid="global.limit"/>
+	</select>
+
+
+	<select id="countPracticeGroupReviews" resultType="java.lang.Integer">
+		SELECT count(*) FROM practice_group pg
+		LEFT JOIN course_schedule_evaluate cse ON pg.id_=cse.music_group_id_ AND DATE_FORMAT(cse.create_time_, '%Y%m') = DATE_FORMAT(#{month},'%Y%m')
+		<include refid="practiceGroupReviewsQueryCondition"/>
+	</select>
 </mapper>

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

@@ -26,7 +26,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 	public void configure(HttpSecurity http) throws Exception {
 		http.csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and()
 				.authorizeRequests().antMatchers("/task/**").hasIpAddress("0.0.0.0/0")
-				.antMatchers("/v2/api-docs", "/classGroup/highClassGroups", "/code/*", "/api/*", "/appVersionInfo/queryByPlatform").permitAll().anyRequest()
+				.antMatchers("/v2/api-docs", "/classGroup/highClassGroups", "/code/*", "/api/*", "/appVersionInfo/queryByPlatform","/practiceGroupManage/getReviews").permitAll().anyRequest()
 				.authenticated().and().httpBasic();
 	}
 

+ 24 - 0
mec-web/src/main/java/com/ym/mec/web/controller/PracticeGroupManageController.java

@@ -87,4 +87,28 @@ public class PracticeGroupManageController extends BaseController {
         groupService.cancelGroup(groupId, groupType, refundAmount);
         return succeed();
     }
+
+    @ApiOperation(value = "评论管理")
+    @GetMapping("getReviews")
+   // @PreAuthorize("@pcs.hasPermissions('practiceGroupManage/getReviews')")
+    public Object getReviews(PracticeGroupQueryInfo queryInfo) {
+//        SysUser sysUser = sysUserFeignService.queryUserInfo();
+//        if (sysUser == null) {
+//            return failed("用户信息获取失败");
+//        }
+//        if (!sysUser.getIsSuperAdmin()) {
+//            Employee employee = employeeDao.get(sysUser.getId());
+//            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+//                queryInfo.setOrganId(employee.getOrganIdList());
+//            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+//                return failed("用户所在分部异常");
+//            } else {
+//                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+//                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+//                    return failed("非法请求");
+//                }
+//            }
+//        }
+        return succeed(practiceGroupService.findPracticeGroupReviews(queryInfo));
+    }
 }