Browse Source

Merge branch 'practice_1129' into online1

yonge 3 years ago
parent
commit
146cf7d703

+ 20 - 0
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/LoginEntity.java

@@ -12,6 +12,10 @@ public class LoginEntity {
     private String phone;
     
     private String deviceNum;
+    
+    private String tenantId;
+    
+    private String organId;
 
     public Boolean getIsRegister() {
 		return isRegister;
@@ -60,4 +64,20 @@ public class LoginEntity {
 	public void setDeviceNum(String deviceNum) {
 		this.deviceNum = deviceNum;
 	}
+
+	public String getTenantId() {
+		return tenantId;
+	}
+
+	public void setTenantId(String tenantId) {
+		this.tenantId = tenantId;
+	}
+
+	public String getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(String organId) {
+		this.organId = organId;
+	}
 }

+ 10 - 0
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/filter/PhoneLoginAuthenticationFilter.java

@@ -25,6 +25,10 @@ public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProces
 	private static final String SPRING_SECURITY_RESTFUL_VERIFY_CODE_KEY = "smsCode";
 	private static final String clientIdParameter = "clientId";
 	private static final String IS_LESSEE = "isLessee";
+
+	private static final String TENANT_ID = "tenantId";
+
+	private static final String ORGAN_ID = "organId";
 	
 	private static final String DEVICE_NUM = "deviceNum";
 
@@ -47,6 +51,10 @@ public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProces
 		String credentials = obtainParameter(request, SPRING_SECURITY_RESTFUL_VERIFY_CODE_KEY);
 		// 是否是租户
 		String isLessee = obtainParameter(request, IS_LESSEE);
+		
+		String tenantId = obtainParameter(request, TENANT_ID);
+		
+		String organId = obtainParameter(request, ORGAN_ID);
 
 		boolean isRegister = StringUtils.equals("1", isLessee) || StringUtils.equals("true", isLessee);
 
@@ -66,6 +74,8 @@ public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProces
 		loginEntity.setSmsCode(credentials);
 		loginEntity.setIsRegister(isRegister);
 		loginEntity.setDeviceNum(deviceNum);
+		loginEntity.setOrganId(organId);
+		loginEntity.setTenantId(tenantId);
 
 		authRequest = new PhoneAuthenticationToken(SecurityConstants.PHONE_PRINCIPAL_PREFIX + principal, loginEntity);
 

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

@@ -71,7 +71,7 @@ public class PhoneAuthenticationProvider extends AbstractAuthenticationProvider
 				throw new LockedException("用户不存在");
 			}
 			
-			userInfo = sysUserService.initUser(loginEntity.getPhone(), clientId);
+			userInfo = sysUserService.initUser(loginEntity.getTenantId(), loginEntity.getOrganId(), loginEntity.getPhone(), clientId);
 			
 			if (StringUtils.isNotBlank(deviceNum)) {
 				sysUserDeviceService.bindDevice(clientId, userInfo.getSysUser().getId(), deviceNum);

+ 1 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/SysUserService.java

@@ -103,7 +103,7 @@ public interface SysUserService extends BaseService<Integer, SysUser> {
 	 * @param clientId
 	 * @return
 	 */
-	SysUserInfo initUser(String phone,String clientId);
+	SysUserInfo initUser(String tenantId, String organId, String phone,String clientId);
 
 	/**
 	 * 刷新token

+ 11 - 2
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysUserServiceImpl.java

@@ -153,7 +153,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implem
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public SysUserInfo initUser(String phone, String clientId) {
+	public SysUserInfo initUser(String tenantId, String organId, String phone,String clientId) {
 		if(StringUtils.equalsIgnoreCase(clientId,"TEACHER")){
 			SysUser sysUser = new SysUser();
 			sysUser.setPhone(phone);
@@ -171,7 +171,16 @@ public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implem
 			SysUser sysUser = new SysUser();
 			sysUser.setPhone(phone);
 			sysUser.setUserType("STUDENT");
-			sysUser.setOrganId(lesseeOrganId);
+			if(StringUtils.isBlank(organId)){
+				sysUser.setOrganId(lesseeOrganId);
+			}else{
+				sysUser.setOrganId(Integer.parseInt(organId));
+			}
+			//注册是否赠送会员
+			if(sysUser.getOrganId() == 59){
+				
+			}
+			
 			sysUserDao.insert(sysUser);
 			sysUserService.saveStudent(sysUser.getId());
 			//添加用户现金账户

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

@@ -10,6 +10,8 @@ public class StudentPreRegistration {
 	/**  */
 	private Long id;
 	
+	private Integer organId;
+	
 	private String musicGroupId;
 	
 	/** 用户编号 */
@@ -65,6 +67,14 @@ public class StudentPreRegistration {
 		return this.id;
 	}
 			
+	public Integer getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(Integer organId) {
+		this.organId = organId;
+	}
+
 	public String getMusicGroupId() {
 		return musicGroupId;
 	}

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMusicScoreAccompaniment.java

@@ -25,7 +25,7 @@ public class SysMusicScoreAccompaniment {
 	private String mp3Url;
 
 	/** 带节拍器MP3 */
-	private String metronomeUrl;
+	private String metronomeMp3Url;
 	
 	/** 是否删除 */
 	private Integer delFlag;
@@ -52,6 +52,9 @@ public class SysMusicScoreAccompaniment {
 
 	/**  */
 	private String url;
+
+	/** 带节拍器MP3 */
+	private String metronomeUrl;
 	
 	/**  */
 	private java.util.Date createTime;
@@ -266,6 +269,14 @@ public class SysMusicScoreAccompaniment {
 		this.enableEvaluation = enableEvaluation;
 	}
 
+	public String getMetronomeMp3Url() {
+		return metronomeMp3Url;
+	}
+
+	public void setMetronomeMp3Url(String metronomeMp3Url) {
+		this.metronomeMp3Url = metronomeMp3Url;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

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

@@ -12,16 +12,18 @@ import com.ym.mec.biz.dal.dto.StatDto;
 import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
 import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.entity.StudentPreRegistration;
 import com.ym.mec.biz.dal.enums.GradeTypeEnum;
 import com.ym.mec.biz.dal.enums.PeriodEnum;
 import com.ym.mec.biz.dal.page.CloudTeacherActiveQueryInfo;
 import com.ym.mec.biz.dal.page.OrganCloudStudyStudentDataQueryInfo;
 import com.ym.mec.biz.dal.page.StudentQueryInfo;
 import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 
 public interface StudentService extends BaseService<Integer, Student> {
+	
+	boolean register(StudentPreRegistration studentPreRegistration);
 
     PageInfo findStudentVipGroupList(StudentQueryInfo queryInfo);
 

+ 122 - 19
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -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>();

+ 11 - 10
mec-biz/src/main/resources/config/mybatis/SysMusicScoreAccompanimentMapper.xml

@@ -12,7 +12,7 @@
 		<result column="subject_id_" property="subjectId" />
 		<result column="subject_name_" property="subjectName" />
 		<result column="mp3_url_" property="mp3Url" />
-		<result column="metronome_url_" property="metronomeUrl" />
+		<result column="metronome_mp3_url_" property="metronomeMp3Url" />
 		<result column="xml_url_" property="xmlUrl" />
 		<result column="name_" property="examSongName" />
 		<result column="categories_name_" property="categoriesName" />
@@ -20,6 +20,7 @@
 		<result column="parent_categories_id_" property="parentCategoriesId" />
 		<result column="type_" property="type" />
 		<result column="url_" property="url" />
+		<result column="metronome_url_" property="metronomeUrl" />
 		<result column="del_flag_" property="delFlag" />
 		<result column="speed_" property="speed" />
 		<result column="create_time_" property="createTime" />
@@ -39,7 +40,7 @@
 
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="SysMusicScoreAccompaniment" >
-		SELECT sesa.*,ses.name_,ses.type_,ses.url_,sesc.name_ categories_name_,sesc.id_ categories_id_,ses.client_type_
+		SELECT sesa.*,ses.name_,ses.type_,ses.url_,sesc.name_ categories_name_,sesc.id_ categories_id_,ses.client_type_,ses.metronome_url_
 		FROM sys_music_score ses
 		LEFT JOIN sys_music_score_accompaniment sesa ON ses.id_ = sesa.exam_song_id_
 		LEFT JOIN sys_music_score_categories sesc ON sesc.id_ = ses.music_score_categories_id_
@@ -53,15 +54,15 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysMusicScoreAccompaniment" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO sys_music_score_accompaniment (exam_song_id_,subject_id_,mp3_url_,metronome_url_,speed_,xml_url_,create_time_,update_time_,is_open_metronome_)
-		VALUES(#{examSongId},#{subjectId},#{mp3Url},#{metronomeUrl},#{speed},#{xmlUrl},NOW(),NOW(),#{isOpenMetronome})
+		INSERT INTO sys_music_score_accompaniment (exam_song_id_,subject_id_,mp3_url_,metronome_mp3_url_,speed_,xml_url_,create_time_,update_time_,is_open_metronome_)
+		VALUES(#{examSongId},#{subjectId},#{mp3Url},#{metronomeMp3Url},#{speed},#{xmlUrl},NOW(),NOW(),#{isOpenMetronome})
 	</insert>
     <insert id="batchInsert">
-		INSERT INTO sys_music_score_accompaniment (exam_song_id_,subject_id_,mp3_url_,speed_,xml_url_,
+		INSERT INTO sys_music_score_accompaniment (exam_song_id_,subject_id_,mp3_url_,metronome_mp3_url_,speed_,xml_url_,
 		                                           create_time_,update_time_,is_show_fingering_,memo_,is_open_metronome_)
 		VALUES
 		<foreach collection="sysMusicScoreAccompaniments" item="item"  separator=",">
-			(#{sysMusicScoreId},#{item.subjectId},#{item.mp3Url},#{item.speed},
+			(#{sysMusicScoreId},#{item.subjectId},#{item.mp3Url},#{item.metronomeMp3Url},#{item.speed},
 			 #{item.xmlUrl},NOW(),NOW(),#{item.isShowFingering},#{item.memo},#{isOpenMetronome})
 		</foreach>
 	</insert>
@@ -86,7 +87,7 @@
 			exam_song_id_ = #{examSongId},
 		</if>
 			subject_id_ = #{subjectId},xml_url_ = #{xmlUrl},
-			mp3_url_ = #{mp3Url},metronome_url_ = #{metronomeUrl}, update_time_ = NOW()
+			mp3_url_ = #{mp3Url},metronome_mp3_url_ = #{metronomeMp3Url}, update_time_ = NOW()
 	</set>WHERE id_ = #{id}
 	</update>
 	<update id="batchDel">
@@ -114,7 +115,7 @@
 				<if test="item.examSongId != null">
 					exam_song_id_ = #{item.examSongId},
 				</if>
-				subject_id_ = #{item.subjectId},xml_url_ = #{item.xmlUrl},metronome_url_ = #{item.metronomeUrl},
+				subject_id_ = #{item.subjectId},xml_url_ = #{item.xmlUrl},metronome_mp3_url_ = #{item.metronomeMp3Url},
 				mp3_url_ = #{item.mp3Url}, update_time_ = NOW()
 			</set> WHERE id_ = #{item.id}
 		</foreach>
@@ -127,7 +128,7 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysMusicScoreAccompaniment" parameterType="map">
-		SELECT sesa.*,ses.name_,ses.type_,ses.url_,s.name_ subject_name_,sesc.name_ categories_name_,sesc.id_ categories_id_,sesc.parent_id_ parent_categories_id_,ses.client_type_,ses.rank_ids_,ses.render_from_,ses.enable_evaluation_
+		SELECT sesa.*,ses.name_,ses.type_,ses.url_,s.name_ subject_name_,sesc.name_ categories_name_,sesc.id_ categories_id_,sesc.parent_id_ parent_categories_id_,ses.client_type_,ses.rank_ids_,ses.render_from_,ses.enable_evaluation_,ses.metronome_url_
 		FROM sys_music_score ses
 		LEFT JOIN sys_music_score_accompaniment sesa ON ses.id_ = sesa.exam_song_id_
 		LEFT JOIN sys_music_score_categories sesc ON sesc.id_ = ses.music_score_categories_id_
@@ -162,7 +163,7 @@
 		</where>
 	</select>
 	<select id="queryAccPage" resultMap="SysMusicScoreAccompaniment">
-		SELECT sesa.*,ses.name_,ses.type_,ses.url_,s.name_ subject_name_,sesc.name_ categories_name_,sesc.id_ categories_id_,sesc.parent_id_ parent_categories_id_,ses.client_type_,ses.enable_evaluation_
+		SELECT sesa.*,ses.name_,ses.type_,ses.url_,s.name_ subject_name_,sesc.name_ categories_name_,sesc.id_ categories_id_,sesc.parent_id_ parent_categories_id_,ses.client_type_,ses.enable_evaluation_,ses.metronome_url_
 		FROM sys_music_score ses
 		LEFT JOIN sys_music_score_accompaniment sesa ON ses.id_ = sesa.exam_song_id_
 		LEFT JOIN sys_music_score_categories sesc ON sesc.id_ = ses.music_score_categories_id_

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

@@ -108,7 +108,7 @@
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysMusicScore" parameterType="map">
 		SELECT ses.*,su.real_name_ create_user_name_,smsc.name_ categories_name_,smsc.id_ categories_id_,
-		smsa.mp3_url_ accompaniment_url_,smsa.metronome_url_ accompaniment_metronome_url_,smsa.is_open_metronome_,smsa.subject_id_
+		smsa.mp3_url_ accompaniment_url_,smsa.metronome_mp3_url_ accompaniment_metronome_url_,smsa.is_open_metronome_,smsa.subject_id_
 		FROM sys_music_score ses
 		LEFT JOIN sys_music_score_accompaniment smsa ON smsa.exam_song_id_ = ses.id_
 		LEFT JOIN sys_user su ON ses.create_user_id_ = su.id_

+ 49 - 32
mec-student/src/main/java/com/ym/mec/student/controller/DegreeController.java

@@ -1,37 +1,53 @@
 package com.ym.mec.student.controller;
 
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
 import com.alibaba.fastjson.JSON;
 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.dao.DegreeRegistrationDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.SporadicChargeInfoDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.DegreeRegistrationActivityDto;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.entity.DegreeRegistration;
+import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
 import com.ym.mec.biz.dal.page.SporadicChargeInfoQueryInfo;
 import com.ym.mec.biz.service.DegreeRegistrationService;
 import com.ym.mec.biz.service.SporadicChargeInfoService;
-import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.util.idcard.IdcardValidator;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpStatus;
-import org.springframework.transaction.annotation.Isolation;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
 @RequestMapping("degree")
 @Api(tags = "考级报名服务")
 @RestController
@@ -75,22 +91,23 @@ public class DegreeController extends BaseController {
             return failed(HttpStatus.FORBIDDEN,"请登录");
         }
         degreeRegistration.setUserId(user.getId());
-
-        if(Objects.nonNull(degreeRegistration.getSporadicId())&&Objects.nonNull(degreeRegistration.getTheoryLevel())){
-            IdcardValidator idcardValidator = new IdcardValidator();
-            if (!debugMode && !idcardValidator.isValidatedAllIdcard(degreeRegistration.getIdcard())) {
-                throw new BizException("身份证号不正确,请核对");
-            }
-            SporadicChargeInfo info = sporadicChargeInfoDao.get(degreeRegistration.getSporadicId());
-            if (info == null || info.getDelFlag().equals(1)) {
-                return failed("报名信息不存在");
-            }
-            if (info.getOrganId() != 42 || !info.getChargeType().equals(SporadicChargeTypeEnum.LEVEL)) {
-                return failed("报名信息不存在");
-            }
-        }else{
-            degreeRegistration.setOrganId(user.getOrganId());
+        
+        if(degreeRegistration.getSporadicId() == null){
+        	return failed("请从正确入口进行报名");
+        }
+        
+        IdcardValidator idcardValidator = new IdcardValidator();
+        if (!debugMode && !idcardValidator.isValidatedAllIdcard(degreeRegistration.getIdcard())) {
+            throw new BizException("身份证号不正确,请核对");
+        }
+        SporadicChargeInfo info = sporadicChargeInfoDao.get(degreeRegistration.getSporadicId());
+        if (info == null || info.getDelFlag().equals(1)) {
+            return failed("报名信息不存在");
+        }
+        if (info.getOrganId() != 42 || !info.getChargeType().equals(SporadicChargeTypeEnum.LEVEL)) {
+            return failed("报名信息不存在");
         }
+        degreeRegistration.setOrganId(user.getOrganId());
 
         if(Objects.isNull(degreeRegistration.getOrganId()) || degreeRegistration.getOrganId() == 4){
             return failed("该分部暂未开放此活动");

+ 36 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentController.java

@@ -0,0 +1,36 @@
+package com.ym.mec.student.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import javax.annotation.Resource;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.biz.dal.entity.StudentPreRegistration;
+import com.ym.mec.biz.service.StudentService;
+import com.ym.mec.common.controller.BaseController;
+
+@RequestMapping("student")
+@Api(tags = "学生服务")
+@RestController
+public class StudentController extends BaseController {
+
+    @Resource
+    private SysUserFeignService sysUserFeignService;
+    
+    @Autowired
+    private StudentService studentService;
+
+    @ApiOperation("注册")
+    @PostMapping(value = "/registering")
+    public Object preRegister(@RequestBody StudentPreRegistration studentPreRegistration) {
+        return studentService.register(studentPreRegistration) ? succeed() : failed();
+    }
+
+}