Browse Source

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

yonge 4 years ago
parent
commit
e209d24570
21 changed files with 779 additions and 8 deletions
  1. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java
  2. 13 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java
  3. 15 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentAttendanceDao.java
  4. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java
  5. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java
  6. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseGroupExportDto.java
  7. 101 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseScheduleStudentListDto.java
  8. 198 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ExportStudentAttendanceDto.java
  9. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/CourseScheduleStudentPaymentQueryInfo.java
  10. 45 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/ExportStudentAttendanceQueryInfo.java
  11. 15 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleStudentPaymentService.java
  12. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/NotifyCallback.java
  13. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentAttendanceService.java
  14. 71 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java
  15. 21 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java
  16. 35 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml
  17. 69 0
      mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml
  18. 7 0
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  19. 18 0
      mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml
  20. 56 0
      mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleStudentPaymentController.java
  21. 68 3
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
+import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -8,6 +8,7 @@ import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -325,4 +326,16 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      * @return
      */
     List<RongyunBasicUserDto> queryNoJoinStu(@Param("roomId") String roomId, @Param("courseScheduleId") String courseScheduleId);
+
+    /**
+     * @describe 获取指定学员的最后一节课时间
+     * @author Joburgess
+     * @date 2020/11/17 0017
+     * @param StudentIds:
+     * @return java.util.List<java.util.Map<java.lang.Integer,java.util.Date>>
+     */
+    List<Map<Integer, Date>> findStudentLastCourseSchedule(@Param("studentIds") List<Integer> StudentIds);
+
+    List<CourseScheduleStudentPayment> queryAll(Map<String, Object> params);
+    int countAll(Map<String, Object> params);
 }

+ 15 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentAttendanceDao.java

@@ -1,9 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
-import com.ym.mec.biz.dal.dto.StudentAttendanceResponse;
-import com.ym.mec.biz.dal.dto.StudentAttendanceStatusCountDto;
-import com.ym.mec.biz.dal.dto.StudentPersonalAttendanceDto;
-import com.ym.mec.biz.dal.dto.StudentStatusCountUtilEntity;
+import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.StudentAttendance;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
@@ -296,4 +293,18 @@ public interface StudentAttendanceDao extends BaseDAO<Long, StudentAttendance> {
      * @return java.lang.Long
      */
     Long findFirstSign(@Param("courseScheduleId") Long courseScheduleId, @Param("userId") Integer userId);
+
+    /**
+     * 学员考勤记录导出查询
+     * @param params
+     * @return
+     */
+    int countExportStudentAttendancesQueryPage(Map<String, Object> params);
+
+    /**
+     * 学员考勤记录导出查询
+     * @param params
+     * @return
+     */
+    List<ExportStudentAttendanceDto> exportStudentAttendancesQueryPage(Map<String, Object> params);
 }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java

@@ -17,6 +17,8 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
 
     int lockUser(@Param("userId") Integer userId);
 
+    List<Student> findByStudentIds(@Param("studentIds") List<Integer> studentIds);
+
     SysUser lockUserReturnInfo(@Param("userId") Integer userId);
 
     List<SysUser> findStudents(Map<String, Object> params);

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java

@@ -92,6 +92,8 @@ public interface TeacherDao extends BaseDAO<Integer, Teacher> {
      */
     List<SimpleUserDto> findSimpleTeachers(@Param("userIds") List<Integer> userIds);
 
+    List<SimpleUserDto> getUsersSimpleInfo(@Param("userIds") List<Integer> userIds);
+
     /**
      * @param organId:   分部编号
      * @param subjectId: 声部编号列表

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseGroupExportDto.java

@@ -17,6 +17,7 @@ public class CourseGroupExportDto {
     private Date expireDate;
     private Date classStartDate;
     private Date classEndDate;
+    private Date lastClassDate;
     private Integer totalClassTimes = 0;
     private Integer noStartClassTimes = 0;
     //是否购买
@@ -30,6 +31,14 @@ public class CourseGroupExportDto {
         this.buyPractice = buyPractice;
     }
 
+    public Date getLastClassDate() {
+        return lastClassDate;
+    }
+
+    public void setLastClassDate(Date lastClassDate) {
+        this.lastClassDate = lastClassDate;
+    }
+
     public String getOrganName() {
         return organName;
     }

+ 101 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseScheduleStudentListDto.java

@@ -0,0 +1,101 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2020/11/17 0017
+ */
+public class CourseScheduleStudentListDto {
+
+    @ApiModelProperty(value = "学员编号")
+    private Integer studentId;
+
+    @ApiModelProperty(value = "学员名称")
+    private String studentName;
+
+    @ApiModelProperty(value = "声部编号")
+    private String subjectIds;
+
+    @ApiModelProperty(value = "声部名称")
+    private String subjectNames;
+
+    @ApiModelProperty(value = "手机号")
+    private String phone;
+
+    @ApiModelProperty(value = "签到时间")
+    private Date signInTime;
+
+    @ApiModelProperty(value = "签退时间")
+    private Date signOutTime;
+
+    @ApiModelProperty(value = "状态(正常、旷课、请假、休学)",required = false)
+    private StudentAttendanceStatusEnum status;
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public String getStudentName() {
+        return studentName;
+    }
+
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
+    }
+
+    public String getSubjectIds() {
+        return subjectIds;
+    }
+
+    public void setSubjectIds(String subjectIds) {
+        this.subjectIds = subjectIds;
+    }
+
+    public String getSubjectNames() {
+        return subjectNames;
+    }
+
+    public void setSubjectNames(String subjectNames) {
+        this.subjectNames = subjectNames;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public Date getSignInTime() {
+        return signInTime;
+    }
+
+    public void setSignInTime(Date signInTime) {
+        this.signInTime = signInTime;
+    }
+
+    public Date getSignOutTime() {
+        return signOutTime;
+    }
+
+    public void setSignOutTime(Date signOutTime) {
+        this.signOutTime = signOutTime;
+    }
+
+    public StudentAttendanceStatusEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(StudentAttendanceStatusEnum status) {
+        this.status = status;
+    }
+}

+ 198 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ExportStudentAttendanceDto.java

@@ -0,0 +1,198 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.dal.enums.SignInStatusEnum;
+import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author zouxuan
+ */
+public class ExportStudentAttendanceDto {
+    @ApiModelProperty(value = "分部编号", required = true)
+    private String organId;
+
+    @ApiModelProperty(value = "分部名称", required = true)
+    private String organName;
+
+    @ApiModelProperty(value = "课程类型", required = true)
+    private GroupType groupType;
+
+    @ApiModelProperty(value = "学生姓名", required = true)
+    private String username;
+
+    @ApiModelProperty(value = "学生编号", required = true)
+    private String userId;
+
+    @ApiModelProperty(value = "课程组编号", required = true)
+    private String groupId;
+
+    @ApiModelProperty(value = "课程组名称", required = true)
+    private String groupName;
+
+    @ApiModelProperty(value = "课程编号", required = true)
+    private Long courseScheduleId;
+
+    @ApiModelProperty(value = "课程名称", required = true)
+    private String courseScheduleName;
+
+    @ApiModelProperty(value = "上课时间", required = true)
+    private String classDate;
+
+    @ApiModelProperty(value = "上课开始时间", required = true)
+    private String startClassTime;
+
+    @ApiModelProperty(value = "上课结束时间", required = true)
+    private String endClassTime;
+
+    @ApiModelProperty(value = "指导老师名称", required = true)
+    private String guideTeacherName;
+
+    @ApiModelProperty(value = "指导老师编号", required = true)
+    private Integer guideTeacherId;
+
+    @ApiModelProperty(value = "教务老师编号", required = true)
+    private Integer educationalTeacherId;
+
+    @ApiModelProperty(value = "教务老师名称", required = true)
+    private String educationalTeacherName;
+
+    @ApiModelProperty(value = "学员考勤状态", required = true)
+    private StudentAttendanceStatusEnum studentAttendanceStatus;
+
+    public String getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(String organId) {
+        this.organId = organId;
+    }
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
+    public GroupType getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(GroupType groupType) {
+        this.groupType = groupType;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    public String getGroupName() {
+        return groupName;
+    }
+
+    public void setGroupName(String groupName) {
+        this.groupName = groupName;
+    }
+
+    public Long getCourseScheduleId() {
+        return courseScheduleId;
+    }
+
+    public void setCourseScheduleId(Long courseScheduleId) {
+        this.courseScheduleId = courseScheduleId;
+    }
+
+    public String getCourseScheduleName() {
+        return courseScheduleName;
+    }
+
+    public void setCourseScheduleName(String courseScheduleName) {
+        this.courseScheduleName = courseScheduleName;
+    }
+
+    public String getClassDate() {
+        return classDate;
+    }
+
+    public void setClassDate(String classDate) {
+        this.classDate = classDate;
+    }
+
+    public String getStartClassTime() {
+        return startClassTime;
+    }
+
+    public void setStartClassTime(String startClassTime) {
+        this.startClassTime = startClassTime;
+    }
+
+    public String getEndClassTime() {
+        return endClassTime;
+    }
+
+    public void setEndClassTime(String endClassTime) {
+        this.endClassTime = endClassTime;
+    }
+
+    public String getGuideTeacherName() {
+        return guideTeacherName;
+    }
+
+    public void setGuideTeacherName(String guideTeacherName) {
+        this.guideTeacherName = guideTeacherName;
+    }
+
+    public Integer getGuideTeacherId() {
+        return guideTeacherId;
+    }
+
+    public void setGuideTeacherId(Integer guideTeacherId) {
+        this.guideTeacherId = guideTeacherId;
+    }
+
+    public Integer getEducationalTeacherId() {
+        return educationalTeacherId;
+    }
+
+    public void setEducationalTeacherId(Integer educationalTeacherId) {
+        this.educationalTeacherId = educationalTeacherId;
+    }
+
+    public String getEducationalTeacherName() {
+        return educationalTeacherName;
+    }
+
+    public void setEducationalTeacherName(String educationalTeacherName) {
+        this.educationalTeacherName = educationalTeacherName;
+    }
+
+    public StudentAttendanceStatusEnum getStudentAttendanceStatus() {
+        return studentAttendanceStatus;
+    }
+
+    public void setStudentAttendanceStatus(StudentAttendanceStatusEnum studentAttendanceStatus) {
+        this.studentAttendanceStatus = studentAttendanceStatus;
+    }
+}

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/CourseScheduleStudentPaymentQueryInfo.java

@@ -0,0 +1,22 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2020/11/17 0017
+ */
+public class CourseScheduleStudentPaymentQueryInfo extends QueryInfo {
+
+    @ApiModelProperty(value = "课程编号")
+    private Integer courseScheduleId;
+
+    public Integer getCourseScheduleId() {
+        return courseScheduleId;
+    }
+
+    public void setCourseScheduleId(Integer courseScheduleId) {
+        this.courseScheduleId = courseScheduleId;
+    }
+}

+ 45 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/ExportStudentAttendanceQueryInfo.java

@@ -0,0 +1,45 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+
+public class ExportStudentAttendanceQueryInfo extends QueryInfo {
+    private String organId;
+
+    private String groupType = "MUSIC";
+
+    private String classStartDate;
+
+    private String classEndDate;
+
+    public String getClassStartDate() {
+        return classStartDate;
+    }
+
+    public void setClassStartDate(String classStartDate) {
+        this.classStartDate = classStartDate;
+    }
+
+    public String getClassEndDate() {
+        return classEndDate;
+    }
+
+    public void setClassEndDate(String classEndDate) {
+        this.classEndDate = classEndDate;
+    }
+
+    public String getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(String organId) {
+        this.organId = organId;
+    }
+
+    public String getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(String groupType) {
+        this.groupType = groupType;
+    }
+}

+ 15 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleStudentPaymentService.java

@@ -1,8 +1,14 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.dto.CourseScheduleStudentListDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
+import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
+import com.ym.mec.biz.dal.page.CourseScheduleStudentPaymentQueryInfo;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
+import org.snaker.engine.access.Page;
 
 import java.util.List;
 
@@ -54,4 +60,13 @@ public interface CourseScheduleStudentPaymentService extends BaseService<Long, C
 	 */
 	void updateVipGiveCourse(Long vipGroupId);
 
+	/**
+	 * @describe 查询课程上学员列表
+	 * @author Joburgess
+	 * @date 2020/11/17 0017
+	 * @param queryInfo:
+	 * @return com.ym.mec.common.page.PageInfo<com.ym.mec.biz.dal.dto.CourseScheduleStudentListDto>
+	 */
+	PageInfo<CourseScheduleStudentListDto> queryCourseStudentList(CourseScheduleStudentPaymentQueryInfo queryInfo);
+
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/NotifyCallback.java

@@ -214,7 +214,7 @@ public class NotifyCallback implements MQTTCallbackHandler {
         hfMember.setStatus("succeeded");
         hfMember.setMemo(corpMemberObj.getString("audit_desc"));
         if (corpMemberObj.containsKey("audit_state") && corpMemberObj.getString("audit_state").equals("E")) {
-            JSONObject accounts = JSON.parseObject(corpMemberObj.get("settle_accounts").toString());
+            JSONObject accounts = JSON.parseObject(corpMemberObj.getString("settle_accounts"));
             hfMember.setSettleAccountId(accounts.getString("id"));
         }
         notifyCallback.hfMemberDao.update(hfMember);

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentAttendanceService.java

@@ -1,12 +1,14 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.CourseScheduleResponse;
+import com.ym.mec.biz.dal.dto.ExportStudentAttendanceDto;
 import com.ym.mec.biz.dal.dto.StudentAttendanceDto;
 import com.ym.mec.biz.dal.dto.StudentPersonalAttendanceDto;
 import com.ym.mec.biz.dal.entity.StudentAttendance;
 import com.ym.mec.biz.dal.enums.SignStatusEnum;
 import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo;
+import com.ym.mec.biz.dal.page.ExportStudentAttendanceQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
@@ -119,4 +121,12 @@ public interface StudentAttendanceService extends BaseService<Long, StudentAtten
 	 * @param userId
 	 */
 	void cleanCourseStudentSignOut(Long courseId, Integer userId);
+
+	/**
+	 * 学员考勤导出列表
+	 * @author zouxuan
+	 * @param queryInfo
+	 * @return
+	 */
+	PageInfo<ExportStudentAttendanceDto> exportStudentAttendancesQueryPage(ExportStudentAttendanceQueryInfo queryInfo);
 }

+ 71 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -1,15 +1,24 @@
 package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.CourseScheduleStudentListDto;
+import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.dto.VipGroupGiveCourseSortDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
+import com.ym.mec.biz.dal.page.CourseScheduleStudentPaymentQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
 import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.collection.MapUtil;
+import io.swagger.models.auth.In;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -34,6 +43,14 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 	private ClassGroupStudentMapperDao classGroupStudentMapperDao;
 	@Autowired
 	private SysUserCashAccountService sysUserCashAccountService;
+	@Autowired
+	private StudentAttendanceDao studentAttendanceDao;
+	@Autowired
+	private TeacherDao teacherDao;
+	@Autowired
+	private StudentDao studentDao;
+	@Autowired
+	private SubjectDao subjectDao;
 
 	@Override
 	public BaseDAO<Long, CourseScheduleStudentPayment> getDAO() {
@@ -264,4 +281,58 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 			courseScheduleStudentPaymentDao.batchUpdate(needUpdatePayments);
 		}
 	}
+
+	@Override
+	public PageInfo<CourseScheduleStudentListDto> queryCourseStudentList(CourseScheduleStudentPaymentQueryInfo queryInfo) {
+		PageInfo<CourseScheduleStudentListDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+
+		List<CourseScheduleStudentListDto> dataList = new ArrayList<>();
+		int count = courseScheduleStudentPaymentDao.countAll(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			List<CourseScheduleStudentPayment> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.queryAll(params);
+			Set<Integer> studentIds = courseScheduleStudentPayments.stream().map(CourseScheduleStudentPayment::getUserId).collect(Collectors.toSet());
+			List<StudentAttendance> studentAttendances = studentAttendanceDao.findByCourseId(queryInfo.getCourseScheduleId().longValue());
+			List<SimpleUserDto> usersSimpleInfo = teacherDao.getUsersSimpleInfo(new ArrayList<>(studentIds));
+			List<Student> students = studentDao.findByStudentIds(new ArrayList<>(studentIds));
+			Set<Integer> subjectIds = new HashSet<>();
+			for (Student student : students) {
+				if(StringUtils.isBlank(student.getSubjectIdList())){
+					continue;
+				}
+				Set<Integer> studentSubjectIds = Arrays.stream(student.getSubjectIdList().split(",")).mapToInt(Integer::valueOf).boxed().collect(Collectors.toSet());
+				subjectIds.addAll(studentSubjectIds);
+			}
+			List<Subject> subjects = new ArrayList<>();
+			if(!CollectionUtils.isEmpty(subjectIds)){
+				subjects = subjectDao.findBySubjectIds(new ArrayList<>(subjectIds));
+			}
+			Map<Integer, StudentAttendance> studentAttendanceMap = studentAttendances.stream().collect(Collectors.toMap(StudentAttendance::getUserId, s -> s, (s1, s2) -> s1));
+			Map<Integer, SimpleUserDto> studentInfoMap = usersSimpleInfo.stream().collect(Collectors.toMap(SimpleUserDto::getUserId, s -> s, (s1, s2) -> s1));
+			Map<Integer, Student> studentMap = students.stream().collect(Collectors.toMap(Student::getUserId, s -> s, (s1, s2) -> s1));
+			for (CourseScheduleStudentPayment courseScheduleStudentPayment : courseScheduleStudentPayments) {
+				CourseScheduleStudentListDto cssld=new CourseScheduleStudentListDto();
+				cssld.setStudentId(courseScheduleStudentPayment.getUserId());
+				cssld.setPhone(studentInfoMap.containsKey(cssld.getStudentId())?studentInfoMap.get(cssld.getStudentId()).getPhone():"");
+				cssld.setSubjectIds(studentMap.containsKey(cssld.getStudentId())?studentMap.get(cssld.getStudentId()).getSubjectIdList():"");
+				if(StringUtils.isNotBlank(cssld.getSubjectIds())){
+					Set<Integer> studentSubjectIds = Arrays.stream(cssld.getSubjectIds().split(",")).mapToInt(Integer::valueOf).boxed().collect(Collectors.toSet());
+					List<String> subjectNames = subjects.stream().filter(s -> studentSubjectIds.contains(s.getId())).map(Subject::getName).collect(Collectors.toList());
+					cssld.setSubjectNames(StringUtils.join(subjectNames, ","));
+				}
+				if(studentAttendanceMap.containsKey(cssld.getStudentId())){
+					StudentAttendance studentAttendance = studentAttendanceMap.get(cssld.getStudentId());
+					cssld.setSignInTime(studentAttendance.getSignInTime());
+					cssld.setSignOutTime(studentAttendance.getSignOutTime());
+					cssld.setStatus(studentAttendance.getStatus());
+				}
+				dataList.add(cssld);
+			}
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
 }

+ 21 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo;
+import com.ym.mec.biz.dal.page.ExportStudentAttendanceQueryInfo;
 import com.ym.mec.biz.dal.page.StudentAttendanceQueryInfo;
 import com.ym.mec.biz.service.StudentAttendanceService;
 import com.ym.mec.biz.service.SysConfigService;
@@ -692,4 +693,24 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
     public void cleanCourseStudentSignOut(Long courseId, Integer userId) {
         studentAttendanceDao.cleanCourseStudentSignOut(courseId, userId);
     }
+
+    @Override
+    public PageInfo<ExportStudentAttendanceDto> exportStudentAttendancesQueryPage(ExportStudentAttendanceQueryInfo queryInfo) {
+        PageInfo<ExportStudentAttendanceDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+
+        List<ExportStudentAttendanceDto> dataList = null;
+        int count = studentAttendanceDao.countExportStudentAttendancesQueryPage(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = studentAttendanceDao.exportStudentAttendancesQueryPage(params);
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
 }

+ 35 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -507,4 +507,39 @@
 			AND cssp.music_group_id_ = #{groupId}
 			AND CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) > NOW( )
 	</select>
+
+	<select id="findStudentLastCourseSchedule" resultType="java.util.Map">
+		SELECT
+			cssp.user_id_ AS 'key',
+			MAX(CONCAT( cs.class_date_, ' ', cs.start_class_time_ )) AS 'value'
+		FROM
+			course_schedule_student_payment cssp
+		LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
+		WHERE
+			cssp.user_id_ IN
+			<foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+				#{studentId}
+			</foreach>
+			AND CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) &lt; NOW( )
+		GROUP BY user_id_;
+	</select>
+
+	<sql id="queryAllCondition">
+		<where>
+			<if test="courseScheduleId != null">
+				course_schedule_id_ = #{courseScheduleId}
+			</if>
+		</where>
+	</sql>
+
+	<select id="queryAll" resultMap="CourseScheduleStudentPayment">
+		SELECT * FROM course_schedule_student_payment
+		<include refid="queryAllCondition" />
+		ORDER BY id_
+		<include refid="global.limit"/>
+	</select>
+	<select id="countAll" resultType="int">
+		SELECT COUNT(*) FROM course_schedule_student_payment
+		<include refid="queryAllCondition" />
+	</select>
 </mapper>

+ 69 - 0
mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -515,4 +515,73 @@
         WHERE sa.current_schedule_id_ = #{courseScheduleId} AND sa.user_id_ = #{userId}
         AND sa.sign_in_time_ IS NOT NULL ORDER BY sa.sign_in_time_ ASC LIMIT 1
     </select>
+    <resultMap id="ExportStudentAttendanceDtoMap" type="com.ym.mec.biz.dal.dto.ExportStudentAttendanceDto">
+        <result property="classDate" column="class_date_"/>
+        <result property="courseScheduleId" column="course_schedule_id_"/>
+        <result property="courseScheduleName" column="course_schedule_name_"/>
+        <result property="educationalTeacherId" column="educational_teacher_id_"/>
+        <result property="educationalTeacherName" column="educational_teacher_name_"/>
+        <result property="endClassTime" column="end_class_time_"/>
+        <result property="groupId" column="music_group_id_"/>
+        <result property="groupName" column="music_group_name_"/>
+        <result property="groupType" column="group_type_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result property="guideTeacherId" column="guide_teacher_id_"/>
+        <result property="guideTeacherName" column="guide_teacher_name_"/>
+        <result property="organId" column="organ_id_"/>
+        <result property="organName" column="organ_name_"/>
+        <result property="startClassTime" column="start_class_time_"/>
+        <result property="studentAttendanceStatus" column="attendance_status_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result property="userId" column="user_id_"/>
+        <result property="username" column="username_"/>
+    </resultMap>
+    <select id="countExportStudentAttendancesQueryPage" resultType="java.lang.Integer">
+        SELECT COUNT(cssp.id_)
+        FROM course_schedule_student_payment cssp
+        LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
+        <include refid="exportStudentAttendancesQueryPageSql"/>
+    </select>
+    <sql id="exportStudentAttendancesQueryPageSql">
+        <where>
+            <if test="organId != null">
+                AND FIND_IN_SET(cs.organ_id_,#{organId})
+            </if>
+            <if test="groupType != null">
+                AND cssp.group_type_ = #{groupType}
+            </if>
+            <if test="classStartDate != null and classStartDate != ''">
+                AND cs.class_date_ >= #{classStartDate}
+            </if>
+            <if test="classEndDate != null and classEndDate != ''">
+                AND cs.class_date_ &lt;= #{classEndDate}
+            </if>
+        </where>
+    </sql>
+    <select id="exportStudentAttendancesQueryPage"
+            resultMap="ExportStudentAttendanceDtoMap">
+        SELECT o.name_ organ_name_,o.id_ organ_id_,cs.music_group_id_,mg.name_ music_group_name_,su.username_,cssp.user_id_,
+        cs.name_ course_schedule_name_,cs.id_ course_schedule_id_,
+        cs.class_date_,cs.start_class_time_,cs.end_class_time_,su2.real_name_ guide_teacher_name_,st.teacher_id_ guide_teacher_id_
+        ,su1.real_name_ educational_teacher_name_,mg.educational_teacher_id_,cs.group_type_,
+        CASE WHEN sa.id_ IS NULL THEN 'TRUANT' ELSE sa.status_ END attendance_status_
+        FROM course_schedule_student_payment cssp
+        LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
+        LEFT JOIN student_attendance sa ON cssp.course_schedule_id_ = sa.course_schedule_id_
+        <if test="groupType == 'MUSIC'">
+            LEFT JOIN music_group mg ON mg.id_ = cssp.music_group_id_
+        </if>
+        <if test="groupType == 'VIP'">
+            LEFT JOIN vip_group mg ON mg.id_ = cssp.music_group_id_
+        </if>
+        <if test="groupType == 'PRACTICE'">
+            LEFT JOIN practice_group mg ON mg.id_ = cssp.music_group_id_
+        </if>
+        LEFT JOIN sys_user su1 ON su1.id_ = mg.educational_teacher_id_
+        LEFT JOIN organization o ON o.id_ = cs.organ_id_
+        LEFT JOIN student st ON st.user_id_ = cssp.user_id_
+        LEFT JOIN sys_user su ON su.id_ = cssp.user_id_
+        LEFT JOIN sys_user su2 ON su2.id_ = st.teacher_id_
+        <include refid="exportStudentAttendancesQueryPageSql"/>
+        ORDER BY cssp.music_group_id_ DESC,cssp.id_ DESC
+        <include refid="global.limit"/>
+    </select>
 </mapper>

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -517,4 +517,11 @@
             #{id}
         </foreach>
     </select>
+
+    <select id="findByStudentIds" resultMap="Student">
+        SELECT * FROM student WHERE user_id_ IN
+        <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+            #{studentId}
+        </foreach>
+    </select>
 </mapper>

+ 18 - 0
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -373,6 +373,7 @@
             </if>
         </where>
     </select>
+
     <select id="findSimpleTeachers" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
         SELECT su.id_ userId,su.real_name_ userName FROM sys_user su
         LEFT JOIN teacher t ON su.id_=t.id_
@@ -385,6 +386,23 @@
             </if>
         </where>
     </select>
+
+    <select id="getUsersSimpleInfo" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
+        SELECT
+            su.id_ userId,
+            su.real_name_ userName,
+            su.phone_ phone
+        FROM sys_user su
+        <where>
+            <if test="userIds != null">
+                su.id_ IN
+                <foreach collection="userIds" separator="," open="(" close=")" item="item">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
     <select id="findTeaTeachersByOrganAndSubject" resultMap="TeacherBasicDto">
         SELECT
             su.id_,

+ 56 - 0
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleStudentPaymentController.java

@@ -0,0 +1,56 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.dal.dto.CourseScheduleStudentListDto;
+import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
+import com.ym.mec.biz.dal.page.CourseScheduleStudentPaymentQueryInfo;
+import com.ym.mec.biz.dal.page.CourseScheduleTeacherSalaryQueryInfo;
+import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.page.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * @Author Joburgess
+ * @Date 2020/11/17 0017
+ */
+@RestController
+@RequestMapping("courseScheduleStudentPayment")
+@Api(tags = "学生课程之缴费记录服务")
+public class CourseScheduleStudentPaymentController extends BaseController {
+
+    @Autowired
+    private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
+
+    @ApiOperation(value = "分页查询指定课程上的学员")
+    @GetMapping("/queryCourseStudentList")
+    @PreAuthorize("@pcs.hasPermissions('courseScheduleStudentPayment/queryCourseStudentList')")
+    public HttpResponseResult queryCourseStudentList(CourseScheduleStudentPaymentQueryInfo queryInfo) {
+        PageInfo<CourseScheduleStudentListDto> pageInfo = courseScheduleStudentPaymentService.queryCourseStudentList(queryInfo);
+        List<CourseScheduleStudentListDto> courseScheduleStudentList = pageInfo.getRows();
+
+        Map<String, Integer> countInfo = new HashMap<>();
+        countInfo.put("totalStudentNum", courseScheduleStudentList.size());
+        countInfo.put("signInStudentNum", (int) courseScheduleStudentList.stream().filter(s -> Objects.nonNull(s.getSignInTime())).count());
+        countInfo.put("leaveStudentNum", (int) courseScheduleStudentList.stream().filter(s -> StudentAttendanceStatusEnum.LEAVE.equals(s.getStatus())).count());
+        countInfo.put("truantStudentNum", (int) courseScheduleStudentList.stream().filter(s -> StudentAttendanceStatusEnum.TRUANT.equals(s.getStatus())).count());
+
+        Map<String, Object> result = new HashMap<>();
+        result.put("pageInfo", pageInfo);
+        result.put("countInfo", countInfo);
+
+        return succeed(result);
+    }
+
+}

+ 68 - 3
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -12,6 +12,7 @@ import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.excel.POIUtil;
@@ -85,6 +86,8 @@ public class ExportController extends BaseController {
     @Autowired
     private TeacherAttendanceService teacherAttendanceService;
     @Autowired
+    private StudentAttendanceService studentAttendanceService;
+    @Autowired
     private TeacherCourseRewardService teacherCourseRewardService;
     @Autowired
     private DegreeRegistrationService degreeRegistrationService;
@@ -102,11 +105,63 @@ public class ExportController extends BaseController {
     private TeacherService teacherService;
     @Autowired
     private MusicGroupBuildLogDao musicGroupBuildLogDao;
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
+
+    @ApiOperation(value = "学员考勤记录导出")
+    @PostMapping("export/exportStudentAttendances")
+    @PreAuthorize("@pcs.hasPermissions('export/exportStudentAttendances')")
+    public void exportStudentAttendances(HttpServletResponse response, ExportStudentAttendanceQueryInfo queryInfo) throws IOException {
+        queryInfo.setPage(1);
+        queryInfo.setRows(49999);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        if (!sysUser.getIsSuperAdmin()) {
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+                queryInfo.setOrganId(employee.getOrganIdList());
+            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+                throw new BizException("用户所在分部异常");
+            } else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                    throw new BizException("非法请求");
+                }
+            }
+        }
+        List<ExportStudentAttendanceDto> rows = studentAttendanceService.exportStudentAttendancesQueryPage(queryInfo).getRows();
+        OutputStream outputStream = response.getOutputStream();
+        try {
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部编号", "分部名称", "课程组类型", "课程组编号", "课程组名称", "学员姓名",
+                    "学员编号", "课程编号", "课程名称", "上课日期", "上课开始时间","上课结束时间","指导老师名称","指导老师编号","教务老师名称","教务老师编号","学员考勤状态"}, new String[]{
+                    "organId", "organName", "groupType.desc", "groupId", "groupName", "username",
+                    "userId", "courseScheduleId", "courseScheduleName", "classDate", "startClassTime", "endClassTime", "guideTeacherName", "guideTeacherId"
+                    , "educationalTeacherName", "educationalTeacherId", "studentAttendanceStatus.msg"}, rows);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=studentAttendance-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+            outputStream.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 
     @ApiOperation(value = "乐团管理--修改--缴费设置--缴费记录导出")
     @PostMapping("export/musicGroupPaymentCalenderDetail")
     @PreAuthorize("@pcs.hasPermissions('export/musicGroupPaymentCalenderDetail')")
-    public void exportTeacherAttendances(HttpServletResponse response, MusicCalenderDetailQueryInfo queryInfo) throws IOException {
+    public void exportMusicGroupPaymentCalenderDetail(HttpServletResponse response, MusicCalenderDetailQueryInfo queryInfo) throws IOException {
         queryInfo.setPage(1);
         queryInfo.setRows(49999);
         List<MusicGroupPaymentCalenderDetail> rows = musicGroupPaymentCalenderDetailService.queryPage(queryInfo).getRows();
@@ -1213,11 +1268,21 @@ public class ExportController extends BaseController {
         }
         OutputStream outputStream = response.getOutputStream();
         Set<Integer> studentIds = vipGroupExports.stream().map(CourseGroupExportDto::getStudentId).collect(Collectors.toSet());
+        List<Map<Integer, Date>> studentLastCourseSchedule = courseScheduleStudentPaymentDao.findStudentLastCourseSchedule(new ArrayList<>(studentIds));
+        Map<Integer, String> studentLastCourseMap = new HashMap<>();
+        if(!CollectionUtils.isEmpty(studentLastCourseSchedule)){
+            studentLastCourseMap = MapUtil.convertMybatisMap(studentLastCourseSchedule);
+        }
         List<CourseGroupExportDto> studentCourseInfos = courseScheduleDao.getStudentVipCourseInfo(studentIds);
         List<CourseGroupExportDto> totalClassTimes = courseScheduleDao.getStudentCourseScheduleNum(studentIds, GroupType.VIP, null);
         List<CourseGroupExportDto> noStartClassTimes = courseScheduleDao.getStudentCourseScheduleNum(studentIds, GroupType.VIP, CourseStatusEnum.NOT_START);
         for (CourseGroupExportDto vipGroupExport : vipGroupExports) {
 
+            String lastClassDateStr = studentLastCourseMap.get(vipGroupExport.getStudentId());
+            if(StringUtils.isNotBlank(lastClassDateStr)){
+                vipGroupExport.setLastClassDate(DateUtil.stringToDate(lastClassDateStr));
+            }
+
             for (CourseGroupExportDto studentCourseInfo : studentCourseInfos) {
                 if (studentCourseInfo.getStudentId().equals(vipGroupExport.getStudentId())) {
                     vipGroupExport.setTeacherIds(studentCourseInfo.getTeacherIds());
@@ -1242,8 +1307,8 @@ public class ExportController extends BaseController {
         }
 
         try {
-            String[] header = {"分部", "学生编号", "学生姓名", "指导老师id", "指导老师", "教务老师id", "教务老师", "课程开始时间", "课程截止时间", "总课时", "剩余课时"};
-            String[] body = {"organName", "studentId", "studentName", "teacherIds", "teacherName", "eduTeacherIds", "eduTeacherName", "classStartDate", "classEndDate", "totalClassTimes", "noStartClassTimes"};
+            String[] header = {"分部", "学生编号", "学生姓名", "指导老师id", "指导老师", "教务老师id", "教务老师", "课程开始时间", "课程截止时间", "上次课时间", "总课时", "剩余课时"};
+            String[] body = {"organName", "studentId", "studentName", "teacherIds", "teacherName", "eduTeacherIds", "eduTeacherName", "classStartDate", "classEndDate", "lastClassDate", "totalClassTimes", "noStartClassTimes"};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, vipGroupExports);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");