Ver Fonte

Merge remote-tracking branch 'origin/master'

zouxuan há 4 anos atrás
pai
commit
03818c1a4d
24 ficheiros alterados com 671 adições e 128 exclusões
  1. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDetailDao.java
  2. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPreRegistrationDao.java
  3. 7 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/IndexBaseDto.java
  4. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java
  5. 157 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPreRegistration.java
  6. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/IndexBaseMonthDataService.java
  7. 16 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java
  8. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPreRegistrationService.java
  9. 15 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java
  10. 57 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  11. 179 84
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  12. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPreRegistrationServiceImpl.java
  13. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  14. 6 4
      mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml
  15. 6 2
      mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml
  16. 7 6
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml
  17. 1 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  18. 108 0
      mec-biz/src/main/resources/config/mybatis/StudentPreRegistrationMapper.xml
  19. 4 0
      mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java
  20. 5 0
      mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java
  21. 13 0
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java
  22. 19 0
      mec-task/src/main/java/com/ym/mec/task/jobs/IndexBaseDataTask.java
  23. 2 2
      mec-web/src/main/java/com/ym/mec/web/controller/IndexController.java
  24. 11 1
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java

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

@@ -115,12 +115,12 @@ public interface MusicGroupPaymentCalenderDetailDao extends BaseDAO<Long, MusicG
 	void batchDel(String musicGroupPaymentCalenderIds);
 
 	/**
-	 * 删除未缴费的明细
+	 * 查询学生在指定乐团中未交费的记录
 	 *
 	 * @param userId
 	 * @param musicGroupId
 	 */
-	void deleteByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
+	List<MusicGroupPaymentCalenderDetail> queryNotPaymentStudentByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
 
 	/**
 	 * 根据缴费记录删除缴费详情

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPreRegistrationDao.java

@@ -0,0 +1,12 @@
+package com.ym.mec.biz.dal.dao;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.ym.mec.biz.dal.entity.StudentPreRegistration;
+import com.ym.mec.common.dal.BaseDAO;
+
+public interface StudentPreRegistrationDao extends BaseDAO<Long, StudentPreRegistration> {
+
+	StudentPreRegistration queryByUserId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
+
+}

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

@@ -72,9 +72,13 @@ public class IndexBaseDto {
         this.indexMonthData = indexMonthData;
         if(!CollectionUtils.isEmpty(indexMonthData)){
             BigDecimal total = indexMonthData.stream().map(IndexBaseMonthData::getTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add);
-            if(IndexDataType.ACTIVATION_RATE.equals(dataType)){
-                BigDecimal activateNum = indexMonthData.stream().map(IndexBaseMonthData::getActivateNum).reduce(BigDecimal.ZERO, BigDecimal::add);
-                this.percent = activateNum.divide(total, CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
+            if(IndexDataType.ACTIVATION_RATE.equals(dataType)||IndexDataType.HOMEWORK_CREATE_RATE.equals(dataType)||IndexDataType.HOMEWORK_SUBMIT_RATE.equals(dataType)||IndexDataType.HOMEWORK_COMMENT_RATE.equals(dataType)){
+                if(total.compareTo(BigDecimal.ZERO)==0){
+                    this.percent = BigDecimal.ZERO;
+                }else{
+                    BigDecimal activateNum = indexMonthData.stream().map(IndexBaseMonthData::getActivateNum).reduce(BigDecimal.ZERO, BigDecimal::add);
+                    this.percent = activateNum.divide(total, CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
+                }
             }else{
                 this.percent = total;
             }

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

@@ -46,6 +46,9 @@ public class MusicGroup {
 	/** 报名截止日期 */
 	@ApiModelProperty(value = "报名截止日期",required = false)
 	private java.util.Date applyExpireDate;
+
+	@ApiModelProperty(value = "预报名截止日期",required = false)
+	private java.util.Date preApplyExpireDate;
 	
 	/** 团长 */
 	@ApiModelProperty(value = "运营主管",required = false)
@@ -359,6 +362,14 @@ public class MusicGroup {
 		return this.applyExpireDate;
 	}
 			
+	public java.util.Date getPreApplyExpireDate() {
+		return preApplyExpireDate;
+	}
+
+	public void setPreApplyExpireDate(java.util.Date preApplyExpireDate) {
+		this.preApplyExpireDate = preApplyExpireDate;
+	}
+
 	public void setTeamTeacherId(Integer teamTeacherId){
 		this.teamTeacherId = teamTeacherId;
 	}

+ 157 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPreRegistration.java

@@ -0,0 +1,157 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(student_pre_registration):
+ */
+public class StudentPreRegistration {
+
+	/**  */
+	private Long id;
+	
+	private String musicGroupId;
+	
+	/** 用户编号 */
+	private Integer userId;
+	
+	/** 联系方式 */
+	private String phone;
+	
+	/** 学生姓名 */
+	private Integer userName;
+	
+	/** 性别 */
+	private boolean gender;
+	
+	/** 年级 */
+	private String currentGrade;
+	
+	/** 班级 */
+	private String currentClass;
+	
+	/** 第一专业 */
+	private Integer subjectFirst;
+	
+	/** 第二专业 */
+	private Integer subjectSecond;
+	
+	/** 是否允许调剂 */
+	private boolean isAllowAdjust;
+	
+	/** 乐器提供方式 */
+	private String kitPurchaseMethod;
+	
+	/** 创建时间 */
+	private java.util.Date createTime;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public String getMusicGroupId() {
+		return musicGroupId;
+	}
+
+	public void setMusicGroupId(String musicGroupId) {
+		this.musicGroupId = musicGroupId;
+	}
+
+	public void setUserId(Integer userId){
+		this.userId = userId;
+	}
+	
+	public Integer getUserId(){
+		return this.userId;
+	}
+			
+	public void setPhone(String phone){
+		this.phone = phone;
+	}
+	
+	public String getPhone(){
+		return this.phone;
+	}
+			
+	public void setUserName(Integer userName){
+		this.userName = userName;
+	}
+	
+	public Integer getUserName(){
+		return this.userName;
+	}
+			
+	public void setGender(boolean gender){
+		this.gender = gender;
+	}
+	
+	public boolean isGender(){
+		return this.gender;
+	}
+			
+	public void setCurrentGrade(String currentGrade){
+		this.currentGrade = currentGrade;
+	}
+	
+	public String getCurrentGrade(){
+		return this.currentGrade;
+	}
+			
+	public void setCurrentClass(String currentClass){
+		this.currentClass = currentClass;
+	}
+	
+	public String getCurrentClass(){
+		return this.currentClass;
+	}
+			
+	public void setSubjectFirst(Integer subjectFirst){
+		this.subjectFirst = subjectFirst;
+	}
+	
+	public Integer getSubjectFirst(){
+		return this.subjectFirst;
+	}
+			
+	public void setSubjectSecond(Integer subjectSecond){
+		this.subjectSecond = subjectSecond;
+	}
+	
+	public Integer getSubjectSecond(){
+		return this.subjectSecond;
+	}
+			
+	public void setIsAllowAdjust(boolean isAllowAdjust){
+		this.isAllowAdjust = isAllowAdjust;
+	}
+	
+	public boolean getIsAllowAdjust(){
+		return this.isAllowAdjust;
+	}
+			
+	public void setKitPurchaseMethod(String kitPurchaseMethod){
+		this.kitPurchaseMethod = kitPurchaseMethod;
+	}
+	
+	public String getKitPurchaseMethod(){
+		return this.kitPurchaseMethod;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

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

@@ -9,7 +9,7 @@ import com.ym.mec.common.service.BaseService;
 
 public interface IndexBaseMonthDataService extends BaseService<Long, IndexBaseMonthData> {
 
-    List<IndexBaseDto> getIndexBaseData(String dataType, String organIds, String startMonth, String endMonth);
+    List<IndexBaseDto> getIndexBaseData(String dataType, String organIds, Integer year);
 
     Map<String, List<IndexBaseDto>> indexBaseDataTask(String month);
 

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

@@ -11,6 +11,7 @@ import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.ApprovalStatus;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 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.page.MusicGroupQueryInfo;
 import com.ym.mec.common.entity.ImGroupMember;
@@ -24,6 +25,13 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
 	 * @Author superzou
 	 */
 	String createGroup(SubFeeSettingDto subFeeSettingDto) throws Exception;
+	
+	/**
+	 * 预报名
+	 * @param studentPreRegistration
+	 * @return
+	 */
+	boolean preRegister(StudentPreRegistration studentPreRegistration);
 
 	/**
 	 * 零星缴费
@@ -108,6 +116,14 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
 	boolean extensionApplyExpireDate(String musicGroupId, Date expireDate);
 
 	/**
+	 * 延长预报名时间
+	 * @param musicGroupId 乐团编号
+	 * @param expireDate 预报名的截止日期
+	 * @return
+	 */
+	boolean extensionPreApplyExpireDate(String musicGroupId, Date expireDate);
+
+	/**
 	 * 申请退团
 	 * @param musicGroupId 乐团编号
 	 * @param reason

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

@@ -0,0 +1,8 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.StudentPreRegistration;
+import com.ym.mec.common.service.BaseService;
+
+public interface StudentPreRegistrationService extends BaseService<Long, StudentPreRegistration> {
+
+}

+ 15 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -46,15 +46,19 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	}
 
 	@Override
-	public List<IndexBaseDto> getIndexBaseData(String dataTypesStr, String organIdsStr, String startMonth, String endMonth) {
+	public List<IndexBaseDto> getIndexBaseData(String dataTypesStr, String organIdsStr, Integer year) {
 		List<IndexBaseDto> result = new ArrayList<>();
 
-		LocalDate nowDateTime = LocalDate.now();
-		nowDateTime.withDayOfMonth(1);
-		if(StringUtils.isBlank(startMonth)){
-			startMonth = nowDateTime.getYear() + "-01";
-			endMonth = null;
+		DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM");
+		LocalDate startDate = LocalDate.now();
+		if(Objects.nonNull(year)){
+			startDate = startDate.withYear(year);
 		}
+		startDate = startDate.withMonth(1);
+		startDate = startDate.withDayOfMonth(1);
+
+		LocalDate endDate = startDate.withMonth(12);
+
 		Set<Integer> organIds = null;
 		if(StringUtils.isNotBlank(organIdsStr)){
 			organIds = Arrays.stream(organIdsStr.split(",")).map(Integer::new).collect(Collectors.toSet());
@@ -64,18 +68,16 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			dataTypes = Arrays.stream(dataTypesStr.split(",")).collect(Collectors.toSet());
 		}
 
-		List<IndexBaseMonthData> indexBaseDatas = indexBaseMonthDataDao.getIndexBaseData(organIds, dataTypes, startMonth, endMonth);
-		if(CollectionUtils.isEmpty(indexBaseDatas)){
-			return result;
+		List<IndexBaseMonthData> indexBaseDatas = indexBaseMonthDataDao.getIndexBaseData(organIds, dataTypes, df.format(startDate), df.format(endDate));
+		if(Objects.isNull(indexBaseDatas)){
+			indexBaseDatas = new ArrayList<>();
 		}
 
-		LocalDate startMonthDate = LocalDate.parse(startMonth + "-01", DateUtil.dateFormatter);
-
 		Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = indexBaseDatas.stream().collect(Collectors.groupingBy(IndexBaseMonthData::getDataType));
 		for (Map.Entry<IndexDataType, List<IndexBaseMonthData>> typeDateMapEntry : typeDateMap.entrySet()) {
 			Set<String> hasMonths = typeDateMapEntry.getValue().stream().map(d -> DateUtil.dateToString(d.getMonth(), "yyyy-MM-dd")).collect(Collectors.toSet());
-			LocalDate currentMonthDate = startMonthDate;
-			while (currentMonthDate.compareTo(nowDateTime)<=0){
+			LocalDate currentMonthDate = startDate;
+			while (currentMonthDate.compareTo(endDate)<=0){
 				if(hasMonths.contains(currentMonthDate.toString())){
 					currentMonthDate = currentMonthDate.plusMonths(1);
 					continue;

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

@@ -4,7 +4,11 @@ import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SC
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.REJECT;
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.*;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.ADD_COURSE;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.ADD_STUDENT;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_RENEW;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.SPAN_GROUP_CLASS_ADJUST;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -20,10 +24,6 @@ import java.util.Map.Entry;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.util.collection.ListUtil;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,12 +35,50 @@ import com.alibaba.fastjson.JSON;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
+import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
+import com.ym.mec.biz.dal.dao.MusicGroupBuildLogDao;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupOrganizationCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupOrganizationCourseSettingsDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderStudentDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentClassAdjustDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.OrganizationCourseUnitPriceSettingsDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
+import com.ym.mec.biz.dal.dto.CalenderPushDto;
+import com.ym.mec.biz.dal.dto.ClassGroup4MixDto;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDetailDto;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto.MusicGroupPaymentDateRange;
+import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupBuildLog;
+import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettings;
+import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettingsDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentClassAdjust;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
+import com.ym.mec.biz.dal.entity.Organization;
+import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
@@ -139,8 +177,18 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 		List<MusicGroupPaymentDateRange> musicGroupPaymentDateRangeList = musicGroupPaymentCalenderDto.getMusicGroupPaymentDateRangeList();
 
-		if ((paymentType == PaymentType.ADD_COURSE) && musicGroupPaymentDateRangeList.size() > 1) {
-			throw new BizException("[临时加课]不支持多周期缴费");
+		if ((paymentType == PaymentType.ADD_COURSE)) {
+			if(musicGroupPaymentDateRangeList.size() > 1){
+				throw new BizException("[临时加课]不支持多周期缴费");
+			}
+		}
+		
+		if ((paymentType == PaymentType.ADD_STUDENT)) {
+			Integer userId = Integer.parseInt(musicGroupPaymentCalenderDto.getStudentIds());
+			List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryNotPaymentStudentByUserIdAndMusicGroupId(userId, musicGroupId);
+			if(musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0){
+				throw new BizException("创建缴费失败:已存在缴费项目");
+			}
 		}
 
 		MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
@@ -149,9 +197,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			throw new BizException("乐团查询失败,请检查参数");
 		}
 		
-		if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS && musicGroup.getStatus() != MusicGroupStatusEnum.PRE_BUILD_FEE) {
+		/*if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS && musicGroup.getStatus() != MusicGroupStatusEnum.PRE_BUILD_FEE) {
 			throw new BizException("创建失败:乐团当前状态不能创建缴费");
-		}
+		}*/
 		
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
 		if (sysUser == null) {

+ 179 - 84
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -21,7 +21,9 @@ import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType;
 import com.ym.mec.biz.dal.enums.*;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -207,6 +209,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     private StudentVisitDao studentVisitDao;
     @Autowired
     private SubjectDao subjectDao;
+    
+    @Autowired
+    private StudentPreRegistrationDao studentPreRegistrationDao;
 
     private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
 
@@ -336,6 +341,34 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     }
 
     @Override
+	public boolean preRegister(StudentPreRegistration studentPreRegistration) {
+    	Integer userId = studentPreRegistration.getUserId();
+    	
+    	String musicGroupId = studentPreRegistration.getMusicGroupId();
+    	
+    	//查询乐团状态
+    	MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+    	if(musicGroup == null){
+    		throw new BizException("乐团信息查询失败");
+    	}
+    	if(musicGroup.getStatus() != MusicGroupStatusEnum.PRE_APPLY){
+    		throw new BizException("乐团当前状态不能预报名");
+    	}
+    	
+    	StudentPreRegistration originRegistration = studentPreRegistrationDao.queryByUserId(userId, musicGroupId);
+    	if(originRegistration != null){
+    		throw new BizException("您已预报名成功,请勿重复提交资料");
+    	}
+    	Date date = new Date();
+    	
+    	studentPreRegistration.setCreateTime(date);
+    	
+    	studentPreRegistrationDao.update(studentPreRegistration);
+    	
+		return true;
+	}
+
+	@Override
     @Transactional(rollbackFor = Exception.class)
     public Map sporadicPay(SporadicPayDto sporadicPayDto) throws Exception {
         //获取收费项价格
@@ -1123,8 +1156,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
         MusicGroup musicGroup = saveLog(musicGroupId, MusicGroupStatusEnum.AUDIT);
         //记录操作日志
-        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "审核通过(审核中 -> 报名)", sysUser.getId(), ""));
-        musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
+        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "审核通过(审核中 -> 报名)", sysUser.getId(), ""));
+        musicGroup.setStatus(MusicGroupStatusEnum.PRE_APPLY);
         musicGroupDao.update(musicGroup);
         //获取报名缴费项目
         MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
@@ -1447,7 +1480,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         if (musicGroup.getStatus() != MusicGroupStatusEnum.PAY) {
-            throw new BizException("乐团当前状态是{},不能延长缴费", musicGroup.getStatus().getMsg());
+            throw new BizException("乐团当前状态是[{}],不能延长缴费", musicGroup.getStatus().getMsg());
         }
 
         Date date = new Date();
@@ -1490,8 +1523,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             throw new BizException("乐团找不到");
         }
 
-        if (musicGroup.getStatus() != MusicGroupStatusEnum.APPLY && musicGroup.getStatus() != MusicGroupStatusEnum.PAY) {
-            throw new BizException("乐团当前状态是{},不能延长报名", musicGroup.getStatus().getMsg());
+        if (musicGroup.getStatus() != MusicGroupStatusEnum.APPLY || musicGroup.getStatus() != MusicGroupStatusEnum.PAY) {
+            throw new BizException("乐团当前状态是[{}],不能延长报名", musicGroup.getStatus().getMsg());
         }
 
         Date date = new Date();
@@ -1508,6 +1541,34 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     }
 
     @Override
+	public boolean extensionPreApplyExpireDate(String musicGroupId, Date expireDate) {
+    	SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+        if (musicGroup == null) {
+            throw new BizException("乐团找不到");
+        }
+
+        if (musicGroup.getStatus() != MusicGroupStatusEnum.PRE_APPLY) {
+            throw new BizException("乐团当前状态是[{}],不能延长预报名", musicGroup.getStatus().getMsg());
+        }
+
+        Date date = new Date();
+
+        if (date.after(expireDate)) {
+            throw new BizException("日期设置错误");
+        }
+
+        musicGroup.setPreApplyExpireDate(expireDate);
+        musicGroup.setUpdateTime(date);
+        musicGroupDao.update(musicGroup);
+        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "延长预报名时间", sysUser.getId(), ""));
+        return true;
+	}
+
+	@Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     public boolean applyQuitMusicGroup(String musicGroupId, String reason) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
@@ -1663,15 +1724,32 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 studentDao.update(student);
             }
 
-
+            //删除进行中加学生,且在审批中或拒绝的缴费
+            List<Long> paymentCalenderIdList = musicGroupPaymentCalenderDao.findStudentNoPaymentCalender(userId, musicGroupId);
+            if(paymentCalenderIdList != null && paymentCalenderIdList.size() > 0){
+            	musicGroupPaymentCalenderDao.delByIds(paymentCalenderIdList);
+            }
+            
+            //查询未交费的项目
+            List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryNotPaymentStudentByUserIdAndMusicGroupId(userId, musicGroupId);
+            
+			for (MusicGroupPaymentCalenderDetail mgpcd : musicGroupPaymentCalenderDetailList) {
+				MusicGroupPaymentCalender mgpc = musicGroupPaymentCalenderDao.get(mgpcd.getMusicGroupPaymentCalenderId());
+				if (mgpc != null) {
+					if (mgpc.getPaymentType() == PaymentType.ADD_STUDENT) {
+						musicGroupPaymentCalenderDao.delete(mgpc.getId());
+					} else {
+						// 缴费项目预计人数减一
+						mgpc.setExpectNum(mgpc.getExpectNum() - 1);
+						mgpc.setUpdateTime(date);
+						musicGroupPaymentCalenderDao.update(mgpc);
+					}
+				}
+				musicGroupPaymentCalenderDetailDao.delete(mgpcd.getId());
+			}
             //删除用户购买的课程记录
             musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
 
-            //缴费项目预计人数减一
-            musicGroupPaymentCalenderDao.cutCalenderExpectNum(userId, musicGroupId);
-            //删除缴费项目详情
-            musicGroupPaymentCalenderDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
-
             //操作人
             SysUser operator = sysUserFeignService.queryUserInfo();
 
@@ -1694,53 +1772,52 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 musicGroupSubjectPlan.setUpdateTime(date);
                 musicGroupSubjectPlanDao.update(musicGroupSubjectPlan);
             }
-
-            StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
-
-            if (studentPaymentOrder == null) {
-                //兼容历史数据
-                return true;
-            }
-
-            List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
-
+            
             if (isRefundCourseFee) {
                 // 退课程费用
                 amount = amount.add(studentRegistration.getSurplusCourseFee());
             }
 
-            SubjectChange studentLastChange = null;
-            if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
-                studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
-            }
+            StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
 
-            BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
-            for (StudentPaymentOrderDetail detail : orderDetailList) {
-                if (remitFee.compareTo(detail.getPrice()) >= 0) {
-                    remitFee = remitFee.subtract(detail.getPrice());
-                    detail.setPrice(BigDecimal.ZERO);
-                } else {
-                    detail.setPrice(detail.getPrice().subtract(remitFee));
-                    remitFee = BigDecimal.ZERO;
+            if (studentPaymentOrder != null) {
+            	List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
+
+                SubjectChange studentLastChange = null;
+                if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
+                    studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
                 }
 
-                if (isRefundInstrumentFee && studentLastChange == null) {
-                    // 退乐器费用
-                    if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
-                        amount = amount.add(detail.getPrice());
+                BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
+                for (StudentPaymentOrderDetail detail : orderDetailList) {
+                    if (remitFee.compareTo(detail.getPrice()) >= 0) {
+                        remitFee = remitFee.subtract(detail.getPrice());
+                        detail.setPrice(BigDecimal.ZERO);
+                    } else {
+                        detail.setPrice(detail.getPrice().subtract(remitFee));
+                        remitFee = BigDecimal.ZERO;
                     }
 
-                }
-                if (isRefundTeachingAssistantsFee && studentLastChange == null) {
-                    // 退教辅费用
-                    if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
-                        amount = amount.add(detail.getPrice());
+                    if (isRefundInstrumentFee && studentLastChange == null) {
+                        // 退乐器费用
+                        if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
+                            amount = amount.add(detail.getPrice());
+                        }
+
+                    }
+                    if (isRefundTeachingAssistantsFee && studentLastChange == null) {
+                        // 退教辅费用
+                        if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
+                            amount = amount.add(detail.getPrice());
+                        }
                     }
                 }
+                if (studentLastChange != null) {
+                    amount = amount.add(studentLastChange.getChangeMusicalPrice()).add(studentLastChange.getChangeAccessoriesPrice());
+                }
             }
-            if (studentLastChange != null) {
-                amount = amount.add(studentLastChange.getChangeMusicalPrice()).add(studentLastChange.getChangeAccessoriesPrice());
-            }
+
+            
             if (amount.doubleValue() > 0) {
                 // 增加交易流水
                 sysUserCashAccountDetailService.addCashAccountDetail(userId, amount, SysUserCashAccountDetailService.MUSIC_GROUP + musicGroupId, "",
@@ -1829,14 +1906,32 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             studentDao.update(student);
         }
 
-
+        //删除进行中加学生,且在审批中或拒绝的缴费
+        List<Long> paymentCalenderIdList = musicGroupPaymentCalenderDao.findStudentNoPaymentCalender(userId, musicGroupId);
+        if(paymentCalenderIdList != null && paymentCalenderIdList.size() > 0){
+        	musicGroupPaymentCalenderDao.delByIds(paymentCalenderIdList);
+        }
+        
+        //查询未交费的项目
+        List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryNotPaymentStudentByUserIdAndMusicGroupId(userId, musicGroupId);
+        
+		for (MusicGroupPaymentCalenderDetail mgpcd : musicGroupPaymentCalenderDetailList) {
+			MusicGroupPaymentCalender mgpc = musicGroupPaymentCalenderDao.get(mgpcd.getMusicGroupPaymentCalenderId());
+			if (mgpc != null) {
+				if (mgpc.getPaymentType() == PaymentType.ADD_STUDENT) {
+					musicGroupPaymentCalenderDao.delete(mgpc.getId());
+				} else {
+					// 缴费项目预计人数减一
+					mgpc.setExpectNum(mgpc.getExpectNum() - 1);
+					mgpc.setUpdateTime(date);
+					musicGroupPaymentCalenderDao.update(mgpc);
+				}
+			}
+			musicGroupPaymentCalenderDetailDao.delete(mgpcd.getId());
+		}
         //删除用户购买的课程记录
         musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
-
-        //缴费项目预计人数减一
-        musicGroupPaymentCalenderDao.cutCalenderExpectNum(userId, musicGroupId);
-        //删除缴费项目详情
-        musicGroupPaymentCalenderDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
+        
 
         //操作人
         SysUser operator = sysUserFeignService.queryUserInfo();
@@ -1860,52 +1955,52 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             musicGroupSubjectPlan.setUpdateTime(date);
             musicGroupSubjectPlanDao.update(musicGroupSubjectPlan);
         }
-
-        StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
-
-        if (studentPaymentOrder == null) {
-            return true;
-        }
-
-        List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
-
+        
         if (isRefundCourseFee) {
             // 退课程费用
             amount = amount.add(studentRegistration.getSurplusCourseFee());
         }
 
-        SubjectChange studentLastChange = null;
-        if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
-            studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
-        }
+        StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
 
-        BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
+        if (studentPaymentOrder != null) {
+        	List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
 
-        for (StudentPaymentOrderDetail detail : orderDetailList) {
-            if (remitFee.compareTo(detail.getPrice()) >= 0) {
-                remitFee = remitFee.subtract(detail.getPrice());
-                detail.setPrice(BigDecimal.ZERO);
-            } else {
-                detail.setPrice(detail.getPrice().subtract(remitFee));
-                remitFee = BigDecimal.ZERO;
+            SubjectChange studentLastChange = null;
+            if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
+                studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
             }
-            if (isRefundInstrumentFee && studentLastChange == null) {
-                // 退乐器费用
-                if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
-                    amount = amount.add(detail.getPrice());
+
+            BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
+
+            for (StudentPaymentOrderDetail detail : orderDetailList) {
+                if (remitFee.compareTo(detail.getPrice()) >= 0) {
+                    remitFee = remitFee.subtract(detail.getPrice());
+                    detail.setPrice(BigDecimal.ZERO);
+                } else {
+                    detail.setPrice(detail.getPrice().subtract(remitFee));
+                    remitFee = BigDecimal.ZERO;
                 }
+                if (isRefundInstrumentFee && studentLastChange == null) {
+                    // 退乐器费用
+                    if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
+                        amount = amount.add(detail.getPrice());
+                    }
 
-            }
-            if (isRefundTeachingAssistantsFee && studentLastChange == null) {
-                // 退教辅费用
-                if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
-                    amount = amount.add(detail.getPrice());
+                }
+                if (isRefundTeachingAssistantsFee && studentLastChange == null) {
+                    // 退教辅费用
+                    if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
+                        amount = amount.add(detail.getPrice());
+                    }
                 }
             }
+            if (studentLastChange != null) {
+                amount = amount.add(studentLastChange.getChangeMusicalPrice()).add(studentLastChange.getChangeAccessoriesPrice());
+            }
         }
-        if (studentLastChange != null) {
-            amount = amount.add(studentLastChange.getChangeMusicalPrice()).add(studentLastChange.getChangeAccessoriesPrice());
-        }
+
+        
         if (amount.doubleValue() > 0) {
             // 增加交易流水
             sysUserCashAccountDetailService.addCashAccountDetail(userId, amount, SysUserCashAccountDetailService.MUSIC_GROUP + musicGroupId, "",

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPreRegistrationServiceImpl.java

@@ -0,0 +1,23 @@
+package com.ym.mec.biz.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.biz.dal.dao.StudentPreRegistrationDao;
+import com.ym.mec.biz.dal.entity.StudentPreRegistration;
+import com.ym.mec.biz.service.StudentPreRegistrationService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+
+@Service
+public class StudentPreRegistrationServiceImpl extends BaseServiceImpl<Long, StudentPreRegistration>  implements StudentPreRegistrationService {
+	
+	@Autowired
+	private StudentPreRegistrationDao studentPreRegistrationDao;
+
+	@Override
+	public BaseDAO<Long, StudentPreRegistration> getDAO() {
+		return studentPreRegistrationDao;
+	}
+	
+}

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

@@ -1425,6 +1425,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		courseScheduleService.checkNewCourseSchedules(courseSchedules, false,false);
 
 		try {
+			imGroupService.create(classGroup.getId().longValue(), null, classGroup.getName(), classGroup.getName(), vipGroupApplyBaseInfoDto.getName(), null, null, GroupType.VIP.getCode());
 			imGroupMemberService.join(classGroup.getId().longValue(), userRoleMap);
 
 			//发送推送短信

+ 6 - 4
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -141,7 +141,7 @@
 	<select id="getStudentSignUpData" resultMap="IndexBaseMonthData">
 		SELECT
 			organ_id_,
-			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			CONCAT(#{month}, '-01') month_,
 			COUNT( id_ ) total_num_,
 			COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END) activate_num_,
 			TRUNCATE(COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END)/COUNT( id_ )*100, 2) percent_
@@ -150,7 +150,8 @@
 			del_flag_=0
 		  	AND organ_id_ IS NOT NULL
 			AND user_type_ LIKE '%STUDENT%'
-			AND YEAR(create_time_)=YEAR(NOW())
+			AND YEAR(create_time_)=YEAR(CONCAT(#{month}, '-01'))
+			AND MONTH(create_time_)&lt;=MONTH(CONCAT(#{month}, '-01'))
 		GROUP BY organ_id_
 		ORDER BY organ_id_;
 	</select>
@@ -158,7 +159,7 @@
 	<select id="getHomeworkData" resultMap="IndexBaseMonthData">
 		SELECT
 			su.organ_id_,
-			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			CONCAT(#{month}, '-01') month_,
 			<choose>
 				<when test="type == 'submit'">
 					SUM(sees.expect_exercises_num_) total_num_,
@@ -180,7 +181,8 @@
 		LEFT JOIN sys_user su ON sees.student_id_=su.id_
 		WHERE su.del_flag_=0
 			AND su.organ_id_ IS NOT NULL
-			AND YEAR(sees.monday_)=YEAR(NOW())
+			AND YEAR(sees.monday_)=YEAR(CONCAT(#{month}, '-01'))
+			AND MONTH(sees.monday_)&lt;=MONTH(CONCAT(#{month}, '-01'))
 		GROUP BY su.organ_id_
 		ORDER BY su.organ_id_
 	</select>

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

@@ -9,6 +9,7 @@
         <result column="organ_id_" property="organId"/>
         <result column="school_id_" property="schoolId"/>
         <result column="apply_expire_date_" property="applyExpireDate"/>
+        <result column="pre_apply_expire_date_" property="preApplyExpireDate"/>
         <result column="team_teacher_id_" property="teamTeacherId"/>
         <result column="educational_teacher_id_" property="educationalTeacherId"/>
         <result column="charge_type_id_" property="chargeTypeId"/>
@@ -66,13 +67,13 @@
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroup"
             useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         INSERT INTO music_group
-        (id_, name_, organ_id_, school_id_, apply_expire_date_, team_teacher_id_, educational_teacher_id_,
+        (id_, name_, organ_id_, school_id_, apply_expire_date_,pre_apply_expire_date_, team_teacher_id_, educational_teacher_id_,
          charge_type_id_, course_form_, create_time_, update_time_, status_,
          bill_start_date_, improvent_classes_num_, enroll_classes_, payment_expire_date_, is_extra_class_,
          settlement_type_, cooperation_organ_id_, enlightenment_course_time_,
          parent_meeting_time_, img_, director_user_id_, is_classroom_lessons_, memo_, expect_start_group_date_,
          ownership_type_, repair_user_id_, del_flag_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_)
-        VALUES (#{id}, #{name}, #{organId}, #{schoolId}, #{applyExpireDate}, #{teamTeacherId}, #{educationalTeacherId},
+        VALUES (#{id}, #{name}, #{organId}, #{schoolId}, #{applyExpireDate},#{preApplyExpireDate}, #{teamTeacherId}, #{educationalTeacherId},
                 #{chargeTypeId}, #{courseForm}, now(), now(),
                 #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{billStartDate},
                 #{improventClassesNum}, #{enrollClasses}, #{paymentExpireDate},
@@ -135,6 +136,9 @@
             <if test="applyExpireDate != null">
                 apply_expire_date_ = #{applyExpireDate},
             </if>
+            <if test="preApplyExpireDate != null">
+                pre_apply_expire_date_ = #{preApplyExpireDate},
+            </if>
             <if test="billStartDate != null">
                 bill_start_date_ = #{billStartDate},
             </if>

+ 7 - 6
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml

@@ -190,15 +190,16 @@
 	<delete id="batchDel">
 		DELETE FROM music_group_payment_calender_detail WHERE FIND_IN_SET(id_,#{musicGroupPaymentCalenderIdDetails})
 	</delete>
-	<delete id="deleteByUserIdAndMusicGroupId">
-		DELETE FROM music_group_payment_calender_detail
-		WHERE music_group_payment_calender_id_ IN (SELECT mgpc.id_ FROM music_group_payment_calender mgpc
-		WHERE mgpc.music_group_id_ = #{musicGroupId})
-		AND user_id_ = #{userId} AND payment_status_ = 'NON_PAYMENT'
-	</delete>
     <delete id="deleteByCalenderId">
 		DELETE FROM music_group_payment_calender_detail WHERE music_group_payment_calender_id_ = #{id}
 	</delete>
+	
+	<select id="queryNotPaymentStudentByUserIdAndMusicGroupId" resultMap="MusicGroupPaymentCalenderDetail" parameterType="map">
+		select * FROM music_group_payment_calender_detail
+		WHERE music_group_payment_calender_id_ IN (SELECT mgpc.id_ FROM music_group_payment_calender mgpc
+		WHERE mgpc.music_group_id_ = #{musicGroupId})
+		AND user_id_ = #{userId} AND payment_status_ = 'NON_PAYMENT'
+	</select>
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="MusicGroupPaymentCalenderDetail" parameterType="map">

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

@@ -220,7 +220,7 @@
     <select id="findStudentNoPaymentCalender" resultType="java.lang.Long">
         SELECT DISTINCT mgpc.id_ FROM music_group_payment_calender mgpc
         WHERE mgpc.student_ids_ = #{userId} AND mgpc.payment_type_ = 'ADD_STUDENT'
-        AND mgpc.music_group_id_ = #{musicGroupId} AND status_ = 'AUDITING'
+        AND mgpc.music_group_id_ = #{musicGroupId} AND status_ in ('AUDITING','REJECT')
     </select>
 
     <!-- 根据主键删除一条记录 -->

+ 108 - 0
mec-biz/src/main/resources/config/mybatis/StudentPreRegistrationMapper.xml

@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.ym.mec.biz.dal.dao.StudentPreRegistrationDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.StudentPreRegistration" id="StudentPreRegistration">
+		<result column="id_" property="id" />
+		<result column="music_group_id_" property="musicGroupId" />
+		<result column="user_id_" property="userId" />
+		<result column="phone_" property="phone" />
+		<result column="user_name_" property="userName" />
+		<result column="gender_" property="gender" />
+		<result column="current_grade_" property="currentGrade" />
+		<result column="current_class_" property="currentClass" />
+		<result column="subject_first_" property="subjectFirst" />
+		<result column="subject_second_" property="subjectSecond" />
+		<result column="is_allow_adjust_" property="isAllowAdjust" />
+		<result column="kit_purchase_method_" property="kitPurchaseMethod" />
+		<result column="create_time_" property="createTime" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="StudentPreRegistration" >
+		SELECT * FROM student_pre_registration WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="StudentPreRegistration">
+		SELECT * FROM student_pre_registration ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentPreRegistration" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!--
+		<selectKey resultClass="int" keyProperty="id" > 
+		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>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentPreRegistration">
+		UPDATE student_pre_registration <set>
+		<if test="musicGroupId != null">
+		music_group_id_ = #{musicGroupId},
+		</if>
+		<if test="userId != null">
+		user_id_ = #{userId},
+		</if>
+		<if test="userName != null">
+		user_name_ = #{userName},
+		</if>
+		<if test="id != null">
+		id_ = #{id},
+		</if>
+		<if test="currentGrade != null">
+		current_grade_ = #{currentGrade},
+		</if>
+		<if test="gender != null">
+		gender_ = #{gender},
+		</if>
+		<if test="subjectFirst != null">
+		subject_first_ = #{subjectFirst},
+		</if>
+		<if test="phone != null">
+		phone_ = #{phone},
+		</if>
+		<if test="subjectSecond != null">
+		subject_second_ = #{subjectSecond},
+		</if>
+		<if test="currentClass != null">
+		current_class_ = #{currentClass},
+		</if>
+		<if test="isAllowAdjust != null">
+		is_allow_adjust_ = #{isAllowAdjust},
+		</if>
+		<if test="kitPurchaseMethod != null">
+		kit_purchase_method_ = #{kitPurchaseMethod},
+		</if>
+		<if test="createTime != null">
+		create_time_ = #{createTime},
+		</if>
+		</set> WHERE id_ = #{id} 
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM student_pre_registration WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="StudentPreRegistration" parameterType="map">
+		SELECT * FROM student_pre_registration ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM student_pre_registration
+	</select>
+	
+	<select id="queryByUserId" resultMap="StudentPreRegistration" parameterType="map">
+		SELECT * FROM student_pre_registration WHERE user_id_ = #{userId} and music_group_id_ = #{musicGroupId}
+	</select>
+</mapper>

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

@@ -145,4 +145,8 @@ public interface TaskRemoteService {
 	//自动确认收货
 	@GetMapping("task/autoAffirmReceiveTask")
     void autoAffirmReceiveTask();
+
+	//首页数据统计
+	@GetMapping("task/countIndexBaseData")
+	void countIndexBaseData();
 }

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

@@ -185,4 +185,9 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
 	public void autoAffirmReceiveTask() {
 		logger.info("确认收货执行失败");
 	}
+
+	@Override
+	public void countIndexBaseData() {
+		logger.info("首页数据统计失败");
+	}
 }

+ 13 - 0
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -30,6 +30,7 @@ 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.StudentPreRegistration;
 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;
@@ -71,6 +72,18 @@ public class MusicGroupController extends BaseController {
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
     @Autowired
     private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+    
+    @ApiOperation("预报名")
+    @PostMapping(value = "/preRegister")
+	public Object preRegister(@RequestBody StudentPreRegistration studentPreRegistration) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		studentPreRegistration.setUserId(sysUser.getId());
+
+		return musicGroupService.preRegister(studentPreRegistration) ? succeed() : failed();
+	}
 
     @ApiOperation("获取学生所在乐团列表")
     @GetMapping(value = "/queryUserMusicGroups")

+ 19 - 0
mec-task/src/main/java/com/ym/mec/task/jobs/IndexBaseDataTask.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 IndexBaseDataTask extends BaseTask {
+
+    @Autowired
+    private TaskRemoteService taskRemoteService;
+
+    @Override
+    public void execute() throws TaskException {
+        taskRemoteService.countIndexBaseData();
+    }
+}

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

@@ -116,7 +116,7 @@ public class IndexController extends BaseController {
 	}
 
 	@GetMapping("/newIndex")
-	public HttpResponseResult newIndex(String dataTypes, String organIds, String startMonth, String endMonth){
+	public HttpResponseResult newIndex(String dataTypes, String organIds, Integer year){
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
 		if (sysUser == null) {
 			return failed("用户信息获取失败");
@@ -134,6 +134,6 @@ public class IndexController extends BaseController {
 				}
 			}
 		}
-		return succeed(indexService.getIndexBaseData(dataTypes , organIds, startMonth, endMonth));
+		return succeed(indexService.getIndexBaseData(dataTypes , organIds, year));
 	}
 }

+ 11 - 1
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java

@@ -199,7 +199,7 @@ public class MusicGroupController extends BaseController {
 		return succeed();
 	}
 
-	@ApiOperation(value = "审核通过(审核中 -> 报名)")
+	@ApiOperation(value = "审核通过(审核中 -> 报名)")
 	@PostMapping("/auditSuccess")
 	@PreAuthorize("@pcs.hasPermissions('musicGroup/auditSuccess')")
 	@ApiImplicitParams({ @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
@@ -273,6 +273,16 @@ public class MusicGroupController extends BaseController {
 		return succeed();
 	}
 
+	@ApiOperation(value = "延长预报名时间")
+	@PostMapping("/extensionPreApplyExpireDate")
+	@PreAuthorize("@pcs.hasPermissions('musicGroup/extensionApplyExpireDate')")
+	@ApiImplicitParams({ @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
+			@ApiImplicitParam(name = "expireDate", value = "延长预报名的截止日期", required = true, dataType = "Date") })
+	public Object extensionPreApplyExpireDate(String musicGroupId, Date expireDate) {
+		musicGroupService.extensionPreApplyExpireDate(musicGroupId, expireDate);
+		return succeed();
+	}
+
 	@ApiOperation("获取分部乐团列表名称")
 	@GetMapping(value = "/queryOrganMusicInfos")
 	@PreAuthorize("@pcs.hasPermissions('musicGroup/queryOrganMusicInfos')")