فهرست منبع

Merge branch 'master' of http://git.dayaedu.com/yonge/edu-saas

zouxuan 5 سال پیش
والد
کامیت
0fb35ba705

+ 2 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamRoomStudentRelationController.java

@@ -91,8 +91,8 @@ public class ExamRoomStudentRelationController extends BaseController {
 
     @ApiOperation("删除指定教室学员")
     @PostMapping(value = "/deleteStudentFromRoom")
-    public HttpResponseResult deleteStudentFromRoom(Long examRoomId, String studentIds){
-        examRoomStudentRelationService.deleteStudentFromRoom(examRoomId, studentIds);
+    public HttpResponseResult deleteStudentFromRoom(Long examRoomId, String registIds){
+        examRoomStudentRelationService.deleteStudentFromRoom(examRoomId, registIds);
         return succeed();
     }
 }

+ 2 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamCertificationDao.java

@@ -10,7 +10,6 @@ public interface ExamCertificationDao extends BaseDAO<Long, ExamCertification> {
 
     int batchInsert(@Param("ecs")List<ExamCertification> ecs);
 
-
     /**
      * 获取学员准考证
      * @param studentId
@@ -18,4 +17,6 @@ public interface ExamCertificationDao extends BaseDAO<Long, ExamCertification> {
      * @return
      */
     ExamCertification findByStuAndBasicId(@Param("studentId") Integer studentId, @Param("basicId") Integer basicId);
+
+    int deleteWithRegist(@Param("registIds") List<Long> registIds);
 }

+ 2 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRegistrationDao.java

@@ -19,6 +19,8 @@ public interface ExamRegistrationDao extends BaseDAO<Long, ExamRegistration> {
 
     int countExamRegist(Map<String, Object> params);
 
+    int batchUpdate(@Param("regists") List<ExamRegistration> regists);
+
     /**
      * @param organIds:
      * @return int

+ 2 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRoomStudentRelationDao.java

@@ -38,11 +38,11 @@ public interface ExamRoomStudentRelationDao extends BaseDAO<Long, ExamRoomStuden
      * @author Joburgess
      * @date 2020.06.24
      * @param examRoomId:
-     * @param studentIds:
+     * @param registIds:
      * @return int
      */
     int deleteStudentsFromExamRoom(@Param("examRoomId") Long examRoomId,
-                                    @Param("studentIds") List<Integer> studentIds);
+                                    @Param("registIds") List<Long> registIds);
 
     /**
      * @describe 根据班级删除记录

+ 2 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomStudentRelationService.java

@@ -53,10 +53,10 @@ public interface ExamRoomStudentRelationService extends BaseService<Long, ExamRo
      * @author Joburgess
      * @date 2020.06.24
      * @param examRoomId:
-     * @param studentIds:
+     * @param registIds:
      * @return void
      */
-    void deleteStudentFromRoom(Long examRoomId, String studentIds);
+    void deleteStudentFromRoom(Long examRoomId, String registIds);
 
     /**
      * 获取教室学员关联

+ 13 - 5
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -100,6 +100,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		List<ExamRoomStudentRelation> examRoomStudentRelations=new ArrayList<>();
 		List<StudentExamResult> studentExamResults=new ArrayList<>();
 		List<ExamCertification> examCertifications=new ArrayList<>();
+		List<ExamRegistration> updateRegistrations = new ArrayList<>();
 		for (String registId : registIds) {
 			if(existRegistIds.contains(Long.valueOf(registId))){
 				continue;
@@ -119,7 +120,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 
 			StudentExamResult ser = new StudentExamResult();
 			ser.setExamRegistrationId(examRegistration.getId().longValue());
-			ser.setExaminationBasicId(examRoom.getExaminationBasicId());
+			ser.setExaminationBasicId(examRegistration.getExaminationBasicId());
 			ser.setStudentId(examRegistration.getStudentId());
 			ser.setIsFinishedExam(0);
 			ser.setConfirmStatus(0);
@@ -140,6 +141,9 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 			}
 			ec.setTenantId(TenantContextHolder.getTenantId());
 			examCertifications.add(ec);
+
+			examRegistration.setCardNo(ec.getCardNo());
+			updateRegistrations.add(examRegistration);
 		}
 		if(!CollectionUtils.isEmpty(examRoomStudentRelations)){
 			examRoomStudentRelationDao.batchInsert(examRoomStudentRelations);
@@ -153,6 +157,9 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		if(!CollectionUtils.isEmpty(examCertifications)){
 			examCertificationDao.batchInsert(examCertifications);
 		}
+		if(!CollectionUtils.isEmpty(updateRegistrations)){
+			examRegistrationDao.batchUpdate(updateRegistrations);
+		}
 	}
 
 	@Override
@@ -231,7 +238,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 	}
 
 	@Override
-	public void deleteStudentFromRoom(Long examRoomId, String studentIdsStr) {
+	public void deleteStudentFromRoom(Long examRoomId, String registIdsStr) {
 		if(Objects.isNull(examRoomId)){
 			throw new BizException("请指定教室");
 		}
@@ -239,11 +246,12 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		if(Objects.isNull(examRoom)){
 			throw new BizException("教室不存在");
 		}
-		if(StringUtils.isBlank(studentIdsStr)){
+		if(StringUtils.isBlank(registIdsStr)){
 			return;
 		}
-		List<Integer> studentIds = Arrays.asList(studentIdsStr.split(",")).stream().map(e -> Integer.valueOf(e)).collect(Collectors.toList());
-		examRoomStudentRelationDao.deleteStudentsFromExamRoom(examRoomId, studentIds);
+		List<Long> registIds = Arrays.asList(registIdsStr.split(",")).stream().map(e -> Long.valueOf(e)).collect(Collectors.toList());
+		examRoomStudentRelationDao.deleteStudentsFromExamRoom(examRoomId, registIds);
+		examCertificationDao.deleteWithRegist(registIds);
 		examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
 	}
 

+ 4 - 4
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExaminationBasicServiceImpl.java

@@ -173,10 +173,10 @@ public class ExaminationBasicServiceImpl extends BaseServiceImpl<Long, Examinati
                 if (CollectionUtils.isEmpty(examOrganizationRelations)) {
                     continue;
                 }
-                long totalRegistrationStudentNum = examOrganizationRelations.stream().map(ExamOrganizationRelation::getTotalRegistrationStudentNum).count();
-                long totalPaymentAmount = examOrganizationRelations.stream().map(ExamOrganizationRelation::getTotalPaymentAmount).count();
-                examinationBasicDto.setTotalRegistrationStudentNum((int) totalRegistrationStudentNum);
-                examinationBasicDto.setTotalPaymentAmount(new BigDecimal(totalPaymentAmount));
+                Integer totalRegistrationStudentNum = examOrganizationRelations.stream().mapToInt(ExamOrganizationRelation::getTotalRegistrationStudentNum).sum();
+                BigDecimal totalPaymentAmount = examOrganizationRelations.stream().map(ExamOrganizationRelation::getTotalPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+                examinationBasicDto.setTotalRegistrationStudentNum(totalRegistrationStudentNum);
+                examinationBasicDto.setTotalPaymentAmount(totalPaymentAmount);
             }
         }
         pageInfo.setRows(dataList);

+ 8 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamCertificationMapper.xml

@@ -92,8 +92,14 @@
 	<delete id="delete" >
 		DELETE FROM exam_certification WHERE id_ = #{id} 
 	</delete>
-	
-	<!-- 分页查询 -->
+    <delete id="deleteWithRegist">
+		DELETE FROM exam_certification WHERE exam_registration_id_ IN
+		<foreach collection="registIds" item="registId" separator="," open="(" close=")">
+			#{registId}
+		</foreach>
+	</delete>
+
+    <!-- 分页查询 -->
 	<select id="queryPage" resultMap="ExamCertification" parameterType="map">
 		SELECT * FROM exam_certification ORDER BY id_
 		<include refid="global.limit"/>

+ 67 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -131,6 +131,73 @@
 		WHERE id_ = #{id}
 	</update>
 
+	<update id="batchUpdate" parameterType="com.keao.edu.user.entity.ExamRegistration">
+		<foreach collection="regists" item="regist" separator=";">
+			UPDATE exam_registration
+			<set>
+				<if test="regist.examinationBasicId != null">
+					examination_basic_id_ = #{regist.examinationBasicId},
+				</if>
+				<if test="regist.studentId != null">
+					student_id_ = #{regist.studentId},
+				</if>
+				<if test="regist.organId != null">
+					organ_id_ = #{regist.organId},
+				</if>
+				<if test="regist.subjectId != null">
+					subject_id_ = #{regist.subjectId},
+				</if>
+				<if test="regist.level != null">
+					level_ = #{regist.level},
+				</if>
+				<if test="regist.levelFee != null">
+					level_fee_ = #{regist.levelFee},
+				</if>
+				<if test="regist.songJson != null">
+					song_json_ = #{regist.songJson},
+				</if>
+				<if test="regist.lastExamLevel != null">
+					last_exam_level_ = #{regist.lastExamLevel},
+				</if>
+				<if test="regist.lastExamCertificateUrl != null">
+					last_exam_certificate_url_ = #{regist.lastExamCertificateUrl},
+				</if>
+				<if test="regist.examMusicTheoryLevel!= null">
+					exam_music_theory_level_ = #{regist.examMusicTheoryLevel},
+				</if>
+				<if test="regist.theoryLevelFee!= null">
+					theory_level_fee_ = #{regist.theoryLevelFee},
+				</if>
+				<if test="regist.lastMusicTheoryLevel != null">
+					last_music_theory_level_ = #{regist.lastMusicTheoryLevel},
+				</if>
+				<if test="regist.lastMusicTheoryCertificateUrl != null">
+					last_music_theory_certificate_url_ = #{regist.lastMusicTheoryCertificateUrl},
+				</if>
+				<if test="regist.adviserName != null">
+					adviser_name_ = #{regist.adviserName},
+				</if>
+				<if test="regist.adviserPhone != null">
+					adviser_phone_ = #{regist.adviserPhone},
+				</if>
+				<if test="regist.cardNo!=null">
+					card_no_ =#{regist.cardNo},
+				</if>
+				<if test="regist.status!=null">
+					status_ = #{regist.status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
+				</if>
+				<if test="regist.tenantId != null">
+					tenant_id_ = #{regist.tenantId},
+				</if>
+				<if test="regist.memo!=null">
+					memo_ = #{regist.memo},
+				</if>
+				update_time_ = NOW()
+			</set>
+			WHERE id_ = #{id}
+		</foreach>
+	</update>
+
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete" >
 		DELETE FROM exam_registration WHERE id_ = #{id}

+ 5 - 3
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomStudentRelationMapper.xml

@@ -96,9 +96,9 @@
 	</delete>
 	<delete id="deleteStudentsFromExamRoom">
 		DELETE FROM exam_room_student_relation WHERE exam_room_id_=#{examRoomId}
-		AND student_id_ IN
-		<foreach collection="studentIds" item="studentId" separator="," open="(" close=")">
-			#{studentId}
+		AND exam_registration_id_ IN
+		<foreach collection="registIds" item="registId" separator="," open="(" close=")">
+			#{registId}
 		</foreach>
 	</delete>
 
@@ -144,6 +144,8 @@
 	<select id="findExamRoomStudents" resultMap="ExamRoomStudentRelationDto" parameterType="map">
 		SELECT
 			ersr.id_,
+			ersr.exam_registration_id_,
+			ersr.examination_basic_id_,
 			er.id_ regist_id_,
 			er.student_id_ regist_student_id_,
 			er.subject_id_ regist_subject_id_,

+ 14 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -28,7 +28,13 @@
 	</resultMap>
 
 	<select id="get" resultMap="Teacher">
-        SELECT t.*,su.* FROM teacher t
+        SELECT t.*,
+        	su.id_ sys_user_id_,
+        	su.username_ sys_user_username_,
+        	su.phone_ sys_user_phone_,
+        	su.avatar_ sys_user_avatar_,
+        	su.real_name_ sys_user_real_name_
+        FROM teacher t
         LEFT JOIN sys_user su ON t.user_id_ = su.id_
         WHERE t.user_id_ = #{id}
     </select>
@@ -107,7 +113,13 @@
 	</sql>
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="Teacher" parameterType="map">
-		SELECT * FROM teacher t
+		SELECT t.*,
+			su.id_ sys_user_id_,
+			su.username_ sys_user_username_,
+			su.phone_ sys_user_phone_,
+			su.avatar_ sys_user_avatar_,
+			su.real_name_ sys_user_real_name_
+		FROM teacher t
 		LEFT JOIN sys_user su ON t.user_id_ = su.id_
 		<include refid="teacherQueryPage"/>
 		<include refid="global.limit"/>