瀏覽代碼

Merge remote-tracking branch 'origin/master'

Joburgess 5 年之前
父節點
當前提交
dadbbe8b05
共有 20 個文件被更改,包括 504 次插入104 次删除
  1. 36 0
      mec-education/src/main/java/com/ym/mec/education/controller/CourseScheduleController.java
  2. 7 0
      mec-education/src/main/java/com/ym/mec/education/controller/MusicGroupController.java
  3. 5 5
      mec-education/src/main/java/com/ym/mec/education/controller/StudentController.java
  4. 11 0
      mec-education/src/main/java/com/ym/mec/education/entity/SysUser.java
  5. 3 1
      mec-education/src/main/java/com/ym/mec/education/mapper/xml/SysUserMapper.xml
  6. 5 0
      mec-education/src/main/java/com/ym/mec/education/req/ClassGroupReq.java
  7. 36 0
      mec-education/src/main/java/com/ym/mec/education/resp/ClassStudentResp.java
  8. 33 0
      mec-education/src/main/java/com/ym/mec/education/resp/ClassTeacherResp.java
  9. 33 0
      mec-education/src/main/java/com/ym/mec/education/resp/CourseScheduleResp.java
  10. 6 9
      mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceResq.java
  11. 1 1
      mec-education/src/main/java/com/ym/mec/education/resp/StudentListResp.java
  12. 3 0
      mec-education/src/main/java/com/ym/mec/education/service/IClassGroupStudentMapperService.java
  13. 3 0
      mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleService.java
  14. 0 1
      mec-education/src/main/java/com/ym/mec/education/service/IStudentRegistrationService.java
  15. 46 0
      mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupStudentMapperServiceImpl.java
  16. 57 0
      mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java
  17. 155 45
      mec-education/src/main/java/com/ym/mec/education/service/impl/MusicGroupServiceImpl.java
  18. 3 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/StudentAttendanceServiceImpl.java
  19. 0 41
      mec-education/src/main/java/com/ym/mec/education/service/impl/StudentRegistrationServiceImpl.java
  20. 61 0
      mec-education/src/main/java/com/ym/mec/education/utils/DateUtil.java

+ 36 - 0
mec-education/src/main/java/com/ym/mec/education/controller/CourseScheduleController.java

@@ -0,0 +1,36 @@
+package com.ym.mec.education.controller;
+
+import com.ym.mec.education.base.PageResponse;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.service.ICourseScheduleService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+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;
+import javax.validation.Valid;
+
+/**
+ * @program: mec
+ * @description: 课表
+ * @author: xw
+ * @create: 2019-09-26 21:04
+ */
+@RestController
+@RequestMapping("api/courseSchedule")
+@Api(tags = "课表")
+@Slf4j
+public class CourseScheduleController {
+
+    @Autowired
+    private ICourseScheduleService courseScheduleService;
+
+    @PostMapping("/list")
+    @ApiOperation("课表列表")
+    public PageResponse list(@RequestBody @Valid ClassGroupReq classGroupReq) {
+        return courseScheduleService.getPage(classGroupReq);
+    }
+}

+ 7 - 0
mec-education/src/main/java/com/ym/mec/education/controller/MusicGroupController.java

@@ -69,6 +69,12 @@ public class MusicGroupController {
         return musicGroupService.groupDetail(groupId);
 
     }
+
+    /**
+     * 班级列表
+     * @param req
+     * @return
+     */
     @PostMapping(value = "/classGroupList")
     public PageResponse classGroupList(@RequestBody ClassGroupReq req){
 
@@ -76,4 +82,5 @@ public class MusicGroupController {
 
     }
 
+
 }

+ 5 - 5
mec-education/src/main/java/com/ym/mec/education/controller/StudentRegistrationController.java → mec-education/src/main/java/com/ym/mec/education/controller/StudentController.java

@@ -2,7 +2,7 @@ package com.ym.mec.education.controller;
 
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.req.ClassGroupReq;
-import com.ym.mec.education.service.IStudentRegistrationService;
+import com.ym.mec.education.service.IClassGroupStudentMapperService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -19,18 +19,18 @@ import org.springframework.web.bind.annotation.RestController;
  * @create: 2019-09-26 19:40
  */
 @RestController
-@RequestMapping("api/studentRegistration")
+@RequestMapping("api/student")
 @Api(tags = "学员名单")
 @Slf4j
-public class StudentRegistrationController {
+public class StudentController {
 
     @Autowired
-    private IStudentRegistrationService studentRegistrationService;
+    private IClassGroupStudentMapperService groupStudentMapperService;
 
     @PostMapping("/list")
     @ApiOperation("学员名单列表")
     public PageResponse list(@RequestBody ClassGroupReq classGroupReq) {
-        return studentRegistrationService.getPage(classGroupReq);
+        return groupStudentMapperService.getPage(classGroupReq);
     }
 
 }

+ 11 - 0
mec-education/src/main/java/com/ym/mec/education/entity/SysUser.java

@@ -110,6 +110,10 @@ public class SysUser extends Model<SysUser> {
      */
     @TableField("im_token_")
     private String imToken;
+
+
+    @TableField("real_name_")
+    private String realName;
     /**
      * 身份证号码
      */
@@ -126,6 +130,13 @@ public class SysUser extends Model<SysUser> {
     @TableField("wechat_id_")
     private String wechatId;
 
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
 
     public Integer getId() {
         return id;

+ 3 - 1
mec-education/src/main/java/com/ym/mec/education/mapper/xml/SysUserMapper.xml

@@ -26,11 +26,13 @@
         <result column="id_card_no_" property="idCardNo" />
         <result column="esign_id_" property="esignId" />
         <result column="wechat_id_" property="wechatId" />
+        <result column="real_name_" property="realName" />
+
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id_, username_, password_, salt_, phone_, avatar_, create_time_, update_time_, lock_flag_, del_flag_, wx_openid_, qq_openid_, user_type_, gender_, nation_, birthdate_, email_, organ_id_, im_token_, id_card_no_, esign_id_, wechat_id_
+        id_, username_, password_, salt_, phone_, avatar_, create_time_, update_time_, lock_flag_, del_flag_, wx_openid_, qq_openid_, user_type_, gender_, nation_, birthdate_, email_, organ_id_, im_token_, id_card_no_, esign_id_, wechat_id_,real_name_
     </sql>
 
 </mapper>

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

@@ -4,6 +4,8 @@ import com.ym.mec.education.base.BaseQuery;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+
+import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
 /**
@@ -17,5 +19,8 @@ import java.io.Serializable;
 public class ClassGroupReq extends BaseQuery implements Serializable {
 
     @ApiModelProperty(value = "班级id",required = true)
+    @NotNull(message = "班级id不能为空")
     private Integer groupId;
+
+    private Integer type = 0;
 }

+ 36 - 0
mec-education/src/main/java/com/ym/mec/education/resp/ClassStudentResp.java

@@ -0,0 +1,36 @@
+package com.ym.mec.education.resp;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @version V1.0
+ * @Description: TODO
+ * @date Date : 2019年09月26日 17:44
+ */
+
+@Data
+@ToString
+public class ClassStudentResp implements Serializable {
+
+    private String name;
+
+    /**
+     * 图像
+     */
+    private String avatar;
+
+    private List<String> classType;
+
+    private Integer truantNum;
+
+    private Integer isVip = 0;
+
+    private Integer userId;
+
+    private Integer classGroupId;
+
+}

+ 33 - 0
mec-education/src/main/java/com/ym/mec/education/resp/ClassTeacherResp.java

@@ -0,0 +1,33 @@
+package com.ym.mec.education.resp;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @version V1.0
+ * @Description: TODO
+ * @date Date : 2019年09月26日 17:44
+ */
+
+@Data
+@ToString
+public class ClassTeacherResp implements Serializable {
+
+    private String name;
+
+    /**
+     * 图像
+     */
+    private String avatar;
+
+
+    private Integer userId;
+
+    private Integer classGroupId;
+
+    private List<String> className;
+
+}

+ 33 - 0
mec-education/src/main/java/com/ym/mec/education/resp/CourseScheduleResp.java

@@ -0,0 +1,33 @@
+package com.ym.mec.education.resp;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import java.io.Serializable;
+
+/**
+ * @program: mec
+ * @description: 课表出参
+ * @author: xw
+ * @create: 2019-09-26 20:58
+ */
+@Data
+@ToString
+@ApiModel(description = "课表出参")
+@Accessors(chain = true)
+public class CourseScheduleResp implements Serializable {
+
+    @ApiModelProperty(value = "上课日期",required = true)
+    private String classDate;
+
+    @ApiModelProperty(value = "上课时间",required = true)
+    private String classTime;
+
+    @ApiModelProperty(value = "班级名称",required = true)
+    private String classGroupName;
+
+    @ApiModelProperty(value = "上课老师",required = true)
+    private String teacher;
+}

+ 6 - 9
mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceResq.java

@@ -4,9 +4,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.experimental.Accessors;
-import org.springframework.format.annotation.DateTimeFormat;
 import java.io.Serializable;
-import java.util.Date;
 
 /**
  * @program: mec
@@ -19,19 +17,18 @@ import java.util.Date;
 @Accessors(chain = true)
 public class StudentAttendanceResq implements Serializable {
 
-    @ApiModelProperty(value = "上课日期",required = true)
-    @DateTimeFormat(pattern = "MM月dd日")
-    private Date classDate;
+    @ApiModelProperty(value = "上课日期", required = true)
+    private String classDate;
 
-    @ApiModelProperty(value = "上课时间",required = true)
+    @ApiModelProperty(value = "上课时间", required = true)
     private String classTime;
 
-    @ApiModelProperty(value = "班级名称",required = true)
+    @ApiModelProperty(value = "班级名称", required = true)
     private String classGroupName;
 
-    @ApiModelProperty(value = "到课比",required = true)
+    @ApiModelProperty(value = "到课比", required = true)
     private String attendanceRate;
 
-    @ApiModelProperty(value = "请假人数",required = true)
+    @ApiModelProperty(value = "请假人数", required = true)
     private Integer leaveNum;
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/resp/StudentRegistrationResp.java → mec-education/src/main/java/com/ym/mec/education/resp/StudentListResp.java

@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
 @Data
 @ApiModel(description = "学员名单出参")
 @Accessors(chain = true)
-public class StudentRegistrationResp extends BaseQuery {
+public class StudentListResp extends BaseQuery {
 
     @ApiModelProperty(value = "学员名称",required = true)
     private String studentName;

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

@@ -1,7 +1,9 @@
 package com.ym.mec.education.service;
 
 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;
 
 /**
  * <p>
@@ -13,4 +15,5 @@ import com.ym.mec.education.entity.ClassGroupStudentMapper;
  */
 public interface IClassGroupStudentMapperService extends IService<ClassGroupStudentMapper> {
 
+    PageResponse getPage(ClassGroupReq classGroupReq);
 }

+ 3 - 0
mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleService.java

@@ -1,7 +1,9 @@
 package com.ym.mec.education.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.CourseSchedule;
+import com.ym.mec.education.req.ClassGroupReq;
 
 /**
  * <p>
@@ -13,4 +15,5 @@ import com.ym.mec.education.entity.CourseSchedule;
  */
 public interface ICourseScheduleService extends IService<CourseSchedule> {
 
+    PageResponse getPage(ClassGroupReq classGroupReq);
 }

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

@@ -15,5 +15,4 @@ import com.ym.mec.education.req.ClassGroupReq;
  */
 public interface IStudentRegistrationService extends IService<StudentRegistration> {
 
-     PageResponse getPage(ClassGroupReq classGroupReq);
 }

+ 46 - 0
mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -1,10 +1,27 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.education.base.PageResponse;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
+import com.ym.mec.education.entity.StudentAttendance;
+import com.ym.mec.education.entity.StudentRegistration;
+import com.ym.mec.education.entity.SysUser;
+import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.education.mapper.ClassGroupStudentMapperMapper;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.resp.StudentListResp;
 import com.ym.mec.education.service.IClassGroupStudentMapperService;
+import com.ym.mec.education.service.IStudentAttendanceService;
+import com.ym.mec.education.service.IStudentRegistrationService;
+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;
 
 /**
  * <p>
@@ -17,4 +34,33 @@ import org.springframework.stereotype.Service;
 @Service
 public class ClassGroupStudentMapperServiceImpl extends ServiceImpl<ClassGroupStudentMapperMapper, ClassGroupStudentMapper> implements IClassGroupStudentMapperService {
 
+    @Autowired
+    private IStudentAttendanceService studentAttendanceService;
+    @Autowired
+    private ISysUserService sysUserService;
+
+    @Override
+    public PageResponse getPage(ClassGroupReq classGroupReq) {
+        Page<ClassGroupStudentMapper> classGroupStudentMapperPage = new Page<>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
+        QueryWrapper<ClassGroupStudentMapper> classGroupStudentMapperQueryWrapper = new QueryWrapper<>();
+        classGroupStudentMapperQueryWrapper.lambda().eq(true, ClassGroupStudentMapper::getClassGroupId, classGroupReq.getGroupId());
+        IPage<ClassGroupStudentMapper> page = page(classGroupStudentMapperPage, classGroupStudentMapperQueryWrapper);
+        Page<StudentListResp> studentListRespPage = new Page<>();
+        BeanUtils.copyProperties(page, studentListRespPage);
+        List<StudentListResp> list = Lists.newArrayList();
+        page.getRecords().forEach(item -> {
+            QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
+            //请假 旷课正常上课次数
+            queryWrapper.lambda().eq(true, StudentAttendance::getUserId, item.getUserId())
+                    .in(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.TRUANT.getCode(),
+                            StudentAttendanceStatusEnum.LEAVE.getCode());
+            int count = studentAttendanceService.count(queryWrapper);
+            SysUser sysUser = sysUserService.getById(item.getUserId());
+            StudentListResp studentRegistrationResp = new StudentListResp()
+                    .setStudentName(sysUser.getRealName()).setStudentAttendance("连续缺到" + count + "次");
+            list.add(studentRegistrationResp);
+        });
+        studentListRespPage.setRecords(list);
+        return PageResponse.success(studentListRespPage);
+    }
 }

+ 57 - 0
mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java

@@ -1,10 +1,29 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.education.base.PageResponse;
+import com.ym.mec.education.entity.ClassGroup;
+import com.ym.mec.education.entity.ClassGroupTeacherMapper;
 import com.ym.mec.education.entity.CourseSchedule;
+import com.ym.mec.education.entity.SysUser;
+import com.ym.mec.education.enums.TeachTypeEnum;
 import com.ym.mec.education.mapper.CourseScheduleMapper;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.resp.CourseScheduleResp;
+import com.ym.mec.education.service.IClassGroupService;
+import com.ym.mec.education.service.IClassGroupTeacherMapperService;
 import com.ym.mec.education.service.ICourseScheduleService;
+import com.ym.mec.education.service.ISysUserService;
+import com.ym.mec.education.utils.DateUtil;
+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;
 
 /**
  * <p>
@@ -17,4 +36,42 @@ import org.springframework.stereotype.Service;
 @Service
 public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper, CourseSchedule> implements ICourseScheduleService {
 
+    @Autowired
+    private IClassGroupService groupService;
+    @Autowired
+    private IClassGroupTeacherMapperService classGroupTeacherMapperService;
+    @Autowired
+    private ISysUserService sysUserService;
+
+    @Override
+    public PageResponse getPage(ClassGroupReq classGroupReq) {
+        Page<CourseSchedule> courseSchedulePage = new Page<>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
+        QueryWrapper<CourseSchedule> courseScheduleQueryWrapper = new QueryWrapper<>();
+        courseScheduleQueryWrapper.lambda().eq(true, CourseSchedule::getClassGroupId, classGroupReq.getGroupId());
+        IPage<CourseSchedule> courseScheduleIPage = page(courseSchedulePage, courseScheduleQueryWrapper);
+        Page<CourseScheduleResp> pageResult = new Page<>();
+        List<CourseScheduleResp> courseScheduleRespList = Lists.newArrayList();
+        BeanUtils.copyProperties(courseScheduleIPage, pageResult);
+        ClassGroup classGroup = groupService.getById(classGroupReq.getGroupId());
+        courseScheduleIPage.getRecords().forEach(item ->{
+            CourseScheduleResp courseScheduleResp = new CourseScheduleResp();
+            courseScheduleResp.setClassDate(DateUtil.date2String(item.getClassDate())
+                    + "" + DateUtil.date2Week(item.getClassDate()))
+                    .setClassTime(item.getStartClassTime() + "-" + item.getEndClassTime())
+                    .setClassGroupName(classGroup.getName());
+            QueryWrapper<ClassGroupTeacherMapper> classGroupTeacherMapperQueryWrapper = new QueryWrapper<>();
+            classGroupTeacherMapperQueryWrapper.lambda().eq(true, ClassGroupTeacherMapper::getClassGroupId, item.getClassGroupId())
+                    .eq(true, ClassGroupTeacherMapper::getTeacherRole, TeachTypeEnum.BISHOP.getCode());
+            ClassGroupTeacherMapper classGroupTeacherMapper = classGroupTeacherMapperService.getOne(classGroupTeacherMapperQueryWrapper);
+            if (Objects.nonNull(classGroupTeacherMapper)){
+                SysUser sysUser = sysUserService.getById(classGroupTeacherMapper.getUserId());
+                if (Objects.nonNull(sysUser)){
+                    courseScheduleResp.setTeacher(sysUser.getRealName());
+                }
+            }
+            courseScheduleRespList.add(courseScheduleResp);
+        });
+        pageResult.setRecords(courseScheduleRespList);
+        return PageResponse.success(pageResult);
+    }
 }

+ 155 - 45
mec-education/src/main/java/com/ym/mec/education/service/impl/MusicGroupServiceImpl.java

@@ -8,14 +8,13 @@ import com.google.common.collect.Lists;
 import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.*;
-import com.ym.mec.education.enums.ClassGroupStudentStatusEnum;
-import com.ym.mec.education.enums.ClassGroupTypeEnum;
-import com.ym.mec.education.enums.ReturnCodeEnum;
-import com.ym.mec.education.enums.TeachTypeEnum;
+import com.ym.mec.education.enums.*;
 import com.ym.mec.education.mapper.MusicGroupMapper;
 import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.req.MusicGroupReq;
 import com.ym.mec.education.resp.ClassGroupResp;
+import com.ym.mec.education.resp.ClassStudentResp;
+import com.ym.mec.education.resp.ClassTeacherResp;
 import com.ym.mec.education.resp.MusicGroupResp;
 import com.ym.mec.education.service.*;
 import org.springframework.beans.BeanUtils;
@@ -24,9 +23,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -58,6 +55,9 @@ public class MusicGroupServiceImpl extends ServiceImpl<MusicGroupMapper, MusicGr
     @Autowired
     private IClassGroupStudentMapperService classGroupStudentMapperService;
 
+    @Autowired
+    private IStudentAttendanceService studentAttendanceService;
+
 
     @Override
     public PageResponse groupList(MusicGroupReq req) {
@@ -105,10 +105,10 @@ public class MusicGroupServiceImpl extends ServiceImpl<MusicGroupMapper, MusicGr
 
             SysUser  sysUser2 = sysUserService.getById(g.getTeamTeacherId());
             if(sysUser1 != null){
-                musicGroupResp.setTeamTeacherName(sysUser1.getUsername());
+                musicGroupResp.setTeamTeacherName(sysUser1.getRealName());
             }
             if(sysUser2 != null){
-                musicGroupResp.setEduTeacherName(sysUser2.getUsername());
+                musicGroupResp.setEduTeacherName(sysUser2.getRealName());
             }
             musicGroupResps.add(musicGroupResp);
         });
@@ -167,10 +167,10 @@ public class MusicGroupServiceImpl extends ServiceImpl<MusicGroupMapper, MusicGr
 
         SysUser  sysUser2 = sysUserService.getById(musicGroup.getTeamTeacherId());
         if(sysUser1 != null){
-            musicGroupResp.setTeamTeacherName(sysUser1.getUsername());
+            musicGroupResp.setTeamTeacherName(sysUser1.getRealName());
         }
         if(sysUser2 != null){
-            musicGroupResp.setEduTeacherName(sysUser2.getUsername());
+            musicGroupResp.setEduTeacherName(sysUser2.getRealName());
         }
         baseResponse.setDataInfo(musicGroupResp);
         baseResponse.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
@@ -202,47 +202,157 @@ public class MusicGroupServiceImpl extends ServiceImpl<MusicGroupMapper, MusicGr
 
         List<ClassGroup> classGroups = classGroupPage.getRecords();
 
-        List<ClassGroupResp> groupRespList = new ArrayList<>();
-        if(!CollectionUtils.isEmpty(classGroups)){
-            classGroups.forEach(e ->{
+        //班级
+        if(req.getType() == 0){
+            List<ClassGroupResp> groupRespList = new ArrayList<>();
+            if(!CollectionUtils.isEmpty(classGroups)){
+                classGroups.forEach(e ->{
+
+                    ClassGroupResp classGroupResp = new ClassGroupResp();
+                    //查询班级老师
+                    BeanUtils.copyProperties(e,classGroupResp);
+                    QueryWrapper<ClassGroupTeacherMapper> queryWrapper2 = new QueryWrapper<>();
+                    queryWrapper2.eq("music_group_id_",e.getId()).eq("teacher_role_", TeachTypeEnum.BISHOP.getCode());
+                    List<ClassGroupTeacherMapper> list = classGroupTeacherMapperService.list(queryWrapper2);
+
+                    if(!CollectionUtils.isEmpty(list)){
+                        List<Integer> firstId = list.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toList());
+                        QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
+                        queryWrapper.in("id_",firstId);
+                        List<SysUser> sysUserList = sysUserService.list(queryWrapper);
+                        if(!CollectionUtils.isEmpty(sysUserList)){
+                            classGroupResp.setFirstTehNameList(sysUserList.stream().map(SysUser::getRealName).collect(Collectors.toList()));
+                        }
+                    }
 
-                ClassGroupResp classGroupResp = new ClassGroupResp();
-                //查询班级老师
-                BeanUtils.copyProperties(e,classGroupResp);
-                QueryWrapper<ClassGroupTeacherMapper> queryWrapper2 = new QueryWrapper<>();
-                queryWrapper2.eq("music_group_id_",e.getId()).eq("teacher_role_", TeachTypeEnum.BISHOP.getCode());
-                List<ClassGroupTeacherMapper> list = classGroupTeacherMapperService.list();
+                    queryWrapper2.eq("music_group_id_",e.getId()).eq("teacher_role_", TeachTypeEnum.TEACHING.getCode());
+                    List<ClassGroupTeacherMapper> list2 = classGroupTeacherMapperService.list();
+                    if(!CollectionUtils.isEmpty(list2)){
+                        List<Integer> secdId = list2.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toList());
+                        QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
+                        queryWrapper.in("id_",secdId);
+                        List<SysUser> sysUserList = sysUserService.list(queryWrapper);
+                        if(!CollectionUtils.isEmpty(sysUserList)){
+                            classGroupResp.setSecdTehNameList(sysUserList.stream().map(SysUser::getRealName).collect(Collectors.toList()));
+                        }
+                    }
+                    groupRespList.add(classGroupResp);
 
-                if(!CollectionUtils.isEmpty(list)){
-                   List<Integer> firstId = list.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toList());
-                   QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
-                   queryWrapper.in("id_",firstId);
-                   List<SysUser> sysUserList = sysUserService.list(queryWrapper);
-                   if(!CollectionUtils.isEmpty(sysUserList)){
-                       classGroupResp.setFirstTehNameList(sysUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()));
-                   }
-                }
+                });
+            }
+
+            response.setRecords(groupRespList);
+            response.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+            response.setMessage(ReturnCodeEnum.CODE_200.getValue());
+            response.setTotal(count);
+            return response;
+        }
+        //学生
+        if(req.getType() == 1){
+            List<ClassStudentResp> classStudentResps = new ArrayList<>();
+
+            classGroups.forEach(e ->{
+
+                QueryWrapper<ClassGroupStudentMapper> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("class_group_id_",e.getId());
+                List<ClassGroupStudentMapper> studentMappers = classGroupStudentMapperService.list(queryWrapper);
+                if(!CollectionUtils.isEmpty(studentMappers)){
+                    studentMappers.forEach(stud ->{
+                        ClassStudentResp classStudentResp = new ClassStudentResp();
+                        Set<String> set = new HashSet<>();
+                        List<ClassStudentResp> removeList = classStudentResps.stream().filter(c ->c.getUserId().equals(stud.getUserId()) && c.getClassGroupId().equals(stud.getClassGroupId())).collect(Collectors.toList());
+                        if(!CollectionUtils.isEmpty(removeList)){
+                            classStudentResp = removeList.get(0);
+                            set.addAll(classStudentResp.getClassType());
+                            set.add(e.getType());
+                            classStudentResp.setClassType(new ArrayList<>(set));
+                        }else{
+
+                            SysUser sysUser = sysUserService.getById(stud.getUserId());
+                            if(sysUser != null){
+                                classStudentResp.setName(sysUser.getRealName());
+                                classStudentResp.setAvatar(sysUser.getAvatar());
+                            }
+                            classStudentResp.setUserId(stud.getUserId());
+                            classStudentResp.setClassGroupId(stud.getClassGroupId());
+                            QueryWrapper<StudentAttendance> truntWrapper = new QueryWrapper<>();
+                            //旷课
+                            truntWrapper.lambda().eq(true, StudentAttendance::getMusicGroupId, req.getGroupId())
+                                    .eq(true, StudentAttendance::getClassGroupId, e.getId())
+                                    .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.TRUANT.getCode())
+                                    .eq(true,StudentAttendance::getUserId,stud.getUserId());
+                            Integer leaveCount = studentAttendanceService.count(truntWrapper);
+                            classStudentResp.setTruantNum(leaveCount);
+                            set.add(e.getType());
+                            if(ClassGroupTypeEnum.VIP.equals(e.getType())){
+                                classStudentResp.setIsVip(1);
+                            }
+                            classStudentResp.setClassType(new ArrayList<>(set));
+                            classStudentResps.add(classStudentResp);
+                        }
+
+
+
+                    });
 
-                queryWrapper2.eq("music_group_id_",e.getId()).eq("teacher_role_", TeachTypeEnum.TEACHING.getCode());
-                List<ClassGroupTeacherMapper> list2 = classGroupTeacherMapperService.list();
-                if(!CollectionUtils.isEmpty(list2)){
-                    List<Integer> secdId = list2.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toList());
-                    QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
-                    queryWrapper.in("id_",secdId);
-                    List<SysUser> sysUserList = sysUserService.list(queryWrapper);
-                    if(!CollectionUtils.isEmpty(sysUserList)){
-                        classGroupResp.setSecdTehNameList(sysUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()));
-                    }
                 }
-                groupRespList.add(classGroupResp);
 
             });
+
+            response.setRecords(classStudentResps);
+            response.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+            response.setMessage(ReturnCodeEnum.CODE_200.getValue());
+            response.setTotal(count);
+            return response;
+
         }
+        //老师
+        if(req.getType() == 2){
 
-        response.setRecords(groupRespList);
-        response.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
-        response.setMessage(ReturnCodeEnum.CODE_200.getValue());
-        response.setTotal(count);
-        return null;
+            List<ClassTeacherResp> classTeacherResps = new ArrayList<>();
+            classGroups.forEach(e -> {
+                QueryWrapper<ClassGroupTeacherMapper> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("music_group_id_", e.getId());
+                List<ClassGroupTeacherMapper> list = classGroupTeacherMapperService.list(queryWrapper2);
+                if(!CollectionUtils.isEmpty(list)){
+
+                    list.forEach(stud ->{
+                        ClassTeacherResp classTeacherResp = new ClassTeacherResp();
+                        List<ClassTeacherResp> removeList = classTeacherResps.stream().filter(c ->c.getUserId().equals(stud.getUserId()) && c.getClassGroupId().equals(stud.getClassGroupId())).collect(Collectors.toList());
+                        HashSet set = new HashSet<>();
+                        if(!CollectionUtils.isEmpty(removeList)){
+
+                            classTeacherResp = removeList.get(0);
+                            set.addAll(classTeacherResp.getClassName());
+                            set.add(e.getName());
+                            classTeacherResp.setClassName(new ArrayList<>(set));
+                        }else{
+                            SysUser sysUser = sysUserService.getById(stud.getUserId());
+                            if(sysUser != null){
+                                classTeacherResp.setName(sysUser.getRealName());
+                                classTeacherResp.setAvatar(sysUser.getAvatar());
+                            }
+                            classTeacherResp.setUserId(stud.getUserId());
+                            classTeacherResp.setClassGroupId(stud.getClassGroupId());
+
+                            set.add(e.getName());
+                            classTeacherResp.setClassName(new ArrayList<>(set));
+                            classTeacherResps.add(classTeacherResp);
+                        }
+
+
+
+                    });
+
+                }
+            });
+
+            response.setRecords(classTeacherResps);
+            response.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+            response.setMessage(ReturnCodeEnum.CODE_200.getValue());
+            response.setTotal(count);
+            return response;
+        }
+        return response;
     }
 }

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

@@ -16,6 +16,7 @@ import com.ym.mec.education.resp.StudentAttendanceResq;
 import com.ym.mec.education.service.IClassGroupService;
 import com.ym.mec.education.service.ICourseScheduleService;
 import com.ym.mec.education.service.IStudentAttendanceService;
+import com.ym.mec.education.utils.DateUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -70,7 +71,8 @@ public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceM
             courseScheduleQueryWrapper.lambda().eq(true, CourseSchedule::getClassGroupId, studentAttendanceReq.getClassGroupId());
             CourseSchedule courseSchedule = courseScheduleService.getOne(courseScheduleQueryWrapper);
             ClassGroup classGroup = groupService.getById(studentAttendanceReq.getClassGroupId());
-            studentAttendanceResq.setClassDate(courseSchedule.getClassDate())
+            studentAttendanceResq.setClassDate(DateUtil.date2String(courseSchedule.getClassDate())
+                    + "" + DateUtil.date2Week(courseSchedule.getClassDate()))
                     .setClassTime(courseSchedule.getStartClassTime() + "-" + courseSchedule.getEndClassTime())
                     .setClassGroupName(classGroup.getName())
                     .setLeaveNum(leaveCount).setAttendanceRate(normalCount + "/" + totalCount);

+ 0 - 41
mec-education/src/main/java/com/ym/mec/education/service/impl/StudentRegistrationServiceImpl.java

@@ -1,25 +1,11 @@
 package com.ym.mec.education.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-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.education.base.PageResponse;
-import com.ym.mec.education.entity.StudentAttendance;
 import com.ym.mec.education.entity.StudentRegistration;
-import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.education.mapper.StudentRegistrationMapper;
-import com.ym.mec.education.req.ClassGroupReq;
-import com.ym.mec.education.resp.StudentRegistrationResp;
-import com.ym.mec.education.service.IStudentAttendanceService;
 import com.ym.mec.education.service.IStudentRegistrationService;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
-
 /**
  * <p>
  * 学生报名表 服务实现类
@@ -30,31 +16,4 @@ import java.util.List;
  */
 @Service
 public class StudentRegistrationServiceImpl extends ServiceImpl<StudentRegistrationMapper, StudentRegistration> implements IStudentRegistrationService {
-
-    @Autowired
-    private IStudentAttendanceService studentAttendanceService;
-
-    @Override
-    public PageResponse getPage(ClassGroupReq classGroupReq) {
-        Page<StudentRegistration> studentRegistrationPage = new Page<>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
-        QueryWrapper<StudentRegistration> studentRegistrationQueryWrapper = new QueryWrapper<>();
-        studentRegistrationQueryWrapper.lambda().eq(true, StudentRegistration::getClassGroupId, classGroupReq.getGroupId());
-        IPage<StudentRegistration> page = page(studentRegistrationPage, studentRegistrationQueryWrapper);
-        Page<StudentRegistrationResp> studentRegistrationRespPage = new Page<>();
-        BeanUtils.copyProperties(page, studentRegistrationRespPage);
-        List<StudentRegistrationResp> list = Lists.newArrayList();
-        page.getRecords().forEach(item -> {
-            QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
-            //请假 旷课正常上课次数
-            queryWrapper.lambda().eq(true, StudentAttendance::getUserId, item.getUserId())
-                    .in(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.TRUANT.getCode(),
-                            StudentAttendanceStatusEnum.LEAVE.getCode());
-            int count = studentAttendanceService.count(queryWrapper);
-            StudentRegistrationResp studentRegistrationResp = new StudentRegistrationResp()
-                    .setStudentName(item.getName()).setStudentAttendance("连续缺到" + count + "次");
-            list.add(studentRegistrationResp);
-        });
-        studentRegistrationRespPage.setRecords(list);
-        return PageResponse.success(studentRegistrationRespPage);
-    }
 }

+ 61 - 0
mec-education/src/main/java/com/ym/mec/education/utils/DateUtil.java

@@ -0,0 +1,61 @@
+package com.ym.mec.education.utils;
+
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * @program: mec
+ * @description: 时间工具类
+ * @author: xw
+ * @create: 2019-09-26 21:22
+ */
+public class DateUtil {
+
+    private static final String DATE_FORMAT = "MM月dd日";
+    private static ThreadLocal<DateFormat> threadLocal = new ThreadLocal<DateFormat>();
+
+    public static DateFormat getDateFormat(String dateFormat) {
+        DateFormat df = threadLocal.get();
+        if (df == null) {
+            df = new SimpleDateFormat(dateFormat);
+            threadLocal.set(df);
+        }
+        return df;
+    }
+
+    public static String date2String(Date date) {
+        DateFormat dateFormat = getDateFormat(DATE_FORMAT);
+        String format = dateFormat.format(date);
+        if (format.startsWith(BigDecimal.ZERO.toString())) {
+            format = format.substring(1);
+        }
+        return format;
+    }
+
+    public static String date2Week(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int i = calendar.get(Calendar.DAY_OF_WEEK);
+        switch (i) {
+            case 1:
+                return "星期日";
+            case 2:
+                return "星期一";
+            case 3:
+                return "星期二";
+            case 4:
+                return "星期三";
+            case 5:
+                return "星期四";
+            case 6:
+                return "星期五";
+            case 7:
+                return "星期六";
+            default:
+                return "";
+        }
+    }
+}