Procházet zdrojové kódy

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

zouxuan před 4 roky
rodič
revize
67b647644f
64 změnil soubory, kde provedl 1079 přidání a 343 odebrání
  1. 0 4
      cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml
  2. 32 0
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUserDevice.java
  3. 2 7
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/filter/UsernameAuthenticationFilter.java
  4. 5 52
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/provider/PhoneAuthenticationProvider.java
  5. 5 3
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/dal/dao/SysUserDeviceDao.java
  6. 11 3
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/SysUserDeviceService.java
  7. 68 18
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysUserDeviceServiceImpl.java
  8. 1 1
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserDeviceController.java
  9. 48 34
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserDeviceMapper.xml
  10. 3 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  11. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java
  12. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentCourseHomeworkDao.java
  13. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java
  14. 25 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicCompareRecordDao.java
  15. 19 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicCompareWeekDataDao.java
  16. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicScoreDao.java
  17. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/BasicUserDto.java
  18. 14 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseHomeworkStudentDetailDto.java
  19. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ExtraExerciseStudentsDto.java
  20. 36 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicScoreSubjectDto.java
  21. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherServeHomeworkDto.java
  22. 15 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseHomework.java
  23. 17 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ExtracurricularExercises.java
  24. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ExtracurricularExercisesReply.java
  25. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImGroupMember.java
  26. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImUserFriend.java
  27. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentCourseHomework.java
  28. 130 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMusicCompareWeekData.java
  29. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/PeriodEnum.java
  30. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/TeacherServeHomeworkQueryInfo.java
  31. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseReviewService.java
  32. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SysMusicCompareWeekDataService.java
  33. 18 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseHomeworkServiceImpl.java
  34. 1 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseReviewServiceImpl.java
  35. 0 16
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  36. 22 19
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesReplyServiceImpl.java
  37. 19 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesServiceImpl.java
  38. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java
  39. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  40. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  41. 1 10
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  42. 54 48
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java
  43. 10 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java
  44. 1 10
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  45. 10 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicCompareRecordServiceImpl.java
  46. 52 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicCompareWeekDataServiceImpl.java
  47. 17 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java
  48. 6 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  49. 8 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml
  50. 0 2
      mec-biz/src/main/resources/config/mybatis/EmployeeMapper.xml
  51. 5 8
      mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesMapper.xml
  52. 0 8
      mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesReplyMapper.xml
  53. 11 4
      mec-biz/src/main/resources/config/mybatis/ImGroupMapper.xml
  54. 5 1
      mec-biz/src/main/resources/config/mybatis/ImUserFriendMapper.xml
  55. 1 31
      mec-biz/src/main/resources/config/mybatis/MemberFeeSettingMapper.xml
  56. 6 3
      mec-biz/src/main/resources/config/mybatis/StudentCourseHomeworkMapper.xml
  57. 21 0
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  58. 18 0
      mec-biz/src/main/resources/config/mybatis/SysMusicCompareRecordMapper.xml
  59. 159 0
      mec-biz/src/main/resources/config/mybatis/SysMusicCompareWeekDataMapper.xml
  60. 3 0
      mec-biz/src/main/resources/config/mybatis/SysMusicScoreMapper.xml
  61. 17 14
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/ClassGroupController.java
  62. 2 2
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/CourseReviewController.java
  63. 17 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/ExtracurricularExercisesController.java
  64. 2 1
      mec-util/src/main/java/com/ym/mec/util/collection/MapUtil.java

+ 0 - 4
cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -125,12 +125,8 @@
 			<if test="type != null">
 				type_ = #{type},
 			</if>
-			<if test="onlineTime != null">
 				online_time_ = #{onlineTime},
-			</if>
-			<if test="offlineTime != null">
 				offline_time_ = #{offlineTime},
-			</if>
 			<if test="subType != null">
 				sub_type_ = #{subType},
 			</if>

+ 32 - 0
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUserDevice.java

@@ -1,5 +1,7 @@
 package com.ym.mec.auth.api.entity;
 
+import java.util.Date;
+
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 /**
@@ -19,9 +21,15 @@ public class SysUserDevice {
 	/** 绑定时间 */
 	private java.util.Date bindTime;
 	
+	private Date updateTime;
+	
 	/** 设备类型 */
 	private String deviceType;
 	
+	private String clientId;
+	
+	private Integer delFlag;
+	
 	private SysUser user;
 	
 	public void setId(Integer id){
@@ -56,6 +64,14 @@ public class SysUserDevice {
 		return this.bindTime;
 	}
 			
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
 	public void setDeviceType(String deviceType){
 		this.deviceType = deviceType;
 	}
@@ -64,6 +80,22 @@ public class SysUserDevice {
 		return this.deviceType;
 	}
 			
+	public String getClientId() {
+		return clientId;
+	}
+
+	public void setClientId(String clientId) {
+		this.clientId = clientId;
+	}
+
+	public Integer getDelFlag() {
+		return delFlag;
+	}
+
+	public void setDelFlag(Integer delFlag) {
+		this.delFlag = delFlag;
+	}
+
 	public SysUser getUser() {
 		return user;
 	}

+ 2 - 7
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/filter/UsernameAuthenticationFilter.java

@@ -9,7 +9,6 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.security.authentication.AuthenticationServiceException;
-import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.LockedException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
@@ -94,13 +93,9 @@ public class UsernameAuthenticationFilter extends AbstractAuthenticationProcessi
 		Authentication authentication = this.getAuthenticationManager().authenticate(authRequest);
 		
 		String deviceNum = request.getParameter(deviceNumParameter);
-		if (StringUtils.isNotBlank(deviceNum) && !StringUtils.equals("STUDENT", clientId)) {
+		if (StringUtils.isNotBlank(deviceNum)) {
 			// 检查设备
-			try {
-				sysUserDeviceService.bindDevice(userInfo.getSysUser().getId(), deviceNum);
-			} catch (Exception e) {
-				throw new BadCredentialsException("当前设备已绑定账号,请更换设备");
-			}
+			sysUserDeviceService.bindDevice(clientId, userInfo.getSysUser().getId(), deviceNum);
 		}
 
 		return authentication;

+ 5 - 52
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/provider/PhoneAuthenticationProvider.java

@@ -1,9 +1,6 @@
 package com.ym.mec.auth.core.provider;
 
-import java.util.ArrayList;
 import java.util.Date;
-import java.util.List;
-import java.util.stream.Collectors;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.security.authentication.BadCredentialsException;
@@ -19,7 +16,6 @@ import org.springframework.transaction.annotation.Transactional;
 import com.ym.mec.auth.api.dto.SysUserInfo;
 import com.ym.mec.auth.api.entity.LoginEntity;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.auth.api.entity.SysUserDevice;
 import com.ym.mec.auth.config.token.PhoneAuthenticationToken;
 import com.ym.mec.auth.service.SysUserDeviceService;
 import com.ym.mec.auth.service.SysUserService;
@@ -74,26 +70,11 @@ public class PhoneAuthenticationProvider extends AbstractAuthenticationProvider
 			if (isRegister == false || StringUtils.equals("SYSTEM", clientId)) {
 				throw new LockedException("用户不存在");
 			}
+			
+			userInfo = sysUserService.initUser(loginEntity.getPhone(), clientId);
+			
 			if (StringUtils.isNotBlank(deviceNum)) {
-				
-				if(!StringUtils.equals("STUDENT", clientId)){
-					// 检查设备
-					List<SysUserDevice> sysUserDeviceList = sysUserDeviceService.queryByDeviceNum(deviceNum);
-
-					if (sysUserDeviceList != null && sysUserDeviceList.size() > 0) {
-						throw new BadCredentialsException("当前设备已绑定账号,请更换设备");
-					}
-				}
-
-				userInfo = sysUserService.initUser(loginEntity.getPhone(), clientId);
-
-				SysUserDevice sysUserDevice = new SysUserDevice();
-				sysUserDevice.setUserId(userInfo.getSysUser().getId());
-				sysUserDevice.setDeviceNum(deviceNum);
-				sysUserDevice.setBindTime(new Date());
-				sysUserDeviceService.insert(sysUserDevice);
-			} else {
-				userInfo = sysUserService.initUser(loginEntity.getPhone(), clientId);
+				sysUserDeviceService.bindDevice(clientId, userInfo.getSysUser().getId(), deviceNum);
 			}
 		} else {
 			SysUser user = userInfo.getSysUser();
@@ -102,35 +83,7 @@ public class PhoneAuthenticationProvider extends AbstractAuthenticationProvider
 			}
 			
 			if (StringUtils.isNotBlank(deviceNum)) {
-				if(StringUtils.equals("STUDENT", clientId)){
-					// 检查学生是否绑定了多个设备号
-					List<SysUserDevice> sysUserDeviceList = sysUserDeviceService.queryByUserId(user.getId());
-					
-					if(sysUserDeviceList == null){
-						sysUserDeviceList = new ArrayList<SysUserDevice>();
-					}
-					
-					List<String> deviceList = sysUserDeviceList.stream().map(t -> t.getDeviceNum()).collect(Collectors.toList());
-					
-					if(!deviceList.contains(deviceNum)){
-						if(deviceList.size() >= 5){
-							throw new BadCredentialsException("当前账号绑定设备过多,请联系主教老师");
-						}
-						SysUserDevice sysUserDevice = new SysUserDevice();
-						sysUserDevice.setUserId(userInfo.getSysUser().getId());
-						sysUserDevice.setDeviceNum(deviceNum);
-						sysUserDevice.setBindTime(new Date());
-						sysUserDeviceService.insert(sysUserDevice);
-					}
-					
-				}else{
-					// 检查老师端、教务端设备号
-					try {
-						sysUserDeviceService.bindDevice(user.getId(), deviceNum);
-					} catch (Exception e) {
-						throw new BadCredentialsException("当前设备已绑定账号,请更换设备");
-					}
-				}
+				sysUserDeviceService.bindDevice(clientId, user.getId(), deviceNum);
 			}
 			
 			if (!userInfo.getSysUser().getUserType().contains(clientId)) {

+ 5 - 3
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/dal/dao/SysUserDeviceDao.java

@@ -2,12 +2,14 @@ package com.ym.mec.auth.dal.dao;
 
 import java.util.List;
 
+import org.apache.ibatis.annotations.Param;
+
 import com.ym.mec.auth.api.entity.SysUserDevice;
 import com.ym.mec.common.dal.BaseDAO;
 
 public interface SysUserDeviceDao extends BaseDAO<Integer, SysUserDevice> {
 
-	List<SysUserDevice> queryByUserId(Integer userId);
-	
-	List<SysUserDevice> queryByDeviceNum(String deviceNum);
+	List<SysUserDevice> queryByUserId(@Param("clientId") String clientId, @Param("userId") Integer userId);
+
+	List<SysUserDevice> queryByDeviceNum(@Param("clientId") String clientId, @Param("deviceNum") String deviceNum);
 }

+ 11 - 3
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/SysUserDeviceService.java

@@ -7,15 +7,23 @@ import com.ym.mec.common.service.BaseService;
 
 public interface SysUserDeviceService extends BaseService<Integer, SysUserDevice> {
 
-	List<SysUserDevice> queryByUserId(Integer userId);
+	List<SysUserDevice> queryByUserId(String clientId, Integer userId);
 
-	List<SysUserDevice> queryByDeviceNum(String deviceNum);
+	List<SysUserDevice> queryByDeviceNum(String clientId, String deviceNum);
 
 	/**
 	 * 绑定设备号
+	 * @param clientId
 	 * @param userId
 	 * @param deviceNum
 	 * @return
 	 */
-	boolean bindDevice(Integer userId, String deviceNum) throws Exception;
+	boolean bindDevice(String clientId, Integer userId, String deviceNum);
+
+	/**
+	 * 逻辑删除
+	 * @param id
+	 * @return
+	 */
+	boolean deleteWithLogic(Integer id);
 }

+ 68 - 18
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysUserDeviceServiceImpl.java

@@ -1,9 +1,13 @@
 package com.ym.mec.auth.service.impl;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.stereotype.Service;
 
 import com.ym.mec.auth.api.entity.SysUserDevice;
@@ -24,33 +28,79 @@ public class SysUserDeviceServiceImpl extends BaseServiceImpl<Integer, SysUserDe
 	}
 
 	@Override
-	public List<SysUserDevice> queryByUserId(Integer userId) {
-		return sysUserDeviceDao.queryByUserId(userId);
+	public List<SysUserDevice> queryByUserId(String clientId, Integer userId) {
+		return sysUserDeviceDao.queryByUserId(clientId, userId);
 	}
 
 	@Override
-	public List<SysUserDevice> queryByDeviceNum(String deviceNum) {
-		return sysUserDeviceDao.queryByDeviceNum(deviceNum);
+	public List<SysUserDevice> queryByDeviceNum(String clientId, String deviceNum) {
+		return sysUserDeviceDao.queryByDeviceNum(clientId, deviceNum);
 	}
 
 	@Override
-	public boolean bindDevice(Integer userId, String deviceNum) throws Exception {
-		//查询设备号是否已存在
-		List<SysUserDevice> sysUserDeviceList = sysUserDeviceDao.queryByDeviceNum(deviceNum);
-		
-		if (sysUserDeviceList != null && sysUserDeviceList.size() > 0) {
-			if (sysUserDeviceList.stream().filter(sud -> sud.getUserId().equals(userId)).count() > 0) {
-				return true;
-			} else {
-				throw new Exception("当前设备已绑定账号,请更换设备");
+	public boolean bindDevice(String clientId, Integer userId, String deviceNum) {
+
+		if (StringUtils.equals(clientId, "STUDENT")) {
+			// 检查学生是否绑定了多个设备号
+			List<SysUserDevice> studentDeviceList = queryByUserId(clientId, userId);
+
+			if (studentDeviceList == null) {
+				studentDeviceList = new ArrayList<SysUserDevice>();
 			}
+
+			List<String> deviceList = studentDeviceList.stream().map(t -> t.getDeviceNum()).collect(Collectors.toList());
+
+			if (!deviceList.contains(deviceNum)) {
+				if (deviceList.size() >= 5) {
+					throw new BadCredentialsException("当前账号绑定设备过多,请联系主教老师");
+				}
+
+				SysUserDevice sysUserDevice = new SysUserDevice();
+				sysUserDevice.setUserId(userId);
+				sysUserDevice.setDeviceNum(deviceNum);
+				sysUserDevice.setBindTime(new Date());
+				sysUserDevice.setClientId(clientId);
+				sysUserDeviceDao.insert(sysUserDevice);
+			}
+		} else {
+			// 查询设备号是否已存在
+			List<SysUserDevice> sysUserDeviceList = sysUserDeviceDao.queryByDeviceNum(null, deviceNum);
+
+			if (sysUserDeviceList == null) {
+				sysUserDeviceList = new ArrayList<SysUserDevice>();
+			}
+
+			sysUserDeviceList = sysUserDeviceList.stream().filter(sud -> !StringUtils.equals(sud.getClientId(), "STUDENT")).collect(Collectors.toList());
+
+			if (sysUserDeviceList != null && sysUserDeviceList.size() > 0) {
+				if (sysUserDeviceList.stream().filter(sud -> sud.getUserId().equals(userId)).count() > 0) {
+
+					return true;
+				}
+
+				throw new BadCredentialsException("当前设备已绑定账号,请更换设备");
+			}
+
+			SysUserDevice sysUserDevice = new SysUserDevice();
+			sysUserDevice.setUserId(userId);
+			sysUserDevice.setDeviceNum(deviceNum);
+			sysUserDevice.setBindTime(new Date());
+			sysUserDevice.setClientId(clientId);
+			sysUserDeviceDao.insert(sysUserDevice);
 		}
+
+		return true;
+	}
+
+	@Override
+	public boolean deleteWithLogic(Integer id) {
 		
-		SysUserDevice sysUserDevice = new SysUserDevice();
-		sysUserDevice.setUserId(userId);
-		sysUserDevice.setDeviceNum(deviceNum);
-		sysUserDevice.setBindTime(new Date());
-		sysUserDeviceDao.insert(sysUserDevice);
+		SysUserDevice sysUserDevice = sysUserDeviceDao.get(id);
+		if(sysUserDevice != null){
+			sysUserDevice.setDelFlag(1);
+			
+			sysUserDeviceDao.update(sysUserDevice);
+		}
 		
 		return true;
 	}

+ 1 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserDeviceController.java

@@ -36,7 +36,7 @@ public class UserDeviceController extends BaseController {
 	@PostMapping(value = "/unbind")
 	@AuditLogAnnotation(operateName = "设备号解除绑定",interfaceURL = "userDevice/unbind")
 	public Object unbind(Integer id) {
-		return succeed(sysUserDeviceService.delete(id));
+		return succeed(sysUserDeviceService.deleteWithLogic(id));
 	}
 
 }

+ 48 - 34
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserDeviceMapper.xml

@@ -9,6 +9,9 @@
 		<result column="device_num_" property="deviceNum" />
 		<result column="bind_time_" property="bindTime" />
 		<result column="device_type_" property="deviceType" />
+		<result column="client_id_" property="clientId" />
+		<result column="del_flag_" property="delFlag" />
+		<result column="update_time_" property="updateTime" />
 		<result column="phone_" property="user.phone" />
 		<result column="real_name_" property="user.realName" />
 	</resultMap>
@@ -31,8 +34,8 @@
 		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO sys_user_device
-		(id_,user_id_,device_num_,bind_time_,device_type_)
-		VALUES(#{id},#{userId},#{deviceNum},#{bindTime},#{deviceType})
+		(id_,user_id_,device_num_,bind_time_,device_type_,client_id_,del_flag_)
+		VALUES(#{id},#{userId},#{deviceNum},#{bindTime},#{deviceType},#{clientId},0)
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -54,6 +57,13 @@
 			<if test="bindTime != null">
 				bind_time_ = #{bindTime},
 			</if>
+			<if test="clientId != null">
+				client_id_ = #{clientId},
+			</if>
+			<if test="delFlag != null">
+				del_flag_ = #{delFlag},
+			</if>
+			update_time_ = now()
 		</set>
 		WHERE id_ = #{id}
 	</update>
@@ -66,20 +76,19 @@
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysUserDevice" parameterType="map">
 		SELECT ud.*,u.phone_,u.real_name_ FROM sys_user_device ud left join sys_user u on ud.user_id_ = u.id_ 
-		<where>
-			<if test="search != null and search != ''">
-				and (u.real_name_ LIKE CONCAT('%',#{search},'%') OR u.phone_ LIKE CONCAT('%',#{search},'%') OR u.id_ like CONCAT('%',#{search},'%'))
-			</if>
-			<if test="deviceNum != null">
-				and device_num_ = #{deviceNum}
-			</if>
-			<if test="bindStartTime != null">
-				and date(bind_time_) &gt;= #{bindStartTime}
-			</if>
-			<if test="bindEndTime != null">
-				and date(bind_time_) &lt;= #{bindEndTime}
-			</if>
-		</where>
+		where ud.del_flag_ = 0
+		<if test="search != null and search != ''">
+			and (u.real_name_ LIKE CONCAT('%',#{search},'%') OR u.phone_ LIKE CONCAT('%',#{search},'%') OR u.id_ like CONCAT('%',#{search},'%'))
+		</if>
+		<if test="deviceNum != null">
+			and device_num_ = #{deviceNum}
+		</if>
+		<if test="bindStartTime != null">
+			and date(bind_time_) &gt;= #{bindStartTime}
+		</if>
+		<if test="bindEndTime != null">
+			and date(bind_time_) &lt;= #{bindEndTime}
+		</if>
 		ORDER BY id_
 		<include refid="global.limit" />
 	</select>
@@ -87,28 +96,33 @@
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(ud.user_id_) FROM sys_user_device ud left join sys_user u on ud.user_id_ = u.id_
-		<where>
-			<if test="search != null and search != ''">
-				and (u.real_name_ LIKE CONCAT('%',#{search},'%') OR u.phone_ LIKE CONCAT('%',#{search},'%') OR u.id_ like CONCAT('%',#{search},'%'))
-			</if>
-			<if test="deviceNum != null">
-				and device_num_ = #{deviceNum}
-			</if>
-			<if test="bindStartTime != null">
-				and date(bind_time_) &gt;= #{bindStartTime}
-			</if>
-			<if test="bindEndTime != null">
-				and date(bind_time_) &lt;= #{bindEndTime}
-			</if>
-		</where>
+		where ud.del_flag_ = 0
+		<if test="search != null and search != ''">
+			and (u.real_name_ LIKE CONCAT('%',#{search},'%') OR u.phone_ LIKE CONCAT('%',#{search},'%') OR u.id_ like CONCAT('%',#{search},'%'))
+		</if>
+		<if test="deviceNum != null">
+			and device_num_ = #{deviceNum}
+		</if>
+		<if test="bindStartTime != null">
+			and date(bind_time_) &gt;= #{bindStartTime}
+		</if>
+		<if test="bindEndTime != null">
+			and date(bind_time_) &lt;= #{bindEndTime}
+		</if>
 	</select>
 	
-	<select id="queryByUserId" resultMap="SysUserDevice">
-		SELECT * FROM sys_user_device WHERE user_id_ = #{userId}
+	<select id="queryByUserId" resultMap="SysUserDevice" parameterType="map">
+		SELECT * FROM sys_user_device WHERE user_id_ = #{userId} and del_flag_ = 0
+		<if test="clientId != null">
+			and client_id_ = #{clientId}
+		</if>
 	</select>
 	
-	<select id="queryByDeviceNum" resultMap="SysUserDevice">
-		SELECT * FROM sys_user_device WHERE device_num_ = #{deviceNum}
+	<select id="queryByDeviceNum" resultMap="SysUserDevice" parameterType="map">
+		SELECT * FROM sys_user_device WHERE device_num_ = #{deviceNum} and del_flag_ = 0
+		<if test="clientId != null">
+			and client_id_ = #{clientId}
+		</if>
 	</select>
 	
 </mapper>

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -247,7 +247,9 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @author Joburgess
      * @date 2019/10/18
      */
-    List<CourseScheduleDto> getTeacherCourseSchedulesWithDate(@Param("classDate") Date classDate, @Param("teacherId") Long teacherId, @Param("type") String type);
+    List<CourseScheduleDto> getTeacherCourseSchedulesWithDate(@Param("classDate") Date classDate,
+                                                              @Param("teacherId") Long teacherId,
+                                                              @Param("type") String type);
 
     /**
      * @param teacherId: 教师编号

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

@@ -552,4 +552,10 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     int getHasVPCourseStudentNum(@Param("organId") Integer organId);
     List<Map<Integer, Integer>> getOrganHasVPCourseStudentNum(@Param("organIds") List<Integer> organIds);
 
+    /**
+     * 获取课程学员列表
+     * @param courseScheduleId
+     * @return
+     */
+    List<BasicUserDto> getCourseStudents(@Param("courseScheduleId") Long courseScheduleId);
 }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentCourseHomeworkDao.java

@@ -55,7 +55,8 @@ public interface StudentCourseHomeworkDao extends BaseDAO<Long, StudentCourseHom
      */
     List<StudentCourseHomework> constructInitialStudentHomeworkRecordsWithPayment(@Param("courseScheduleID") Long courseScheduleID,
                                                                                   @Param("courseHomeworkID") Long courseHomeworkID,
-                                                                                  @Param("musicScoreId") Integer musicScoreId);
+                                                                                  @Param("musicScoreId") String musicScoreId,
+                                                                                  @Param("userIdList") List<Integer> userIdList);
 
     /**
      * @param courseScheduleId: 作业编号

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

@@ -372,4 +372,18 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
      * @return java.util.Set<java.lang.Integer>
      */
     Set<Integer> getValidVipStudentIds();
+
+    /**
+     * 获取课程中学员会员数量
+     * @param courseIds
+     * @return
+     */
+    List<Map<Long, Long>> countCourseStudentMemberNum(@Param("courseIds") Set<Long> courseIds);
+
+    /**
+     * 获取课程生学员声部名称
+     * @param courseIds
+     * @return
+     */
+    List<Map<Long, String>> countCourseStudentSubjectName(@Param("courseIds") Set<Long> courseIds);
 }

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicCompareRecordDao.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.biz.dal.entity.SysMusicCompareWeekData;
 import com.ym.mec.biz.dal.enums.HeardLevelEnum;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.biz.dal.entity.SysMusicCompareRecord;
@@ -84,4 +85,28 @@ public interface SysMusicCompareRecordDao extends BaseDAO<Long, SysMusicCompareR
     int getOrganNewCloudStudyNum(@Param("organId") Integer organId);
     int getOrgansTotalNewCloudStudyNum(@Param("organIds") List<Integer> organIds);
     List<Map<Integer, Integer>> getOrgansNewCloudStudyNum(@Param("organIds") List<Integer> organIds);
+
+    /**
+     * @describe 统计用户指定周训练数据
+     * @author Joburgess
+     * @date 2021/8/30 0030
+     * @param userId:
+     * @param monday:
+     * @return com.ym.mec.biz.dal.entity.SysMusicCompareWeekData
+     */
+    SysMusicCompareWeekData getUserWeekCompareData(@Param("userId") Integer userId,
+                                                   @Param("monday") String monday);
+
+    /**
+     * @describe 获取用户本周最高分对应曲目编号
+     * @author Joburgess
+     * @date 2021/8/30 0030
+     * @param userId:
+     * @param monday:
+     * @param heardLevel:
+     * @return java.lang.Integer
+     */
+    Integer getUserWeekMaxMusicScoreId(@Param("userId") Integer userId,
+                                       @Param("monday") String monday,
+                                        @Param("heardLevel") HeardLevelEnum heardLevel);
 }

+ 19 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicCompareWeekDataDao.java

@@ -0,0 +1,19 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.dto.MusicCompareRankingDto;
+import com.ym.mec.biz.dal.entity.SysMusicCompareWeekData;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface SysMusicCompareWeekDataDao extends BaseDAO<Integer, SysMusicCompareWeekData> {
+
+    SysMusicCompareWeekData getWithUserAndMonday(@Param("userId") Integer userId,
+                                                 @Param("monday") String monday);
+
+    List<MusicCompareRankingDto> getUserTrainStat(@Param("monday") String monday,
+                                                  @Param("orderType") Integer orderType,
+                                                  @Param("heardLevel") String heardLevel);
+	
+}

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicScoreDao.java

@@ -3,7 +3,11 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.SysMusicScore;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface SysMusicScoreDao extends BaseDAO<Integer, SysMusicScore> {
 
+    List<SysMusicScore> findByIds(@Param("musicScoreIds") String musicScoreIds);
 }

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/BasicUserDto.java

@@ -34,6 +34,26 @@ public class BasicUserDto {
     @ApiModelProperty(value = "加油包:0:默认不可用;1:可用;2:已使用;")
     private Integer comeOnPackage;
 
+    private Integer memberRankSettingId;
+
+    private String subjectIdList;
+
+    public Integer getMemberRankSettingId() {
+        return memberRankSettingId;
+    }
+
+    public void setMemberRankSettingId(Integer memberRankSettingId) {
+        this.memberRankSettingId = memberRankSettingId;
+    }
+
+    public String getSubjectIdList() {
+        return subjectIdList;
+    }
+
+    public void setSubjectIdList(String subjectIdList) {
+        this.subjectIdList = subjectIdList;
+    }
+
     public Integer getOrganId() {
         return organId;
     }

+ 14 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseHomeworkStudentDetailDto.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * @Author Joburgess
@@ -59,7 +60,7 @@ public class CourseHomeworkStudentDetailDto {
     private String teacherName;
 
     @ApiModelProperty(value = "伴奏编号",required = false)
-    private Integer musicScoreId;
+    private String musicScoreId;
 
     private String musicScoreName;
 
@@ -69,6 +70,8 @@ public class CourseHomeworkStudentDetailDto {
 
     private SysMusicScore sysMusicScore;
 
+    private List<SysMusicScore> sysMusicScoreList;
+
     public SysMusicScore getSysMusicScore() {
         return sysMusicScore;
     }
@@ -77,6 +80,14 @@ public class CourseHomeworkStudentDetailDto {
         this.sysMusicScore = sysMusicScore;
     }
 
+    public List<SysMusicScore> getSysMusicScoreList() {
+        return sysMusicScoreList;
+    }
+
+    public void setSysMusicScoreList(List<SysMusicScore> sysMusicScoreList) {
+        this.sysMusicScoreList = sysMusicScoreList;
+    }
+
     public Integer getHasMember() {
         return hasMember;
     }
@@ -96,11 +107,11 @@ public class CourseHomeworkStudentDetailDto {
         this.homeworkOpenFlag = homeworkOpenFlag;
     }
 
-    public Integer getMusicScoreId() {
+    public String getMusicScoreId() {
         return musicScoreId;
     }
 
-    public void setMusicScoreId(Integer musicScoreId) {
+    public void setMusicScoreId(String musicScoreId) {
         this.musicScoreId = musicScoreId;
     }
 

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ExtraExerciseStudentsDto.java

@@ -17,7 +17,7 @@ public class ExtraExerciseStudentsDto extends ExtracurricularExercisesReply {
 
     private String teacherName;
 
-    private Integer musicScoreId;
+    private String musicScoreId;
 
     private String musicScoreName;
 
@@ -41,11 +41,11 @@ public class ExtraExerciseStudentsDto extends ExtracurricularExercisesReply {
 
     private String existVipCourseStr;
 
-    public Integer getMusicScoreId() {
+    public String getMusicScoreId() {
         return musicScoreId;
     }
 
-    public void setMusicScoreId(Integer musicScoreId) {
+    public void setMusicScoreId(String musicScoreId) {
         this.musicScoreId = musicScoreId;
     }
 

+ 36 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicScoreSubjectDto.java

@@ -0,0 +1,36 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.util.List;
+
+public class MusicScoreSubjectDto {
+
+    private Integer subjectId;
+
+    private List<Integer> userIdList;
+
+    private List<Integer> musicScoreIdList;
+
+    public Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public List<Integer> getUserIdList() {
+        return userIdList;
+    }
+
+    public void setUserIdList(List<Integer> userIdList) {
+        this.userIdList = userIdList;
+    }
+
+    public List<Integer> getMusicScoreIdList() {
+        return musicScoreIdList;
+    }
+
+    public void setMusicScoreIdList(List<Integer> musicScoreIdList) {
+        this.musicScoreIdList = musicScoreIdList;
+    }
+}

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherServeHomeworkDto.java

@@ -10,8 +10,28 @@ public class TeacherServeHomeworkDto extends CourseSchedule {
 
     private String subjectName;
 
+    private String studentSubjectName;
+
+    private Integer memberNum;
+
     private int homeworkExist;
 
+    public String getStudentSubjectName() {
+        return studentSubjectName;
+    }
+
+    public void setStudentSubjectName(String studentSubjectName) {
+        this.studentSubjectName = studentSubjectName;
+    }
+
+    public Integer getMemberNum() {
+        return memberNum;
+    }
+
+    public void setMemberNum(Integer memberNum) {
+        this.memberNum = memberNum;
+    }
+
     public String getSubjectName() {
         return subjectName;
     }

+ 15 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseHomework.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.ym.mec.biz.dal.dto.MusicScoreSubjectDto;
 import io.swagger.annotations.ApiModelProperty;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -7,6 +8,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 import com.ym.mec.biz.dal.enums.GroupType;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 对应数据库表(course_homework):
@@ -53,13 +55,23 @@ public class CourseHomework {
 	private Integer expectNum;
 
 	@ApiModelProperty(value = "伴奏编号",required = false)
-	private Integer musicScoreId;
+	private String musicScoreId;
 
-	public Integer getMusicScoreId() {
+	private List<MusicScoreSubjectDto> musicScoreSubjectDto;
+
+	public List<MusicScoreSubjectDto> getMusicScoreSubjectDto() {
+		return musicScoreSubjectDto;
+	}
+
+	public void setMusicScoreSubjectDto(List<MusicScoreSubjectDto> musicScoreSubjectDto) {
+		this.musicScoreSubjectDto = musicScoreSubjectDto;
+	}
+
+	public String getMusicScoreId() {
 		return musicScoreId;
 	}
 
-	public void setMusicScoreId(Integer musicScoreId) {
+	public void setMusicScoreId(String musicScoreId) {
 		this.musicScoreId = musicScoreId;
 	}
 

+ 17 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ExtracurricularExercises.java

@@ -1,10 +1,13 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.ym.mec.biz.dal.dto.MusicScoreSubjectDto;
 import com.ym.mec.biz.dal.enums.ImSendTypeEnum;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import com.ym.mec.auth.api.entity.SysUser;
 
+import java.util.List;
+
 /**
  * 对应数据库表(extracurricular_exercises):
  */
@@ -58,10 +61,21 @@ public class ExtracurricularExercises {
 
 	private ImSendTypeEnum msgType = ImSendTypeEnum.TXT;
 
-	private Integer musicScoreId;
+	/** 伴奏列表(多个用逗号分隔) */
+	private String musicScoreId;
 
 	private String musicScoreName;
 
+	private List<MusicScoreSubjectDto> musicScoreSubjectDtos;
+
+	public List<MusicScoreSubjectDto> getMusicScoreSubjectDtos() {
+		return musicScoreSubjectDtos;
+	}
+
+	public void setMusicScoreSubjectDtos(List<MusicScoreSubjectDto> musicScoreSubjectDtos) {
+		this.musicScoreSubjectDtos = musicScoreSubjectDtos;
+	}
+
 	public String getMusicScoreName() {
 		return musicScoreName;
 	}
@@ -70,11 +84,11 @@ public class ExtracurricularExercises {
 		this.musicScoreName = musicScoreName;
 	}
 
-	public Integer getMusicScoreId() {
+	public String getMusicScoreId() {
 		return musicScoreId;
 	}
 
-	public void setMusicScoreId(Integer musicScoreId) {
+	public void setMusicScoreId(String musicScoreId) {
 		this.musicScoreId = musicScoreId;
 	}
 

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ExtracurricularExercisesReply.java

@@ -51,6 +51,16 @@ public class ExtracurricularExercisesReply {
 
 	private Date submitTime;
 
+	private String musicScoreId;
+
+	public String getMusicScoreId() {
+		return musicScoreId;
+	}
+
+	public void setMusicScoreId(String musicScoreId) {
+		this.musicScoreId = musicScoreId;
+	}
+
 	public Integer getIsRepliedTimely() {
 		return isRepliedTimely;
 	}

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImGroupMember.java

@@ -23,6 +23,10 @@ public class ImGroupMember {
 	
 	/** 群角色 */
 	private String roleType;
+
+	private Integer memberRankSettingId;
+
+	private String subjectName;
 	
 	/**  */
 	private java.util.Date createTime;
@@ -30,6 +34,22 @@ public class ImGroupMember {
 	/**  */
 	private java.util.Date updateTime;
 
+	public Integer getMemberRankSettingId() {
+		return memberRankSettingId;
+	}
+
+	public void setMemberRankSettingId(Integer memberRankSettingId) {
+		this.memberRankSettingId = memberRankSettingId;
+	}
+
+	public String getSubjectName() {
+		return subjectName;
+	}
+
+	public void setSubjectName(String subjectName) {
+		this.subjectName = subjectName;
+	}
+
 	public void setId(Long id){
 		this.id = id;
 	}

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImUserFriend.java

@@ -23,12 +23,32 @@ public class ImUserFriend {
 	
 	private String tags;
 
+	private Integer memberRankSettingId;
+
+	private String subjectName;
+
 	/**  */
 	private java.util.Date createTime;
 
 	/**  */
 	private java.util.Date updateTime;
 
+	public Integer getMemberRankSettingId() {
+		return memberRankSettingId;
+	}
+
+	public void setMemberRankSettingId(Integer memberRankSettingId) {
+		this.memberRankSettingId = memberRankSettingId;
+	}
+
+	public String getSubjectName() {
+		return subjectName;
+	}
+
+	public void setSubjectName(String subjectName) {
+		this.subjectName = subjectName;
+	}
+
 	public void setId(Long id) {
 		this.id = id;
 	}

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentCourseHomework.java

@@ -55,7 +55,7 @@ public class StudentCourseHomework {
 	private ImSendTypeEnum msgType = ImSendTypeEnum.TXT;
 
 	//伴奏编号
-	private Integer musicScoreId;
+	private String musicScoreId;
 	//伴奏编号
 	private String musicScoreName;
 
@@ -67,11 +67,11 @@ public class StudentCourseHomework {
 		this.musicScoreName = musicScoreName;
 	}
 
-	public Integer getMusicScoreId() {
+	public String getMusicScoreId() {
 		return musicScoreId;
 	}
 
-	public void setMusicScoreId(Integer musicScoreId) {
+	public void setMusicScoreId(String musicScoreId) {
 		this.musicScoreId = musicScoreId;
 	}
 

+ 130 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMusicCompareWeekData.java

@@ -0,0 +1,130 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(sys_music_compare_week_data):
+ */
+public class SysMusicCompareWeekData {
+
+	/** 用户编号 */
+	private Integer userId;
+	
+	/** 周一日期 */
+	private java.util.Date monday;
+	
+	/** 训练次数 */
+	private Integer trainNum;
+	
+	/** 本周训练天数 */
+	private Integer trainDays;
+	
+	/** 本周训练时长 */
+	private Float trainTime;
+	
+	/** 本周入门级最高分 */
+	private Integer beginnerMaxScore;
+	private Integer beginnerMaxScoreId;
+
+	/** 本周进阶级最高分 */
+	private Integer advancedMaxScore;
+	private Integer advancedMaxScoreId;
+
+	/** 本周大师级最高分 */
+	private Integer performerMaxScore;
+	private Integer performerMaxScoreId;
+
+	public void setUserId(Integer userId){
+		this.userId = userId;
+	}
+	
+	public Integer getUserId(){
+		return this.userId;
+	}
+			
+	public void setMonday(java.util.Date monday){
+		this.monday = monday;
+	}
+	
+	public java.util.Date getMonday(){
+		return this.monday;
+	}
+			
+	public void setTrainNum(Integer trainNum){
+		this.trainNum = trainNum;
+	}
+	
+	public Integer getTrainNum(){
+		return this.trainNum;
+	}
+			
+	public void setTrainDays(Integer trainDays){
+		this.trainDays = trainDays;
+	}
+	
+	public Integer getTrainDays(){
+		return this.trainDays;
+	}
+
+	public Float getTrainTime() {
+		return trainTime;
+	}
+
+	public void setTrainTime(Float trainTime) {
+		this.trainTime = trainTime;
+	}
+
+	public void setBeginnerMaxScore(Integer beginnerMaxScore){
+		this.beginnerMaxScore = beginnerMaxScore;
+	}
+	
+	public Integer getBeginnerMaxScore(){
+		return this.beginnerMaxScore;
+	}
+			
+	public void setAdvancedMaxScore(Integer advancedMaxScore){
+		this.advancedMaxScore = advancedMaxScore;
+	}
+	
+	public Integer getAdvancedMaxScore(){
+		return this.advancedMaxScore;
+	}
+			
+	public void setPerformerMaxScore(Integer performerMaxScore){
+		this.performerMaxScore = performerMaxScore;
+	}
+	
+	public Integer getPerformerMaxScore(){
+		return this.performerMaxScore;
+	}
+
+	public Integer getBeginnerMaxScoreId() {
+		return beginnerMaxScoreId;
+	}
+
+	public void setBeginnerMaxScoreId(Integer beginnerMaxScoreId) {
+		this.beginnerMaxScoreId = beginnerMaxScoreId;
+	}
+
+	public Integer getAdvancedMaxScoreId() {
+		return advancedMaxScoreId;
+	}
+
+	public void setAdvancedMaxScoreId(Integer advancedMaxScoreId) {
+		this.advancedMaxScoreId = advancedMaxScoreId;
+	}
+
+	public Integer getPerformerMaxScoreId() {
+		return performerMaxScoreId;
+	}
+
+	public void setPerformerMaxScoreId(Integer performerMaxScoreId) {
+		this.performerMaxScoreId = performerMaxScoreId;
+	}
+
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/PeriodEnum.java

@@ -6,7 +6,7 @@ import com.ym.mec.common.enums.BaseEnum;
  * 周期
  */
 public enum PeriodEnum implements BaseEnum<String, PeriodEnum> {
-	DAY("日"), MONTH("月"), YEAR_HALF("半年"), YEAR("年");
+	DAY("日"), MONTH("月"), QUARTERLY("季度"), YEAR_HALF("半年"), YEAR("年");
 
 	private String msg;
 

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/TeacherServeHomeworkQueryInfo.java

@@ -16,6 +16,16 @@ public class TeacherServeHomeworkQueryInfo extends QueryInfo {
 
     private Integer teacherId;
 
+    private String courseType;
+
+    public String getCourseType() {
+        return courseType;
+    }
+
+    public void setCourseType(String courseType) {
+        this.courseType = courseType;
+    }
+
     public Date getMonday() {
         return monday;
     }

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

@@ -105,7 +105,7 @@ public interface CourseReviewService extends BaseService<Integer, CourseSchedule
 	 * @param expiryDate
 	 * @return
 	 */
-	CourseHomework addHomeWork(Integer courseScheduleId,String content, Date expiryDate,Integer musicScoreId);
+	CourseHomework addHomeWork(Integer courseScheduleId,String content, Date expiryDate,String musicScoreId);
 
 	/**
 	 * 获取网管课列表

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysMusicCompareWeekDataService.java

@@ -0,0 +1,20 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.SysMusicCompareWeekData;
+import com.ym.mec.common.service.BaseService;
+
+import java.time.LocalDate;
+
+public interface SysMusicCompareWeekDataService extends BaseService<Integer, SysMusicCompareWeekData>{
+
+    /**
+     * @describe 更新学员本周训练统计数据
+     * @author Joburgess
+     * @date 2021/8/30 0030
+     * @param userId: 用户编号
+     * @param monday: 本周周一日期
+     * @return void
+     */
+    void updateUserWeekTrainData(Integer userId, LocalDate monday);
+
+}

+ 18 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseHomeworkServiceImpl.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import com.ym.mec.biz.dal.dao.StudentCourseHomeworkDao;
 import com.ym.mec.biz.dal.dao.StudentCourseHomeworkReplyDao;
 import com.ym.mec.biz.dal.dto.Mapper;
+import com.ym.mec.biz.dal.dto.MusicScoreSubjectDto;
 import com.ym.mec.biz.dal.dto.TeacherHomeworkListDto;
 import com.ym.mec.biz.dal.dto.WebCourseHomeworkListDto;
 import com.ym.mec.biz.dal.entity.CourseHomework;
@@ -79,9 +80,23 @@ public class CourseHomeworkServiceImpl extends BaseServiceImpl<Long, CourseHomew
 			oldCourseHomework.setExpiryDate(DateUtil.addDays(date,7));
 			oldCourseHomework.setExpectNum(courseScheduleDao.countCourseStudentNum(courseSchedule.getId()));
 			courseHomeworkDao.insert(oldCourseHomework);
-			List<StudentCourseHomework> studentCourseHomeworks = studentCourseHomeworkDao
-					.constructInitialStudentHomeworkRecordsWithPayment(courseSchedule.getId(),
-							oldCourseHomework.getId(),oldCourseHomework.getMusicScoreId());
+			List<StudentCourseHomework> studentCourseHomeworks = new ArrayList<>();
+
+			//获取按学员声部发放的作业
+			List<MusicScoreSubjectDto> musicScoreSubjectDto = courseHomework.getMusicScoreSubjectDto();
+			if(musicScoreSubjectDto != null && musicScoreSubjectDto.size() > 0){
+				for (MusicScoreSubjectDto scoreSubjectDto : musicScoreSubjectDto) {
+					studentCourseHomeworks.addAll(studentCourseHomeworkDao.constructInitialStudentHomeworkRecordsWithPayment(courseSchedule.getId(),
+							oldCourseHomework.getId(),
+							StringUtils.join(scoreSubjectDto.getMusicScoreIdList(),","),
+							scoreSubjectDto.getUserIdList()));
+				}
+			}else {
+				studentCourseHomeworks.addAll(studentCourseHomeworkDao.constructInitialStudentHomeworkRecordsWithPayment(courseSchedule.getId(),
+						oldCourseHomework.getId(),
+						oldCourseHomework.getMusicScoreId(),
+						null));
+			}
 			if(CollectionUtils.isEmpty(studentCourseHomeworks)){
 				throw new BizException("此课程没有学生");
 			}

+ 1 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseReviewServiceImpl.java

@@ -532,7 +532,7 @@ public class CourseReviewServiceImpl extends BaseServiceImpl<Integer, CourseSche
 
     @Override
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-    public CourseHomework addHomeWork(Integer courseScheduleId, String content, Date expiryDate,Integer musicScoreId) {
+    public CourseHomework addHomeWork(Integer courseScheduleId, String content, Date expiryDate,String musicScoreId) {
         if (StringUtils.isBlank(content)) {
             throw new BizException("作业内容不能为空");
         }
@@ -566,10 +566,8 @@ public class CourseReviewServiceImpl extends BaseServiceImpl<Integer, CourseSche
             courseHomework.setId(existHomework.getId());
             courseHomework.setContent(content);
             courseHomework.setExpiryDate(expiryDate);
-            courseHomework.setMusicScoreId(musicScoreId);
             courseHomeworkService.update(courseHomework);
         } else {
-            courseHomework.setMusicScoreId(musicScoreId);
             courseHomework.setContent(content);
             courseHomework.setCourseScheduleId(courseSchedule.getId());
             courseHomework.setMusicGroupId(courseSchedule.getMusicGroupId());

+ 0 - 16
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -234,22 +234,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if(planList.size() >= courseNumNo){
 			currentCourseDetail.setCoursePlan(planList.get(courseNumNo - 1).getPlan());
 		}
-		//获取有会员的学员数
-//		String configValue = sysConfigDao.findConfigValue(SysConfigService.HOMEWORK_OPEN_FLAG);
-//		if(StringUtils.isEmpty(configValue)){
-//			configValue = "0";
-//		}
-//		if(configValue.equals("0")){
-//			currentCourseDetail.setMemberNum(0);
-//		}else {
-//			CourseSchedule courseSchedule = courseScheduleDao.get(courseID);
-//			MusicGroup musicGroup = musicGroupDao.get(courseSchedule.getMusicGroupId());
-//			if(musicGroup != null){
-//				currentCourseDetail.setCourseViewType(musicGroup.getCourseViewType());
-//			}
-//			List<BasicUserDto> students = courseScheduleStudentPaymentDao.findStudents(courseID);
-//			currentCourseDetail.setMemberNum(studentDao.getMemberNum(StringUtils.join(students, ",")));
-//		}
 		return currentCourseDetail;
     }
 

+ 22 - 19
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesReplyServiceImpl.java

@@ -105,23 +105,26 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 		detail.setStudentName(extraExerciseReply.getStudentName());
 		detail.setExpiryDate(extraExerciseReply.getExpireDate());
 		detail.setType("EXTRA");
-		if(extraExerciseReply.getMusicScoreId() != null){
-			detail.setSysMusicScore(sysMusicScoreDao.get(extraExerciseReply.getMusicScoreId()));
-		}
 
-		String configValue = sysConfigDao.findConfigValue(SysConfigService.HOMEWORK_OPEN_FLAG);
-		if(StringUtils.isEmpty(configValue)){
-			configValue = "0";
-		}
-		detail.setHomeworkOpenFlag(Integer.parseInt(configValue));
-		if(configValue.equals("0")){
-			detail.setHasMember(0);
-		}else {
-			detail.setMusicScoreId(extraExerciseReply.getMusicScoreId());
-			detail.setMusicScoreName(extraExerciseReply.getMusicScoreName());
-			Student student = studentDao.get(extraExerciseReply.getUserId());
-			detail.setHasMember(student.getMemberRankSettingId()==null?0:1);
+//		String configValue = sysConfigDao.findConfigValue(SysConfigService.HOMEWORK_OPEN_FLAG);
+//		if(StringUtils.isEmpty(configValue)){
+//			configValue = "0";
+//		}
+//		detail.setHomeworkOpenFlag(Integer.parseInt(configValue));
+//		if(configValue.equals("0")){
+//			detail.setHasMember(0);
+//		}else {
+		if(StringUtils.isNotEmpty(extraExerciseReply.getMusicScoreId())){
+			List<SysMusicScore> sysMusicScores = sysMusicScoreDao.findByIds(extraExerciseReply.getMusicScoreId());
+			detail.setSysMusicScoreList(sysMusicScores);
+			SysMusicScore sysMusicScore = sysMusicScores.get(0);
+			detail.setSysMusicScore(sysMusicScore);
+			detail.setMusicScoreId(sysMusicScore.getId().toString());
+			detail.setMusicScoreName(sysMusicScore.getName());
 		}
+		Student student = studentDao.get(extraExerciseReply.getUserId());
+		detail.setHasMember(student.getMemberRankSettingId()==null?0:1);
+//		}
 		return detail;
 	}
 
@@ -173,10 +176,10 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 		existExtra.setSubmitTime(new Date());
 		extracurricularExercisesReplyDao.update(existExtra);
 
-		LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
-		LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
-		LocalDate createDateTime = LocalDateTime.ofInstant(existExtra.getCreateTime().toInstant(), DateUtil.zoneId).toLocalDate();
-		LocalDate createMonday = createDateTime.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
+//		LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
+//		LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
+//		LocalDate createDateTime = LocalDateTime.ofInstant(existExtra.getCreateTime().toInstant(), DateUtil.zoneId).toLocalDate();
+//		LocalDate createMonday = createDateTime.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
 
 		int submitStudentNum=extracurricularExercisesReplyDao.countIsSubmitStudents(existExtra.getExtracurricularExercisesId());
 		extracurricularExercises.setCompletedNum(submitStudentNum);

+ 19 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesServiceImpl.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.dao.ExtracurricularExercisesReplyDao;
 import com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
+import com.ym.mec.biz.dal.dto.MusicScoreSubjectDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercises;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply;
@@ -87,6 +88,14 @@ public class ExtracurricularExercisesServiceImpl extends BaseServiceImpl<Long, E
 		exercises.setExpectNum(studentIds.size());
 		extracurricularExercisesDao.insert(exercises);
 		String dateStr = DateUtil.dateToString(exercises.getExpireDate(), "MM月dd日HH点");
+
+		List<MusicScoreSubjectDto> scoreSubjectDtoList = exercises.getMusicScoreSubjectDtos();
+		Map<List<Integer>, List<MusicScoreSubjectDto>> collect = null;
+		Set<List<Integer>> lists = null;
+		if(!CollectionUtils.isEmpty(scoreSubjectDtoList)){
+			collect = scoreSubjectDtoList.stream().collect(Collectors.groupingBy(e -> e.getUserIdList()));
+			lists = collect.keySet();
+		}
 		for (Integer studentId : studentIds) {
 			ExtracurricularExercisesReply studentExtraExercise=new ExtracurricularExercisesReply();
 			studentExtraExercise.setExtracurricularExercisesId(exercises.getId());
@@ -95,6 +104,16 @@ public class ExtracurricularExercisesServiceImpl extends BaseServiceImpl<Long, E
 			studentExtraExercise.setIsReplied(0);
 			studentExtraExercise.setIsView(0);
 			studentExtraExercise.setIsRepliedTimely(0);
+			studentExtraExercise.setMusicScoreId(exercises.getMusicScoreId());
+			if(!CollectionUtils.isEmpty(scoreSubjectDtoList)){
+				for (List<Integer> list : lists) {
+					if(list.contains(studentId)){
+						MusicScoreSubjectDto musicScoreSubjectDto = collect.get(list).get(0);
+						studentExtraExercise.setMusicScoreId(StringUtils.join(musicScoreSubjectDto.getMusicScoreIdList(),","));
+						break;
+					}
+				}
+			}
 			extracurricularExercisesReplyDao.insert(studentExtraExercise);
 
 			String notifyUrl = "?courseScheduleID=" + studentExtraExercise.getId() + "&studentCourseHomeworkId=" + studentExtraExercise.getId() + "&extra=1";

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java

@@ -165,6 +165,11 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
 			cloudTeacherOrder.setType(2);
 			cloudTeacherOrder.setTime(1);
 			break;
+		case QUARTERLY:
+			actualAmount = memberFeeSetting.getCurrentQuarterlyFee();
+			cloudTeacherOrder.setType(2);
+			cloudTeacherOrder.setTime(3);
+			break;
 		case YEAR_HALF:
 			actualAmount = memberFeeSetting.getCurrentHalfYearFee();
 			cloudTeacherOrder.setType(2);

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

@@ -314,7 +314,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 						originalMemberPaymentAmount = memberFee.getOriginalMonthFee().setScale(0, BigDecimal.ROUND_HALF_UP);
 						break;
 					case 6 :
-						memberPaymentAmount = memberFee.getGroupPurchaseYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
+						memberPaymentAmount = memberFee.getGroupPurchaseHalfYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
 						originalMemberPaymentAmount = memberFee.getOriginalHalfYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
 						break;
 					case 12 :

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

@@ -2627,6 +2627,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         studentPaymentOrder.setUpdateTime(date);
         studentPaymentOrder.setVersion(0);
         studentPaymentOrderService.insert(studentPaymentOrder);
+        calenderDetail.setPaymentStatus(PaymentStatus.PROCESSING);
         calenderDetail.setPaymentOrderId(studentPaymentOrder.getId());
         musicGroupPaymentCalenderDetailDao.update(calenderDetail);
         
@@ -3249,7 +3250,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
         //课程团和amr可以互相修改,但不可以改为会员团
         if(group.getCourseViewType() != musicGroup.getCourseViewType()){
-            if(group.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+            if(group.getStatus() == MusicGroupStatusEnum.PROGRESS && group.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
                 throw new BizException("会员收费乐团不可更改收费模式");
             }
             if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){

+ 1 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -2059,16 +2059,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             student.setOperatingTag(1);
             studentDao.insert(student);
         } else {
-            if (Objects.isNull(student.getSubjectIdList())) {
-                student.setSubjectIdList(practiceGroup.getSubjectId().toString());
-            } else {
-                String[] studentIdStrings = student.getSubjectIdList().split(",");
-                List<String> studentIds = new ArrayList<>(Arrays.asList(studentIdStrings));
-                if (!studentIds.contains(practiceGroup.getSubjectId().toString())) {
-                    studentIds.add(practiceGroup.getSubjectId().toString());
-                }
-                student.setSubjectIdList(StringUtils.join(studentIds.toArray(), ","));
-            }
+            student.setSubjectIdList(practiceGroup.getSubjectId().toString());
             studentDao.update(student);
         }
 

+ 54 - 48
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -128,29 +128,29 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
         courseHomework.setCompletedNum(studentCourseHomeworkDao.countCompletedStudentNum(bean.getCourseHomeworkId()));
         courseHomeworkService.update(courseHomework);
 
-        LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
-        LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
-        LocalDate createDateTime = LocalDateTime.ofInstant(courseSchedule.getClassDate().toInstant(), DateUtil.zoneId).toLocalDate();
-        LocalDate createMonday = createDateTime.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
-        LocalDate homeworkCreateDateTime = LocalDateTime.ofInstant(existHomework.getCreateTime().toInstant(), DateUtil.zoneId).toLocalDate();
-        boolean isOk = false;
-        switch (createDateTime.getDayOfWeek()) {
-            case SATURDAY:
-                if (createDateTime.until(homeworkCreateDateTime, ChronoUnit.DAYS) < 4) {
-                    isOk = true;
-                }
-                break;
-            case SUNDAY:
-                if (createDateTime.until(homeworkCreateDateTime, ChronoUnit.DAYS) < 3) {
-                    isOk = true;
-                }
-                break;
-            default:
-                if (createDateTime.get(DateUtil.weekFields.weekOfYear()) == homeworkCreateDateTime.get(DateUtil.weekFields.weekOfYear())) {
-                    isOk = true;
-                }
-                break;
-        }
+//        LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
+//        LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
+//        LocalDate createDateTime = LocalDateTime.ofInstant(courseSchedule.getClassDate().toInstant(), DateUtil.zoneId).toLocalDate();
+//        LocalDate createMonday = createDateTime.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
+//        LocalDate homeworkCreateDateTime = LocalDateTime.ofInstant(existHomework.getCreateTime().toInstant(), DateUtil.zoneId).toLocalDate();
+//        boolean isOk = false;
+//        switch (createDateTime.getDayOfWeek()) {
+//            case SATURDAY:
+//                if (createDateTime.until(homeworkCreateDateTime, ChronoUnit.DAYS) < 4) {
+//                    isOk = true;
+//                }
+//                break;
+//            case SUNDAY:
+//                if (createDateTime.until(homeworkCreateDateTime, ChronoUnit.DAYS) < 3) {
+//                    isOk = true;
+//                }
+//                break;
+//            default:
+//                if (createDateTime.get(DateUtil.weekFields.weekOfYear()) == homeworkCreateDateTime.get(DateUtil.weekFields.weekOfYear())) {
+//                    isOk = true;
+//                }
+//                break;
+//        }
 
         studentServeService.updateExercisesSituation(courseSchedule.getClassDate(), new ArrayList<>(Arrays.asList(bean.getUserId())), courseSchedule.getTeacherId());
 
@@ -200,34 +200,40 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
             throw new BizException("作业不存在");
         }
         CourseHomeworkStudentDetailDto courseHomeworkStudentDetail = studentCourseHomeworkDao.findCourseHomeworkStudentDetail(courseScheduleID, userId);
-        if (Objects.nonNull(courseHomeworkStudentDetail)) {
-            SysUser student = teacherDao.getUser(userId.intValue());
-            courseHomeworkStudentDetail.setStudentId(userId.intValue());
-            courseHomeworkStudentDetail.setStudentName(student.getUsername());
-            CourseSchedule courseSchedule = courseScheduleDao.get(courseHomeworkStudentDetail.getCourseScheduleId());
-            if (Objects.nonNull(courseSchedule)) {
-                SysUser teacher = teacherDao.getUser(courseSchedule.getActualTeacherId());
-                courseHomeworkStudentDetail.setTeacherId(courseSchedule.getActualTeacherId());
-                courseHomeworkStudentDetail.setTeacherName(teacher.getRealName());
-            }
-            if(courseHomeworkStudentDetail.getMusicScoreId() != null){
-                courseHomeworkStudentDetail.setSysMusicScore(sysMusicScoreDao.get(courseHomeworkStudentDetail.getMusicScoreId()));
-            }
+        if(courseHomeworkStudentDetail == null){
+            throw new BizException("作业不存在");
         }
-        courseHomeworkStudentDetail.setType("HOMEWORK");
-        String configValue = sysConfigDao.findConfigValue(SysConfigService.HOMEWORK_OPEN_FLAG);
-        if(StringUtils.isEmpty(configValue)){
-            configValue = "0";
+        SysUser sysUser = teacherDao.getUser(userId.intValue());
+        courseHomeworkStudentDetail.setStudentId(userId.intValue());
+        courseHomeworkStudentDetail.setStudentName(sysUser.getUsername());
+        CourseSchedule courseSchedule = courseScheduleDao.get(courseHomeworkStudentDetail.getCourseScheduleId());
+        if (Objects.nonNull(courseSchedule)) {
+            SysUser teacher = teacherDao.getUser(courseSchedule.getActualTeacherId());
+            courseHomeworkStudentDetail.setTeacherId(courseSchedule.getActualTeacherId());
+            courseHomeworkStudentDetail.setTeacherName(teacher.getRealName());
         }
-        courseHomeworkStudentDetail.setHomeworkOpenFlag(Integer.parseInt(configValue));
-        if(configValue.equals("0")){
-            courseHomeworkStudentDetail.setMusicScoreId(null);
-            courseHomeworkStudentDetail.setMusicScoreName(null);
-            courseHomeworkStudentDetail.setHasMember(0);
-        }else {
-            Student student = studentDao.get(userId.intValue());
-            courseHomeworkStudentDetail.setHasMember(student.getMemberRankSettingId()==null?0:1);
+        courseHomeworkStudentDetail.setType("HOMEWORK");
+//        String configValue = sysConfigDao.findConfigValue(SysConfigService.HOMEWORK_OPEN_FLAG);
+//        if(StringUtils.isEmpty(configValue)){
+//            configValue = "0";
+//        }
+//        courseHomeworkStudentDetail.setHomeworkOpenFlag(Integer.parseInt(configValue));
+//        if(configValue.equals("0")){
+//            courseHomeworkStudentDetail.setMusicScoreId(null);
+//            courseHomeworkStudentDetail.setMusicScoreName(null);
+//            courseHomeworkStudentDetail.setHasMember(0);
+//        }else {
+        if(StringUtils.isNotEmpty(courseHomeworkStudentDetail.getMusicScoreId())){
+            List<SysMusicScore> sysMusicScoreList = sysMusicScoreDao.findByIds(courseHomeworkStudentDetail.getMusicScoreId());
+            courseHomeworkStudentDetail.setSysMusicScoreList(sysMusicScoreList);
+            SysMusicScore sysMusicScore = sysMusicScoreList.get(0);
+            courseHomeworkStudentDetail.setSysMusicScore(sysMusicScore);
+            courseHomeworkStudentDetail.setMusicScoreId(sysMusicScore.getId().toString());
+            courseHomeworkStudentDetail.setMusicScoreName(sysMusicScore.getName());
         }
+        Student student = studentDao.get(userId.intValue());
+        courseHomeworkStudentDetail.setHasMember(student.getMemberRankSettingId()==null?0:1);
+//        }
         return courseHomeworkStudentDetail;
     }
 

+ 10 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java

@@ -311,7 +311,10 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 
 	@Override
 	public PageInfo<TeacherServeHomeworkDto> queryTeacherServeHomeworkDetail(TeacherServeHomeworkQueryInfo queryInfo) {
-		if(Objects.isNull(queryInfo.getMonday())||Objects.isNull(queryInfo.getSunday())||Objects.isNull(queryInfo.getTeacherId())){
+		if(Objects.isNull(queryInfo.getMonday())||Objects.isNull(queryInfo.getSunday())){
+			throw new BizException("请指定课程时间");
+		}
+		if(Objects.isNull(queryInfo.getTeacherId())){
 			throw new BizException("请指定教师");
 		}
 		PageInfo<TeacherServeHomeworkDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
@@ -343,6 +346,9 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 		MapUtil.populateMap(params, queryInfo);
 		params.put("courseIds", courseIds);
 
+		Map<Long,Long> memberNumMap = MapUtil.convertIntegerMap(studentDao.countCourseStudentMemberNum(courseIds));
+		Map<Long,String> studentSubjectMap = MapUtil.convertMybatisMap(studentDao.countCourseStudentSubjectName(courseIds));
+
 		List<TeacherServeHomeworkDto> dataList = new ArrayList<>();
 		int count = courseScheduleDao.countByCourseScheduleIds(params);
 		if (count > 0) {
@@ -380,6 +386,9 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 				subjects = subjectDao.findBySubjectIds(new ArrayList<>(subjectIds));
 			}
 			for (TeacherServeHomeworkDto teacherServeHomeworkDto : dataList) {
+				Long aLong = memberNumMap.get(teacherServeHomeworkDto.getId());
+				teacherServeHomeworkDto.setMemberNum(aLong==null?0:aLong.intValue());
+				teacherServeHomeworkDto.setStudentSubjectName(studentSubjectMap.get(teacherServeHomeworkDto.getId()));
 				if(idClassGroupMap.containsKey(teacherServeHomeworkDto.getClassGroupId())){
 					ClassGroup classGroup = idClassGroupMap.get(teacherServeHomeworkDto.getClassGroupId());
 					if(StringUtils.isNotBlank(classGroup.getSubjectIdList())){

+ 1 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -776,19 +776,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             Student student = studentDao.get(userId);
             if (student == null) {
                 studentDao.insert(new Student(userId, studentRegistration.getSubjectId().toString()));
-            } else if (StringUtils.isEmpty(student.getSubjectIdList())) {
+            } else {
                 student.setSubjectIdList(studentRegistration.getSubjectId().toString());
                 student.setUpdateTime(date);
                 studentDao.update(student);
-            } else if (StringUtils.isNotEmpty(student.getSubjectIdList())) {
-                String[] split = student.getSubjectIdList().split(",");
-                List<String> list = new ArrayList<>(Arrays.asList(split));
-                if (!list.contains(studentRegistration.getSubjectId().toString())) {
-                    list.add(studentRegistration.getSubjectId().toString());
-                    student.setSubjectIdList(StringUtils.join(list, ","));
-                    student.setUpdateTime(date);
-                    studentDao.update(student);
-                }
             }
             imGroupDao.updateNickname(userId, sysUser.getUsername());
             imGroupDao.updateUserFriendNickname(userId, sysUser.getUsername());

+ 10 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicCompareRecordServiceImpl.java

@@ -13,6 +13,7 @@ import com.ym.mec.biz.dal.page.SysMusicCompareRecordQueryInfo;
 import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.biz.service.SysMusicCompareRecordService;
+import com.ym.mec.biz.service.SysMusicCompareWeekDataService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
@@ -37,6 +38,10 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 	@Autowired
 	private SysMusicCompareRecordDao sysMusicCompareRecordDao;
 	@Autowired
+	private SysMusicCompareWeekDataService sysMusicCompareWeekDataService;
+	@Autowired
+	private SysMusicCompareWeekDataDao sysMusicCompareWeekDataDao;
+	@Autowired
 	private SysMusicScoreDao sysMusicScoreDao;
 	@Autowired
 	private TeacherDao teacherDao;
@@ -55,8 +60,10 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 
 	@Override
 	public long insert(SysMusicCompareRecord bean) {
+		long insert = super.insert(bean);
 		studentDao.addStudentCloudStudySequenceDays(bean.getUserId());
-		return super.insert(bean);
+		sysMusicCompareWeekDataService.updateUserWeekTrainData(bean.getUserId(), LocalDate.now().with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue()));
+		return insert;
 	}
 
 	@Override
@@ -95,6 +102,7 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 		sysMusicCompareRecord.setFeature(FeatureType.CLOUD_STUDY_EVALUATION);
 		sysMusicCompareRecordDao.insert(sysMusicCompareRecord);
 		studentDao.addStudentCloudStudySequenceDays(user.getId());
+		sysMusicCompareWeekDataService.updateUserWeekTrainData(user.getId(), LocalDate.now().with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue()));
 	}
 
 	@Override
@@ -132,19 +140,8 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 		StatDto result = new StatDto();
 		MusicCompareRankingDto head = new MusicCompareRankingDto();
 		head.setUserId(queryInfo.getUserId());
-		List<MusicCompareRankingDto> userTrainStat = sysMusicCompareRecordDao.getUserTrainStat(queryInfo.getStartTime(), queryInfo.getEndTime(), queryInfo.getHeardLevel());
+		List<MusicCompareRankingDto> userTrainStat = sysMusicCompareWeekDataDao.getUserTrainStat(queryInfo.getStartTime(), queryInfo.getOrderType(), Objects.isNull(queryInfo.getHeardLevel())?null:queryInfo.getHeardLevel().getCode());
 		List<MusicCompareRankingDto> detail = new ArrayList<>();
-		switch (queryInfo.getOrderType()){
-			case 1:
-				userTrainStat.sort(Comparator.comparing(MusicCompareRankingDto::getScore, Comparator.reverseOrder()).thenComparing(MusicCompareRankingDto::getUserId));
-				break;
-			case 2:
-				userTrainStat.sort(Comparator.comparing(MusicCompareRankingDto::getTrainDays, Comparator.reverseOrder()).thenComparing(MusicCompareRankingDto::getUserId));
-				break;
-			default:
-				userTrainStat.sort(Comparator.comparing(MusicCompareRankingDto::getTrainTime, Comparator.reverseOrder()).thenComparing(MusicCompareRankingDto::getUserId));
-				break;
-		}
 
 		List<Integer> studentIds = userTrainStat.stream().limit(10).map(MusicCompareRankingDto::getUserId).collect(Collectors.toList());
 		Map<Integer, String> studentSubjectMap = new HashMap<>();

+ 52 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicCompareWeekDataServiceImpl.java

@@ -0,0 +1,52 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.SysMusicCompareRecordDao;
+import com.ym.mec.biz.dal.entity.SysMusicCompareRecord;
+import com.ym.mec.biz.dal.enums.HeardLevelEnum;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.util.date.DateUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.biz.dal.entity.SysMusicCompareWeekData;
+import com.ym.mec.biz.service.SysMusicCompareWeekDataService;
+import com.ym.mec.biz.dal.dao.SysMusicCompareWeekDataDao;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.sql.Date;
+import java.time.LocalDate;
+import java.util.Objects;
+
+@Service
+public class SysMusicCompareWeekDataServiceImpl extends BaseServiceImpl<Integer, SysMusicCompareWeekData> implements SysMusicCompareWeekDataService{
+
+	@Autowired
+	private SysMusicCompareWeekDataDao sysMusicCompareWeekDataDao;
+	@Autowired
+	private SysMusicCompareRecordDao sysMusicCompareRecordDao;
+
+	@Override
+	public BaseDAO<Integer, SysMusicCompareWeekData> getDAO() {
+		return sysMusicCompareWeekDataDao;
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+	public void updateUserWeekTrainData(Integer userId, LocalDate monday) {
+		SysMusicCompareWeekData userWeekData = sysMusicCompareWeekDataDao.getWithUserAndMonday(userId, monday.toString());
+
+		SysMusicCompareWeekData userWeekCompareData = sysMusicCompareRecordDao.getUserWeekCompareData(userId, monday.toString());
+		userWeekCompareData.setUserId(userId);
+		userWeekCompareData.setMonday(Date.from(monday.atStartOfDay(DateUtil.zoneId).toInstant()));
+		userWeekCompareData.setBeginnerMaxScoreId(sysMusicCompareRecordDao.getUserWeekMaxMusicScoreId(userId, monday.toString(), HeardLevelEnum.BEGINNER));
+		userWeekCompareData.setAdvancedMaxScoreId(sysMusicCompareRecordDao.getUserWeekMaxMusicScoreId(userId, monday.toString(), HeardLevelEnum.ADVANCED));
+		userWeekCompareData.setPerformerMaxScoreId(sysMusicCompareRecordDao.getUserWeekMaxMusicScoreId(userId, monday.toString(), HeardLevelEnum.PERFORMER));
+
+		if(Objects.isNull(userWeekData)){
+			sysMusicCompareWeekDataDao.insert(userWeekCompareData);
+		}else{
+			sysMusicCompareWeekDataDao.update(userWeekCompareData);
+		}
+	}
+}

+ 17 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -282,9 +282,23 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 					courseHomework.setExpiryDate(DateUtil.addDays(date,7));
 
 					courseHomeworkService.insert(courseHomework);
-
-					List<StudentCourseHomework> studentCourseHomeworks = studentCourseHomeworkDao
-							.constructInitialStudentHomeworkRecordsWithPayment(teacherAttendance.getCourseScheduleId(),courseHomework.getId(),courseHomework.getMusicScoreId());
+					List<StudentCourseHomework> studentCourseHomeworks = new ArrayList<>();
+
+					//获取按学员声部发放的作业
+					List<MusicScoreSubjectDto> musicScoreSubjectDto = courseHomework.getMusicScoreSubjectDto();
+					if(musicScoreSubjectDto != null && musicScoreSubjectDto.size() > 0){
+						for (MusicScoreSubjectDto scoreSubjectDto : musicScoreSubjectDto) {
+							studentCourseHomeworks.addAll(studentCourseHomeworkDao.constructInitialStudentHomeworkRecordsWithPayment(teacherAttendance.getCourseScheduleId(),
+									courseHomework.getId(),
+									StringUtils.join(scoreSubjectDto.getMusicScoreIdList(),","),
+									scoreSubjectDto.getUserIdList()));
+						}
+					}else {
+						studentCourseHomeworks.addAll(studentCourseHomeworkDao.constructInitialStudentHomeworkRecordsWithPayment(teacherAttendance.getCourseScheduleId(),
+								courseHomework.getId(),
+								courseHomework.getMusicScoreId(),
+								null));
+					}
 					if(CollectionUtils.isEmpty(studentCourseHomeworks)){
 						throw new BizException("此课程没有学生");
 					}

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -3842,6 +3842,9 @@
         <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
             #{courseId}
         </foreach>
+        <if test="courseType != null and courseType != ''">
+            AND FIND_IN_SET(cs.type_,#{courseType})
+        </if>
         ORDER BY cs.class_date_,cs.start_class_time_,cs.id_
         <include refid="global.limit"></include>
     </select>
@@ -3853,6 +3856,9 @@
         <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
             #{courseId}
         </foreach>
+        <if test="courseType != null and courseType != ''">
+            AND FIND_IN_SET(cs.type_,#{courseType})
+        </if>
     </select>
 
     <select id="getMusicGroupHasStartCourseNum" resultType="integer">

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

@@ -813,4 +813,12 @@
 		GROUP BY
 			su.organ_id_
 	</select>
+    <select id="getCourseStudents" resultType="com.ym.mec.biz.dal.dto.BasicUserDto">
+		SELECT cssp.user_id_ userId,st.member_rank_setting_id_,s.name_ subjectName,su.avatar_ headUrl,su.username_ name,st.subject_id_list_
+		FROM course_schedule_student_payment cssp
+		LEFT JOIN sys_user su ON su.id_ = cssp.user_id_
+		LEFT JOIN student st ON st.user_id_ = cssp.user_id_
+		LEFT JOIN `subject` s ON s.id_ = st.subject_id_list_
+		WHERE cssp.course_schedule_id_ = #{courseScheduleId}
+	</select>
 </mapper>

+ 0 - 2
mec-biz/src/main/resources/config/mybatis/EmployeeMapper.xml

@@ -137,9 +137,7 @@
             <if test="demissionDate != null">
                 demission_date_ = #{demissionDate},
             </if>
-            <if test="deptId != null">
                 dept_id_ = #{deptId},
-            </if>
             <if test="deptIds != null">
                 dept_ids_ = #{deptIds},
             </if>

+ 5 - 8
mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesMapper.xml

@@ -21,8 +21,6 @@
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="organ_name_" property="organName" />
-		<result column="music_score_id_" property="musicScoreId" />
-		<result column="music_score_name_" property="musicScoreName"/>
 	</resultMap>
 
 	<sql id="queryPageCondition">
@@ -61,18 +59,15 @@
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercises" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO extracurricular_exercises (teacher_id_,student_id_list_,batch_no_,
-		                                       title_,attachments_,content_,expire_date_,completed_num_,expect_num_,create_time_,update_time_,music_score_id_)
+		                                       title_,attachments_,content_,expire_date_,completed_num_,expect_num_,create_time_,update_time_)
 		VALUES(#{teacherId},#{studentIdList},#{batchNo},#{title},#{attachments},
-		       #{content},#{expireDate},#{completedNum},#{expectNum},NOW(), NOW(),#{musicScoreId})
+		       #{content},#{expireDate},#{completedNum},#{expectNum},NOW(), NOW())
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercises">
 		UPDATE extracurricular_exercises
 		<set>
-			<if test="musicScoreId != null">
-				music_score_id_ = #{musicScoreId},
-			</if>
 			<if test="studentIdList != null">
 			student_id_list_ = #{studentIdList},
 			</if>
@@ -165,7 +160,9 @@
 			su.id_ userId,
 			su.username_ name,
 			su.avatar_ headUrl,
-			GROUP_CONCAT(sub.name_) subjectName
+			GROUP_CONCAT(sub.name_) subjectName,
+		    stu.member_rank_setting_id_,
+			stu.subject_id_list_
 		FROM
 			student_extracurricular_exercises_situation_ sees
 			<if test="musicGroupId!=null and musicGroupId!=''">

+ 0 - 8
mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesReplyMapper.xml

@@ -35,7 +35,6 @@
 		<result column="content_" property="content"/>
 		<result column="expire_date_" property="expireDate"/>
 		<result column="music_score_id_" property="musicScoreId" />
-		<result column="music_score_name_" property="musicScoreName"/>
 	</resultMap>
 
 	<sql id="queryPageCondition">
@@ -88,11 +87,6 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!--
-		<selectKey resultClass="int" keyProperty="id" > 
-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
-		</selectKey>
-		-->
 		INSERT INTO extracurricular_exercises_reply (extracurricular_exercises_id_,user_id_,attachments_,create_time_,update_time_,remark_,status_,is_replied_,is_view_,is_replied_timely_)
 		VALUES(#{extracurricularExercisesId},#{userId},#{attachments},NOW(),NOW(),#{remark},#{status},#{isReplied},#{isView},#{isRepliedTimely})
 	</insert>
@@ -200,12 +194,10 @@
 			ee.expire_date_,
 			ee.teacher_id_,
 			ee.music_score_id_,
-			sms.name_ music_score_name_,
 			su.username_ student_name_
 		FROM
 			extracurricular_exercises_reply eer
 			LEFT JOIN extracurricular_exercises ee ON ee.id_=eer.extracurricular_exercises_id_
-			LEFT JOIN sys_music_score sms ON sms.id_ = ee.music_score_id_
 			LEFT JOIN sys_user su ON su.id_ = eer.user_id_
 		WHERE
 			eer.id_ = #{extraExerciseReplyId}

+ 11 - 4
mec-biz/src/main/resources/config/mybatis/ImGroupMapper.xml

@@ -28,6 +28,8 @@
 		<result column="role_type_" property="roleType" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+		<result column="member_rank_setting_id_" property="memberRankSettingId" />
+		<result column="subject_name_" property="subjectName" />
 		<result column="username_" property="user.username" />
 		<result column="avatar_" property="user.avatar" />
 	</resultMap>
@@ -121,7 +123,8 @@
 	</select>
 	
 	<select id="queryByUserId" resultMap="ImGroup" parameterType="map">
-		SELECT ig.* FROM im_group_member igm left join im_group ig on igm.im_group_id_ = ig.id_
+		SELECT ig.* FROM im_group_member igm
+		LEFT JOIN im_group ig ON igm.im_group_id_ = ig.id_
 		where igm.user_id_ = #{userId}
 		<if test="search != null">
 			and (ig.name_ like concat('%',#{search},'%') or ig.tags_ like concat('%',#{search},'%'))
@@ -129,9 +132,13 @@
 	</select>
 	
 	<select id="queryMemberById" resultMap="ImGroupMemberDto">
-		SELECT igm.*,u.avatar_,case when find_in_set('STUDENT',u.user_type_) then u.username_ else u.real_name_ end username_
-		FROM im_group_member igm left join sys_user u on igm.user_id_ = u.id_
-		where igm.im_group_id_ = #{imGroupId}
+		SELECT igm.*,u.avatar_,CASE WHEN find_in_set('STUDENT',u.user_type_) THEN u.username_ ELSE u.real_name_ END username_,
+		st.member_rank_setting_id_,s.name_ subject_name_
+		FROM im_group_member igm
+		LEFT JOIN sys_user u ON igm.user_id_ = u.id_
+		LEFT JOIN student st ON st.user_id_ = u.id_
+		LEFT JOIN `subject` s ON s.id_ = st.subject_id_list_
+		WHERE igm.im_group_id_ = #{imGroupId}
 	</select>
 	
 	<select id="queryMember" resultMap="ImGroupMemberDto" parameterType="map">

+ 5 - 1
mec-biz/src/main/resources/config/mybatis/ImUserFriendMapper.xml

@@ -13,6 +13,8 @@
 		<result column="friend_nickname_" property="friendNickname" />
 		<result column="memo_" property="memo" />
 		<result column="tags_" property="tags" />
+		<result column="member_rank_setting_id_" property="memberRankSettingId" />
+		<result column="subject_name_" property="subjectName" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 	</resultMap>
@@ -90,9 +92,11 @@
 	</select>
 	
 	<select id="queryFriendListByUserId" resultMap="ImUserFriendDto" parameterType="map">
-		SELECT iuf.*,u.real_name_,u.avatar_,u.phone_,u.user_type_
+		SELECT iuf.*,u.real_name_,u.avatar_,u.phone_,u.user_type_,st.member_rank_setting_id_,s.name_ subject_name_
 		FROM im_user_friend iuf
 		LEFT JOIN sys_user u ON iuf.friend_id_ = u.id_
+		LEFT JOIN student st ON st.user_id_ = u.id_
+		LEFT JOIN `subject` s ON s.id_ = st.subject_id_list_
 		WHERE iuf.user_id_ = #{userId}
 		<if test="search != null">
 			and (u.real_name_ like concat('%',#{search},'%') or iuf.friend_nickname_ like concat('%',#{search},'%'))

+ 1 - 31
mec-biz/src/main/resources/config/mybatis/MemberFeeSettingMapper.xml

@@ -49,54 +49,24 @@
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.MemberFeeSetting">
 		UPDATE member_fee_setting
 		<set>
-			<if test="originalHalfYearFee != null">
 				original_half_year_fee_ = #{originalHalfYearFee},
-			</if>
-			<if test="originalQuarterlyFee != null">
 				original_quarterly_fee_ = #{originalQuarterlyFee},
-			</if>
-			<if test="originalDayFee != null">
 				original_day_fee_ = #{originalDayFee},
-			</if>
 			<if test="id != null">
 				id_ = #{id},
 			</if>
-			<if test="currentHalfYearFee != null">
 				current_half_year_fee_ = #{currentHalfYearFee},
-			</if>
-			<if test="currentQuarterlyFee != null">
 				current_quarterly_fee_ = #{currentQuarterlyFee},
-			</if>
-			<if test="currentDayFee != null">
 				current_day_fee_ = #{currentDayFee},
-			</if>
-			<if test="groupPurchaseQuarterlyFee != null">
 				group_purchase_quarterly_fee_ = #{groupPurchaseQuarterlyFee},
-			</if>
-			<if test="groupPurchaseHalfYearFee != null">
 				group_purchase_half_year_fee_ = #{groupPurchaseHalfYearFee},
-			</if>
-			<if test="currentYearFee != null">
 				current_year_fee_ = #{currentYearFee},
-			</if>
-			<if test="groupPurchaseDayFee != null">
 				group_purchase_day_fee_ = #{groupPurchaseDayFee},
-			</if>
-			<if test="groupPurchaseMonthFee != null">
 				group_purchase_month_fee_ = #{groupPurchaseMonthFee},
-			</if>
-			<if test="groupPurchaseYearFee != null">
 				group_purchase_year_fee_ = #{groupPurchaseYearFee},
-			</if>
-			<if test="currentMonthFee != null">
 				current_month_fee_ = #{currentMonthFee},
-			</if>
-			<if test="originalMonthFee != null">
 				original_month_fee_ = #{originalMonthFee},
-			</if>
-			<if test="originalYearFee != null">
-				original_year_fee_ = #{originalYearFee},
-			</if>
+				original_year_fee_ = #{originalYearFee}
 		</set>
 		WHERE id_ = #{id}
 	</update>

+ 6 - 3
mec-biz/src/main/resources/config/mybatis/StudentCourseHomeworkMapper.xml

@@ -40,7 +40,6 @@
         <result column="expect_num_" property="expectNum"/>
         <result column="attachments_" property="attachments"/>
         <result column="score_" property="score"/>
-        <result column="music_score_name_" property="musicScoreName"/>
         <result column="music_score_id_" property="musicScoreId"/>
         <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="is_replied_" property="isReplied" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
@@ -225,7 +224,6 @@
                ch.expect_num_,
                ch.expiry_date_,
                sch.music_score_id_,
-               sms.name_ music_score_name_,
                sch.id_  studentCourseHomeworkId,
                sch.attachments_,
                sch.score_,
@@ -236,7 +234,6 @@
                  LEFT JOIN student_course_homework sch ON ch.id_ = sch.course_homework_id_
                  LEFT JOIN music_group mg ON ch.music_group_id_ = mg.id_
                  LEFT JOIN class_group cg ON ch.class_group_id_ = cg.id_
-                 LEFT JOIN sys_music_score sms ON sch.music_score_id_ = sms.id_
         WHERE ch.course_schedule_id_ = #{courseScheduleID}
           AND sch.user_id_ = #{userID}
     </select>
@@ -259,6 +256,12 @@
                0                   is_replied_timely_
         FROM course_schedule_student_payment sa
         WHERE sa.course_schedule_id_ = #{courseScheduleID}
+        <if test="userIdList != null and userIdList.size > 0">
+            AND sa.user_id_ IN
+            <foreach collection="userIdList" open="(" close=")" separator="," item="userId">
+                #{userId}
+            </foreach>
+        </if>
     </select>
     <select id="findByCourseSchedule" resultMap="StudentCourseHomework">
         SELECT

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

@@ -1220,6 +1220,27 @@
     <select id="getValidVipStudentIds" resultType="java.lang.Integer">
         SELECT user_id_ FROM student WHERE member_rank_setting_id_ IS NOT NULl OR experience_member_rank_setting_id_ IS NOT NULL
     </select>
+    <select id="countCourseStudentMemberNum" resultType="java.util.Map">
+        SELECT cssp.course_schedule_id_ 'key',COUNT(CASE WHEN s.member_rank_setting_id_ IS NULL THEN NULL ELSE 1 END) 'value'
+        FROM course_schedule_student_payment cssp
+        LEFT JOIN student s ON s.user_id_ = cssp.course_schedule_id_
+        WHERE cssp.course_schedule_id_ IN
+        <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
+            #{courseId}
+        </foreach>
+        GROUP BY cssp.course_schedule_id_
+    </select>
+    <select id="countCourseStudentSubjectName" resultType="java.util.Map">
+        SELECT cssp.course_schedule_id_ 'key',GROUP_CONCAT(DISTINCT st.name_) 'value'
+        FROM course_schedule_student_payment cssp
+        LEFT JOIN student s ON s.user_id_ = cssp.user_id_
+        LEFT JOIN `subject` st ON st.id_ = s.subject_id_list_
+        WHERE cssp.course_schedule_id_ IN
+        <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
+            #{courseId}
+        </foreach>
+        GROUP BY cssp.course_schedule_id_
+    </select>
 
     <update id="updateGrade"><![CDATA[
         UPDATE student SET current_grade_num_=current_grade_num_+1

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

@@ -384,4 +384,22 @@
     <select id="getUserLastEvaluationData" resultMap="SysMusicCompareRecord">
 		SELECT * FROM sys_music_compare_record WHERE user_id_=#{userId} AND feature_ = 'CLOUD_STUDY_EVALUATION' ORDER BY create_time_ DESC LIMIT 1
 	</select>
+
+	<select id="getUserWeekCompareData" resultType="com.ym.mec.biz.dal.entity.SysMusicCompareWeekData">
+		SELECT
+			COUNT(smcr.id_) trainNum,
+			COUNT(DISTINCT DATE(smcr.create_time_)) trainDays,
+			SUM(smcr.play_time_) trainTime,
+			MAX(IF(heard_level_='BEGINNER', smcr.score_, 0)) beginnerMaxScore,
+			MAX(IF(heard_level_='ADVANCED', smcr.score_, 0)) advancedMaxScore,
+			MAX(IF(heard_level_='PERFORMER', smcr.score_, 0)) performerMaxScore
+		FROM sys_music_compare_record smcr
+		WHERE user_id_=#{userId} AND monday_ = #{monday}
+	</select>
+
+	<select id="getUserWeekMaxMusicScoreId" resultType="java.lang.Integer">
+		SELECT sys_music_score_id_ FROM sys_music_compare_record
+		WHERE user_id_=#{userId} AND monday_ = #{monday} AND heard_level_ = #{heardLevel, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+		ORDER BY score_ DESC LIMIT 1
+	</select>
 </mapper>

+ 159 - 0
mec-biz/src/main/resources/config/mybatis/SysMusicCompareWeekDataMapper.xml

@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.ym.mec.biz.dal.dao.SysMusicCompareWeekDataDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.SysMusicCompareWeekData" id="SysMusicCompareWeekData">
+		<result column="user_id_" property="userId" />
+		<result column="monday_" property="monday" />
+		<result column="train_num_" property="trainNum" />
+		<result column="train_days_" property="trainDays" />
+		<result column="train_time_" property="trainTime" />
+		<result column="beginner_max_score_" property="beginnerMaxScore" />
+		<result column="advanced_max_score_" property="advancedMaxScore" />
+		<result column="performer_max_score_" property="performerMaxScore" />
+	</resultMap>
+	
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="SysMusicCompareWeekData">
+		SELECT * FROM sys_music_compare_week_data
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysMusicCompareWeekData">
+		<!--
+		<selectKey resultClass="int" keyProperty="id" > 
+		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
+		</selectKey>
+		-->
+		INSERT INTO sys_music_compare_week_data (user_id_,monday_,train_num_,train_days_,train_time_,
+		                                         beginner_max_score_,beginner_max_score_id_,advanced_max_score_,advanced_max_score_id_,
+		                                         performer_max_score_,performer_max_score_id_,
+		                                         create_time_,update_time_)
+		VALUES(#{userId},#{monday},#{trainNum},#{trainDays},#{trainTime},#{beginnerMaxScore},#{beginnerMaxScoreId},
+		       #{advancedMaxScore},#{advancedMaxScoreId},#{performerMaxScore},#{performerMaxScoreId},NOW(),NOW())
+	</insert>
+	
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.SysMusicCompareWeekData">
+		UPDATE sys_music_compare_week_data
+		<set>
+			<if test="trainNum!=null">
+				train_num_ = #{trainNum},
+			</if>
+			<if test="trainDays!=null">
+				train_days_ = #{trainDays},
+			</if>
+			<if test="trainTime!=null">
+				train_time_ = #{trainTime},
+			</if>
+			<if test="beginnerMaxScore!=null">
+				beginner_max_score_ = #{beginnerMaxScore},
+			</if>
+			<if test="beginnerMaxScoreId!=null">
+				beginner_max_score_id_ = #{beginnerMaxScoreId},
+			</if>
+			<if test="advancedMaxScore!=null">
+				advanced_max_score_ = #{advancedMaxScore},
+			</if>
+			<if test="advancedMaxScoreId!=null">
+				advanced_max_score_id_ = #{advancedMaxScoreId},
+			</if>
+			<if test="performerMaxScore!=null">
+				performer_max_score_ = #{performerMaxScore},
+			</if>
+			<if test="performerMaxScoreId!=null">
+				performer_max_score_id_ = #{performerMaxScoreId},
+			</if>
+			update_time_ = NOW()
+		</set>
+		WHERE user_id_=#{userId} AND monday_ = #{monday}
+	</update>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="SysMusicCompareWeekData" parameterType="map">
+		SELECT * FROM sys_music_compare_week_data <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM sys_music_compare_week_data
+	</select>
+
+	<select id="getWithUserAndMonday" resultMap="SysMusicCompareWeekData">
+		SELECT * FROM sys_music_compare_week_data WHERE user_id_=#{userId} AND monday_=#{monday}
+	</select>
+
+	<select id="getUserTrainStat" resultType="com.ym.mec.biz.dal.dto.MusicCompareRankingDto">
+		SELECT
+		smcwd.user_id_ userId,
+			su.avatar_ avatar,
+			su.username_ studentName,
+			<if test="orderType==1">
+				sms.name_ musicScoreName,
+				<if test="heardLevel==null">
+					smcwd.advanced_max_score_ score,
+				</if>
+				<if test="heardLevel=='BEGINNER'">
+					smcwd.beginner_max_score_ score,
+				</if>
+				<if test="heardLevel=='ADVANCED'">
+					smcwd.advanced_max_score_ score,
+				</if>
+				<if test="heardLevel=='PERFORMER'">
+					smcwd.performer_max_score_ score,
+				</if>
+			</if>
+			smcwd.train_num_ trainNum,
+			smcwd.train_days_ trainDays,
+			smcwd.train_time_ trainTime
+		FROM sys_music_compare_week_data smcwd
+		LEFT JOIN sys_user su ON smcwd.user_id_=su.id_
+		LEFT JOIN student stu ON smcwd.user_id_ = stu.user_id_
+		<if test="orderType==1">
+			LEFT JOIN sys_music_score sms
+			<if test="heardLevel==null">
+				ON smcwd.advanced_max_score_id_ = sms.id_
+			</if>
+			<if test="heardLevel=='BEGINNER'">
+				ON smcwd.beginner_max_score_id_ = sms.id_
+			</if>
+			<if test="heardLevel=='ADVANCED'">
+				ON smcwd.advanced_max_score_id_ = sms.id_
+			</if>
+			<if test="heardLevel=='PERFORMER'">
+				ON smcwd.performer_max_score_id_ = sms.id_
+			</if>
+		</if>
+		WHERE smcwd.monday_ = #{monday}
+			AND stu.user_id_=smcwd.user_id_
+			ORDER BY
+			<if test="orderType==null">
+				smcwd.train_time_ DESC,
+			</if>
+			<if test="orderType==0">
+				smcwd.train_time_ DESC,
+			</if>
+			<if test="orderType==1">
+				<if test="heardLevel==null">
+					smcwd.advanced_max_score_ DESC,
+				</if>
+				<if test="heardLevel=='BEGINNER'">
+					smcwd.beginner_max_score_ DESC,
+				</if>
+				<if test="heardLevel=='ADVANCED'">
+					smcwd.advanced_max_score_ DESC,
+				</if>
+				<if test="heardLevel=='PERFORMER'">
+					smcwd.performer_max_score_ DESC,
+				</if>
+			</if>
+			<if test="orderType==2">
+				smcwd.train_days_ DESC,
+			</if>
+			smcwd.user_id_
+	</select>
+</mapper>

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/SysMusicScoreMapper.xml

@@ -101,6 +101,9 @@
 		SELECT COUNT(0) FROM sys_music_score ses
 		<include refid="queryPageSql"/>
 	</select>
+    <select id="findByIds" resultMap="SysMusicScore">
+		SELECT * FROM sys_music_score WHERE FIND_IN_SET(id_,#{musicScoreIds})
+	</select>
     <sql id="queryPageSql">
 		<where>
 			ses.del_flag_ = 0

+ 17 - 14
mec-teacher/src/main/java/com/ym/mec/teacher/controller/ClassGroupController.java

@@ -1,21 +1,8 @@
 package com.ym.mec.teacher.controller;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-import java.util.Objects;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
 import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.ImGroupNoticeQueryInfo;
@@ -24,6 +11,14 @@ import com.ym.mec.biz.service.CourseScheduleEvaluateService;
 import com.ym.mec.biz.service.ImGroupNoticeService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Objects;
 
 /**
  * @Author Joburgess
@@ -42,6 +37,8 @@ public class ClassGroupController extends BaseController {
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private ImGroupNoticeService imGroupNoticeService;
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 
     @ApiOperation(value = "教师关联班级获取")
     @GetMapping("/findTeacherClassGroups")
@@ -61,6 +58,12 @@ public class ClassGroupController extends BaseController {
         return succeed(classGroupService.findTeacherClassStudents(queryInfo));
     }
 
+    @ApiOperation(value = "获取课程学员列表")
+    @GetMapping("/getCourseStudents")
+    public HttpResponseResult getCourseStudents(Long courseScheduleId){
+        return succeed(courseScheduleStudentPaymentDao.getCourseStudents(courseScheduleId));
+    }
+
     @ApiOperation(value = "提交陪练报告")
     @PostMapping(value = "/addStudyReport")
     public HttpResponseResult addStudyReport(@RequestBody CourseScheduleEvaluate courseScheduleEvaluate) {

+ 2 - 2
mec-teacher/src/main/java/com/ym/mec/teacher/controller/CourseReviewController.java

@@ -109,9 +109,9 @@ public class CourseReviewController extends BaseController {
     @PostMapping(value = "/addHomeWork")
     @ApiImplicitParams({ @ApiImplicitParam(name = "courseId", value = "课程编号", required = true, dataType = "int"),
             @ApiImplicitParam(name = "content", value = "作业内容", required = true, dataType = "String"),
-            @ApiImplicitParam(name = "musicScoreId", value = "伴奏编号", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "musicScoreId", value = "伴奏编号", required = true, dataType = "String"),
             @ApiImplicitParam(name = "expiryDate", value = "作业截止日期", required = true, dataType = "Date")})
-    public HttpResponseResult addHomeWork(Integer courseId, String content, Date expiryDate,Integer musicScoreId) {
+    public HttpResponseResult addHomeWork(Integer courseId, String content, Date expiryDate,String musicScoreId) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (Objects.isNull(sysUser)) {
             return failed(HttpStatus.FORBIDDEN, "请登录");

+ 17 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/ExtracurricularExercisesController.java

@@ -3,6 +3,7 @@ package com.ym.mec.teacher.controller;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
 import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
@@ -11,8 +12,10 @@ import com.ym.mec.biz.dal.entity.ExtracurricularExercises;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.page.ExtraExercilseQueryInfo;
+import com.ym.mec.biz.dal.page.TeacherServeHomeworkQueryInfo;
 import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
 import com.ym.mec.biz.service.ExtracurricularExercisesService;
+import com.ym.mec.biz.service.StudentExtracurricularExercisesSituationService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.yonge.log.model.AuditLogAnnotation;
@@ -20,6 +23,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -43,6 +47,8 @@ public class ExtracurricularExercisesController extends BaseController {
     @Autowired
     private ExtracurricularExercisesReplyService extracurricularExercisesReplyService;
     @Autowired
+    private StudentExtracurricularExercisesSituationService studentExtracurricularExercisesSituationService;
+    @Autowired
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private StudentRegistrationDao studentRegistrationDao;
@@ -51,6 +57,17 @@ public class ExtracurricularExercisesController extends BaseController {
     @Autowired
     private StudentDao studentDao;
 
+    @ApiOperation(value = "教师服务课后作业")
+    @GetMapping("/queryTeacherServeHomeworkDetail")
+    public HttpResponseResult queryTeacherServeHomeworkDetail(TeacherServeHomeworkQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        queryInfo.setTeacherId(sysUser.getId());
+        return succeed(studentExtracurricularExercisesSituationService.queryTeacherServeHomeworkDetail(queryInfo));
+    }
+
     @ApiOperation(value = "创建课外训练")
     @PostMapping("/createExtraExercises")
     @AuditLogAnnotation(operateName = "创建课外训练")

+ 2 - 1
mec-util/src/main/java/com/ym/mec/util/collection/MapUtil.java

@@ -131,7 +131,8 @@ public class MapUtil {
 			if(Objects.isNull(stringIntegerMap)){
 				return;
 			}
-			result.put(stringIntegerMap.get("key"),stringIntegerMap.get("value").toString());
+			K value = stringIntegerMap.get("value");
+			result.put(stringIntegerMap.get("key"),value == null?"":value.toString());
 		});
 		return result;
 	}