zouxuan hace 4 años
padre
commit
2e9ff336ad
Se han modificado 21 ficheros con 483 adiciones y 46 borrados
  1. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java
  2. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java
  3. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java
  4. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java
  5. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseGroupExportDto.java
  6. 101 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseScheduleStudentListDto.java
  7. 8 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Student.java
  8. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/CourseScheduleStudentPaymentQueryInfo.java
  9. 15 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleStudentPaymentService.java
  10. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/NotifyCallback.java
  11. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentManageService.java
  12. 71 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java
  13. 68 23
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java
  14. 19 0
      mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml
  15. 16 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml
  16. 7 0
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  17. 17 0
      mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml
  18. 56 0
      mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleStudentPaymentController.java
  19. 14 2
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  20. 34 17
      mec-web/src/main/java/com/ym/mec/web/controller/StudentManageController.java
  21. 5 1
      mec-web/src/main/java/com/ym/mec/web/controller/SysUserContractsController.java

+ 4 - 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;
@@ -153,6 +154,9 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
     List<StudentAttendanceViewDto> findStudentByCourseWithPage(Map<String, Object> params);
     int countStudentByCourseWithPage(Map<String, Object> params);
 
+    List<CourseScheduleStudentPayment> queryAll(Map<String, Object> params);
+    int countAll(Map<String, Object> params);
+
     /**
      * 查找班级学生对应关系
      *

+ 10 - 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,13 @@ 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);
 }

+ 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;
+    }
+}

+ 8 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Student.java

@@ -2,10 +2,17 @@ package com.ym.mec.biz.dal.entity;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
+import com.ym.mec.auth.api.entity.SysUser;
+
 /**
  * 对应数据库表(student):
  */
-public class Student {
+public class Student extends SysUser {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -5869690088559659057L;
 
 	/**  */
 	private Integer userId;

+ 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;
+    }
+}

+ 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);

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

@@ -5,6 +5,7 @@ import java.util.Map;
 
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.biz.dal.entity.Student;
 import com.ym.mec.biz.dal.page.MusicGroupStudentQueryInfo;
 import com.ym.mec.biz.dal.page.StudentManageAttendanceQueryInfo;
 import com.ym.mec.biz.dal.page.StudentManageCourseQueryInfo;
@@ -140,7 +141,7 @@ public interface StudentManageService {
      * @param sysUser
      * @return
      */
-    int studentUpdate(SysUser sysUser);
+    int studentUpdate(Student student);
 
     /**
      * 获取激活比例

+ 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 = classGroupStudentMapperDao.countAll(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			List<CourseScheduleStudentPayment> courseScheduleStudentPayments = classGroupStudentMapperDao.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;
+	}
 }

+ 68 - 23
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -1,12 +1,67 @@
 package com.ym.mec.biz.service.impl;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupQuitDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao;
+import com.ym.mec.biz.dal.dao.StudentManageDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.SubjectChangeDao;
+import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
+import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dao.VipGroupDao;
+import com.ym.mec.biz.dal.dto.BasicUserDto;
+import com.ym.mec.biz.dal.dto.ConditionDto;
+import com.ym.mec.biz.dal.dto.MusicCardDto;
+import com.ym.mec.biz.dal.dto.MusicGroupStudentSignDto;
+import com.ym.mec.biz.dal.dto.MusicGroupStudentsDto;
+import com.ym.mec.biz.dal.dto.SimpleUserDto;
+import com.ym.mec.biz.dal.dto.Student4operating;
+import com.ym.mec.biz.dal.dto.StudentManageAccountBaseInfoDto;
+import com.ym.mec.biz.dal.dto.StudentManageBaseInfoOfMusicGroupDto;
+import com.ym.mec.biz.dal.dto.StudentManageCourseListDto;
+import com.ym.mec.biz.dal.dto.StudentManageListDto;
+import com.ym.mec.biz.dal.dto.StudentManageVipGroupClassDto;
+import com.ym.mec.biz.dal.dto.StudentManageVipGroupDto;
+import com.ym.mec.biz.dal.dto.StudentRegisterPerDto;
+import com.ym.mec.biz.dal.dto.UserGoodsDto;
+import com.ym.mec.biz.dal.entity.MusicGroupQuit;
+import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
-import com.ym.mec.biz.dal.page.*;
+import com.ym.mec.biz.dal.page.MusicGroupStudentQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageAttendanceQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageCourseQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageVipClassQueryInfo;
+import com.ym.mec.biz.dal.page.StudentOperatingQueryInfo;
+import com.ym.mec.biz.dal.page.StudentSignQueryInfo;
+import com.ym.mec.biz.dal.page.TeacherPaymentRecordInfo;
 import com.ym.mec.biz.service.StudentManageService;
 import com.ym.mec.biz.service.StudentService;
 import com.ym.mec.common.entity.ImResult;
@@ -15,15 +70,6 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.util.collection.MapUtil;
-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;
-import org.springframework.util.CollectionUtils;
-
-import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * @Author Joburgess
@@ -473,24 +519,23 @@ public class StudentManageServiceImpl implements StudentManageService {
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public int studentUpdate(SysUser sysUser) {
-        Integer userId = sysUser.getId();
-        if (userId == null || StringUtils.isEmpty(sysUser.getPhone())) {
+    public int studentUpdate(Student student) {
+        Integer userId = student.getId();
+        if (userId == null || StringUtils.isEmpty(student.getPhone())) {
             throw new BizException("参数校验失败");
         }
-        SysUser sysUser1 = sysUserFeignService.queryUserByMobile(sysUser.getPhone());
+        SysUser sysUser1 = sysUserFeignService.queryUserByMobile(student.getPhone());
         if (sysUser1 != null && !userId.equals(sysUser1.getId())) {
             throw new BizException("手机号已被占用");
         }
-        teacherDao.updateUser(sysUser);
-        Student student = new Student(userId, studentRegistrationDao.getSubjectIds(userId));
-        student.setOperatingTag(sysUser.getOperatingTag());
+        teacherDao.updateUser(student);
+        student.setOperatingTag(student.getOperatingTag());
         student.setOperatingTempTag(0);
-        student.setServiceTag(sysUser.getServiceTag() == 0 ? 2 : 1);
-        student.setTeacherId(sysUser.getTeacherId());
+        student.setServiceTag(student.getServiceTag() == 0 ? 2 : 1);
+        student.setTeacherId(student.getTeacherId());
         studentService.upSet(student);
         if (new Integer(2).equals(student.getServiceTag())) {
-            studentExtracurricularExercisesSituationDao.deleteByStudent(sysUser.getId());
+            studentExtracurricularExercisesSituationDao.deleteByStudent(student.getId());
         }
         return userId;
     }

+ 19 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -531,4 +531,23 @@
         ) t
         LEFT JOIN sys_user su ON t.educational_teacher_id_=su.id_
     </select>
+
+    <sql id="queryAllCondition">
+        <where>
+            <if test="courseScheduleId != null">
+                course_schedule_id_ = #{courseScheduleId}
+            </if>
+        </where>
+    </sql>
+
+    <select id="queryAll" resultMap="ClassGroupStudentMapper">
+        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>

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

@@ -507,4 +507,20 @@
 			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>
 </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>

+ 17 - 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,22 @@
             </if>
         </where>
     </select>
+
+    <select id="getUserSimpleInfo" 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);
+    }
+
+}

+ 14 - 2
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -105,6 +105,8 @@ public class ExportController extends BaseController {
     private TeacherService teacherService;
     @Autowired
     private MusicGroupBuildLogDao musicGroupBuildLogDao;
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 
     @ApiOperation(value = "学员考勤记录导出")
     @PostMapping("export/exportStudentAttendances")
@@ -1266,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());
@@ -1295,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");

+ 34 - 17
mec-web/src/main/java/com/ym/mec/web/controller/StudentManageController.java

@@ -1,30 +1,47 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dto.UpdateStudentFeeDto;
-import com.ym.mec.biz.dal.entity.Employee;
-import com.ym.mec.biz.dal.page.*;
-import com.ym.mec.biz.service.*;
-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.QueryInfo;
-import io.swagger.annotations.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+import java.util.Arrays;
+import java.util.List;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Arrays;
-import java.util.List;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.dto.UpdateStudentFeeDto;
+import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.page.MusicGroupStudentQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageAttendanceQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageCourseQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageVipClassQueryInfo;
+import com.ym.mec.biz.dal.page.StudentOperatingQueryInfo;
+import com.ym.mec.biz.dal.page.StudentSignQueryInfo;
+import com.ym.mec.biz.dal.page.TeacherPaymentRecordInfo;
+import com.ym.mec.biz.service.MusicGroupStudentFeeService;
+import com.ym.mec.biz.service.StudentCourseHomeworkService;
+import com.ym.mec.biz.service.StudentManageService;
+import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.StudentService;
+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.QueryInfo;
 
 @Api(tags = "学生管理")
 @RestController
@@ -93,8 +110,8 @@ public class StudentManageController extends BaseController {
     @ApiOperation(value = "修改学员信息")
     @PostMapping("/studentUpdate")
     @PreAuthorize("@pcs.hasPermissions('studentManage/studentUpdate')")
-    public Object studentUpdate(SysUser sysUser){
-        return succeed(studentManageService.studentUpdate(sysUser));
+    public Object studentUpdate(Student student){
+        return succeed(studentManageService.studentUpdate(student));
     }
 
     @ApiOperation(value = "乐团管理--乐团详情--获取学员列表")

+ 5 - 1
mec-web/src/main/java/com/ym/mec/web/controller/SysUserContractsController.java

@@ -1,8 +1,10 @@
 package com.ym.mec.web.controller;
 
 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;
@@ -20,7 +22,9 @@ public class SysUserContractsController extends BaseController {
 	@Autowired
 	private SysUserContractsService sysUserContractsService;
 	
-	@GetMapping("/getLatest")
+    @ApiOperation(value = "查询学生最新协议")
+    @GetMapping("/getLatest")
+    @PreAuthorize("@pcs.hasPermissions('sysUserContracts/getLatest')")
 	public HttpResponseResult<SysUserContracts> getLatest(Integer userId) {
 		
 		SysUserContracts sysUserContracts = sysUserContractsService.getLatestUserContract(userId);