Browse Source

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

zouxuan 4 năm trước cách đây
mục cha
commit
e24daf7e28
76 tập tin đã thay đổi với 1670 bổ sung292 xóa
  1. 1 1
      cms/src/main/java/com/ym/mec/cms/config/ResourceServerConfig.java
  2. 13 4
      cms/src/main/java/com/ym/mec/cms/controller/NewsController.java
  3. 3 0
      cms/src/main/java/com/ym/mec/cms/dal/dao/SysNewsInformationDao.java
  4. 13 0
      cms/src/main/java/com/ym/mec/cms/dal/dao/SysNewsTypeDao.java
  5. 81 0
      cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsType.java
  6. 17 0
      cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsTypeTree.java
  7. 26 0
      cms/src/main/java/com/ym/mec/cms/dto/SysNewsInformationDto.java
  8. 9 1
      cms/src/main/java/com/ym/mec/cms/service/SysNewsInformationService.java
  9. 15 0
      cms/src/main/java/com/ym/mec/cms/service/SysNewsTypeService.java
  10. 6 0
      cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java
  11. 49 0
      cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsTypeServiceImpl.java
  12. 12 0
      cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml
  13. 83 0
      cms/src/main/resources/config/mybatis/SysNewsTypeMapper.xml
  14. 10 0
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUser.java
  15. 4 3
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserMapper.xml
  16. 3 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  17. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java
  18. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentInstrumentDao.java
  19. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroup4MixDto.java
  20. 57 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseTimeDto.java
  21. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupStudentsDto.java
  22. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentApplyDetailDto.java
  23. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentManageListDto.java
  24. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Organization.java
  25. 24 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Student.java
  26. 53 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentInstrument.java
  27. 12 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPreRegistration.java
  28. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRegistration.java
  29. 37 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/FivePlusGradeEnum.java
  30. 27 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/GradeTypeEnum.java
  31. 37 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SixPlusGradeEnum.java
  32. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicGroupStudentQueryInfo.java
  33. 24 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentRegistrationQueryInfo.java
  34. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/OrganizationService.java
  35. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentGoodsSellService.java
  36. 30 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentInstrumentService.java
  37. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java
  38. 95 33
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  39. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesReplyServiceImpl.java
  40. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/InspectionItemPlanServiceImpl.java
  41. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/InspectionItemServiceImpl.java
  42. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/InspectionServiceImpl.java
  43. 20 15
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  44. 26 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationServiceImpl.java
  45. 21 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java
  46. 5 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java
  47. 84 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java
  48. 13 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java
  49. 45 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  50. 5 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  51. 169 141
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java
  52. 8 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java
  53. 14 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  54. 2 1
      mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesReplyMapper.xml
  55. 6 2
      mec-biz/src/main/resources/config/mybatis/OrganizationMapper.xml
  56. 72 13
      mec-biz/src/main/resources/config/mybatis/StudentInstrumentMapper.xml
  57. 13 3
      mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml
  58. 16 0
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  59. 5 1
      mec-biz/src/main/resources/config/mybatis/StudentPreRegistrationMapper.xml
  60. 16 3
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  61. 1 1
      mec-biz/src/main/resources/config/mybatis/StudentRepairMapper.xml
  62. 3 0
      mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml
  63. 2 2
      mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml
  64. 10 0
      mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java
  65. 10 0
      mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java
  66. 1 0
      mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java
  67. 14 12
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java
  68. 1 1
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java
  69. 15 3
      mec-student/src/main/java/com/ym/mec/student/controller/StudentManageController.java
  70. 19 0
      mec-task/src/main/java/com/ym/mec/task/jobs/MaintenanceOldDataAddTask.java
  71. 19 0
      mec-task/src/main/java/com/ym/mec/task/jobs/UpdateGradeTask.java
  72. 2 2
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  73. 14 4
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java
  74. 11 0
      mec-web/src/main/java/com/ym/mec/web/controller/OrganizationController.java
  75. 98 2
      mec-web/src/main/java/com/ym/mec/web/controller/StudentInstrumentController.java
  76. 12 0
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

+ 1 - 1
cms/src/main/java/com/ym/mec/cms/config/ResourceServerConfig.java

@@ -27,7 +27,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 		http.authorizeRequests()
 		.antMatchers("/task/**")
 		.hasIpAddress("0.0.0.0/0")
-				.antMatchers("/v2/api-docs", "/news/list", "/news/query", "/news/homeList")
+				.antMatchers("/v2/api-docs", "/news/list", "/news/query", "/news/homeList", "/news/typeList")
 				.permitAll()
 				// 任何人不登录都可以获取的资源
 				// .antMatchers("/ipController/**").hasIpAddress("127.0.0.1") //特定ip可以不登录获取资源

+ 13 - 4
cms/src/main/java/com/ym/mec/cms/controller/NewsController.java

@@ -1,8 +1,5 @@
 package com.ym.mec.cms.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
@@ -19,10 +16,13 @@ import org.springframework.web.bind.annotation.PostMapping;
 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.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.ym.mec.cms.dal.dao.SysNewsInformationDao;
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
 import com.ym.mec.cms.service.SysNewsInformationService;
+import com.ym.mec.cms.service.SysNewsTypeService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.util.collection.MapUtil;
 import com.yonge.log.model.AuditLogAnnotation;
@@ -36,6 +36,9 @@ public class NewsController extends BaseController {
 	private SysNewsInformationService sysNewsInformationService;
 	
 	@Autowired
+	private SysNewsTypeService sysNewsTypeService;
+	
+	@Autowired
 	private SysNewsInformationDao sysNewsInformationDao;
 	
 	@Autowired
@@ -57,6 +60,12 @@ public class NewsController extends BaseController {
 		return succeed(sysNewsInformationService.queryPage(queryInfo));
 	}
 
+	@ApiOperation("资讯类型列表查询")
+	@GetMapping(value = "/typeList")
+	public Object getTypeList(Integer parentId) {
+		return succeed(sysNewsTypeService.queryByParentId(parentId));
+	}
+
 	@ApiOperation("资讯列表分页查询")
 	@GetMapping(value = "/homeList")
 	public Object getHomeList(NewsInformationQueryInfo queryInfo) {
@@ -70,7 +79,7 @@ public class NewsController extends BaseController {
 	@GetMapping(value = "/query")
 	public Object query(Long id) {
 
-		return succeed(sysNewsInformationService.get(id));
+		return succeed(sysNewsInformationService.queryById(id));
 	}
 
 	@ApiOperation("新增资讯")

+ 3 - 0
cms/src/main/java/com/ym/mec/cms/dal/dao/SysNewsInformationDao.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
+import com.ym.mec.cms.dto.SysNewsInformationDto;
 import com.ym.mec.common.dal.BaseDAO;
 
 public interface SysNewsInformationDao extends BaseDAO<Long, SysNewsInformation> {
@@ -31,4 +32,6 @@ public interface SysNewsInformationDao extends BaseDAO<Long, SysNewsInformation>
 	 * @return
 	 */
 	List<SysNewsInformation> queryNeedUpdateStatusList();
+	
+	SysNewsInformationDto queryById(Long id);
 }

+ 13 - 0
cms/src/main/java/com/ym/mec/cms/dal/dao/SysNewsTypeDao.java

@@ -0,0 +1,13 @@
+package com.ym.mec.cms.dal.dao;
+
+import java.util.List;
+
+import com.ym.mec.cms.dal.entity.SysNewsType;
+import com.ym.mec.cms.dal.entity.SysNewsTypeTree;
+import com.ym.mec.common.dal.BaseDAO;
+
+public interface SysNewsTypeDao extends BaseDAO<Integer, SysNewsType> {
+
+	// 根据父级查询子集
+	List<SysNewsTypeTree> queryByParentId(Integer parentId);
+}

+ 81 - 0
cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsType.java

@@ -0,0 +1,81 @@
+package com.ym.mec.cms.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(sys_news_type):
+ */
+public class SysNewsType {
+
+	/**  */
+	private Integer id;
+	
+	/**  */
+	private String name;
+	
+	/**  */
+	private Integer parentId;
+	
+	/**  */
+	private boolean delFlag;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setName(String name){
+		this.name = name;
+	}
+	
+	public String getName(){
+		return this.name;
+	}
+			
+	public void setParentId(Integer parentId){
+		this.parentId = parentId;
+	}
+	
+	public Integer getParentId(){
+		return this.parentId;
+	}
+			
+	public void setDelFlag(boolean delFlag){
+		this.delFlag = delFlag;
+	}
+	
+	public boolean isDelFlag(){
+		return this.delFlag;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 17 - 0
cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsTypeTree.java

@@ -0,0 +1,17 @@
+package com.ym.mec.cms.dal.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SysNewsTypeTree extends SysNewsType {
+
+	private List<SysNewsTypeTree> subTypeList = new ArrayList<SysNewsTypeTree>();
+
+	public List<SysNewsTypeTree> getSubTypeList() {
+		return subTypeList;
+	}
+
+	public void setSubTypeList(List<SysNewsTypeTree> subTypeList) {
+		this.subTypeList = subTypeList;
+	}
+}

+ 26 - 0
cms/src/main/java/com/ym/mec/cms/dto/SysNewsInformationDto.java

@@ -0,0 +1,26 @@
+package com.ym.mec.cms.dto;
+
+import com.ym.mec.cms.dal.entity.SysNewsInformation;
+
+public class SysNewsInformationDto extends SysNewsInformation {
+
+	private String typeName;
+
+	private String subTypeName;
+
+	public String getTypeName() {
+		return typeName;
+	}
+
+	public void setTypeName(String typeName) {
+		this.typeName = typeName;
+	}
+
+	public String getSubTypeName() {
+		return subTypeName;
+	}
+
+	public void setSubTypeName(String subTypeName) {
+		this.subTypeName = subTypeName;
+	}
+}

+ 9 - 1
cms/src/main/java/com/ym/mec/cms/service/SysNewsInformationService.java

@@ -6,6 +6,7 @@ import java.util.Map;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
+import com.ym.mec.cms.dto.SysNewsInformationDto;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
@@ -32,7 +33,14 @@ public interface SysNewsInformationService extends BaseService<Long, SysNewsInfo
 	 * @return
 	 */
 	Map<String, PageInfo<SysNewsInformation>> getHomeList(SysUser user, NewsInformationQueryInfo queryInfo);
-	
+
+	/**
+	 * 获取详情
+	 * @param id
+	 * @return
+	 */
+	SysNewsInformationDto queryById(Long id);
+
 	/**
 	 * 自动更新状态
 	 * @return

+ 15 - 0
cms/src/main/java/com/ym/mec/cms/service/SysNewsTypeService.java

@@ -0,0 +1,15 @@
+package com.ym.mec.cms.service;
+
+import java.util.List;
+
+import com.ym.mec.cms.dal.entity.SysNewsType;
+import com.ym.mec.cms.dal.entity.SysNewsTypeTree;
+import com.ym.mec.common.service.BaseService;
+
+public interface SysNewsTypeService extends BaseService<Integer, SysNewsType> {
+	
+	List<SysNewsTypeTree> queryTree(Integer parentId);
+
+	//根据父级查询子集
+	List<SysNewsTypeTree> queryByParentId(Integer parentId);
+}

+ 6 - 0
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -17,6 +17,7 @@ import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.ym.mec.cms.dal.dao.SysNewsInformationDao;
 import com.ym.mec.cms.dal.entity.NewsStatusEnum;
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
+import com.ym.mec.cms.dto.SysNewsInformationDto;
 import com.ym.mec.cms.service.SysNewsInformationService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
@@ -133,6 +134,11 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 		return homeList;
 	}
 	
+	@Override
+	public SysNewsInformationDto queryById(Long id) {
+		return sysNewsInformationDao.queryById(id);
+	}
+
 	private PageInfo<SysNewsInformation> queryHomePage(QueryInfo queryInfo) {
 		PageInfo<SysNewsInformation> pageInfo = new PageInfo<SysNewsInformation>(queryInfo.getPage(), queryInfo.getRows());
 		Map<String, Object> params = new HashMap<String, Object>();

+ 49 - 0
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsTypeServiceImpl.java

@@ -0,0 +1,49 @@
+package com.ym.mec.cms.service.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.cms.dal.dao.SysNewsTypeDao;
+import com.ym.mec.cms.dal.entity.SysNewsType;
+import com.ym.mec.cms.dal.entity.SysNewsTypeTree;
+import com.ym.mec.cms.service.SysNewsTypeService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+
+@Service
+public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType>  implements SysNewsTypeService {
+	
+	@Autowired
+	private SysNewsTypeDao sysNewsTypeDao;
+
+	@Override
+	public BaseDAO<Integer, SysNewsType> getDAO() {
+		return sysNewsTypeDao;
+	}
+
+	@Override
+	public List<SysNewsTypeTree> queryTree(Integer parentId) {
+		if(parentId == null){
+			parentId = 0 ;
+		}
+		List<SysNewsTypeTree> sysNewsTypeList = queryByParentId(parentId);
+		if(sysNewsTypeList != null && sysNewsTypeList.size() > 0){
+			for(SysNewsTypeTree type : sysNewsTypeList){
+				type.setSubTypeList(queryTree(type.getId()));
+			}
+		}
+		
+		return sysNewsTypeList;
+	}
+
+	@Override
+	public List<SysNewsTypeTree> queryByParentId(Integer parentId) {
+		if(parentId == null){
+			parentId = 0 ;
+		}
+		return sysNewsTypeDao.queryByParentId(parentId);
+	}
+	
+}

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

@@ -31,6 +31,11 @@
 		<result column="subject_name_" property="subjectName" />
 	</resultMap>
 	
+	<resultMap type="com.ym.mec.cms.dto.SysNewsInformationDto" id="SysNewsInformationDto" extends="SysNewsInformation">
+		<result column="typeName" property="typeName" />
+		<result column="subTypeName" property="subTypeName" />
+	</resultMap>
+	
 	<sql id="queryCondition">
 		<where>
 			sni.del_flag_=0 
@@ -268,4 +273,11 @@
 		or (online_time_ is not null and online_time_ &gt;= now() and status_ = 1)
 		)
 	</select>
+	
+	<select id="queryById" resultMap="SysNewsInformationDto" >
+		SELECT sni.*,sntp.name_ typeName,snts.name_ subTypeName FROM sys_news_information sni 
+		left join sys_news_type sntp on sni.type_ = sntp.id_
+		left join sys_news_type snts on sni.sub_type_ = snts.id_
+		where sni.id_ = #{id}
+	</select>
 </mapper>

+ 83 - 0
cms/src/main/resources/config/mybatis/SysNewsTypeMapper.xml

@@ -0,0 +1,83 @@
+<?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.cms.dal.dao.SysNewsTypeDao">
+
+	<resultMap type="com.ym.mec.cms.dal.entity.SysNewsType" id="SysNewsType">
+		<result column="id_" property="id" />
+		<result column="name_" property="name" />
+		<result column="parent_id_" property="parentId" />
+		<result column="del_flag_" property="delFlag" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	<resultMap type="com.ym.mec.cms.dal.entity.SysNewsTypeTree" extends="SysNewsType" id="SysNewsTypeTree">
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="SysNewsType">
+		SELECT * FROM
+		sys_news_type WHERE id_ = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="SysNewsType">
+		SELECT * FROM sys_news_type ORDER
+		BY id_
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.cms.dal.entity.SysNewsType"
+		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO sys_news_type
+		(id_,name_,parent_id_,del_flag_,create_time_,update_time_)
+		VALUES(#{id},#{name},#{parentId},#{delFlag},#{createTime},#{updateTime})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.cms.dal.entity.SysNewsType">
+		UPDATE sys_news_type
+		<set>
+			<if test="parentId != null">
+				parent_id_ = #{parentId},
+			</if>
+			<if test="delFlag != null">
+				del_flag_ = #{delFlag},
+			</if>
+			<if test="id != null">
+				id_ = #{id},
+			</if>
+			<if test="updateTime != null">
+				update_time_ = #{updateTime},
+			</if>
+			<if test="name != null">
+				name_ = #{name},
+			</if>
+			<if test="createTime != null">
+				create_time_ = #{createTime},
+			</if>
+		</set>
+		WHERE id_ = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM sys_news_type WHERE id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="SysNewsType" parameterType="map">
+		SELECT * FROM sys_news_type ORDER BY id_
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM sys_news_type
+	</select>
+	
+	<select id="queryByParentId" resultMap="SysNewsTypeTree">
+		SELECT * FROM sys_news_type where parent_id_ = #{parentId}
+	</select>
+</mapper>

+ 10 - 0
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUser.java

@@ -107,6 +107,9 @@ public class SysUser implements Serializable{
 	@ApiModelProperty(value = "年级",required = false)
 	private String currentGrade;
 
+	@ApiModelProperty(value = "年级(数字表示)",required = false)
+	private Integer currentGradeNum;
+
 	@ApiModelProperty(value = "班级",required = false)
 	private String currentClass;
 
@@ -412,4 +415,11 @@ public class SysUser implements Serializable{
 		return ToStringBuilder.reflectionToString(this);
 	}
 
+	public Integer getCurrentGradeNum() {
+		return currentGradeNum;
+	}
+
+	public void setCurrentGradeNum(Integer currentGradeNum) {
+		this.currentGradeNum = currentGradeNum;
+	}
 }

+ 4 - 3
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -31,6 +31,7 @@
         <result column="wechat_id_" property="wechatId"/>
         <result column="is_super_admin_" property="isSuperAdmin"/>
         <result column="current_grade_" property="currentGrade"/>
+        <result column="current_grade_num_" property="currentGradeNum"/>
         <result column="current_class_" property="currentClass"/>
         <result column="certificate_type_" property="certificateType"/>
     </resultMap>
@@ -53,9 +54,9 @@
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="SysUser">
-		SELECT su.*,sr.current_class_,sr.current_grade_
-        FROM sys_user su LEFT JOIN student_registration sr ON su.id_ = sr.user_id_
-        WHERE su.id_ = #{id} LIMIT 1
+		SELECT su.*,s.current_class_,s.current_grade_num_
+        FROM sys_user su LEFT JOIN student s ON su.id_ = s.user_id_
+        WHERE su.id_ = #{id}
 	</select>
 
     <!-- 全查询 -->

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

@@ -1539,6 +1539,9 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     List<CourseSchedule> findCourseByGroupId(@Param("groupType") String groupType, @Param("groupId") String groupId);
 
+    List<CourseSchedule> findCourseByGroupIds(@Param("groupIds") List<String> groupIds,
+                                              @Param("groupType") GroupType groupType);
+
     /**
      * 获取老师正常签退的课程
      *

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

@@ -188,4 +188,10 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
 
     List<Student> queryByIds(Map<String, Object> params);
     int countByIds(Map<String, Object> params);
+
+    /**
+     * 更新学生班级
+     * @return
+     */
+    int updateGrade();
 }

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentInstrumentDao.java

@@ -26,9 +26,32 @@ public interface StudentInstrumentDao extends BaseDAO<Long, StudentInstrument> {
 
     /**
      * 根据服务结束时间获取列表
+     *
      * @param startTime
      * @param endTime
      * @return
      */
     List<StudentInstrument> getListByEndTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
+
+    /**
+     * 获取学生乐器信息
+     *
+     * @param orderId
+     * @return
+     */
+    StudentInstrument getByOrderId(Long orderId);
+
+    /**
+     * 获取学生的乐器信息
+     *
+     * @return
+     */
+    StudentInstrument getStudentInstrument(@Param("studentId") Integer studentId, @Param("goodsId") Integer goodsId);
+
+    /**
+     * 获取用户已购买乐保的商品的记录
+     * @param startTime
+     * @return
+     */
+    List<StudentInstrument> getOldStudentInstrument(@Param("startTime") Date startTime);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroup4MixDto.java

@@ -70,6 +70,17 @@ public class ClassGroup4MixDto implements Cloneable{
     @ApiModelProperty(value = "是否允许0课酬")
     private Boolean allowZeroSalary = false;
 
+    @ApiModelProperty(value = "确认生成课程")
+    private Boolean confirmGenerate;
+
+    public Boolean getConfirmGenerate() {
+        return confirmGenerate;
+    }
+
+    public void setConfirmGenerate(Boolean confirmGenerate) {
+        this.confirmGenerate = confirmGenerate;
+    }
+
     public Boolean getAllowZeroSalary() {
         return allowZeroSalary;
     }

+ 57 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseTimeDto.java

@@ -3,6 +3,8 @@ package com.ym.mec.biz.dal.dto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.Date;
+
 public class CourseTimeDto {
 
 
@@ -12,12 +14,35 @@ public class CourseTimeDto {
     @ApiModelProperty(value = "排课星期几")
     private Integer dayOfWeek;
 
+    @ApiModelProperty(value = "开始排课日期,如果有值,则单独循环")
+    private Date startDate;
+
+    @ApiModelProperty(value = "结束排课日期")
+    private Date endDate;
+
     @ApiModelProperty(value = "上课开始时间")
     private String startClassTime;
 
     @ApiModelProperty(value = "上课结束时间")
     private String endClassTime;
 
+    @ApiModelProperty(value = "预计排课次数")
+    private int expectCourseNum;
+
+    @ApiModelProperty(value = "已生成课程数量")
+    private int courseNum;
+
+    @ApiModelProperty(value = "是否跳过节假日 true-跳过 false-不跳过", required = true)
+    private Boolean isHoliday = false;
+
+    public Boolean getHoliday() {
+        return isHoliday;
+    }
+
+    public void setHoliday(Boolean holiday) {
+        isHoliday = holiday;
+    }
+
     public CourseSchedule.CourseScheduleType getCourseType() {
         return courseType;
     }
@@ -26,6 +51,22 @@ public class CourseTimeDto {
         this.courseType = courseType;
     }
 
+    public Date getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(Date startDate) {
+        this.startDate = startDate;
+    }
+
+    public Date getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(Date endDate) {
+        this.endDate = endDate;
+    }
+
     public Integer getDayOfWeek() {
         return dayOfWeek;
     }
@@ -49,4 +90,20 @@ public class CourseTimeDto {
     public void setEndClassTime(String endClassTime) {
         this.endClassTime = endClassTime;
     }
+
+    public int getExpectCourseNum() {
+        return expectCourseNum;
+    }
+
+    public void setExpectCourseNum(int expectCourseNum) {
+        this.expectCourseNum = expectCourseNum;
+    }
+
+    public int getCourseNum() {
+        return courseNum;
+    }
+
+    public void setCourseNum(int courseNum) {
+        this.courseNum = courseNum;
+    }
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupStudentsDto.java

@@ -52,6 +52,9 @@ public class MusicGroupStudentsDto{
     @ApiModelProperty(value = "是否新增学员(1是0否)",required = false)
     private Integer isNewStudent;
 
+    @ApiModelProperty(value = "入团时间",required = false)
+    private Date registerTime;
+
     private Boolean isActive = false;
 
     private Boolean hasCourse;
@@ -303,4 +306,12 @@ public class MusicGroupStudentsDto{
     public void setCurrentGradeDate(Date currentGradeDate) {
         this.currentGradeDate = currentGradeDate;
     }
+
+    public Date getRegisterTime() {
+        return registerTime;
+    }
+
+    public void setRegisterTime(Date registerTime) {
+        this.registerTime = registerTime;
+    }
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentApplyDetailDto.java

@@ -65,6 +65,9 @@ public class StudentApplyDetailDto{
     @ApiModelProperty(value = "备注",required = false)
     private String remark;
 
+    @ApiModelProperty(value = "注册时间",required = false)
+    private Date createTime;
+
     @ApiModelProperty(value = "声部更换详情",required = false)
     private SubjectChange subjectChange;
 
@@ -203,4 +206,12 @@ public class StudentApplyDetailDto{
     public void setCurrentGradeDate(Date currentGradeDate) {
         this.currentGradeDate = currentGradeDate;
     }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
 }

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentManageListDto.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dto;
 
+import com.ym.mec.biz.dal.enums.GradeTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.common.enums.UserGenderEnum;
 import io.swagger.annotations.ApiModelProperty;
@@ -42,6 +43,9 @@ public class StudentManageListDto {
     @ApiModelProperty(value = "年级",required = false)
     private String currentGrade;
 
+    @ApiModelProperty(value = "年级(数字表示)",required = false)
+    private Integer currentGradeNum;
+
     @ApiModelProperty(value = "课程余额")
     private BigDecimal courseBalance;
 
@@ -91,6 +95,9 @@ public class StudentManageListDto {
     @ApiModelProperty(value = "加油包:0:默认不可用;1:可用;2:已使用;")
     private Integer comeOnPackage;
 
+    @ApiModelProperty(value = "0 - 6+3年制    1 - 5+4年制")
+    private GradeTypeEnum gradeType;
+
     public String getContractVersions() {
         return contractVersions;
     }
@@ -346,4 +353,20 @@ public class StudentManageListDto {
 	public void setIsSignedContract(boolean isSignedContract) {
 		this.isSignedContract = isSignedContract;
 	}
+
+    public Integer getCurrentGradeNum() {
+        return currentGradeNum;
+    }
+
+    public void setCurrentGradeNum(Integer currentGradeNum) {
+        this.currentGradeNum = currentGradeNum;
+    }
+
+    public GradeTypeEnum getGradeType() {
+        return gradeType;
+    }
+
+    public void setGradeType(GradeTypeEnum gradeType) {
+        this.gradeType = gradeType;
+    }
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Organization.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.ym.mec.biz.dal.enums.GradeTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 
 import io.swagger.annotations.ApiModelProperty;
@@ -51,6 +52,9 @@ public class Organization {
 	@ApiModelProperty(value = "地址",required = false)
 	private String address;
 
+	@ApiModelProperty(value = "学年制",required = false)
+	private GradeTypeEnum gradeType;
+
 	@ApiModelProperty(value = "子节点列表",required = false)
 	private List<Organization> organizations;
 
@@ -155,4 +159,11 @@ public class Organization {
 		return ToStringBuilder.reflectionToString(this);
 	}
 
+	public GradeTypeEnum getGradeType() {
+		return gradeType;
+	}
+
+	public void setGradeType(GradeTypeEnum gradeType) {
+		this.gradeType = gradeType;
+	}
 }

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Student.java

@@ -48,6 +48,12 @@ public class Student extends SysUser {
 	@ApiModelProperty(value = "加油包:0:默认不可用;1:可用;2:已使用;")
 	private Integer comeOnPackage;
 
+	@ApiModelProperty(value = "年级 1-13")
+	private Integer currentGradeNum;
+
+	@ApiModelProperty(value = "班级")
+	private String currentClass;
+
 	public Student(Integer userId, String subjectIdList) {
 		this.userId = userId;
 		this.subjectIdList = subjectIdList;
@@ -169,4 +175,22 @@ public class Student extends SysUser {
 	public void setTeacherName(String teacherName) {
 		this.teacherName = teacherName;
 	}
+
+	public Integer getCurrentGradeNum() {
+		return currentGradeNum;
+	}
+
+	public void setCurrentGradeNum(Integer currentGradeNum) {
+		this.currentGradeNum = currentGradeNum;
+	}
+
+	@Override
+	public String getCurrentClass() {
+		return currentClass;
+	}
+
+	@Override
+	public void setCurrentClass(String currentClass) {
+		this.currentClass = currentClass;
+	}
 }

+ 53 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentInstrument.java

@@ -59,6 +59,24 @@ public class StudentInstrument {
     private Date endTime;
 
     /**
+     * 对应订单id
+     */
+    @ApiModelProperty(value = "原订单id")
+    private Long orderId;
+
+    /**
+     * 对应订单id
+     */
+    @ApiModelProperty(value = "更改后订单id")
+    private Long changeOrderId;
+
+    /**
+     * 操作人
+     */
+    @ApiModelProperty(value = "操作人")
+    private Integer operation;
+
+    /**
      * 添加时间
      */
     @ApiModelProperty(value = "添加时间")
@@ -70,6 +88,9 @@ public class StudentInstrument {
     @ApiModelProperty(value = "更新时间")
     private Date updateTime;
 
+    @ApiModelProperty(value = "删除标识 1 已删除 0 正常")
+    private Integer delFlag;
+
     @ApiModelProperty(value = "乐器名称")
     private String goodsName;
 
@@ -235,4 +256,36 @@ public class StudentInstrument {
     public void setGoodsCategoryName(String goodsCategoryName) {
         this.goodsCategoryName = goodsCategoryName;
     }
+
+    public Integer getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Integer delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public Long getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Long orderId) {
+        this.orderId = orderId;
+    }
+
+    public Integer getOperation() {
+        return operation;
+    }
+
+    public void setOperation(Integer operation) {
+        this.operation = operation;
+    }
+
+    public Long getChangeOrderId() {
+        return changeOrderId;
+    }
+
+    public void setChangeOrderId(Long changeOrderId) {
+        this.changeOrderId = changeOrderId;
+    }
 }

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPreRegistration.java

@@ -23,10 +23,13 @@ public class StudentPreRegistration {
 	
 	/** 性别 */
 	private boolean gender;
-	
+
 	/** 年级 */
 	private String currentGrade;
-	
+
+	/** 年级编号 */
+	private Integer currentGradeNum;
+
 	/** 班级 */
 	private String currentClass;
 	
@@ -154,4 +157,11 @@ public class StudentPreRegistration {
 		return ToStringBuilder.reflectionToString(this);
 	}
 
+	public Integer getCurrentGradeNum() {
+		return currentGradeNum;
+	}
+
+	public void setCurrentGradeNum(Integer currentGradeNum) {
+		this.currentGradeNum = currentGradeNum;
+	}
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRegistration.java

@@ -43,6 +43,9 @@ public class StudentRegistration {
     @ApiModelProperty(value = "当前所在年级", required = false)
     private String currentGrade;
 
+    @ApiModelProperty(value = "年级(数字表示)", required = false)
+    private Integer currentGradeNum;
+
     @ApiModelProperty(value = "年级年份", required = false)
     private Date currentGradeDate;
 
@@ -434,4 +437,12 @@ public class StudentRegistration {
     public void setIsMerge(Integer isMerge) {
         this.isMerge = isMerge;
     }
+
+    public Integer getCurrentGradeNum() {
+        return currentGradeNum;
+    }
+
+    public void setCurrentGradeNum(Integer currentGradeNum) {
+        this.currentGradeNum = currentGradeNum;
+    }
 }

+ 37 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/FivePlusGradeEnum.java

@@ -0,0 +1,37 @@
+package com.ym.mec.biz.dal.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+public enum FivePlusGradeEnum implements BaseEnum<Integer, FivePlusGradeEnum> {
+	GRADE1(1, "一年级"),
+	GRADE2(2, "二年级"),
+	GRADE3(3, "三年级"),
+	GRADE4(4, "四年级"),
+	GRADE5(5, "五年级"),
+	GRADE6(6, "六年级/初一"),
+	GRADE7(7, "七年级/初二"),
+	GRADE8(8, "八年级/初三"),
+	GRADE9(9, "九年级/初四"),
+	GRADE10(10, "高一"),
+	GRADE11(11, "高二"),
+	GRADE12(12, "高三");
+
+	private Integer code;
+
+	private String desc;
+
+	private FivePlusGradeEnum(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	@Override
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+}

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/GradeTypeEnum.java

@@ -0,0 +1,27 @@
+package com.ym.mec.biz.dal.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+public enum GradeTypeEnum implements BaseEnum<Integer, GradeTypeEnum> {
+	SIX_PLUS(0, "6+3学制"),
+	FIVE_PLUS(1, "5+4学制");
+
+	private Integer code;
+
+	private String desc;
+
+	private GradeTypeEnum(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	@Override
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+}

+ 37 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SixPlusGradeEnum.java

@@ -0,0 +1,37 @@
+package com.ym.mec.biz.dal.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+public enum SixPlusGradeEnum implements BaseEnum<Integer, SixPlusGradeEnum> {
+	GRADE1(1, "一年级"),
+	GRADE2(2, "二年级"),
+	GRADE3(3, "三年级"),
+	GRADE4(4, "四年级"),
+	GRADE5(5, "五年级"),
+	GRADE6(6, "六年级"),
+	GRADE7(7, "七年级/初一"),
+	GRADE8(8, "八年级/初二"),
+	GRADE9(9, "九年级/初三"),
+	GRADE10(10, "高一"),
+	GRADE11(11, "高二"),
+	GRADE12(12, "高三");
+
+	private Integer code;
+
+	private String desc;
+
+	private SixPlusGradeEnum(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	@Override
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+}

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

@@ -41,6 +41,12 @@ public class MusicGroupStudentQueryInfo extends QueryInfo {
   @ApiModelProperty(value = "加油包:0:默认不可用;1:可用;2:已使用;")
   private Integer comeOnPackage;
 
+  @ApiModelProperty(value = "年级",required = false)
+  private String currentGrade;
+
+  @ApiModelProperty(value = "入学年份",required = false)
+  private String createYear;
+
   private boolean isExport = false;
 
   public Boolean getOweFlag() {
@@ -146,4 +152,20 @@ public class MusicGroupStudentQueryInfo extends QueryInfo {
   public void setPaymentStatus(String paymentStatus) {
     this.paymentStatus = paymentStatus;
   }
+
+  public String getCurrentGrade() {
+    return currentGrade;
+  }
+
+  public void setCurrentGrade(String currentGrade) {
+    this.currentGrade = currentGrade;
+  }
+
+  public String getCreateYear() {
+    return createYear;
+  }
+
+  public void setCreateYear(String createYear) {
+    this.createYear = createYear;
+  }
 }

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentRegistrationQueryInfo.java

@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.common.page.QueryInfo;
 
+import javax.xml.crypto.Data;
+
 public class StudentRegistrationQueryInfo extends QueryInfo {
 
     @ApiModelProperty(value = "乐团编号",required = false)
@@ -25,6 +27,12 @@ public class StudentRegistrationQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "用户名或手机号",required = false)
     private String name;
 
+    @ApiModelProperty(value = "年级",required = false)
+    private String currentGrade;
+
+    @ApiModelProperty(value = "入学年份",required = false)
+    private String createYear;
+
     private boolean isExport = false;
 
     public boolean getIsExport() {
@@ -82,4 +90,20 @@ public class StudentRegistrationQueryInfo extends QueryInfo {
     public void setPaymentStatus(String paymentStatus) {
         this.paymentStatus = paymentStatus;
     }
+
+    public String getCreateYear() {
+        return createYear;
+    }
+
+    public void setCreateYear(String createYear) {
+        this.createYear = createYear;
+    }
+
+    public String getCurrentGrade() {
+        return currentGrade;
+    }
+
+    public void setCurrentGrade(String currentGrade) {
+        this.currentGrade = currentGrade;
+    }
 }

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/OrganizationService.java

@@ -1,11 +1,13 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.entity.Organization;
+import com.ym.mec.biz.dal.enums.GradeTypeEnum;
 import com.ym.mec.biz.dal.page.OrganizationQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
 import java.util.List;
+import java.util.Map;
 
 public interface OrganizationService extends BaseService<Integer, Organization> {
 
@@ -27,4 +29,10 @@ public interface OrganizationService extends BaseService<Integer, Organization>
      * @return
      */
     String getOrganName(String organId);
+
+    /**
+     * 获取分部学年制的年级列表
+     * @param id
+     */
+    Map<Integer, String> getGradeList(Integer id);
 }

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

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
 import com.ym.mec.biz.dal.entity.StudentInstrument;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
@@ -51,6 +52,6 @@ public interface StudentGoodsSellService extends BaseService<Integer, StudentGoo
      * 将购买的乐器加入学生乐器列表
      * @return
      */
-    List<StudentInstrument> saveStudentInstrument(String orderNo);
+    List<StudentInstrument> saveStudentInstrument(StudentPaymentOrder order);
 
 }

+ 30 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentInstrumentService.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.dto.MaintenancePayDto;
 import com.ym.mec.biz.dal.entity.StudentInstrument;
 
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.SubjectChange;
 import com.ym.mec.common.service.BaseService;
 
 import java.math.BigDecimal;
@@ -45,4 +46,33 @@ public interface StudentInstrumentService extends BaseService<Long, StudentInstr
      * @return
      */
     Boolean pushNotice();
+
+
+    /**
+     * 修改学生乐器
+     * @param studentInstrument
+     * @return
+     */
+    StudentInstrument updateStudentInstrument(StudentInstrument studentInstrument);
+
+
+    /**
+     * 乐器更换更新乐器信息
+     * @param subjectChange
+     * @return
+     */
+    Boolean subjectChangeUpdateInstrument(SubjectChange subjectChange);
+
+
+    /**
+     * 获取学生的乐器信息
+     * @param studentId
+     * @param goodsId
+     * @return
+     */
+    StudentInstrument getStudentInstrument(Integer studentId,Integer goodsId);
+
+
+    Boolean addOldStudentInstrument();
+
 }

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import java.text.ParseException;
 
+import com.ym.mec.biz.dal.enums.GradeTypeEnum;
 import org.springframework.http.ResponseEntity;
 
 import com.ym.mec.biz.dal.entity.Student;
@@ -35,4 +36,17 @@ public interface StudentService extends BaseService<Integer, Student> {
      * @param teacherId
      */
     void batchUpdateAdviser(Integer teacherId,String studentIds);
+
+    /**
+     * 升级学生的年级
+     */
+    Integer updateGrade();
+
+    /**
+     * 根据学制和年级数字获取年级
+     * @param gradeType
+     * @param gradeNum
+     * @return
+     */
+    String getStudentGrade(GradeTypeEnum gradeType,Integer gradeNum);
 }

+ 95 - 33
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -18,17 +18,7 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.dao.*;
@@ -813,6 +803,15 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //获取学员的乐团列表详情
         List<CourseListDto> musicCourse = classGroupDao.queryStudentMusicGroupCourses(StringUtils.join(musicGroupIds, ","), userId);
 
+        List<CourseSchedule> musicGroupCourses = new ArrayList<>();
+        if(!CollectionUtils.isEmpty(musicGroupIds)){
+            musicGroupCourses = courseScheduleDao.findCourseByGroupIds(musicGroupIds, MUSIC);
+        }
+        Map<String, Map<TeachModeEnum, Long>> musicGroupTeachModeNumMap = new HashMap<>();
+        if(!CollectionUtils.isEmpty(musicGroupCourses)){
+            musicGroupTeachModeNumMap = musicGroupCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getMusicGroupId, Collectors.groupingBy(CourseSchedule::getTeachMode, Collectors.counting())));
+        }
+
         if (!CollectionUtils.isEmpty(typeGroupMap.get(PRACTICE))) {
             musicGroupIds = typeGroupMap.get(PRACTICE).stream().map(Group::getId).collect(Collectors.toList());
         } else {
@@ -911,8 +910,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     else if(PracticeGroupType.COME_ON_PACKAGE.equals(practiceGroupTypeMap.get(Long.valueOf(e.getPracticeId()))))
                         e.setPracticeType(3);
                 }
-            }
-            if (ClassGroupTypeEnum.VIP == e.getType()) {
+            }else if (ClassGroupTypeEnum.VIP == e.getType()) {
                 e.setStudentNames(vipStuNames.get(e.getVipId()));
                 //1:线上;2:线下;3:线上+线下
                 if (e.getOnlineClassesNum() > 0 && e.getOffLineClassesNum() <= 0) {
@@ -924,6 +922,27 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 } else {
                     e.setClassMode(0);
                 }
+            }else{
+                Long onlineCourseNum = 0L;
+                Long offlineCourseNum = 0L;
+                if(musicGroupTeachModeNumMap.containsKey(e.getMusicId())){
+                    Map<TeachModeEnum, Long> teachModeCourseNumMap = musicGroupTeachModeNumMap.get(e.getMusicId());
+                    if(teachModeCourseNumMap.containsKey(TeachModeEnum.ONLINE)){
+                        onlineCourseNum = teachModeCourseNumMap.get(TeachModeEnum.ONLINE);
+                    }
+                    if(teachModeCourseNumMap.containsKey(TeachModeEnum.OFFLINE)){
+                        offlineCourseNum = teachModeCourseNumMap.get(TeachModeEnum.OFFLINE);
+                    }
+                }
+                if (onlineCourseNum > 0 && offlineCourseNum <= 0) {
+                    e.setClassMode(1);
+                } else if (onlineCourseNum > 0 && offlineCourseNum > 0) {
+                    e.setClassMode(3);
+                } else if (onlineCourseNum <= 0 && offlineCourseNum > 0) {
+                    e.setClassMode(2);
+                } else {
+                    e.setClassMode(0);
+                }
             }
         }
         pageInfo.setRows(courseListDtos);
@@ -2263,6 +2282,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             throw new BizException("班级不存在");
         }
 
+        Boolean confirmGenerate = false;
+        if(Objects.nonNull(classGroup4MixDtos.get(0).getConfirmGenerate())){
+            confirmGenerate = classGroup4MixDtos.get(0).getConfirmGenerate();
+        }
+
         TeachModeEnum teachMode = TeachModeEnum.OFFLINE;
         if (classGroup.getType().equals(HIGH_ONLINE) || classGroup.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) {
             teachMode = TeachModeEnum.ONLINE;
@@ -2335,10 +2359,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             }
         }
 
-        List<Integer> allTeacherIds = newClassGroupTeacherMapperList.stream()
-                .map(ClassGroupTeacherMapper::getUserId)
-                .collect(Collectors.toList());
-
         Set<String> newTeacher = newClassGroupTeacherMapperList.stream().map(
                 classGroupTeacherMapper -> classGroupTeacherMapper.getTeacherRole().getCode() + classGroupTeacherMapper.getUserId()
         ).collect(Collectors.toSet());
@@ -2368,7 +2388,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
             //3、插入班级排课信息
-            LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
+            LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
 
             if (!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())) {
                 throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
@@ -2380,39 +2400,68 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg());
             }
 
+            int totalCourseTimes = 0;
+            int generateCourseTimes = 0;
+            if(!CollectionUtils.isEmpty(classGroup4MixDto.getCourseTimeDtoList())){
+                totalCourseTimes = classGroup4MixDto.getCourseTimeDtoList().stream().mapToInt(CourseTimeDto::getExpectCourseNum).reduce(0, Integer::sum);
+            }
+
             Set<String> holidayDays = new HashSet<>();
-            if (classGroup4MixDto.getHoliday()) {
-                SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
-                if (Objects.nonNull(holidaySetting) && StringUtils.isNotBlank(holidaySetting.getParanValue())) {
-                    holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
-                }
+            SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
+            if (Objects.nonNull(holidaySetting) && StringUtils.isNotBlank(holidaySetting.getParanValue())) {
+                holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
             }
 
             WhileNode:
             while (true) {
-                if (classGroup4MixDto.getHoliday() && holidayDays.contains(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) {
-                    now = now.plusDays(1);
-                    continue;
-                }
                 int dayOfWeek = now.getDayOfWeek().getValue();
                 for (CourseTimeDto courseTimeDto : classGroup4MixDto.getCourseTimeDtoList()) {
                     if (courseTimeDto.getDayOfWeek() < 1 || courseTimeDto.getDayOfWeek() > 7) {
                         throw new BizException("排课循环周期错误,请核查");
                     }
+                    if(Objects.isNull(courseTimeDto.getStartDate())||Objects.isNull(courseTimeDto.getEndDate())){
+                        throw new BizException("排课循环周期错误,请核查");
+                    }
+
+                    //跳过节假日
+                    if (courseTimeDto.getHoliday() && holidayDays.contains(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) {
+                        continue;
+                    }
+
                     if (!courseTimeDto.getDayOfWeek().equals(dayOfWeek)) continue;
 
+                    Date classDate = DateConvertor.toDate(now);
+
+                    if(courseTimeDto.getStartDate().compareTo(classDate)>0
+                            ||courseTimeDto.getEndDate().compareTo(classDate)<0
+                            ||courseTimeDto.getExpectCourseNum()<=courseTimeDto.getCourseNum()){
+                        if(courseTimeDto.getEndDate().compareTo(classDate)<0&&courseTimeDto.getExpectCourseNum()>courseTimeDto.getCourseNum()){
+                            throw new BizException("在指定的排课时间段内({}-{})无法完成预计课时数的排课", DateUtil.dateToString(courseTimeDto.getStartDate(), "yyyy.MM.dd"), DateUtil.dateToString(courseTimeDto.getEndDate(), "yyyy.MM.dd"));
+                        }
+                        if(totalCourseTimes<=generateCourseTimes){
+                            break WhileNode;
+                        }
+                        continue;
+                    }
+
                     //课时长度
-                    long classCourseDuration = Duration.between(LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + courseTimeDto.getStartClassTime() + ":00", formatter),
-                            LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + courseTimeDto.getEndClassTime() + ":00", formatter))
+                    long classCourseDuration = Duration.between(LocalDateTime.parse(DateUtil.dateToString(courseTimeDto.getStartDate(), "yyyy-MM-dd") + " " + courseTimeDto.getStartClassTime() + ":00", formatter),
+                            LocalDateTime.parse(DateUtil.dateToString(courseTimeDto.getStartDate(), "yyyy-MM-dd") + " " + courseTimeDto.getEndClassTime() + ":00", formatter))
                             .toMinutes();
 
                     totalCourseDuration += classCourseDuration;
 
-                    if (totalCourseDuration > totalMinutes) {
+//                    if (totalCourseDuration > totalMinutes) {
+//                        break WhileNode;
+//                    }
+
+                    courseTimeDto.setCourseNum(courseTimeDto.getCourseNum()+1);
+                    generateCourseTimes+=1;
+
+                    if(totalCourseTimes<generateCourseTimes){
                         break WhileNode;
                     }
 
-                    Date classDate = DateConvertor.toDate(now);
                     String startClassTime = DateUtil.getDate(classDate) + " " + courseTimeDto.getStartClassTime() + ":00";
                     String endClassTime = DateUtil.getDate(classDate) + " " + courseTimeDto.getEndClassTime() + ":00";
 
@@ -2422,6 +2471,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     courseSchedule.setStatus(CourseStatusEnum.NOT_START);
                     courseSchedule.setClassDate(classDate);
                     courseSchedule.setStartClassTime(DateUtil.stringToDate(startClassTime));
+                    if(date.compareTo(courseSchedule.getStartClassTime())>0){
+                        throw new BizException("课程开始时间不得早于当前时间");
+                    }
                     courseSchedule.setEndClassTime(DateUtil.stringToDate(endClassTime));
                     courseSchedule.setCreateTime(date);
                     courseSchedule.setUpdateTime(date);
@@ -2453,19 +2505,29 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                         courseScheduleTeacherSalary.setUpdateTime(date);
                         courseScheduleTeacherSalaryService.createMusicGroupCourseTeacherSalary(musicGroup, courseSchedule, courseScheduleTeacherSalary);
                         courseScheduleTeacherSalaryList.add(courseScheduleTeacherSalary);
-                        if(!classGroup4MixDto.getAllowZeroSalary()&&BigDecimal.ZERO.compareTo(courseScheduleTeacherSalary.getExpectSalary())==0){
+                        if(confirmGenerate&&!classGroup4MixDto.getAllowZeroSalary()&&BigDecimal.ZERO.compareTo(courseScheduleTeacherSalary.getExpectSalary())==0){
                             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                            return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"当前课程课酬预计为0,是否继续");
+                            return BaseController.failed(HttpStatus.MULTI_STATUS,"当前课程课酬预计为0,是否继续");
                         }
                     }
                 }
 
                 now = now.plusDays(1);
             }
+
+            if (totalCourseDuration > totalMinutes) {
+                throw new BizException("课程时长不足");
+            }
         }
 
         courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
 
+        if(!confirmGenerate){
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            courseScheduleList.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
+            return BaseController.failed(HttpStatus.PARTIAL_CONTENT, courseScheduleList, "");
+        }
+
         //老师结算表
         if (courseScheduleTeacherSalaryList.size() > 0) {
             courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);

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

@@ -75,6 +75,7 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 			studentCourseHomework.setStatus(extraExerciseStudent.getStatus()==0?YesOrNoEnum.NO:YesOrNoEnum.YES);
 			studentCourseHomework.setIsReplied(extraExerciseStudent.getIsReplied()==0?YesOrNoEnum.NO:YesOrNoEnum.YES);
 			studentCourseHomework.setIsView(extraExerciseStudent.getIsView()==0?YesOrNoEnum.NO:YesOrNoEnum.YES);
+			studentCourseHomework.setAvatar(extraExerciseStudent.getHeadUrl());
 			studentCourseHomeworks.add(studentCourseHomework);
 		}
 		return studentCourseHomeworks;

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

@@ -50,7 +50,7 @@ public class InspectionItemPlanServiceImpl extends BaseServiceImpl<Long, Inspect
     @Override
     public PageInfo<InspectionItemPlan> getPageList(InspectionItemPlanQueryInfo queryInfo) {
         PageInfo<InspectionItemPlan> pageInfo = this.queryPage(queryInfo);
-        if (pageInfo.getTotal() > 0) {
+        if (pageInfo.getRows().size() > 0) {
             Integer attendanceRange = Integer.valueOf(sysConfigDao.findConfigValue(SysConfigService.ATTENDANCE_RANGE));
             List<Long> planIds = pageInfo.getRows().stream().map(InspectionItemPlan::getId).collect(Collectors.toList());
             List<CheckItemDto> lastCheckItems = inspectionItemPlanConclusionDao.getLastCheckItem(planIds);

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

@@ -45,7 +45,7 @@ public class InspectionItemServiceImpl extends BaseServiceImpl<Long, InspectionI
             queryInfo.setEndTime(DateUtil.getLastTimeWithDay(DateUtil.getLastDayOfMonth(queryInfo.getEndTime())));
         }
         PageInfo<InspectionItem> pageInfo = this.queryPage(queryInfo);
-        if (pageInfo.getTotal() <= 0) {
+        if (pageInfo.getRows().size() <= 0) {
             return pageInfo;
         }
         List<InspectionItem> rows = pageInfo.getRows();

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

@@ -41,7 +41,7 @@ public class InspectionServiceImpl extends BaseServiceImpl<Long, Inspection> imp
             queryInfo.setEndTime(DateUtil.getLastTimeWithDay(DateUtil.getLastDayOfMonth(queryInfo.getMonth())));
         }
         PageInfo<Inspection> pageInfo = this.queryPage(queryInfo);
-        if (pageInfo.getTotal() > 0) {
+        if (pageInfo.getRows().size() > 0) {
             List<Inspection> rows = pageInfo.getRows();
             List<Long> inspectionIds = rows.stream().map(Inspection::getId).collect(Collectors.toList());
             List<InspectionItem> itemCountAndTimes = inspectionItemDao.getItemCountAndTimes(inspectionIds);

+ 20 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -18,6 +18,7 @@ import java.util.Set;
 import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.event.source.GroupEventSource;
 import com.ym.mec.biz.service.*;
 import org.apache.commons.lang3.StringUtils;
@@ -77,21 +78,6 @@ import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SubjectChange;
 import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GoodsType;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
-import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -426,6 +412,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             student.setCreateTime(date);
             student.setUpdateTime(date);
             student.setIsNewUser(true);
+            student.setCurrentGradeNum(studentPreRegistration.getCurrentGradeNum());
+            student.setCurrentClass(studentPreRegistration.getCurrentClass());
             studentDao.insert(student);
             sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
         }
@@ -433,6 +421,23 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         studentPreRegistration.setCreateTime(date);
         studentPreRegistration.setUserId(user.getId());
 
+        Organization organization = organizationDao.get(musicGroup.getOrganId());
+        if(organization.getGradeType().equals(GradeTypeEnum.SIX_PLUS)){
+            for (SixPlusGradeEnum value : SixPlusGradeEnum.values()) {
+                if(value.getCode().equals(studentPreRegistration.getCurrentGradeNum())){
+                    studentPreRegistration.setCurrentGrade(value.getDesc());
+                    break;
+                }
+            }
+        }else {
+            for (FivePlusGradeEnum value : FivePlusGradeEnum.values()) {
+                if(value.getCode().equals(studentPreRegistration.getCurrentGradeNum())){
+                    studentPreRegistration.setCurrentGrade(value.getDesc());
+                    break;
+                }
+            }
+        }
+
         studentPreRegistrationDao.insert(studentPreRegistration);
 
         // 添加成员

+ 26 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationServiceImpl.java

@@ -1,9 +1,12 @@
 package com.ym.mec.biz.service.impl;
 
-import java.util.List;
+import java.util.*;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.enums.FivePlusGradeEnum;
+import com.ym.mec.biz.dal.enums.GradeTypeEnum;
+import com.ym.mec.biz.dal.enums.SixPlusGradeEnum;
 import com.ym.mec.common.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -18,7 +21,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 
 @Service
 public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organization> implements OrganizationService {
-	
+
 	@Autowired
 	private OrganizationDao organizationDao;
 	@Autowired
@@ -54,7 +57,7 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 	}
 
 
-	private Organization getTree(Organization org){
+    private Organization getTree(Organization org){
 		//得到根节点对象
 		//获取子节点list
 		List<Organization> byParentId = organizationDao.findByParentId(org.getId(), null);
@@ -69,4 +72,24 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 		}
 			return org;
 	}
+
+	@Override
+	public Map<Integer, String> getGradeList(Integer id) {
+		Organization organization = organizationDao.get(id);
+		Map<Integer, String> gradeMap = new HashMap<>();
+
+		if(organization.getGradeType().equals(GradeTypeEnum.FIVE_PLUS)){
+			FivePlusGradeEnum[] fivePlusGradeEnums = FivePlusGradeEnum.values();
+			for (FivePlusGradeEnum fivePlusGradeEnum : fivePlusGradeEnums) {
+				gradeMap.put(fivePlusGradeEnum.getCode(),fivePlusGradeEnum.getDesc());
+			}
+		}
+		if(organization.getGradeType().equals(GradeTypeEnum.SIX_PLUS)){
+			SixPlusGradeEnum[] sixPlusGradeEnums = SixPlusGradeEnum.values();
+			for (SixPlusGradeEnum sixPlusGradeEnum : sixPlusGradeEnums) {
+				gradeMap.put(sixPlusGradeEnum.getCode(),sixPlusGradeEnum.getDesc());
+			}
+		}
+		return gradeMap;
+	}
 }

+ 21 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java

@@ -57,6 +57,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
             balance = BigDecimal.ZERO;
         }
         StudentPaymentOrder order = studentPaymentOrderDao.get(orderId);
+        BigDecimal totalActualAmount = order.getActualAmount() == null ? BigDecimal.ZERO : order.getActualAmount();
         MusicGroup musicGroup = new MusicGroup();
         if (StringUtils.isNotBlank(musicGroupId)) {
             musicGroup = musicGroupDao.get(musicGroupId);
@@ -74,8 +75,14 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
             }
         }
 
+        //已分配的商品余额
         BigDecimal hasRouteBalance = BigDecimal.ZERO;
-        BigDecimal goodsTotalBalance = goodsTotalPrice.multiply(balance).divide(totalAmount, 2, BigDecimal.ROUND_DOWN);
+        //已分配的商品现金
+        BigDecimal hasRouteActualAmount= BigDecimal.ZERO;
+        //商品占用的的余额
+        BigDecimal goodsTotalBalance = totalAmount.compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : goodsTotalPrice.multiply(balance).divide(totalAmount, 2, BigDecimal.ROUND_DOWN);
+        //商品占用的总现金
+        BigDecimal goodsTotalActualAmount = totalAmount.compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : goodsTotalPrice.multiply(totalActualAmount).divide(totalAmount, 2, BigDecimal.ROUND_DOWN);
         AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(order.getPaymentChannel()), order.getMerNos());
 
         List<SellOrder> sellOrderList = goodsService.subtractStock(goodsIds, accountType);
@@ -91,11 +98,19 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
             }
             goodsPrice = nowGoods.getDiscountPrice();
 
-            BigDecimal goodsBalance = goodsTotalBalance.multiply(goodsPrice).divide(goodsTotalPrice, 2, BigDecimal.ROUND_DOWN);
+            //当前商品占用的总余额
+            BigDecimal goodsBalance = goodsTotalPrice.compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO :
+                    goodsTotalBalance.multiply(goodsPrice).divide(goodsTotalPrice, 2, BigDecimal.ROUND_DOWN);
+            //当前商品占用的总现金
+            BigDecimal goodsActualAmount = goodsTotalPrice.compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO :
+                    goodsTotalActualAmount.multiply(goodsPrice).divide(goodsTotalPrice, 2, BigDecimal.ROUND_DOWN);
+
             if (i == goodsNum) {
                 goodsBalance = goodsTotalBalance.subtract(hasRouteBalance);
+                goodsActualAmount = goodsTotalActualAmount.subtract(hasRouteActualAmount);
             }
             hasRouteBalance = hasRouteBalance.add(goodsBalance);
+            hasRouteActualAmount = hasRouteActualAmount.add(goodsActualAmount);
             i++;
 
             int complementGoodsNum = nowGoods.getComplementGoodsIdList() == null ? 1 : nowGoods.getComplementGoodsIdList().split(",").length;
@@ -120,21 +135,21 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
                 BigDecimal sellOrderActualAmount = BigDecimal.ZERO;
                 BigDecimal sellOrderBalance = BigDecimal.ZERO;
                 if (complementPrice.compareTo(BigDecimal.ZERO) > 0) {
-                    sellOrderActualAmount = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(goodsPrice).divide(complementPrice, 2, BigDecimal.ROUND_DOWN);
+                    sellOrderActualAmount = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(goodsActualAmount).divide(complementPrice, 2, BigDecimal.ROUND_DOWN);
                     sellOrderBalance = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(goodsBalance).divide(complementPrice, 2, BigDecimal.ROUND_DOWN);
                 }
 
                 complementGoodsNum = complementGoodsNum - sellOrder.getNum();
                 if (complementGoodsNum <= 0) {
-                    sellOrderActualAmount = goodsPrice.subtract(hasRouteSellOrderActualAmount);
+                    sellOrderActualAmount = goodsActualAmount.subtract(hasRouteSellOrderActualAmount);
                     sellOrderBalance = goodsBalance.subtract(hasRouteSellOrderBalance);
                 }
                 hasRouteSellOrderActualAmount = hasRouteSellOrderActualAmount.add(sellOrderActualAmount);
                 hasRouteSellOrderBalance = hasRouteSellOrderBalance.add(sellOrderBalance);
 
-                sellOrder.setExpectAmount(sellOrderActualAmount);
+                sellOrder.setExpectAmount(sellOrderActualAmount.add(sellOrderBalance));
                 sellOrder.setBalanceAmount(sellOrderBalance);
-                sellOrder.setActualAmount(sellOrderActualAmount.subtract(sellOrderBalance));
+                sellOrder.setActualAmount(sellOrderActualAmount);
                 sellOrder.setOrganId(order.getOrganId());
                 sellOrder.setCooperationOrganId(musicGroup.getCooperationOrganId());
                 sellOrder.setTransNo(order.getTransNo());

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java

@@ -12,6 +12,7 @@ import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
 import com.ym.mec.biz.dal.entity.StudentInstrument;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.biz.service.StudentGoodsSellService;
 import com.ym.mec.common.dal.BaseDAO;
@@ -110,8 +111,8 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
     }
 
     @Override
-    public List<StudentInstrument> saveStudentInstrument(String orderNo) {
-        StudentGoodsSell studentGoodsSell = studentGoodsSellDao.findByOrderNo(orderNo);
+    public List<StudentInstrument> saveStudentInstrument(StudentPaymentOrder order) {
+        StudentGoodsSell studentGoodsSell = studentGoodsSellDao.findByOrderNo(order.getOrderNo());
         List<GoodsSellDto> goodsSellDtos = JSONObject.parseArray(studentGoodsSell.getGoodsJson(), GoodsSellDto.class);
         List<Integer> goodsIds = new ArrayList<>();
         for (GoodsSellDto goodsSellDto : goodsSellDtos) {
@@ -134,6 +135,8 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
             studentInstrument.setGoodsBrand(goods.getBrand());
             studentInstrument.setSpecification(goods.getSpecification());
             studentInstrument.setGoodsImg(goods.getImage());
+            studentInstrument.setOrderId(order.getId());
+            studentInstrument.setChangeOrderId(order.getId());
             studentInstrument.setStatus(0);
             studentInstruments.add(studentInstrument);
         }

+ 84 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java

@@ -14,6 +14,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.date.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -247,7 +248,7 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
                 sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "乐保购买支付失败");
             }
 
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_SPORADIC_PAYMENT_FAILED, map, null, 0, "", "STUDENT",
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_SPORADIC_PAYMENT_FAILED, map, null, 0, null, "STUDENT",
                     studentPaymentOrder.getActualAmount(), "乐保购买");
             return false;
         }
@@ -276,7 +277,7 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
         List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailDao.getOrderDetailByType(order.getId(), orderDetailTypes);
         List<StudentPaymentOrderDetail> orderDetails4Instruments = orderDetails.stream()
                 .filter(e -> e.getType().equals(OrderDetailTypeEnum.MUSICAL))
-                .filter(e -> KitGroupPurchaseTypeEnum.GROUP.equals(e.getKitGroupPurchaseType())).collect(Collectors.toList());
+                .collect(Collectors.toList());
         if (orderDetails4Instruments.size() <= 0) {
             return false;
         }
@@ -300,6 +301,8 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
         studentInstrument.setOrganId(order.getOrganId());
         studentInstrument.setGoodsId(goodsId);
         studentInstrument.setStatus(maintenanceStatus);
+        studentInstrument.setOrderId(order.getId());
+        studentInstrument.setChangeOrderId(order.getId());
         studentInstrument.setStartTime(startTime);
         studentInstrument.setEndTime(endTime);
         addStudentInstrument(studentInstrument);
@@ -312,7 +315,7 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
 
     @Override
     public Boolean pushNotice() {
-        Date endTime = DateUtil.addDays(DateUtil.getLastTimeWithDay(new Date()), -6);
+        Date endTime = DateUtil.addDays(DateUtil.getLastTimeWithDay(new Date()), +7);
         Date startTime = DateUtil.trunc(endTime);
         List<StudentInstrument> studentInstruments = studentInstrumentDao.getListByEndTime(startTime, endTime);
         if (studentInstruments.size() <= 0) {
@@ -328,4 +331,82 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
         }
         return true;
     }
+
+    @Override
+    public StudentInstrument updateStudentInstrument(StudentInstrument studentInstrument) {
+        Goods goods = goodsService.get(studentInstrument.getGoodsId());
+        GoodsCategory goodsCategory = goodsCategoryService.get(goods.getGoodsCategoryId());
+        studentInstrument.setGoodsCategoryId(goods.getGoodsCategoryId());
+        studentInstrument.setGoodsCategoryName(goodsCategory.getName());
+        studentInstrument.setGoodsName(goods.getName());
+        studentInstrument.setGoodsBrand(goods.getBrand());
+        studentInstrument.setSpecification(goods.getSpecification());
+        studentInstrument.setGoodsImg(goods.getImage());
+        studentInstrumentDao.update(studentInstrument);
+        return studentInstrument;
+    }
+
+    @Override
+    public Boolean subjectChangeUpdateInstrument(SubjectChange subjectChange) {
+        if (subjectChange == null || subjectChange.getChangeMusical() == null ||
+                KitGroupPurchaseTypeEnum.OWNED.equals(subjectChange.getKitGroupPurchaseType())) {
+            return false;
+        }
+        StudentInstrument studentInstrument = studentInstrumentDao.getByOrderId(subjectChange.getOriginalOrderId().longValue());
+
+        if (studentInstrument == null) {
+            studentInstrument = new StudentInstrument();
+            studentInstrument.setStudentId(subjectChange.getStudentId());
+            studentInstrument.setOrganId(subjectChange.getOrganId());
+            studentInstrument.setOrderId(subjectChange.getOrderId().longValue());
+            studentInstrument.setStatus(0);
+        }
+        studentInstrument.setChangeOrderId(subjectChange.getOrderId().longValue());
+        studentInstrument.setGoodsId(subjectChange.getChangeMusical());
+        if (studentInstrument.getId() == null) {
+            addStudentInstrument(studentInstrument);
+            return true;
+        }
+        updateStudentInstrument(studentInstrument);
+        return true;
+    }
+
+    @Override
+    public StudentInstrument getStudentInstrument(Integer studentId, Integer goodsId) {
+        return studentInstrumentDao.getStudentInstrument(studentId, goodsId);
+    }
+
+    @Override
+    public Boolean addOldStudentInstrument() {
+        Date startTime = null;
+        Date nowDate = new Date();
+        StudentInstrument studentInstrument = studentInstrumentDao.getStudentInstrument(2094765, 60);
+        if (studentInstrument != null) {
+            startTime = DateUtil.addMinutes(nowDate, -15);
+        }
+        List<StudentInstrument> oldStudentInstruments = studentInstrumentDao.getOldStudentInstrument(startTime);
+        for (StudentInstrument oldStudentInstrument : oldStudentInstruments) {
+            oldStudentInstrument.setChangeOrderId(oldStudentInstrument.getOrderId());
+            if (oldStudentInstrument.getEndTime().compareTo(nowDate) > 0) {
+                oldStudentInstrument.setStatus(1);
+            } else {
+                oldStudentInstrument.setStatus(0);
+            }
+            StudentInstrument has = studentInstrumentDao.getStudentInstrument(oldStudentInstrument.getStudentId(), oldStudentInstrument.getGoodsId());
+            if (has == null) {
+                studentInstrumentDao.insert(oldStudentInstrument);
+                continue;
+            }
+            oldStudentInstrument.setId(has.getId());
+            if (has.getEndTime() == null) {
+                studentInstrumentDao.update(oldStudentInstrument);
+                continue;
+            }
+            if (has.getEndTime().compareTo(oldStudentInstrument.getEndTime()) >= 0) {
+                continue;
+            }
+            studentInstrumentDao.update(oldStudentInstrument);
+        }
+        return true;
+    }
 }

+ 13 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -182,6 +182,8 @@ public class StudentManageServiceImpl implements StudentManageService {
 //                if(!subject.getId().equals(dto.getUserId())) continue;
 //                dto.setSubjectName(subject.getName());
 //            }
+            //年级
+            dto.setCurrentGrade(studentService.getStudentGrade(dto.getGradeType(),dto.getCurrentGradeNum()));
         }
 
         if (queryInfo.getIsExport()) {
@@ -563,11 +565,17 @@ public class StudentManageServiceImpl implements StudentManageService {
     @Transactional(rollbackFor = Exception.class)
     public void updateUser(SysUser sysUser) {
         studentManageDao.updateUser(sysUser);
-        StudentRegistration studentRegistration = new StudentRegistration();
-        studentRegistration.setUserId(sysUser.getId());
-        studentRegistration.setCurrentClass(sysUser.getCurrentClass());
-        studentRegistration.setCurrentGrade(sysUser.getCurrentGrade());
-        studentRegistrationDao.updateCurrentClass(studentRegistration);
+        Student student = studentDao.get(sysUser.getId());
+        if(student != null) {
+            student.setCurrentGradeNum(sysUser.getCurrentGradeNum());
+            student.setCurrentClass(sysUser.getCurrentClass());
+            studentDao.update(student);
+        }
+//        StudentRegistration studentRegistration = new StudentRegistration();
+//        studentRegistration.setUserId(sysUser.getId());
+//        studentRegistration.setCurrentClass(sysUser.getCurrentClass());
+//        studentRegistration.setCurrentGrade(sysUser.getCurrentGrade());
+//        studentRegistrationDao.updateCurrentClass(studentRegistration);
     }
 
     @Override

+ 45 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -154,9 +154,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Autowired
     private StudentInstrumentService studentInstrumentService;
     @Autowired
+    private OrganizationDao organizationDao;
+
+    @Autowired
     private GroupEventSource groupEventSource;
     @Autowired
     private WebFeignService webFeignService;
+    @Autowired
+    private StudentService studentService;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -336,15 +341,24 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentRegistration.setUpdateTime(date);
         studentRegistration.setUserId(sysUser.getId());
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
-        if (hasReg != null) {
+
+        Organization organization = organizationDao.get(studentRegistration.getOrganId());
+        String studentGrade = studentService.getStudentGrade(organization.getGradeType(), studentRegistration.getCurrentGradeNum());
+        studentRegistration.setCurrentGrade(studentGrade);
+
+        if(hasReg != null){
             studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
             studentRegistration.setId(hasReg.getId());
             studentRegistrationDao.update(studentRegistration);
         } else {
             studentRegistrationDao.insert(studentRegistration);
         }
+        //更新年级信息
+        student.setCurrentGradeNum(studentRegistration.getCurrentGradeNum());
+        student.setCurrentClass(studentRegistration.getCurrentClass());
+        studentDao.update(student);
 
-//        webFeignService.updateNickName(sysUser.getId(),studentRegistration.getName(),"STUDENT");
+        //webFeignService.updateNickName(sysUser.getId(),studentRegistration.getName(),"STUDENT");
         // 增加报名学生数
         musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(), 1);
         // 报名成功后,发送短信
@@ -416,7 +430,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetail4goodsGroup.setPaymentOrderId(studentPaymentOrder.getId());
                 studentPaymentOrderDetail4goodsGroup.setKitGroupPurchaseType(goodsGroup.getKitGroupPurchaseType());
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goodsGroup);
-                if (OrderDetailTypeEnum.MUSICAL.equals(type) && KitGroupPurchaseTypeEnum.GROUP.equals(goodsGroup.getKitGroupPurchaseType())) {
+                if (OrderDetailTypeEnum.MUSICAL.equals(type)) {
                     maintenanceGoodsId = goodsGroup.getGoodsIdList();
                 }
             }
@@ -442,7 +456,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }
         if (buyMaintenance) {
             if ("".equals(maintenanceGoodsId)) {
-                throw new BizException("团购乐器才能购买乐保,请核查");
+                throw new BizException("乐器才能购买乐保,请核查");
             }
             BigDecimal maintenancePrice = new BigDecimal(sysConfigDao.findConfigValue("maintenance_price"));
             StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
@@ -541,7 +555,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetail4goodsGroup.setPaymentOrderId(studentPaymentOrder.getId());
                 studentPaymentOrderDetail4goodsGroup.setKitGroupPurchaseType(goodsGroup.getKitGroupPurchaseType());
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goodsGroup);
-                if (OrderDetailTypeEnum.MUSICAL.equals(type) && KitGroupPurchaseTypeEnum.GROUP.equals(goodsGroup.getKitGroupPurchaseType())) {
+                if (OrderDetailTypeEnum.MUSICAL.equals(type)) {
                     maintenanceGoodsId = goodsGroup.getGoodsIdList();
                 }
             }
@@ -567,7 +581,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }
         if (buyMaintenance) {
             if ("".equals(maintenanceGoodsId)) {
-                throw new BizException("团购乐器才能购买乐保,请核查");
+                throw new BizException("乐器才能购买乐保,请核查");
             }
             BigDecimal maintenancePrice = new BigDecimal(sysConfigDao.findConfigValue("maintenance_price"));
             StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
@@ -691,6 +705,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             if (studentFeeDaoByUser != null) {
                 throw new BizException("该学员已存在");
             }
+            Organization organization = organizationDao.get(musicGroup.getOrganId());
+            String studentGrade = studentService.getStudentGrade(organization.getGradeType(), studentRegistration.getCurrentGradeNum());
+            studentRegistration.setCurrentGrade(studentGrade);
             studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
             studentRegistration.setUserId(userId);
             studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);
@@ -754,7 +771,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             } else {
                 studentRegistrationDao.insertBasic(studentRegistration);
             }
-            studentRegistrationDao.updateCurrentClass(studentRegistration);
+            Student student = studentDao.get(userId);
+            student.setCurrentGradeNum(studentRegistration.getCurrentGradeNum());
+            student.setCurrentClass(studentRegistration.getCurrentClass());
+            studentDao.update(student);
+            //studentRegistrationDao.updateCurrentClass(studentRegistration);
 
             return userId;
         }
@@ -1011,7 +1032,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.getOrderDetail(studentPaymentOrder.getId());
 
             List<StudentPaymentOrderDetail> allDetails = studentPaymentOrderDetailDao.getOrderDetailByOrderId(studentPaymentOrder.getId());
-            BigDecimal courseFee = allDetails.stream().filter(o -> !o.getType().getCode().equals("MUSICAL")).filter(o -> !o.getType().getCode().equals("ACCESSORIES")).map(o -> o.getPrice().subtract(o.getRemitFee() == null ? BigDecimal.ZERO : o.getRemitFee()))
+            BigDecimal courseFee = allDetails.stream().filter(o -> !o.getType().getCode().equals("MUSICAL"))
+                    .filter(o -> !o.getType().getCode().equals("ACCESSORIES"))
+                    .filter(o -> !o.getType().getCode().equals("MAINTENANCE"))
+                    .map(o -> o.getPrice().subtract(o.getRemitFee() == null ? BigDecimal.ZERO : o.getRemitFee()))
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
 
             //累加充值金额
@@ -1098,13 +1122,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 Map<Integer, String> map = new HashMap<>(1);
                 map.put(studentPaymentOrder.getUserId(), studentRegistration.getParentsPhone());
                 sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS,
-                        MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, map, null, 0, "1", "",
+                        MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, map, null, 0, null, "",
                         studentRegistration.getName(), studentPaymentOrder.getActualAmount());
                 //push
                 Map<Integer, String> map1 = new HashMap<>(1);
                 map1.put(studentPaymentOrder.getUserId(), studentPaymentOrder.getUserId().toString());
                 sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
-                        MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, map1, null, 0, "1", "STUDENT",
+                        MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, map1, null, 0, null, "STUDENT",
                         studentRegistration.getName(), studentPaymentOrder.getActualAmount());
             }
             try {
@@ -1139,7 +1163,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 Map<Integer, String> map = new HashMap<>(1);
                 map.put(studentPaymentOrder.getUserId(), studentRegistration.getParentsPhone());
                 sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS,
-                        MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED, map, null, 0, "1", "",
+                        MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED, map, null, 0, null, "",
                         HttpUtil.getSortUrl(studentApplyUrl));
             }
 //            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
@@ -1359,7 +1383,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public StudentRegistration updateStudent(StudentRegistration studentRegistration) {
         if (StringUtils.isBlank(studentRegistration.getCertificateType())) {
             studentRegistration.setCertificateType(CertificateTypeEnum.IDENTITY.getCode());
@@ -1372,8 +1396,16 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         student.setParentsName(studentRegistration.getParentsName());
         student.setIdCardNo(studentRegistration.getIdCardNo());
         student.setGender(studentRegistration.getGender());
+        Organization organization = organizationDao.get(studentRegistration.getOrganId());
+        String studentGrade = studentService.getStudentGrade(organization.getGradeType(), studentRegistration.getCurrentGradeNum());
+        studentRegistration.setCurrentGrade(studentGrade);
         update(studentRegistration);
-        studentRegistrationDao.updateUser(student.getUserId(), student.getName(), student.getParentsName(), student.getIdCardNo(), student.getGender(), studentRegistration.getCertificateType());
+        studentRegistrationDao.updateUser(student.getUserId(),student.getName(), student.getParentsName(), student.getIdCardNo(), student.getGender(),studentRegistration.getCertificateType());
+        //更新年级信息
+        Student studentInfo = studentDao.get(student.getUserId());
+        studentInfo.setCurrentGradeNum(studentRegistration.getCurrentGradeNum());
+        studentInfo.setCurrentClass(studentRegistration.getCurrentClass());
+        studentDao.update(studentInfo);
         // 添加用户电子签章账户
         if (CertificateTypeEnum.IDENTITY.getCode().equals(studentRegistration.getCertificateType())) {
             contractService.register(student.getUserId(), student.getParentsName(), student.getIdCardNo(), student.getParentsPhone());

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

@@ -736,7 +736,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             paymentDetail.setUserId(userId);
             sysUserCashAccountDetailService.insert(paymentDetail);
             //将购买的乐器加入学生乐器列表
-            studentGoodsSellService.saveStudentInstrument(studentPaymentOrder.getOrderNo());
+            studentGoodsSellService.saveStudentInstrument(studentPaymentOrder);
             //购买的商品加入销售列表
             saveSellOrder(studentPaymentOrder.getOrderNo());
         } else if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
@@ -1051,7 +1051,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 List<Goods> goods = JSONObject.parseArray(repairInfo.getGoodsJson(), Goods.class);
                 List<Integer> goodsIds = goods.stream().map(Goods::getId).collect(Collectors.toList());
                 if (goodsIds.size() > 0) {
-                    sellOrderService.addSellOrder(studentPaymentOrder.getId(), null, goodsIds, studentPaymentOrder.getExpectAmount(), studentPaymentOrder.getBalancePaymentAmount());
+                    sellOrderService.addSellOrder(studentPaymentOrder.getId(), null, goodsIds, studentPaymentOrder.getExpectAmount().add(repairInfo.getExemptionAmount()), studentPaymentOrder.getBalancePaymentAmount());
                 }
             }
 
@@ -1062,10 +1062,10 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                         "联系人:" + repairInfo.getEmployeeName() + "(" + repairInfo.getEmployeePhone() + ")\n" +
                         "地址:" + repairInfo.getEmployeeAddress() + "";
 
-                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_REPAIR_ONLINE_PAYMENT_SUCCESS, map, null, 0, "1", "STUDENT",
+                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_REPAIR_ONLINE_PAYMENT_SUCCESS, map, null, 0, null, "STUDENT",
                         repairInfo.getStudentName(), repairInfo.getEmployeeName(), repairInfo.getEmployeePhone(), repairInfo.getEmployeeAddress());
             } else {
-                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_REPAIR_OFFLINE_PAYMENT_SUCCESS, map, null, 0, "1", "STUDENT",
+                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_REPAIR_OFFLINE_PAYMENT_SUCCESS, map, null, 0, null, "STUDENT",
                         repairInfo.getStudentName());
             }
             sysMessageService.sendNoAuthPrivateMessage(repairInfo.getEmployeeId().toString(), userId.toString(), imContent);
@@ -1082,7 +1082,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "乐器维修支付失败");
             }
 
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_SPORADIC_PAYMENT_FAILED, map, null, 0, "", "STUDENT",
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_SPORADIC_PAYMENT_FAILED, map, null, 0, null, "STUDENT",
                     studentPaymentOrder.getActualAmount(), "乐器维修");
             return false;
         }

+ 169 - 141
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -9,6 +9,10 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.enums.FivePlusGradeEnum;
+import com.ym.mec.biz.dal.enums.GradeTypeEnum;
+import com.ym.mec.biz.dal.enums.SixPlusGradeEnum;
+import com.ym.mec.common.page.QueryInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
@@ -31,145 +35,169 @@ import com.ym.mec.util.collection.MapUtil;
 @Service
 public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implements StudentService {
 
-	@Autowired
-	private StudentDao studentDao;
-	@Autowired
-	private CourseScheduleDao courseScheduleDao;
-	
-	@Autowired
-	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
-
-	@Override
-	public BaseDAO<Integer, Student> getDAO() {
-		return studentDao;
-	}
-
-	@Override
-	public PageInfo findStudentVipGroupList(StudentQueryInfo queryInfo) {
-		PageInfo pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
-		Map<String, Object> params = new HashMap<String, Object>();
-		MapUtil.populateMap(params, queryInfo);
-
-		List dataList = null;
-		int count = studentDao.countStudents(params);
-		if (count > 0) {
-			pageInfo.setTotal(count);
-			params.put("offset", pageInfo.getOffset());
-			dataList = studentDao.findStudents(params);
-		}
-		if (count == 0) {
-			dataList = new ArrayList<>();
-		}
-		pageInfo.setRows(dataList);
-		return pageInfo;
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public Long upSet(Student student) {
-		if(studentDao.get(student.getUserId()) == null){
-			return studentDao.insert(student);
-		}else {
-			student.setUpdateTime(new Date());
-			studentDao.update(student);
-			return student.getUserId().longValue();
-		}
-	}
-
-	@Override
-	public boolean updateOperatingTempTag() {
-		List<StudentCourseTimesDto> studentCourseTimesDtoList = courseScheduleStudentPaymentDao.queryStudentNotStartCourseTimesOfOnline();
-		Map<Integer,StudentCourseTimesDto> map = studentCourseTimesDtoList.stream().collect(Collectors.toMap(StudentCourseTimesDto::getUserId, s -> s));
-		//查询服务指标为0的用户
-		List<Student> unlabeledStudentList = studentDao.queryByOperatingTempTag(0);
-		
-		List<Student> updateStudentList = new ArrayList<Student>();
-		StudentCourseTimesDto dto = null;
-		for(Student s : unlabeledStudentList){
-			if(s.getOperatingTag() == 1){
-				continue;
-			}
-			dto = map.get(s.getUserId());
-			if(dto != null){
-				if(dto.getTotalCourseTimes() > 0 && dto.getTotalCourseTimes() != dto.getFreePracticeCourseTimes()){
-					s.setOperatingTempTag(1);
-					s.setOperatingTag(1);
-					updateStudentList.add(s);
-				}
-			}
-		}
-
-		List<Student> labeledStudentList = studentDao.queryByOperatingTempTag(1);
-		for(Student s : labeledStudentList){
-			dto = map.get(s.getUserId());
-			if (dto == null || dto.getTotalCourseTimes() == dto.getFreePracticeCourseTimes()) {
-				s.setOperatingTempTag(0);
-				s.setOperatingTag(0);
-				updateStudentList.add(s);
-			}
-		}
-		
-		if(updateStudentList.size() > 0){
-			studentDao.batchUpdate(updateStudentList);
-		}
-		
-		return true;
-	}
-
-	@Override
-	public void initTeacherId() {
-		List<StudentTeacherCourseDto> allStudentCourseInfo = courseScheduleStudentPaymentDao.findAllStudentCourseInfo();
-		Map<Integer, List<StudentTeacherCourseDto>> studentCoursesMap = allStudentCourseInfo.stream().collect(Collectors.groupingBy(StudentTeacherCourseDto::getStudentId));
-		List<Student> students=new ArrayList<>();
-		for (Map.Entry<Integer, List<StudentTeacherCourseDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
-			Map<CourseSchedule.CourseScheduleType, List<StudentTeacherCourseDto>> courseTypeCourseMap = studentCoursesEntry.getValue().stream().collect(Collectors.groupingBy(StudentTeacherCourseDto::getCourseScheduleType));
-			List<StudentTeacherCourseDto> practiceCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.PRACTICE);
-			if (!CollectionUtils.isEmpty(practiceCourses)) {
-				practiceCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
-				Student student=new Student(studentCoursesEntry.getKey());
-				student.setTeacherId(practiceCourses.get(0).getTeacherId());
-				students.add(student);
-				continue;
-			}
-
-			List<StudentTeacherCourseDto> vipCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.VIP);
-			if (!CollectionUtils.isEmpty(vipCourses)) {
-				Student student=new Student(studentCoursesEntry.getKey());
-				vipCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
-				student.setTeacherId(vipCourses.get(0).getTeacherId());
-				students.add(student);
-				continue;
-			}
-
-			List<StudentTeacherCourseDto> singleCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE);
-			if (!CollectionUtils.isEmpty(singleCourses)) {
-				Student student=new Student(studentCoursesEntry.getKey());
-				singleCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
-				student.setTeacherId(singleCourses.get(0).getTeacherId());
-				students.add(student);
-				continue;
-			}
-
-			List<StudentTeacherCourseDto> mixCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.MIX);
-			if (!CollectionUtils.isEmpty(mixCourses)) {
-				Student student=new Student(studentCoursesEntry.getKey());
-				mixCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
-				student.setTeacherId(mixCourses.get(0).getTeacherId());
-				students.add(student);
-				continue;
-			}
-		}
-		if(!CollectionUtils.isEmpty(students)){
-			studentDao.batchUpdate(students);
-		}
-		students=null;
-		studentCoursesMap=null;
-		allStudentCourseInfo=null;
-	}
-
-	@Override
-	public void batchUpdateAdviser(Integer teacherId,String studentIds) {
-		studentDao.batchUpdateAdviser(teacherId,studentIds);
-	}
-
+    @Autowired
+    private StudentDao studentDao;
+    @Autowired
+    private CourseScheduleDao courseScheduleDao;
+
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
+
+    @Override
+    public BaseDAO<Integer, Student> getDAO() {
+        return studentDao;
+    }
+
+    @Override
+    public PageInfo findStudentVipGroupList(StudentQueryInfo queryInfo) {
+        PageInfo pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<String, Object>();
+        MapUtil.populateMap(params, queryInfo);
+
+        List dataList = null;
+        int count = studentDao.countStudents(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = studentDao.findStudents(params);
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Long upSet(Student student) {
+        if (studentDao.get(student.getUserId()) == null) {
+            return studentDao.insert(student);
+        } else {
+            student.setUpdateTime(new Date());
+            studentDao.update(student);
+            return student.getUserId().longValue();
+        }
+    }
+
+    @Override
+    public boolean updateOperatingTempTag() {
+        List<StudentCourseTimesDto> studentCourseTimesDtoList = courseScheduleStudentPaymentDao.queryStudentNotStartCourseTimesOfOnline();
+        Map<Integer, StudentCourseTimesDto> map = studentCourseTimesDtoList.stream().collect(Collectors.toMap(StudentCourseTimesDto::getUserId, s -> s));
+        //查询服务指标为0的用户
+        List<Student> unlabeledStudentList = studentDao.queryByOperatingTempTag(0);
+
+        List<Student> updateStudentList = new ArrayList<Student>();
+        StudentCourseTimesDto dto = null;
+        for (Student s : unlabeledStudentList) {
+            if (s.getOperatingTag() == 1) {
+                continue;
+            }
+            dto = map.get(s.getUserId());
+            if (dto != null) {
+                if (dto.getTotalCourseTimes() > 0 && dto.getTotalCourseTimes() != dto.getFreePracticeCourseTimes()) {
+                    s.setOperatingTempTag(1);
+                    s.setOperatingTag(1);
+                    updateStudentList.add(s);
+                }
+            }
+        }
+
+        List<Student> labeledStudentList = studentDao.queryByOperatingTempTag(1);
+        for (Student s : labeledStudentList) {
+            dto = map.get(s.getUserId());
+            if (dto == null || dto.getTotalCourseTimes() == dto.getFreePracticeCourseTimes()) {
+                s.setOperatingTempTag(0);
+                s.setOperatingTag(0);
+                updateStudentList.add(s);
+            }
+        }
+
+        if (updateStudentList.size() > 0) {
+            studentDao.batchUpdate(updateStudentList);
+        }
+
+        return true;
+    }
+
+    @Override
+    public void initTeacherId() {
+        List<StudentTeacherCourseDto> allStudentCourseInfo = courseScheduleStudentPaymentDao.findAllStudentCourseInfo();
+        Map<Integer, List<StudentTeacherCourseDto>> studentCoursesMap = allStudentCourseInfo.stream().collect(Collectors.groupingBy(StudentTeacherCourseDto::getStudentId));
+        List<Student> students = new ArrayList<>();
+        for (Map.Entry<Integer, List<StudentTeacherCourseDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
+            Map<CourseSchedule.CourseScheduleType, List<StudentTeacherCourseDto>> courseTypeCourseMap = studentCoursesEntry.getValue().stream().collect(Collectors.groupingBy(StudentTeacherCourseDto::getCourseScheduleType));
+            List<StudentTeacherCourseDto> practiceCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.PRACTICE);
+            if (!CollectionUtils.isEmpty(practiceCourses)) {
+                practiceCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
+                Student student = new Student(studentCoursesEntry.getKey());
+                student.setTeacherId(practiceCourses.get(0).getTeacherId());
+                students.add(student);
+                continue;
+            }
+
+            List<StudentTeacherCourseDto> vipCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.VIP);
+            if (!CollectionUtils.isEmpty(vipCourses)) {
+                Student student = new Student(studentCoursesEntry.getKey());
+                vipCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
+                student.setTeacherId(vipCourses.get(0).getTeacherId());
+                students.add(student);
+                continue;
+            }
+
+            List<StudentTeacherCourseDto> singleCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE);
+            if (!CollectionUtils.isEmpty(singleCourses)) {
+                Student student = new Student(studentCoursesEntry.getKey());
+                singleCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
+                student.setTeacherId(singleCourses.get(0).getTeacherId());
+                students.add(student);
+                continue;
+            }
+
+            List<StudentTeacherCourseDto> mixCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.MIX);
+            if (!CollectionUtils.isEmpty(mixCourses)) {
+                Student student = new Student(studentCoursesEntry.getKey());
+                mixCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
+                student.setTeacherId(mixCourses.get(0).getTeacherId());
+                students.add(student);
+                continue;
+            }
+        }
+        if (!CollectionUtils.isEmpty(students)) {
+            studentDao.batchUpdate(students);
+        }
+        students = null;
+        studentCoursesMap = null;
+        allStudentCourseInfo = null;
+    }
+
+    @Override
+    public void batchUpdateAdviser(Integer teacherId, String studentIds) {
+        studentDao.batchUpdateAdviser(teacherId, studentIds);
+    }
+
+    @Override
+    public Integer updateGrade() {
+        return studentDao.updateGrade();
+    }
+
+    @Override
+    public String getStudentGrade(GradeTypeEnum gradeType, Integer gradeNum) {
+        String grade = "";
+        if (GradeTypeEnum.FIVE_PLUS.equals(gradeType)) {
+            FivePlusGradeEnum[] fivePlusGradeEnums = FivePlusGradeEnum.values();
+            for (FivePlusGradeEnum fivePlusGradeEnum : fivePlusGradeEnums) {
+                if (!fivePlusGradeEnum.getCode().equals(gradeNum)) continue;
+                grade = fivePlusGradeEnum.getDesc();
+            }
+        }
+        if (GradeTypeEnum.SIX_PLUS.equals(gradeType)) {
+            SixPlusGradeEnum[] sixPlusGradeEnums = SixPlusGradeEnum.values();
+            for (SixPlusGradeEnum sixPlusGradeEnum : sixPlusGradeEnums) {
+                if (!sixPlusGradeEnum.getCode().equals(gradeNum)) continue;
+                grade = sixPlusGradeEnum.getDesc();
+            }
+        }
+        return grade;
+    }
 }

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

@@ -68,6 +68,8 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
     private SellOrderService sellOrderService;
     @Autowired
     private GoodsService goodsService;
+    @Autowired
+    private StudentInstrumentService studentInstrumentService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -300,6 +302,8 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
                 //添加新订单
                 this.addSellOrder(studentPaymentOrder.getId(), subjectChange.getMusicGroupId(), goodsIdList, BigDecimal.ZERO, BigDecimal.ZERO, subjectChange.getKitGroupPurchaseType());
             }
+            //乐保处理
+            studentInstrumentService.subjectChangeUpdateInstrument(subjectChange);
         }
         return subjectChange;
     }
@@ -491,6 +495,9 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
                 this.addSellOrder(studentPaymentOrder.getId(), subjectChange.getMusicGroupId(), goodsIdList, studentPaymentOrder.getExpectAmount(), studentPaymentOrder.getBalancePaymentAmount(), subjectChange.getKitGroupPurchaseType());
             }
 
+            //乐保处理
+            studentInstrumentService.subjectChangeUpdateInstrument(subjectChange);
+
             //插入交易明细
             BigDecimal amount = studentPaymentOrder.getActualAmount();
             SysUserCashAccount cashAccount = sysUserCashAccountService.get(userId);
@@ -538,7 +545,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
                 sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "声部更改支付失败");
             }
 
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_SPORADIC_PAYMENT_FAILED, map, null, 0, "", "STUDENT",
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_SPORADIC_PAYMENT_FAILED, map, null, 0, null, "STUDENT",
                     studentPaymentOrder.getActualAmount(), "声部更换");
             return false;
         }

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

@@ -3153,6 +3153,20 @@
           AND cs.group_type_ = #{groupType}
           AND cs.del_flag_ = 0
     </select>
+    <select id="findCourseByGroupIds" resultMap="CourseSchedule">
+        SELECT
+        <include refid="resultSql"></include>
+        FROM course_schedule cs
+        WHERE cs.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        AND cs.del_flag_ = 0
+        AND (new_course_id_ is null or new_course_id_ = 0)
+        <if test="groupIds!=null and groupIds.size()>0">
+            AND cs.music_group_id_ IN
+            <foreach collection="groupIds" item="groupId" open="(" close=")" separator=",">
+                #{groupId}
+            </foreach>
+        </if>
+    </select>
     <select id="queryScheduleByAttendance" resultMap="CourseSchedule">
         SELECT cs.*
         FROM teacher_attendance ta

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesReplyMapper.xml

@@ -170,7 +170,8 @@
 	<select id="findExtraExerciseStudents" resultMap="ExtraExerciseStudentsDto">
 		SELECT
 			eer.*,
-			su.username_ student_name_
+			su.username_ student_name_,
+		    su.avatar_
 		FROM
 			extracurricular_exercises_reply eer
 			LEFT JOIN sys_user su ON su.id_ = eer.user_id_

+ 6 - 2
mec-biz/src/main/resources/config/mybatis/OrganizationMapper.xml

@@ -18,6 +18,7 @@
         <result column="linkman_" property="linkman"/>
         <result column="mobile_" property="mobile"/>
         <result column="address_" property="address"/>
+        <result column="grade_type_" property="gradeType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -33,8 +34,8 @@
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Organization" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
-        INSERT INTO organization (id_,name_,area_id_,create_time_,update_time_,register_date_,linkman_,mobile_,address_)
-        VALUES(#{id},#{name},#{areaId},now(),now(),#{registerDate},#{linkman},#{mobile},#{address})
+        INSERT INTO organization (id_,name_,area_id_,create_time_,update_time_,register_date_,linkman_,mobile_,address_,grade_type_)
+        VALUES(#{id},#{name},#{areaId},now(),now(),#{registerDate},#{linkman},#{mobile},#{address},#{gradeType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -65,6 +66,9 @@
             <if test="address != null">
                 address_ = #{address},
             </if>
+            <if test="gradeType != null">
+                grade_type_ = #{gradeType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
         </set>
         WHERE id_ = #{id}
     </update>

+ 72 - 13
mec-biz/src/main/resources/config/mybatis/StudentInstrumentMapper.xml

@@ -13,8 +13,12 @@
         <result column="status_" property="status"/>
         <result column="start_time_" property="startTime"/>
         <result column="end_time_" property="endTime"/>
+        <result column="order_id_" property="orderId"/>
+        <result column="change_order_id_" property="changeOrderId"/>
+        <result column="operation_" property="operation"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time" property="updateTime"/>
+        <result column="del_flag_" property="delFlag"/>
         <result column="goods_name_" property="goodsName"/>
         <result column="specification_" property="specification"/>
         <result column="goods_brand_" property="goodsBrand"/>
@@ -37,11 +41,11 @@
         <!--@mbg.generated-->
         insert into student_instrument
         (student_id_,organ_id_,goods_id_,goods_category_id_,goods_category_name_,goods_name_,goods_brand_,specification_,goods_img_,
-        status_, start_time_, end_time_, create_time_, update_time
+        status_,order_id_,change_order_id_,operation_, start_time_, end_time_, create_time_, update_time
         )
         values
         (#{studentId},#{organId},#{goodsId},#{goodsCategoryId},#{goodsCategoryName},#{goodsName},#{goodsBrand},#{specification},#{goodsImg},
-        #{status}, #{startTime}, #{endTime}, NOW(), NOW()
+        #{status},#{orderId},#{changeOrderId},#{operation}, #{startTime}, #{endTime}, NOW(), NOW()
         )
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentInstrument">
@@ -72,18 +76,21 @@
             <if test="status != null">
                 status_ = #{status},
             </if>
-            <if test="startTime != null">
-                start_time_ = #{startTime},
+            <if test="operation != null">
+                operation_ = #{operation},
             </if>
-            <if test="endTime != null">
-                end_time_ = #{endTime},
+            start_time_ = #{startTime},
+            end_time_ = #{endTime},
+            <if test="changeOrderId != null">
+                change_order_id_ = #{changeOrderId},
             </if>
             <if test="createTime != null">
                 create_time_ = #{createTime},
             </if>
-            <if test="updateTime != null">
-                update_time = #{updateTime},
+            <if test="delFlag != null">
+                del_flag_ = #{delFlag},
             </if>
+            update_time = NOW(),
         </set>
         where id_ = #{id}
     </update>
@@ -131,20 +138,24 @@
             <if test="specification != null">
                 AND si.specification_ LIKE CONCAT('%',#{specification},'%')
             </if>
+            <if test="status != null">
+                AND si.status_ = #{status}
+            </if>
             <if test="search != null">
                 AND (si.student_id_ = #{search} OR su.phone_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%'))
             </if>
+            AND si.del_flag_ = 0
         </where>
     </sql>
 
     <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         insert into student_instrument
         (student_id_,organ_id_,goods_id_,goods_category_id_,goods_category_name_,goods_name_,goods_brand_,specification_,goods_img_,
-        status_, start_time_, end_time_, create_time_, update_time)
+        order_id_,change_order_id_,status_, start_time_, end_time_, create_time_, update_time)
         VALUE
         <foreach collection="studentInstruments" item="item" separator=",">
             (#{item.studentId},#{item.organId},#{item.goodsId},#{item.goodsCategoryId},#{item.goodsCategoryName},#{item.goodsName},#{item.goodsBrand},#{item.specification},#{item.goodsImg},
-            #{item.status}, #{item.startTime},
+            #{item.orderId},#{item.changeOrderId},#{item.status}, #{item.startTime},
             #{item.endTime}, NOW(), NOW())
         </foreach>
     </insert>
@@ -153,13 +164,61 @@
    <![CDATA[
         UPDATE student_instrument
         SET status_ = 0
-        WHERE end_time_ <= NOW()
+        WHERE status_ = 0
+          AND end_time_ <= NOW()
         ]]>
     </update>
     <select id="getListByEndTime" resultMap="StudentInstrument">
         <![CDATA[
-        SELECT * FROM student_instrument WHERE end_time_ >= #{startTime} AND end_time_ <= #{endTime}
-     ]]>
+        SELECT *
+        FROM student_instrument
+        WHERE end_time_ >= #{startTime}
+          AND end_time_ <= #{endTime}
+        ]]>
+    </select>
+
+    <select id="getByOrderId" resultMap="StudentInstrument">
+        SELECT *
+        FROM student_instrument
+        WHERE change_order_id_ = #{orderId}
+    </select>
+
+    <select id="getStudentInstrument" resultMap="StudentInstrument">
+        SELECT *
+        FROM student_instrument
+        WHERE student_id_ = #{studentId}
+          AND goods_id_ = #{goodsId}
+          AND del_flag_ = 0
+        ORDER BY id_ DESC
+        LIMIT 1
+    </select>
+
+    <select id="getOldStudentInstrument" resultMap="StudentInstrument">
+        SELECT spo.user_id_ student_id_,
+        spo.organ_id_,
+        g.id_ goods_id_,
+        g.goods_category_id_,
+        gc.name_ goods_category_name_,
+        g.name_ goods_name_,
+        g.brand_ goods_brand_,
+        g.specification_,
+        g.image_ goods_img_,
+        spo.create_time_ start_time_,
+        DATE_ADD(spo.create_time_, INTERVAL 1 YEAR) end_time_,
+        spo.id_ order_id_
+        FROM student_payment_order_detail spod
+        LEFT JOIN student_payment_order spo ON spo.id_ = spod.payment_order_id_
+        LEFT JOIN student_payment_order_detail spod2 ON spod2.payment_order_id_ = spo.id_
+        LEFT JOIN goods g ON g.id_ = spod2.goods_id_list_
+        LEFT JOIN goods_category gc on g.goods_category_id_ = gc.id_
+        WHERE spo.status_ = 'SUCCESS'
+        AND spod2.type_ = 'MUSICAL'
+        AND (spod.goods_id_list_ IN ('437', '438', '439', '440', '441', '442', '443') OR
+        FIND_IN_SET('76', spod.goods_id_list_))
+        <if test="startTime != null ">
+            AND spo.pay_time_ >= #{startTime}
+        </if>
+        ORDER BY spo.create_time_ ASC
     </select>
 
 </mapper>

+ 13 - 3
mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml

@@ -44,6 +44,7 @@
         <result property="username" column="username_"/>
         <result property="birthdate" column="birthdate_"/>
         <result property="currentGrade" column="current_grade_"/>
+        <result property="currentGradeNum" column="current_grade_num_"/>
         <result property="currentClass" column="current_class_"/>
         <result property="isActive" column="isActive_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result property="hasCourse" column="hasCourse_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
@@ -66,6 +67,7 @@
         <result property="isSignedContract" column="is_signed_contract_"/>
         <result column="care_package_" property="carePackage"/>
         <result column="come_on_package_" property="comeOnPackage"/>
+        <result column="grade_type_" property="gradeType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
     </resultMap>
 
     <sql id="queryCondition">
@@ -152,9 +154,10 @@
     </update>
 
     <select id="findStudentsByOrganId" resultMap="studentManageListDto">
-        SELECT o.`name_` organ_name_,s.`user_id_` ,su.`username_` ,su.`phone_` parents_phone_,su.`real_name_` ,su.`gender_` , su.organ_id_,
+        SELECT o.`name_` organ_name_,o.grade_type_,s.`user_id_` ,su.`username_` ,su.`phone_` parents_phone_,su.`real_name_` ,su.`gender_` , su.organ_id_,
 		tu.`real_name_` teacher_name_,CASE s.service_tag_ WHEN 2 THEN 0 ELSE s.service_tag_ END service_tag_ ,s.`operating_tag_` , s.care_package_, s.come_on_package_, suca.`course_balance_` ,
-		sub.`name_` music_group_subject_ ,su.birthdate_,s.subject_id_list_,s.teacher_id_,case when su.password_ is null then false else true end isActive_,s.is_new_user_,case when sut.user_id_ is null then 0 else 1 end is_signed_contract_
+		sub.`name_` music_group_subject_ ,su.birthdate_,s.subject_id_list_,s.teacher_id_,s.current_grade_num_,s.current_class_,
+        case when su.password_ is null then false else true end isActive_,s.is_new_user_,case when sut.user_id_ is null then 0 else 1 end is_signed_contract_
 		FROM `student` s LEFT JOIN `sys_user` su on s.`user_id_` = su.`id_`
 		LEFT JOIN `organization` o on o.`id_` = su.`organ_id_`
 		LEFT JOIN `sys_user` tu on tu.`id_` = s.`teacher_id_` 
@@ -474,6 +477,12 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="currentGrade != null">
+                AND sr.current_grade_ LIKE CONCAT('%',#{currentGrade},'%')
+            </if>
+            <if test="createYear != null">
+                AND DATE_FORMAT(sr.create_time_,'%Y') =  #{createYear}
+            </if>
         </where>
     </sql>
     <resultMap id="MusicGroupStudentsDto" type="com.ym.mec.biz.dal.dto.MusicGroupStudentsDto">
@@ -496,13 +505,14 @@
         <result property="paymentPeriodList" column="payment_period_list_"/>
         <result column="care_package_" property="carePackage"/>
         <result column="come_on_package_" property="comeOnPackage"/>
+        <result column="registerTime" property="registerTime"/>
     </resultMap>
     <select id="queryMusicGroupStudent" resultMap="MusicGroupStudentsDto">
         SELECT sr.user_id_,su.username_ real_name_,su.gender_,su.phone_ parents_phone_,sr.current_grade_,sr.current_grade_date_,
         sr.current_class_,sr.music_group_status_ student_status_,CASE WHEN sr.payment_status_ = 2 THEN 1 ELSE 0 END payment_status_,
         s.name_ subject_name_,sr.music_group_id_,CASE WHEN su.password_ IS NULL THEN 0 ELSE 1 END isActive_,
         IF(DATE_FORMAT(sr.create_time_,'%Y-%m-%d') > DATE_FORMAT(mg.payment_expire_date_,'%Y-%m-%d'),1,0) is_new_student_,
-        stu.care_package_,stu.come_on_package_
+        stu.care_package_,stu.come_on_package_,sr.create_time_ registerTime
         FROM student_registration sr
         LEFT JOIN sys_user su ON sr.user_id_ = su.id_
         LEFT JOIN `subject` s ON s.id_ = sr.actual_subject_id_

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

@@ -19,6 +19,8 @@
         <result column="update_time_" property="updateTime"/>
         <result column="care_package_" property="carePackage"/>
         <result column="come_on_package_" property="comeOnPackage"/>
+        <result column="current_grade_num" property="currentGradeNum"/>
+        <result column="current_class_" property="currentClass"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -103,6 +105,12 @@
             <if test="comeOnPackage != null">
                 come_on_package_=#{comeOnPackage},
             </if>
+            <if test="currentGradeNum != null">
+                current_grade_num_=#{currentGradeNum},
+            </if>
+            <if test="currentClass != null">
+                current_class_=#{currentClass},
+            </if>
                 update_time_ = NOW()
         </set>
         WHERE user_id_ = #{userId}
@@ -663,4 +671,12 @@
             #{studentId}
         </foreach>
     </select>
+
+    <update id="updateGrade"><![CDATA[
+        UPDATE student SET current_grade_num_=current_grade_num_+1
+        WHERE current_grade_num_>=1
+          AND current_grade_num_<= 11
+        ]]>
+    </update>
+
 </mapper>

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

@@ -14,6 +14,7 @@
 		<result column="user_name_" property="userName" />
 		<result column="gender_" property="gender" />
 		<result column="current_grade_" property="currentGrade" />
+		<result column="current_grade_num_" property="currentGradeNum" />
 		<result column="current_class_" property="currentClass" />
 		<result column="subject_first_" property="subjectFirst" />
 		<result column="subject_second_" property="subjectSecond" />
@@ -51,7 +52,7 @@
 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 		</selectKey>
 		-->
-		INSERT INTO student_pre_registration (id_,music_group_id_,user_id_,phone_,user_name_,gender_,current_grade_,current_class_,subject_first_,subject_second_,is_allow_adjust_,kit_purchase_method_,create_time_) VALUES(#{id},#{musicGroupId},#{userId},#{phone},#{userName},#{gender},#{currentGrade},#{currentClass},#{subjectFirst},#{subjectSecond},#{isAllowAdjust},#{kitPurchaseMethod},#{createTime})
+		INSERT INTO student_pre_registration (id_,music_group_id_,user_id_,phone_,user_name_,gender_,current_grade_,current_grade_num_,current_class_,subject_first_,subject_second_,is_allow_adjust_,kit_purchase_method_,create_time_) VALUES(#{id},#{musicGroupId},#{userId},#{phone},#{userName},#{gender},#{currentGrade},#{currentGradeNum},#{currentClass},#{subjectFirst},#{subjectSecond},#{isAllowAdjust},#{kitPurchaseMethod},#{createTime})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -72,6 +73,9 @@
 		<if test="currentGrade != null">
 		current_grade_ = #{currentGrade},
 		</if>
+		<if test="currentGradeNum != null">
+			current_grade_num_ = #{currentGradeNum},
+		</if>
 		<if test="gender != null">
 		gender_ = #{gender},
 		</if>

+ 16 - 3
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -15,6 +15,7 @@
         <result column="current_grade_" property="currentGrade"/>
         <result column="current_grade_date_" property="currentGradeDate"/>
         <result column="current_grade_" property="currentGrade"/>
+        <result column="current_grade_num_" property="currentGradeNum"/>
         <result column="current_class_" property="currentClass"/>
         <result column="subject_id_" property="subjectId"/>
         <result column="actual_subject_id_" property="actualSubjectId"/>
@@ -117,6 +118,7 @@
             <if test="name!=null">name_,</if>
             <if test="musicGroupId!=null">music_group_id_,</if>
             <if test="currentGrade!=null">current_grade_,</if>
+            <if test="currentGradeNum!=null">current_grade_num_,</if>
             <if test="currentGradeDate!=null">current_grade_date_,</if>
             <if test="currentClass!=null">current_class_,</if>
             <if test="subjectId!=null">subject_id_,</if>
@@ -141,6 +143,7 @@
             <if test="name!=null">#{name},</if>
             <if test="musicGroupId!=null">#{musicGroupId},</if>
             <if test="currentGrade!=null">#{currentGrade},</if>
+            <if test="currentGradeNum!=null">#{currentGradeNum},</if>
             <if test="currentGradeDate!=null">#{currentGradeDate},</if>
             <if test="currentClass!=null">#{currentClass},</if>
             <if test="subjectId!=null">#{subjectId},</if>
@@ -180,6 +183,9 @@
             <if test="currentGrade != null">
                 current_grade_ = #{currentGrade},
             </if>
+            <if test="currentGradeNum != null">
+                current_grade_num_ = #{currentGradeNum},
+            </if>
             <if test="currentGradeDate != null">
                 current_grade_date_ = #{currentGradeDate},
             </if>
@@ -285,6 +291,12 @@
             <if test="name != null">
                 AND (sr.name_ LIKE CONCAT('%',#{name},'%') OR sr.parents_phone_ LIKE CONCAT('%',#{name},'%'))
             </if>
+            <if test="currentGrade != null">
+                AND sr.current_grade_ LIKE CONCAT('%',#{currentGrade},'%')
+            </if>
+            <if test="createYear != null">
+                AND DATE_FORMAT(sr.create_time_,'%Y') =  #{createYear}
+            </if>
         </where>
     </sql>
 
@@ -304,9 +316,10 @@
         <result column="user_id_" property="studentId"/>
         <result column="id_" property="id"/>
         <result column="remark_" property="remark"/>
+        <result column="create_time_" property="createTime"/>
     </resultMap>
     <select id="queryStudentDetailPage" resultMap="studentApplyDetail">
-        SELECT sr.id_, sr.user_id_,su.username_ username_,sr.parents_name_,sr.current_class_,sr.current_grade_,sr.current_grade_date_,
+        SELECT sr.id_,sr.create_time_, sr.user_id_,su.username_ username_,sr.parents_name_,sr.current_class_,sr.current_grade_,sr.current_grade_date_,
         su.gender_,sr.is_allow_adjust_, s.name_ subject_name_,ss.name_
         actual_subject_name_,su.phone_ parents_phone_,sr.payment_status_,sr.remark_,sr.actual_subject_id_
         FROM student_registration sr
@@ -580,11 +593,11 @@
         GROUP BY sr.music_group_id_
     </select>
     <select id="queryUserByPhone" resultMap="StudentRegistration">
-        SELECT su.id_,su.real_name_ parents_name_,su.phone_,sr.current_grade_,
+        SELECT su.id_,su.real_name_ parents_name_,su.phone_,sr.current_grade_,sr.current_grade_num_,
         sr.current_class_,su.username_ name_,su.birthdate_,su.gender_
         FROM sys_user su
         LEFT JOIN student_registration sr ON sr.user_id_ = su.id_
-        WHERE su.phone_ = #{mobile}
+        WHERE su.phone_ = #{mobile} ORDER BY sr.id_ DESC
         LIMIT 1
     </select>
     <select id="queryPurchaseTypeMap" resultType="java.util.Map">

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

@@ -210,7 +210,7 @@
                 AND sr.student_instrument_id_ = #{studentInstrumentId}
             </if>
             <if test="hasExemptionAmount != null and hasExemptionAmount ==1">
-                AND sr.exemption_amount_ > #{exemptionAmount}
+                AND sr.exemption_amount_ > 0
             </if>
             <if test="hasExemptionAmount != null and hasExemptionAmount ==0">
                 AND sr.exemption_amount_ = 0

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

@@ -312,6 +312,9 @@
             <if test="organId != null and organId != ''">
                 AND FIND_IN_SET(cs.organ_id_,#{organId})
             </if>
+            <if test="teacherId != null">
+                AND ta.teacher_id_ = #{teacherId}
+            </if>
             <if test="teacherAttendanceId != null and teacherAttendanceId != ''">
                 AND FIND_IN_SET(ta.id_,#{teacherAttendanceId})
             </if>

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

@@ -385,7 +385,7 @@
         vg.total_price_,
         cg.expect_student_num_,
         cg.student_num_,
-        su.username_ teacher_name_,
+        su.real_name_ teacher_name_,
         su.avatar_,
         t.introduction_,
         vga.type_,
@@ -477,7 +477,7 @@
                cg.total_class_times_,
                cg.expect_student_num_,
                cg.student_num_,
-               su.username_                                      teacher_name_,
+               su.real_name_                                      teacher_name_,
                su.avatar_,
                t.introduction_,
                s.name_                                           address_,

+ 10 - 0
mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java

@@ -163,4 +163,14 @@ public interface TaskRemoteService {
 	//乐保到期提醒
 	@GetMapping("task/maintenanceNotice")
 	void maintenanceNotice();
+
+	/**
+	 * 更新学生年级
+	 */
+	@GetMapping("task/updateGrade")
+	void updateGrade();
+
+	//乐保历史数据处理
+	@GetMapping("task/maintenanceOldDateAdd")
+	void maintenanceOldDateAdd();
 }

+ 10 - 0
mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java

@@ -201,8 +201,18 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
 		logger.info("学员服务指标关闭失败");
 	}
 
+	@Override
+	public void updateGrade() {
+		logger.info("学生年级更新失败");
+	}
+
     @Override
     public void maintenanceNotice() {
 		logger.info("乐保到期提醒推送失败");
     }
+
+    @Override
+    public void maintenanceOldDateAdd() {
+		logger.info("乐保历史数据处理失败");
+    }
 }

+ 1 - 0
mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java

@@ -44,6 +44,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
                 "/contracts/queryProduceContract",
                 "/repair/studentPaymentGoodsOrder",
                 "/studentCompetition/getWinnerList",
+                "/musicGroup/getGradeList",
                 "/studentCompetition/get","/musicGroup/preRegister").permitAll().anyRequest().authenticated().and().httpBasic();
     }
 

+ 14 - 12
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -1,5 +1,8 @@
 package com.ym.mec.student.controller;
 
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -25,25 +28,13 @@ import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
 import com.ym.mec.biz.dal.dao.StudentPreRegistrationDao;
 import com.ym.mec.biz.dal.dto.RegisterPayDto;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPreRegistration;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
@@ -76,6 +67,9 @@ public class MusicGroupController extends BaseController {
     @Autowired
     private CourseScheduleDao courseScheduleDao;
 
+    @Autowired
+    private OrganizationService organizationService;
+
     @ApiOperation("预报名")
     @PostMapping(value = "/preRegister")
     public Object preRegister(@RequestBody StudentPreRegistration studentPreRegistration) {
@@ -356,4 +350,12 @@ public class MusicGroupController extends BaseController {
 
         return succeed(orderDetail);
     }
+
+    @ApiOperation(value = "获取乐团的年级列表")
+    @GetMapping("/getGradeList")
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult<Map<Integer,String>> getGradeList(String musicGroupId) {
+        MusicGroup musicGroup = musicGroupService.get(musicGroupId);
+        return succeed(organizationService.getGradeList(musicGroup.getOrganId()));
+    }
 }

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java

@@ -72,6 +72,7 @@ public class MusicGroupRegisterController extends BaseController {
             return failed("乐团已截止报名");
         }
 
+        studentRegistration.setOrganId(musicGroup.getOrganId());
         if (studentRegistration.getId() != null) {
             return succeed(studentRegistrationService.updateStudent(studentRegistration));
         }
@@ -101,7 +102,6 @@ public class MusicGroupRegisterController extends BaseController {
             studentRegistration.setUserId(sysUser.getId());
         }
 
-        studentRegistration.setOrganId(musicGroup.getOrganId());
         return succeed(studentRegistrationService.addStudent(studentRegistration));
     }
 

+ 15 - 3
mec-student/src/main/java/com/ym/mec/student/controller/StudentManageController.java

@@ -1,11 +1,11 @@
 package com.ym.mec.student.controller;
 
 import com.ym.mec.biz.service.*;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.*;
 
 import java.util.Date;
+import java.util.Map;
 
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -54,6 +54,8 @@ public class StudentManageController extends BaseController {
     private SubjectService subjectService;
     @Autowired
     private StudentService studentService;
+    @Autowired
+    private OrganizationService organizationService;
 
     private final static Logger LOGGER = LoggerFactory.getLogger(StudentManageController.class);
 
@@ -216,4 +218,14 @@ public class StudentManageController extends BaseController {
         return succeed(subjectService.findSubSubjects(tenantId));
     }
 
+    @ApiOperation(value = "获取用户所在分部的年级列表)")
+    @GetMapping("studentManage/getGradeList")
+    public HttpResponseResult<Map<Integer,String>> getGradeList() {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(sysUser == null){
+            return failed("请重新登录");
+        }
+        return succeed(organizationService.getGradeList(sysUser.getOrganId()));
+    }
+
 }

+ 19 - 0
mec-task/src/main/java/com/ym/mec/task/jobs/MaintenanceOldDataAddTask.java

@@ -0,0 +1,19 @@
+package com.ym.mec.task.jobs;
+
+import com.ym.mec.task.TaskRemoteService;
+import com.ym.mec.task.core.BaseTask;
+import com.ym.mec.task.core.TaskException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class MaintenanceOldDataAddTask extends BaseTask {
+
+	@Autowired
+	private TaskRemoteService taskRemoteService;
+
+	@Override
+	public void execute() throws TaskException {
+		taskRemoteService.maintenanceOldDateAdd();
+	}
+}

+ 19 - 0
mec-task/src/main/java/com/ym/mec/task/jobs/UpdateGradeTask.java

@@ -0,0 +1,19 @@
+package com.ym.mec.task.jobs;
+
+import com.ym.mec.task.TaskRemoteService;
+import com.ym.mec.task.core.BaseTask;
+import com.ym.mec.task.core.TaskException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class UpdateGradeTask extends BaseTask {
+
+	@Autowired
+	private TaskRemoteService taskRemoteService;
+
+	@Override
+	public void execute() throws TaskException {
+		taskRemoteService.updateGrade();
+	}
+}

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

@@ -1685,8 +1685,8 @@ public class ExportController extends BaseController {
         OutputStream ouputStream = null;
         try {
             HSSFWorkbook workbook = POIUtil.exportExcel(
-                    new String[]{"学员编号", "学员姓名", "所属分部", "乐团名称", "指导老师", "教务老师", "预期安排", "实际安排", "提交次数", "评价次数", "及时评价次数", "付费网管课", "VIP课", "作业提交时间"},
-                    new String[]{"studentId", "studentName", "organName", "groupNames", "teacherName", "educationalTeacherName", "expectExercisesNum", "actualExercisesNum", "exercisesReplyNum",
+                    new String[]{"学员编号", "学员姓名", "所属分部", "乐团名称", "指导老师", "教务老师", "服务课程", "预期安排", "实际安排", "提交次数", "评价次数", "及时评价次数", "付费网管课", "VIP课", "作业提交时间"},
+                    new String[]{"studentId", "studentName", "organName", "groupNames", "teacherName", "educationalTeacherName", "serveType == 'EXERCISE' ? '课外训练':courseIds", "expectExercisesNum", "actualExercisesNum", "exercisesReplyNum",
                             "exercisesMessageNum", "exercisesMessageTimelyNum", "existPracticeCourse", "existVipCourse", "lastSubmitTime"}, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");

+ 14 - 4
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java

@@ -2,7 +2,9 @@ package com.ym.mec.web.controller;
 
 import com.ym.mec.biz.dal.dto.CloseMusicGroupDto;
 import com.ym.mec.biz.dal.dto.MusicGroupRegsDto;
+import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.common.entity.HttpResponseResult;
 
 import io.swagger.annotations.Api;
@@ -10,10 +12,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -48,6 +47,8 @@ public class MusicGroupController extends BaseController {
 	private SysUserFeignService sysUserFeignService;
 	@Autowired
 	private EmployeeDao employeeDao;
+	@Autowired
+	private OrganizationService organizationService;
 
 	@ApiOperation(value = "修改乐团基本信息")
 	@PostMapping("/update")
@@ -321,4 +322,13 @@ public class MusicGroupController extends BaseController {
 		return musicGroupService.sendParentMeetingNotice(sysUser.getId(), musicGroupId, meetingDate, address) ? succeed() : failed();
 	}
 
+	@ApiOperation(value = "获取乐团的年级列表")
+	@GetMapping("/getGradeList")
+	@PreAuthorize("@pcs.hasPermissions('musicGroup/getGradeList')")
+	@ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+	public HttpResponseResult<Map<Integer,String>> getGradeList(String musicGroupId) {
+		MusicGroup musicGroup = musicGroupService.get(musicGroupId);
+		return succeed(organizationService.getGradeList(musicGroup.getOrganId()));
+	}
+
 }

+ 11 - 0
mec-web/src/main/java/com/ym/mec/web/controller/OrganizationController.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.page.OrganizationQueryInfo;
 import com.ym.mec.biz.service.OrganizationService;
 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;
@@ -14,6 +15,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
+import java.util.Map;
 
 @RequestMapping("organization")
 @Api(tags = "分部服务")
@@ -72,4 +74,13 @@ public class OrganizationController extends BaseController {
     public Object get( @PathVariable("id") Integer id){
         return succeed(organizationService.get(id));
     }
+
+
+    @ApiOperation(value = "获取用户所在分部的年级列表)")
+    @GetMapping("organization/getGradeList")
+    @PreAuthorize("@pcs.hasPermissions('organization/getGradeList')")
+    @ApiParam(value = "分部编号", required = true)
+    public HttpResponseResult<Map<Integer,String>> getGradeList(Integer id) {
+        return succeed(organizationService.getGradeList(id));
+    }
 }

+ 98 - 2
mec-web/src/main/java/com/ym/mec/web/controller/StudentInstrumentController.java

@@ -4,16 +4,15 @@ package com.ym.mec.web.controller;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
 import com.ym.mec.biz.dal.entity.Employee;
-import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.StudentInstrument;
 import com.ym.mec.biz.dal.page.StudentInstrumentQueryInfo;
 import com.ym.mec.biz.service.StudentInstrumentService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.util.date.DateUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -29,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 
 @RequestMapping("studentInstrument")
@@ -79,9 +79,105 @@ public class StudentInstrumentController extends BaseController {
         if (studentInstrument.getStudentId() == null) {
             return failed("学生id不能为空");
         }
+        StudentInstrument oldInstrument = studentInstrumentService.getStudentInstrument(studentInstrument.getStudentId(), studentInstrument.getGoodsId());
+        if (oldInstrument != null) {
+            return failed("学生乐器信息已存在,请核查");
+        }
+
+        Date nowDate = new Date();
+        //不是乐保
+        if (studentInstrument.getStatus().equals(0)) {
+            studentInstrument.setStartTime(null);
+            studentInstrument.setEndTime(null);
+        }
+        if (studentInstrument.getStatus().equals(1)) {
+            if (studentInstrument.getStartTime() == null) {
+                return failed("乐保开始时间不能为空");
+            }
+            if (studentInstrument.getEndTime() == null) {
+                return failed("乐保结束时间不能为空");
+            }
+            if (studentInstrument.getStartTime().compareTo(nowDate) > 0) {
+                return failed("乐保开始时间不能大于当前时间");
+            }
+            if (studentInstrument.getEndTime().compareTo(nowDate) <= 0) {
+                return failed("乐保结束时间不能小于当前时间");
+            }
+        }
+        studentInstrument.setOperation(sysUser.getId());
         SysUser student = sysUserFeignService.queryUserById(studentInstrument.getStudentId());
         studentInstrument.setOrganId(student.getOrganId());
         return succeed(studentInstrumentService.addStudentInstrument(studentInstrument));
     }
 
+
+    @ApiOperation(value = "获取乐保信息")
+    @GetMapping("/getInfo")
+    @PreAuthorize("@pcs.hasPermissions('studentInstrument/getInfo')")
+    public HttpResponseResult<StudentInstrument> getInfo(Long id, Integer studentId) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        StudentInstrument studentInstrument = studentInstrumentService.get(id);
+        if (studentInstrument == null || !studentInstrument.getStudentId().equals(studentId)) {
+            return failed("学生乐器信息不存在");
+        }
+        return succeed(studentInstrument);
+    }
+
+
+    @ApiOperation(value = "修改乐保信息")
+    @PostMapping("/update")
+    @PreAuthorize("@pcs.hasPermissions('studentInstrument/update')")
+    public HttpResponseResult<StudentInstrument> update(StudentInstrument studentInstrument) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if (studentInstrument.getStudentId() == null) {
+            return failed("学生id不能为空");
+        }
+        Date nowDate = new Date();
+        //不是乐保
+        if (studentInstrument.getStatus().equals(0)) {
+            studentInstrument.setStartTime(null);
+            studentInstrument.setEndTime(null);
+        }
+        if (studentInstrument.getStatus().equals(1)) {
+            if (studentInstrument.getStartTime() == null) {
+                return failed("乐保开始时间不能为空");
+            }
+            if (studentInstrument.getEndTime() == null) {
+                return failed("乐保结束时间不能为空");
+            }
+            if (studentInstrument.getStartTime().compareTo(nowDate) > 0) {
+                return failed("乐保开始时间不能大于当前时间");
+            }
+            if (studentInstrument.getEndTime().compareTo(nowDate) <= 0) {
+                return failed("乐保结束时间不能小于当前时间");
+            }
+        }
+        studentInstrument.setOperation(sysUser.getId());
+        SysUser student = sysUserFeignService.queryUserById(studentInstrument.getStudentId());
+        studentInstrument.setOrganId(student.getOrganId());
+        return succeed(studentInstrumentService.updateStudentInstrument(studentInstrument));
+    }
+
+    @ApiOperation(value = "删除学生乐器信息")
+    @PostMapping("/del")
+    @PreAuthorize("@pcs.hasPermissions('studentInstrument/del')")
+    public HttpResponseResult<StudentInstrument> del(Long id, Integer studentId) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        StudentInstrument studentInstrument = studentInstrumentService.get(id);
+        if (studentInstrument == null || !studentInstrument.getStudentId().equals(studentId)) {
+            return failed("学生乐器信息不存在");
+        }
+        studentInstrument.setOperation(sysUser.getId());
+        studentInstrument.setDelFlag(1);
+        return succeed(studentInstrumentService.updateStudentInstrument(studentInstrument));
+    }
 }

+ 12 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -348,4 +348,16 @@ public class TaskController extends BaseController {
 	public void maintenanceNotice(){
 		studentInstrumentService.pushNotice();
 	}
+
+	//每年9.1升级学员的班级
+	@GetMapping("/updateGrade")
+	public void updateGrade(){
+		studentService.updateGrade();
+	}
+
+	//乐保历史数据处理
+	@GetMapping("/maintenanceOldDateAdd")
+	public void maintenanceOldDateAdd(){
+		studentInstrumentService.addOldStudentInstrument();
+	}
 }