|  | @@ -1,12 +1,75 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.biz.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.enums.IndexDataType.CLOUD_NEW_STUDENT_NUM;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.math.BigDecimal;
 | 
	
		
			
				|  |  | +import java.time.LocalDate;
 | 
	
		
			
				|  |  | +import java.util.ArrayList;
 | 
	
		
			
				|  |  | +import java.util.Arrays;
 | 
	
		
			
				|  |  | +import java.util.Collections;
 | 
	
		
			
				|  |  | +import java.util.Comparator;
 | 
	
		
			
				|  |  | +import java.util.Date;
 | 
	
		
			
				|  |  | +import java.util.HashMap;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.Map;
 | 
	
		
			
				|  |  | +import java.util.Objects;
 | 
	
		
			
				|  |  | +import java.util.Set;
 | 
	
		
			
				|  |  | +import java.util.concurrent.atomic.AtomicInteger;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | +import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | +import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | +import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.*;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.*;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.*;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.*;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.CloudTeacherDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.CloudTeacherOrderDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.EmployeeDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.IndexBaseMonthDataDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.MemberRankSettingDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.MusicGroupDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.OrganizationDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.PracticeGroupDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.StudentDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.SysConfigDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.SysMusicCompareRecordDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.TeacherDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.CloudStudyStudentDataDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.CloudTeacherActiveTargetDetailDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.CloudTeacherActiveTargetDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.EduOrganStudentDataDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.EduOrganStudentListDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.EduOrganStudentListExportDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.StatDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.StudentClassInfoDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.StudentCourseTimesDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.StudentTeacherCourseDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.CooperationOrgan;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.CourseSchedule;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.IndexBaseMonthData;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.MemberRankSetting;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.Organization;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.Student;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.StudentPreRegistration;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.StudentRegistration;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.SysConfig;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.FivePlusGradeEnum;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.GradeTypeEnum;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.PeriodEnum;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.SixPlusGradeEnum;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.CloudTeacherActiveQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.OrganCloudStudyStudentDataQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.StudentQueryInfo;
 | 
	
	
		
			
				|  | @@ -16,27 +79,13 @@ import com.ym.mec.biz.service.SysConfigService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.SysMessageService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.constant.CommonConstants;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.dal.BaseDAO;
 | 
	
		
			
				|  |  | +import com.ym.mec.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.PageInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.service.impl.BaseServiceImpl;
 | 
	
		
			
				|  |  |  import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.collection.MapUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.date.DateUtil;
 | 
	
		
			
				|  |  | -import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | -import org.apache.poi.ss.formula.functions.T;
 | 
	
		
			
				|  |  | -import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  | -import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | -import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | -import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | -import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import java.math.BigDecimal;
 | 
	
		
			
				|  |  | -import java.time.LocalDate;
 | 
	
		
			
				|  |  | -import java.util.*;
 | 
	
		
			
				|  |  | -import java.util.concurrent.atomic.AtomicInteger;
 | 
	
		
			
				|  |  | -import java.util.stream.Collectors;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.enums.IndexDataType.CLOUD_NEW_STUDENT_NUM;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implements StudentService {
 | 
	
	
		
			
				|  | @@ -74,12 +123,66 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private OrganizationService organizationService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysUserFeignService sysUserFeignService;
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysUserCashAccountDao sysUserCashAccountDao;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public BaseDAO<Integer, Student> getDAO() {
 | 
	
		
			
				|  |  |          return studentDao;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | +    @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | +	public boolean register(StudentPreRegistration studentPreRegistration) {
 | 
	
		
			
				|  |  | +    	
 | 
	
		
			
				|  |  | +    	Date date = new Date();
 | 
	
		
			
				|  |  | +    	// 判断用户是否存在
 | 
	
		
			
				|  |  | +        SysUser user = sysUserFeignService.queryUserByMobile(studentPreRegistration.getPhone());
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        Integer userId = null;
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        if(user != null && user.getId() != null){
 | 
	
		
			
				|  |  | +        	if(user.getUserType().contains("STUDENT")){
 | 
	
		
			
				|  |  | +        		throw new BizException("您已注册,请直接下载APP!");
 | 
	
		
			
				|  |  | +        	}
 | 
	
		
			
				|  |  | +        	userId = user.getId();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            user.setUpdateTime(date);
 | 
	
		
			
				|  |  | +            teacherDao.updateUser(user);
 | 
	
		
			
				|  |  | +        }else{
 | 
	
		
			
				|  |  | +        	user = new SysUser();
 | 
	
		
			
				|  |  | +            user.setPhone(studentPreRegistration.getPhone());
 | 
	
		
			
				|  |  | +            user.setUsername(studentPreRegistration.getUserName());
 | 
	
		
			
				|  |  | +            user.setOrganId(studentPreRegistration.getOrganId());
 | 
	
		
			
				|  |  | +            user.setUserType("STUDENT");
 | 
	
		
			
				|  |  | +            user.setCreateTime(date);
 | 
	
		
			
				|  |  | +            user.setUpdateTime(date);
 | 
	
		
			
				|  |  | +            // 注册账户信息
 | 
	
		
			
				|  |  | +            HttpResponseResult<Integer> result = sysUserFeignService.addUser(user);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            userId = result.getData();
 | 
	
		
			
				|  |  | +            user.setId(userId);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        //添加student
 | 
	
		
			
				|  |  | +        Student student = new Student();
 | 
	
		
			
				|  |  | +        student.setUserId(userId);
 | 
	
		
			
				|  |  | +        student.setCreateTime(date);
 | 
	
		
			
				|  |  | +        student.setUpdateTime(date);
 | 
	
		
			
				|  |  | +        student.setIsNewUser(true);
 | 
	
		
			
				|  |  | +        student.setCurrentGradeNum(studentPreRegistration.getCurrentGradeNum());
 | 
	
		
			
				|  |  | +        student.setCurrentClass(studentPreRegistration.getCurrentClass());
 | 
	
		
			
				|  |  | +        studentDao.insert(student);
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        return true;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	@Override
 | 
	
		
			
				|  |  |      public PageInfo findStudentVipGroupList(StudentQueryInfo queryInfo) {
 | 
	
		
			
				|  |  |          PageInfo pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
 | 
	
		
			
				|  |  |          Map<String, Object> params = new HashMap<String, Object>();
 |