Ver Fonte

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

yonge há 5 anos atrás
pai
commit
d21e3b1574
23 ficheiros alterados com 418 adições e 56 exclusões
  1. 10 1
      mec-education/src/main/java/com/ym/mec/education/base/BaseResponse.java
  2. 44 0
      mec-education/src/main/java/com/ym/mec/education/controller/ClassGroupController.java
  3. 5 26
      mec-education/src/main/java/com/ym/mec/education/controller/MusicGroupController.java
  4. 11 10
      mec-education/src/main/java/com/ym/mec/education/controller/StudentAttendanceController.java
  5. 36 0
      mec-education/src/main/java/com/ym/mec/education/enums/ClassGroupStudentStatusEnum.java
  6. 36 0
      mec-education/src/main/java/com/ym/mec/education/enums/ClassGroupTypeEnum.java
  7. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/ClassGroupStudentMapperMapper.java
  8. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/CourseScheduleMapper.java
  9. 18 0
      mec-education/src/main/java/com/ym/mec/education/req/ClassGroupReq.java
  10. 0 1
      mec-education/src/main/java/com/ym/mec/education/req/MusicGroupReq.java
  11. 15 0
      mec-education/src/main/java/com/ym/mec/education/resp/ClassGroupResp.java
  12. 27 4
      mec-education/src/main/java/com/ym/mec/education/resp/MusicGroupResp.java
  13. 37 0
      mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceResq.java
  14. 4 0
      mec-education/src/main/java/com/ym/mec/education/service/IClassGroupService.java
  15. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/IClassGroupStudentMapperService.java
  16. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleService.java
  17. 2 1
      mec-education/src/main/java/com/ym/mec/education/service/IMusicGroupService.java
  18. 4 0
      mec-education/src/main/java/com/ym/mec/education/service/IStudentAttendanceService.java
  19. 44 0
      mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupServiceImpl.java
  20. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupStudentMapperServiceImpl.java
  21. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java
  22. 57 6
      mec-education/src/main/java/com/ym/mec/education/service/impl/MusicGroupServiceImpl.java
  23. 62 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/StudentAttendanceServiceImpl.java

+ 10 - 1
mec-education/src/main/java/com/ym/mec/education/base/BaseResponse.java

@@ -1,5 +1,6 @@
 package com.ym.mec.education.base;
 
+import com.ym.mec.education.enums.ReturnCodeEnum;
 import javax.persistence.MappedSuperclass;
 import java.io.Serializable;
 
@@ -28,4 +29,12 @@ public class BaseResponse<T> extends Response implements Serializable {
     public String toString() {
         return "BaseResponse(super=" + super.toString() + ", dataInfo=" + this.getDataInfo() + ")";
     }
-}
+
+    public static BaseResponse success(Object dataInfo) {
+        BaseResponse baseResponse = new BaseResponse<>();
+        baseResponse.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+        baseResponse.setMessage(ReturnCodeEnum.CODE_200.getValue());
+        baseResponse.setDataInfo(dataInfo);
+        return baseResponse;
+    }
+}

+ 44 - 0
mec-education/src/main/java/com/ym/mec/education/controller/ClassGroupController.java

@@ -0,0 +1,44 @@
+package com.ym.mec.education.controller;
+
+import com.ym.mec.education.base.BaseResponse;
+import com.ym.mec.education.enums.ReturnCodeEnum;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.service.IClassGroupService;
+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 java.util.Objects;
+
+/**
+ * @program: mec
+ * @description: 班级
+ * @author: xw
+ * @create: 2019-09-26 14:03
+ */
+@RestController
+@RequestMapping("api/ClassGroup")
+@Api(tags = "班级")
+@Slf4j
+public class ClassGroupController {
+
+    @Autowired
+    private IClassGroupService classGroupService;
+
+    @PostMapping("/info")
+    @ApiOperation("班级详情")
+    public BaseResponse getInfo(@RequestBody ClassGroupReq classGroupReq) {
+        if (Objects.nonNull(classGroupReq.getClassGroupId())) {
+            BaseResponse baseResponse = new BaseResponse();
+            baseResponse.setReturnCode(ReturnCodeEnum.CODE_206.getCode());
+            baseResponse.setMessage(ReturnCodeEnum.CODE_206.getValue());
+            return baseResponse;
+        }
+        return classGroupService.getInfo(classGroupReq);
+    }
+}

+ 5 - 26
mec-education/src/main/java/com/ym/mec/education/controller/MusicGroupController.java

@@ -1,34 +1,16 @@
 package com.ym.mec.education.controller;
 
-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.google.common.collect.Lists;
 import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
 import com.ym.mec.education.base.BaseResponse;
 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.CourseScheduleTeacherSalary;
-import com.ym.mec.education.entity.MusicGroup;
 import com.ym.mec.education.enums.ReturnCodeEnum;
+import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.req.MusicGroupReq;
-import com.ym.mec.education.resp.MusicGroupResp;
-import com.ym.mec.education.service.IClassGroupService;
-import com.ym.mec.education.service.IClassGroupTeacherMapperService;
-import com.ym.mec.education.service.ICourseScheduleTeacherSalaryService;
 import com.ym.mec.education.service.IMusicGroupService;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
 
 /**
  * @author : chengp
@@ -75,7 +57,7 @@ public class MusicGroupController {
      * @return
      */
     @GetMapping(value = "/groupDetail")
-    public BaseResponse groupDetail(@RequestBody Integer groupId) {
+    public BaseResponse groupDetail(@RequestParam("groupId") Integer groupId) {
 
         BaseResponse baseResponse = new BaseResponse();
         if (groupId == null) {
@@ -87,13 +69,10 @@ public class MusicGroupController {
         return musicGroupService.groupDetail(groupId);
 
     }
-    @GetMapping(value = "/classGroupList")
-    public PageResponse classGroupList(@RequestBody Integer groupId){
-
-
-
+    @PostMapping(value = "/classGroupList")
+    public PageResponse classGroupList(@RequestBody ClassGroupReq req){
 
-        return null;
+        return musicGroupService.classGroupList(req);
 
     }
 

+ 11 - 10
mec-education/src/main/java/com/ym/mec/education/controller/StudentAttendanceController.java

@@ -1,8 +1,14 @@
 package com.ym.mec.education.controller;
 
+import com.ym.mec.education.base.PageResponse;
+import com.ym.mec.education.req.StudentAttendanceReq;
 import com.ym.mec.education.service.IStudentAttendanceService;
+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;
 
@@ -14,22 +20,17 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 @RequestMapping("api/studentAttendance")
+@Api(tags = "学生考勤")
 @Slf4j
 public class StudentAttendanceController {
 
     @Autowired
     private IStudentAttendanceService studentAttendanceService;
 
-    /*@PostMapping("/page")
+    @PostMapping("/page")
+    @ApiOperation("点名记录列表")
     public PageResponse page(@RequestBody StudentAttendanceReq studentAttendanceReq) {
-        Page<StudentAttendance> page = new Page(studentAttendanceReq.getPageNo(), studentAttendanceReq.getPageSize());
-        QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(Objects.nonNull(studentAttendanceReq.getMusicGroupId()),
-                StudentAttendance::getMusicGroupId, studentAttendanceReq.getMusicGroupId())
-                .eq(Objects.nonNull(studentAttendanceReq.getClassGroupId()),
-                        StudentAttendance::getClassGroupId, studentAttendanceReq.getClassGroupId());
-        IPage<StudentAttendance> pageResult = studentAttendanceService.page(page, queryWrapper);
-        return PageResponse.success(pageResult);
-    }*/
+        return studentAttendanceService.getPage(studentAttendanceReq);
+    }
 
 }

+ 36 - 0
mec-education/src/main/java/com/ym/mec/education/enums/ClassGroupStudentStatusEnum.java

@@ -0,0 +1,36 @@
+package com.ym.mec.education.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+/**
+ * 班级类型(普通班级、合奏班级)
+ */
+public enum ClassGroupStudentStatusEnum implements BaseEnum<String, ClassGroupStudentStatusEnum> {
+	NORMAL("NORMAL", "在读"), LEAVE("LEAVE", "请假"), QUIT("QUIT", "退学");
+
+	private String code;
+
+	private String msg;
+
+	ClassGroupStudentStatusEnum(String code, String msg) {
+		this.code = code;
+		this.msg = msg;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	@Override
+	public String getCode() {
+		return this.code;
+	}
+}

+ 36 - 0
mec-education/src/main/java/com/ym/mec/education/enums/ClassGroupTypeEnum.java

@@ -0,0 +1,36 @@
+package com.ym.mec.education.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+/**
+ * 班级类型
+ */
+public enum ClassGroupTypeEnum implements BaseEnum<String, ClassGroupTypeEnum> {
+	NORMAL("NORMAL", "普通班级"), MIX("MIX", "合奏班级"), HIGH("HIGH", "提高班"), VIP("VIP", "vip课"), DEMO("demo", "试听课");
+
+	private String code;
+
+	private String msg;
+
+	ClassGroupTypeEnum(String code, String msg) {
+		this.code = code;
+		this.msg = msg;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	@Override
+	public String getCode() {
+		return this.code;
+	}
+}

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

@@ -1,6 +1,6 @@
 package com.ym.mec.education.mapper;
 
-import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
 
 /**

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

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

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

@@ -0,0 +1,18 @@
+package com.ym.mec.education.req;
+
+import com.ym.mec.education.base.BaseQuery;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author : chengp
+ * @version V1.0
+ * @Description: TODO
+ * @date Date : 2019年09月26日 15:43
+ */
+@Data
+@ApiModel(description = "班级入参")
+public class ClassGroupReq extends BaseQuery implements Serializable {
+    private Integer groupId;
+}

+ 0 - 1
mec-education/src/main/java/com/ym/mec/education/req/MusicGroupReq.java

@@ -2,7 +2,6 @@ package com.ym.mec.education.req;
 
 import com.ym.mec.education.base.BaseQuery;
 import lombok.Data;
-import java.io.Serializable;
 
 /**
  * @version V1.0

+ 15 - 0
mec-education/src/main/java/com/ym/mec/education/resp/ClassGroupResp.java

@@ -1,5 +1,7 @@
 package com.ym.mec.education.resp;
 
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.ToString;
 
@@ -16,6 +18,7 @@ import java.util.List;
 
 @Data
 @ToString
+@ApiModel(description = "班级出参")
 public class ClassGroupResp implements Serializable {
     private Integer id;
     private Integer musicGroupId;
@@ -59,4 +62,16 @@ public class ClassGroupResp implements Serializable {
 
     private List<String> secdTehNameList;
 
+    @ApiModelProperty(value = "授课老师",required = true)
+    private String teacher;
+
+    @ApiModelProperty(value = "授课老师",required = true)
+    private String assistant;
+
+    @ApiModelProperty(value = "课程进度",required = true)
+    private String courseProgress;
+
+    @ApiModelProperty(value = "班级名称",required = true)
+    private String classGroupName;
+
 }

+ 27 - 4
mec-education/src/main/java/com/ym/mec/education/resp/MusicGroupResp.java

@@ -93,12 +93,35 @@ public class MusicGroupResp implements Serializable {
      */
     private Date parentMeetingTime;
 
-    private Integer studentNum;
+    /**
+     * 学生数
+     */
+    private Integer studentNum = 0 ;
+
+    /**
+     * 老师数量
+     */
+    private Integer teacherNum = 0;
 
-    private Integer teacherNum;
 
-    private BigDecimal payments;
+    /**
+     * 合排
+     */
+    private Integer mergeClassNum = 0;
 
-    private BigDecimal income;
+    /**
+     * 单技能
+     */
+    private Integer unitClassNum = 0;
+
+    /**
+     * 在读
+     */
+    private Integer liveStudNum = 0;
+
+    /**
+     * 退学
+     */
+    private Integer delStudNum = 0;
 
 }

+ 37 - 0
mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceResq.java

@@ -0,0 +1,37 @@
+package com.ym.mec.education.resp;
+
+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
+ * @description: 考勤出参
+ * @author: xw
+ * @create: 2019-09-26 15:24
+ */
+@Data
+@ApiModel(description = "考勤出参")
+@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 classTime;
+
+    @ApiModelProperty(value = "班级名称",required = true)
+    private String classGroupName;
+
+    @ApiModelProperty(value = "到课比",required = true)
+    private String attendanceRate;
+
+    @ApiModelProperty(value = "请假人数",required = true)
+    private Integer leaveNum;
+}

+ 4 - 0
mec-education/src/main/java/com/ym/mec/education/service/IClassGroupService.java

@@ -1,7 +1,10 @@
 package com.ym.mec.education.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.entity.ClassGroup;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.resp.ClassGroupResp;
 
 /**
  * <p>
@@ -13,4 +16,5 @@ import com.ym.mec.education.entity.ClassGroup;
  */
 public interface IClassGroupService extends IService<ClassGroup> {
 
+    BaseResponse<ClassGroupResp> getInfo(ClassGroupReq classGroupReq);
 }

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

@@ -1,6 +1,6 @@
 package com.ym.mec.education.service;
 
-import com.baomidou.mybatisplus.service.IService;
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
 
 /**

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

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

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.MusicGroup;
+import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.req.MusicGroupReq;
 
 /**
@@ -21,5 +22,5 @@ public interface IMusicGroupService extends IService<MusicGroup> {
 
     BaseResponse groupDetail(Integer groupId);
 
-    PageResponse classGroupList(Integer groupId);
+    PageResponse classGroupList(ClassGroupReq req);
 }

+ 4 - 0
mec-education/src/main/java/com/ym/mec/education/service/IStudentAttendanceService.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.StudentAttendance;
+import com.ym.mec.education.req.StudentAttendanceReq;
 
 /**
  * <p>
@@ -13,4 +15,6 @@ import com.ym.mec.education.entity.StudentAttendance;
  */
 public interface IStudentAttendanceService extends IService<StudentAttendance> {
 
+    PageResponse getPage(StudentAttendanceReq studentAttendanceReq);
+
 }

+ 44 - 0
mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupServiceImpl.java

@@ -1,10 +1,23 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.entity.ClassGroup;
+import com.ym.mec.education.entity.ClassGroupTeacherMapper;
+import com.ym.mec.education.enums.ReturnCodeEnum;
 import com.ym.mec.education.mapper.ClassGroupMapper;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.resp.ClassGroupResp;
 import com.ym.mec.education.service.IClassGroupService;
+import com.ym.mec.education.service.IClassGroupTeacherMapperService;
+import com.ym.mec.education.service.ISysUserService;
+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;
 
 /**
  * <p>
@@ -17,4 +30,35 @@ import org.springframework.stereotype.Service;
 @Service
 public class ClassGroupServiceImpl extends ServiceImpl<ClassGroupMapper, ClassGroup> implements IClassGroupService {
 
+    @Autowired
+    private IClassGroupTeacherMapperService classGroupTeacherMapperService;
+    @Autowired
+    private ISysUserService userService;
+
+    @Override
+    public BaseResponse<ClassGroupResp> getInfo(ClassGroupReq classGroupReq) {
+        BaseResponse<ClassGroupResp> baseResponse = new BaseResponse<>();
+        ClassGroup classGroup = getById(classGroupReq.getClassGroupId());
+        if (Objects.isNull(classGroup)) {
+            baseResponse.setReturnCode(ReturnCodeEnum.CODE_207.getCode());
+            baseResponse.setMessage(ReturnCodeEnum.CODE_207.getValue());
+            return baseResponse;
+        }
+        QueryWrapper<ClassGroupTeacherMapper> teacherMapperQueryWrapper = new QueryWrapper<>();
+        teacherMapperQueryWrapper.lambda().eq(true, ClassGroupTeacherMapper::getClassGroupId, classGroupReq.getClassGroupId());
+        ClassGroupResp classGroupResp = new ClassGroupResp();
+        List<ClassGroupTeacherMapper> teacherMapperList = classGroupTeacherMapperService.list(teacherMapperQueryWrapper);
+        if (!CollectionUtils.isEmpty(teacherMapperList)) {
+            teacherMapperList.stream().filter(item -> "TEACHING".equals(item.getTeacherRole())).findFirst().
+                    ifPresent(classGroupTeacherMapper -> classGroupResp.
+                            setTeacher(userService.getById(classGroupTeacherMapper.getUserId()).getUsername()));
+            teacherMapperList.stream().filter(item -> "BISHOP".equals(item.getTeacherRole())).findFirst().
+                    ifPresent(classGroupTeacherMapper -> classGroupResp.
+                            setAssistant(userService.getById(classGroupTeacherMapper.getUserId()).getUsername()));
+        }
+        classGroupResp.setStudentNum(classGroup.getStudentNum());
+        classGroupResp.setCourseProgress(classGroup.getCurrentClassTimes() + "/" + classGroup.getTotalClassTimes());
+        classGroupResp.setClassGroupName(classGroup.getName());
+        return BaseResponse.success(classGroupResp);
+    }
 }

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

@@ -1,6 +1,6 @@
 package com.ym.mec.education.service.impl;
 
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
 import com.ym.mec.education.mapper.ClassGroupStudentMapperMapper;
 import com.ym.mec.education.service.IClassGroupStudentMapperService;

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.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.CourseSchedule;
 import com.ym.mec.education.mapper.CourseScheduleMapper;
 import com.ym.mec.education.service.ICourseScheduleService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 /**

+ 57 - 6
mec-education/src/main/java/com/ym/mec/education/service/impl/MusicGroupServiceImpl.java

@@ -8,21 +8,25 @@ 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.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.MusicGroupResp;
 import com.ym.mec.education.service.*;
-import io.swagger.models.auth.In;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 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.stream.Collectors;
 
 /**
@@ -50,11 +54,20 @@ public class MusicGroupServiceImpl extends ServiceImpl<MusicGroupMapper, MusicGr
 
     @Autowired
     private ISysUserService sysUserService;
+
+    @Autowired
+    private IClassGroupStudentMapperService classGroupStudentMapperService;
+
+
     @Override
     public PageResponse groupList(MusicGroupReq req) {
         PageResponse response = new PageResponse();
-        IPage page = new Page();
+        IPage page = new Page(req.getPageNo()==null? 0: req.getPageNo(),req.getPageSize() == null ? 10:req.getPageSize());
         QueryWrapper<MusicGroup> queryWrapper = new QueryWrapper<>();
+        if(req != null && !StringUtils.isEmpty(req.getName())){
+            queryWrapper.eq("name_",req.getName());
+        }
+
         IPage<MusicGroup> queryPage = this.page(page, queryWrapper);
         if (queryPage.getRecords() == null && queryPage.getRecords().isEmpty()) {
             response.setReturnCode(ReturnCodeEnum.CODE_206.getCode());
@@ -125,23 +138,61 @@ public class MusicGroupServiceImpl extends ServiceImpl<MusicGroupMapper, MusicGr
         if (!CollectionUtils.isEmpty(classGroups)) {
             int studNum = classGroups.stream().mapToInt(ClassGroup::getStudentNum).sum();
             musicGroupResp.setStudentNum(studNum);
+
+            Long mergeNum = classGroups.stream().filter(e -> ClassGroupTypeEnum.MIX.getCode().equalsIgnoreCase(e.getType())).count();
+
+            Long unitClassNum = classGroups.stream().filter(e -> ClassGroupTypeEnum.NORMAL.getCode().equalsIgnoreCase(e.getType())).count();
+            musicGroupResp.setMergeClassNum(Optional.ofNullable(mergeNum).orElse(0L).intValue());
+            musicGroupResp.setUnitClassNum(Optional.ofNullable(unitClassNum).orElse(0L).intValue());
+
+
+            List<Integer> classId = classGroups.stream().map(e ->e.getId()).collect(Collectors.toList());
+            QueryWrapper<ClassGroupStudentMapper> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.in("class_group_id_", classId);
+
+            List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperService.list(queryWrapper2);
+
+            if(!CollectionUtils.isEmpty(classGroupStudentMappers)){
+
+                Long liveNum = classGroups.stream().filter(e -> ClassGroupStudentStatusEnum.NORMAL.getCode().equalsIgnoreCase(e.getType())).count();
+
+                Long delNum = classGroups.stream().filter(e -> ClassGroupStudentStatusEnum.QUIT.getCode().equalsIgnoreCase(e.getType())).count();
+                musicGroupResp.setLiveStudNum(Optional.ofNullable(liveNum).orElse(0L).intValue());
+                musicGroupResp.setDelStudNum(Optional.ofNullable(delNum).orElse(0L).intValue());
+
+            }
         }
+        //老师
+        SysUser  sysUser1 = sysUserService.getById(musicGroup.getTeamTeacherId());
 
+        SysUser  sysUser2 = sysUserService.getById(musicGroup.getTeamTeacherId());
+        if(sysUser1 != null){
+            musicGroupResp.setTeamTeacherName(sysUser1.getUsername());
+        }
+        if(sysUser2 != null){
+            musicGroupResp.setEduTeacherName(sysUser2.getUsername());
+        }
+        baseResponse.setDataInfo(musicGroupResp);
+        baseResponse.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+        baseResponse.setMessage(ReturnCodeEnum.CODE_200.getValue());
         return baseResponse;
     }
 
     /**
      * 班级列表
-     * @param groupId
+     * @param
      * @return
      */
     @Override
-    public PageResponse classGroupList(Integer groupId) {
+    public PageResponse classGroupList(ClassGroupReq req) {
 
         PageResponse response = new PageResponse();
-        IPage page = new Page();
+        IPage page = new Page(req.getPageNo()==null? 0: req.getPageNo(),req.getPageSize() == null ? 10:req.getPageSize());
         QueryWrapper<ClassGroup> queryWrapper1 = new QueryWrapper<>();
-        queryWrapper1.eq("music_group_id_", groupId);
+        if(req != null && req.getGroupId() != null){
+            queryWrapper1.eq("music_group_id_", req.getGroupId());
+        }
+
         IPage<ClassGroup> classGroupPage = classGroupService.page(page,queryWrapper1);
         int count = classGroupService.count(queryWrapper1);
         if (classGroupPage.getRecords() == null && classGroupPage.getRecords().isEmpty()) {

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

@@ -1,10 +1,25 @@
 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.CourseSchedule;
 import com.ym.mec.education.entity.StudentAttendance;
 import com.ym.mec.education.mapper.StudentAttendanceMapper;
+import com.ym.mec.education.req.StudentAttendanceReq;
+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 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>
@@ -14,7 +29,53 @@ import org.springframework.stereotype.Service;
  * @author lemeng
  * @since 2019-09-25
  */
-@Service
+@Service("iStudentAttendanceService")
 public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceMapper, StudentAttendance> implements IStudentAttendanceService {
 
+    @Autowired
+    private ICourseScheduleService courseScheduleService;
+    @Autowired
+    private IClassGroupService groupService;
+
+    @Override
+    public PageResponse getPage(StudentAttendanceReq studentAttendanceReq) {
+        Page<StudentAttendance> pageParam = new Page(studentAttendanceReq.getPageNo(), studentAttendanceReq.getPageSize());
+        QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(Objects.nonNull(studentAttendanceReq.getMusicGroupId()),
+                StudentAttendance::getMusicGroupId, studentAttendanceReq.getMusicGroupId())
+                .eq(Objects.nonNull(studentAttendanceReq.getClassGroupId()),
+                        StudentAttendance::getClassGroupId, studentAttendanceReq.getClassGroupId());
+        IPage<StudentAttendance> page = page(pageParam, queryWrapper);
+        IPage<StudentAttendanceResq> pageResult = new Page<>();
+        BeanUtils.copyProperties(page, pageResult);
+        List<StudentAttendanceResq> list = Lists.newArrayList();
+        QueryWrapper<StudentAttendance> leaveWrapper = new QueryWrapper<>();
+        QueryWrapper<StudentAttendance> normalWrapper = new QueryWrapper<>();
+        //总人数
+        Integer totalCount = count();
+        //请假
+        leaveWrapper.lambda().eq(true, StudentAttendance::getMusicGroupId, studentAttendanceReq.getMusicGroupId())
+                .eq(true, StudentAttendance::getClassGroupId, studentAttendanceReq.getClassGroupId())
+                .eq(true, StudentAttendance::getStatus, "LEAVE");
+        Integer leaveCount = count(leaveWrapper);
+        //正常
+        normalWrapper.lambda().eq(true, StudentAttendance::getMusicGroupId, studentAttendanceReq.getMusicGroupId())
+                .eq(true, StudentAttendance::getClassGroupId, studentAttendanceReq.getClassGroupId())
+                .eq(true, StudentAttendance::getStatus, "NORMAL");
+        Integer normalCount = count(normalWrapper);
+        page.getRecords().forEach(item ->{
+            StudentAttendanceResq studentAttendanceResq = new StudentAttendanceResq();
+            QueryWrapper<CourseSchedule> courseScheduleQueryWrapper = new QueryWrapper<>();
+            courseScheduleQueryWrapper.lambda().eq(true, CourseSchedule::getClassGroupId, studentAttendanceReq.getClassGroupId());
+            CourseSchedule courseSchedule = courseScheduleService.getOne(courseScheduleQueryWrapper);
+            ClassGroup classGroup = groupService.getById(studentAttendanceReq.getClassGroupId());
+            studentAttendanceResq.setClassDate(courseSchedule.getClassDate())
+                    .setClassTime(courseSchedule.getStartClassTime() + "-" + courseSchedule.getEndClassTime())
+                    .setClassGroupName(classGroup.getName())
+                    .setLeaveNum(leaveCount).setAttendanceRate(normalCount + "/" + totalCount);
+            list.add(studentAttendanceResq);
+        });
+        pageResult.setRecords(list);
+        return PageResponse.success(pageResult);
+    }
 }