Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

yonge 5 years ago
parent
commit
b1209071fa
16 changed files with 100 additions and 28 deletions
  1. 33 0
      mec-education/src/main/java/com/ym/mec/education/controller/SubjectController.java
  2. 10 0
      mec-education/src/main/java/com/ym/mec/education/mapper/ClassGroupStudentMapperMapper.java
  3. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/DemoGroupCoursesPlanMapper.java
  4. 2 2
      mec-education/src/main/java/com/ym/mec/education/mapper/VipGroupMapper.java
  5. 3 0
      mec-education/src/main/java/com/ym/mec/education/req/ClassGroupReq.java
  6. 3 2
      mec-education/src/main/java/com/ym/mec/education/service/IClassGroupStudentMapperService.java
  7. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/IDemoGroupCoursesPlanService.java
  8. 2 2
      mec-education/src/main/java/com/ym/mec/education/service/ISubjectService.java
  9. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/IVipGroupService.java
  10. 6 2
      mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupStudentMapperServiceImpl.java
  11. 6 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java
  12. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/DemoGroupCoursesPlanServiceImpl.java
  13. 12 10
      mec-education/src/main/java/com/ym/mec/education/service/impl/StudentAttendanceServiceImpl.java
  14. 4 4
      mec-education/src/main/java/com/ym/mec/education/service/impl/SubjectServiceImpl.java
  15. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/VipGroupServiceImpl.java
  16. 14 0
      mec-education/src/main/resources/mapper/ClassGroupStudentMapperMapper.xml

+ 33 - 0
mec-education/src/main/java/com/ym/mec/education/controller/SubjectController.java

@@ -0,0 +1,33 @@
+package com.ym.mec.education.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ym.mec.education.base.BaseResponse;
+import com.ym.mec.education.service.ISubjectService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @program: mec
+ * @description: 声部
+ * @author: xw
+ * @create: 2019-10-01 11:25
+ */
+@RestController
+@RequestMapping("api/subject")
+@Api(tags = "声部")
+public class SubjectController {
+
+    @Autowired
+    private ISubjectService subjectService;
+
+    @PostMapping("/list")
+    @ApiOperation("声部列表")
+    public BaseResponse list(@RequestBody JSONObject jsonObject) {
+        return BaseResponse.success(subjectService.list());
+    }
+}

+ 10 - 0
mec-education/src/main/java/com/ym/mec/education/mapper/ClassGroupStudentMapperMapper.java

@@ -2,9 +2,11 @@ package com.ym.mec.education.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
 import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.resp.ClassStudentResp;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -23,4 +25,12 @@ public interface ClassGroupStudentMapperMapper extends BaseMapper<ClassGroupStud
     List<ClassStudentResp> selectStudentPage(IPage page, ClassGroupReq req);
 
     int selectStudentPageCount(ClassGroupReq req);
+
+    /**
+     * 根据班级id  乐团id查询学生考勤
+     * @param page
+     * @param classGroupReq
+     * @return
+     */
+    Page<ClassGroupStudentMapper> selectPageByCondition(Page page, @Param("query") ClassGroupReq classGroupReq);
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/mapper/DemoGroupCoursesPlanMapper.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.DemoGroupCoursesPlan;
-import com.baomidou.mybatisplus.mapper.BaseMapper;
 
 /**
  * <p>

+ 2 - 2
mec-education/src/main/java/com/ym/mec/education/mapper/VipGroupMapper.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.VipGroup;
-import com.baomidou.mybatisplus.mapper.BaseMapper;
 
 /**
  * <p>
@@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
  * @author lemeng
  * @since 2019-09-25
  */
-public interface VipGroupMapper extends BaseMapper<VipGroup> {
+public interface VipGroupMapper extends BaseMapper<VipGroup>{
 
 }

+ 3 - 0
mec-education/src/main/java/com/ym/mec/education/req/ClassGroupReq.java

@@ -24,4 +24,7 @@ public class ClassGroupReq extends BaseQuery implements Serializable {
 
     @ApiModelProperty(value = "乐团id", required = true)
     private Integer musicGroupId;
+
+    @ApiModelProperty(value = "声部id")
+    private Integer subjectId;
 }

+ 3 - 2
mec-education/src/main/java/com/ym/mec/education/service/IClassGroupStudentMapperService.java

@@ -1,11 +1,11 @@
 package com.ym.mec.education.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
 import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.resp.ClassStudentResp;
-
 import java.util.List;
 
 /**
@@ -22,6 +22,7 @@ public interface IClassGroupStudentMapperService extends IService<ClassGroupStud
 
     List<ClassStudentResp> selectStudentPage(ClassGroupReq classGroupReq);
 
-    int  selectStudentPageCount(ClassGroupReq classGroupReq);
+    int selectStudentPageCount(ClassGroupReq classGroupReq);
 
+    Page<ClassGroupStudentMapper> selectPageByCondition(ClassGroupReq classGroupReq);
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/IDemoGroupCoursesPlanService.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.entity.DemoGroupCoursesPlan;
-import com.baomidou.mybatisplus.service.IService;
 
 /**
  * <p>

+ 2 - 2
mec-education/src/main/java/com/ym/mec/education/service/ISubjectService.java

@@ -15,10 +15,10 @@ import java.util.List;
 public interface ISubjectService extends IService<Subject> {
 
     /**
-     * 根据声部id List查询声部名称
+     * 根据声部id List查询声部
      * @param subjectIdArr
      * @return
      */
-    List<String> getSubjectNameList(String subjectIdArr);
+    List<Subject> getSubjectList(String subjectIdArr);
 
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/IVipGroupService.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.entity.VipGroup;
-import com.baomidou.mybatisplus.service.IService;
 
 /**
  * <p>

+ 6 - 2
mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -21,10 +21,8 @@ import com.ym.mec.education.service.ISysUserService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-
 import java.util.List;
 import java.util.Objects;
-import java.util.Optional;
 
 /**
  * <p>
@@ -90,4 +88,10 @@ public class ClassGroupStudentMapperServiceImpl extends ServiceImpl<ClassGroupSt
     public int selectStudentPageCount(ClassGroupReq classGroupReq) {
         return 0;
     }
+
+    @Override
+    public Page<ClassGroupStudentMapper> selectPageByCondition(ClassGroupReq classGroupReq) {
+        Page<ClassGroupStudentMapper> classGroupStudentMapperPage = new Page(classGroupReq.getPageNo(), classGroupReq.getPageSize());
+        return baseMapper.selectPageByCondition(classGroupStudentMapperPage, classGroupReq);
+    }
 }

+ 6 - 1
mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java

@@ -21,9 +21,12 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -73,7 +76,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
                         DateUtil.time2String(item.getEndClassTime()));
             }
             if (StringUtils.isNotBlank(classGroup.getSubjectIdList())) {
-                List<String> subjectNameList = subjectService.getSubjectNameList(classGroup.getSubjectIdList());
+                List<String> subjectNameList = subjectService.getSubjectList(classGroup.getSubjectIdList()).stream().map(Subject::getName).collect(Collectors.toList());
                 if (!CollectionUtils.isEmpty(subjectNameList)) {
                     courseScheduleResp.setSubjectName(subjectNameList);
                 }
@@ -140,6 +143,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
             if (totalCount != 0) {
                 courseScheduleResp.setAttendanceRate(normalCount + "/" + totalCount);
             }
+            //当前时间
+            courseScheduleResp.setClassDate(DateUtil.date2String(new Date()) + " " + DateUtil.date2Week(new Date()));
         }
         return BaseResponse.success(courseScheduleResp);
     }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/impl/DemoGroupCoursesPlanServiceImpl.java

@@ -1,9 +1,9 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.education.entity.DemoGroupCoursesPlan;
 import com.ym.mec.education.mapper.DemoGroupCoursesPlanMapper;
 import com.ym.mec.education.service.IDemoGroupCoursesPlanService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 /**

+ 12 - 10
mec-education/src/main/java/com/ym/mec/education/service/impl/StudentAttendanceServiceImpl.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.*;
 import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
@@ -21,8 +20,10 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -91,7 +92,7 @@ public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceM
             }
             ClassGroup classGroup = groupService.getById(classGroupReq.getGroupId());
             if (Objects.nonNull(classGroup)) {
-                studentAttendanceResp.setSubjectName(subjectService.getSubjectNameList(classGroup.getSubjectIdList()));
+                studentAttendanceResp.setSubjectName(subjectService.getSubjectList(classGroup.getSubjectIdList()).stream().map(Subject::getName).collect(Collectors.toList()));
                 list.add(studentAttendanceResp);
             }
         });
@@ -138,26 +139,27 @@ public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceM
         if (Objects.isNull(classGroupReq.getGroupId())) {
             PageResponse.errorParam();
         }
-        Page<ClassGroupStudentMapper> classGroupStudentMapperPage = new Page<ClassGroupStudentMapper>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
         Page<StudentAttendanceStatisticsResp> pageResult = new Page();
         ClassGroup classGroup = groupService.getById(classGroupReq.getGroupId());
         if (Objects.nonNull(classGroup)) {
-            List<String> subjectNameList = subjectService.getSubjectNameList(classGroup.getSubjectIdList());
-            QueryWrapper<ClassGroupStudentMapper> classGroupStudentMapperQueryWrapper = new QueryWrapper<>();
-            classGroupStudentMapperQueryWrapper.lambda().eq(true, ClassGroupStudentMapper::getClassGroupId, classGroup.getId())
-                    .in(true, ClassGroupStudentMapper::getStatus,
-                            ClassGroupStudentStatusEnum.NORMAL.getCode(), ClassGroupStudentStatusEnum.LEAVE.getCode());
-            IPage<ClassGroupStudentMapper> studentMapperPage = classGroupStudentMapperService.page(classGroupStudentMapperPage, classGroupStudentMapperQueryWrapper);
+            List<String> subjectNameList = Lists.newArrayList();
+            if (Objects.nonNull(classGroupReq.getSubjectId())) {
+                subjectNameList = Lists.newArrayList(subjectService.getById(classGroupReq.getSubjectId()).getName());
+            } else {
+                subjectNameList = subjectService.getSubjectList(classGroup.getSubjectIdList()).stream().map(Subject::getName).collect(Collectors.toList());
+            }
+            Page<ClassGroupStudentMapper> studentMapperPage = classGroupStudentMapperService.selectPageByCondition(classGroupReq);
             if (!CollectionUtils.isEmpty(studentMapperPage.getRecords())) {
                 List<StudentAttendanceStatisticsResp> studentAttendanceStatisticsRespList = Lists.newArrayList();
                 BeanUtils.copyProperties(studentMapperPage, pageResult);
+                List<String> finalSubjectNameList = subjectNameList;
                 studentMapperPage.getRecords().forEach(item -> {
                     StudentAttendanceStatisticsResp resp = new StudentAttendanceStatisticsResp();
                     SysUser user = userService.getById(item.getUserId());
                     if (Objects.nonNull(user) && StringUtils.isNotBlank(user.getRealName())) {
                         resp.setStudentName(user.getRealName());
                     }
-                    resp.setSubjectName(subjectNameList);
+                    resp.setSubjectName(finalSubjectNameList);
                     //是否连续旷课
                     QueryWrapper<MusicGroupStudentFee> musicGroupStudentFeeQueryWrapper = new QueryWrapper<MusicGroupStudentFee>();
                     musicGroupStudentFeeQueryWrapper.lambda().eq(true, MusicGroupStudentFee::getMusicGroupId, classGroup.getMusicGroupId())

+ 4 - 4
mec-education/src/main/java/com/ym/mec/education/service/impl/SubjectServiceImpl.java

@@ -25,17 +25,17 @@ import java.util.Objects;
 public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> implements ISubjectService {
 
     @Override
-    public List<String> getSubjectNameList(String subjectIdArr) {
+    public List<Subject> getSubjectList(String subjectIdArr) {
         if (StringUtils.isNotBlank(subjectIdArr)) {
-            List<String> subjectName = Lists.newArrayList();
+            List<Subject> subjectList = Lists.newArrayList();
             List<String> subjectIdList = Arrays.asList(subjectIdArr.split(","));
             subjectIdList.forEach(subjectId -> {
                 Subject subject = getById(Integer.parseInt(subjectId));
                 if (Objects.nonNull(subject)) {
-                    subjectName.add(subject.getName());
+                    subjectList.add(subject);
                 }
             });
-            return subjectName;
+            return subjectList;
         } else {
             return Collections.emptyList();
         }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/impl/VipGroupServiceImpl.java

@@ -1,9 +1,9 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.education.entity.VipGroup;
 import com.ym.mec.education.mapper.VipGroupMapper;
 import com.ym.mec.education.service.IVipGroupService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 /**

+ 14 - 0
mec-education/src/main/resources/mapper/ClassGroupStudentMapperMapper.xml

@@ -15,6 +15,9 @@
     <sql id="Base_Column_List">
         id_, class_group_id_, user_id_, create_time_, status_
     </sql>
+    <sql id="Column_List">
+        class_group_student_mapper.id_, class_group_student_mapper.class_group_id_, class_group_student_mapper.user_id_, class_group_student_mapper.create_time_, class_group_student_mapper.status_
+    </sql>
 
     <select id="selectStudentPage" parameterType="com.ym.mec.education.req.ClassGroupReq"
             resultType="com.ym.mec.education.resp.ClassStudentResp">
@@ -30,4 +33,15 @@
 
     </select>
 
+    <select id="selectPageByCondition" parameterType="com.ym.mec.education.req.ClassGroupReq" resultMap="BaseResultMap">
+        SELECT class_group_student_mapper.* FROM class_group_student_mapper LEFT JOIN class_group ON class_group_student_mapper.class_group_id_ = class_group.id_
+	    LEFT JOIN `subject` ON `subject`.id_ in (class_group.subject_id_list_)
+	    where
+	    class_group_student_mapper.class_group_id_ = #{query.groupId}
+	    and class_group_student_mapper.status_ in ('NORMAL', 'LEAVE')
+	    <if test="query.subjectId != null">
+            and subject.id_ = #{query.subjectId}
+        </if>
+    </select>
+
 </mapper>