Joburgess 4 lat temu
rodzic
commit
fbd528a264

+ 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 Integer subjectId;
+
+    @ApiModelProperty(value = "声部名称")
+    private String subjectName;
+
+    @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 Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public String getSubjectName() {
+        return subjectName;
+    }
+
+    public void setSubjectName(String subjectName) {
+        this.subjectName = subjectName;
+    }
+
+    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;
+    }
+}

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

+ 42 - 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,12 @@ 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;
 
 	@Override
 	public BaseDAO<Long, CourseScheduleStudentPayment> getDAO() {
@@ -264,4 +279,31 @@ 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));
+			for (Student student : students) {
+				if(StringUtils.isBlank(student.getSubjectIdList())){
+					continue;
+				}
+				List<Integer> collect = Arrays.stream(student.getSubjectIdList().split(",")).mapToInt(Integer::valueOf).boxed().collect(Collectors.toList());
+			}
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
 }

+ 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_,

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

@@ -102,6 +102,8 @@ public class ExportController extends BaseController {
     private TeacherService teacherService;
     @Autowired
     private MusicGroupBuildLogDao musicGroupBuildLogDao;
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 
     @ApiOperation(value = "乐团管理--修改--缴费设置--缴费记录导出")
     @PostMapping("export/musicGroupPaymentCalenderDetail")
@@ -1213,11 +1215,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 +1254,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");