Joburgess 5 năm trước cách đây
mục cha
commit
8d4e2b93d8

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

@@ -30,7 +30,7 @@ public interface ExamRoomStudentRelationDao extends BaseDAO<Long, ExamRoomStuden
      * @param examRoomId:
      * @return java.util.List<com.keao.edu.user.api.entity.ExamRoomStudentRelation>
      */
-    List<ExamRoomStudentRelation> findStudentsWithExamRoom(@Param("examRoomId") Long examRoomId);
+    List<ExamRoomStudentRelation> findStudentsWithExamRoom(@Param("examId") Integer examId,@Param("examRoomId") Long examRoomId);
 
     /**
      * @describe 删除指定教室的学员
@@ -60,4 +60,14 @@ public interface ExamRoomStudentRelationDao extends BaseDAO<Long, ExamRoomStuden
      * @return
      */
     ExamRoomStudentRelation getExamRoomStudentRelation(@Param("basicId") Integer basicId, @Param("roomId") String roomId, @Param("studentId") Integer studentId);
+
+    /**
+     * 获取教室学员关联
+     * @param basicId
+     * @param roomId
+     * @param studentId
+     * @return
+     */
+    ExamRoomStudentRelation getExamRoomStudentRelations(@Param("basicId") Integer basicId, @Param("roomId") String roomId, @Param("studentId") Integer studentId);
+
 }

+ 9 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamTeacherSalaryService.java

@@ -5,4 +5,13 @@ import com.keao.edu.user.entity.ExamTeacherSalary;
 
 public interface ExamTeacherSalaryService extends BaseService<Long, ExamTeacherSalary> {
 
+    /**
+     * @describe 结算指定考试中教师的薪酬
+     * @author Joburgess
+     * @date 2020.07.01
+     * @param examId:
+     * @return void
+     */
+    void teacherSalarySettlementWithExam(Integer examId);
+
 }

+ 26 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamTeacherSalaryServiceImpl.java

@@ -2,15 +2,31 @@ package com.keao.edu.user.service.impl;
 
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
+import com.keao.edu.user.api.entity.ExamRoom;
+import com.keao.edu.user.dao.ExamRoomDao;
+import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
 import com.keao.edu.user.dao.ExamTeacherSalaryDao;
+import com.keao.edu.user.dao.ExaminationBasicDao;
 import com.keao.edu.user.entity.ExamTeacherSalary;
 import com.keao.edu.user.service.ExamTeacherSalaryService;
+import com.keao.edu.user.service.ExaminationBasicService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @Service
 public class ExamTeacherSalaryServiceImpl extends BaseServiceImpl<Long, ExamTeacherSalary> implements ExamTeacherSalaryService {
-	
+
+	@Autowired
+	private ExaminationBasicDao examinationBasicDao;
+	@Autowired
+	private ExamRoomDao examRoomDao;
+	@Autowired
+	private ExamRoomStudentRelationDao examRoomStudentRelationDao;
 	@Autowired
 	private ExamTeacherSalaryDao examTeacherSalaryDao;
 
@@ -18,5 +34,13 @@ public class ExamTeacherSalaryServiceImpl extends BaseServiceImpl<Long, ExamTeac
 	public BaseDAO<Long, ExamTeacherSalary> getDAO() {
 		return examTeacherSalaryDao;
 	}
-	
+
+	@Override
+	public void teacherSalarySettlementWithExam(Integer examId) {
+		List<ExamRoom> examRooms = examRoomDao.getWithExam(null, examId);
+		if(CollectionUtils.isEmpty(examRooms)){
+			return;
+		}
+		List<Long> roomIds = examRooms.stream().map(ExamRoom::getId).collect(Collectors.toList());
+	}
 }

+ 7 - 4
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomMapper.xml

@@ -156,9 +156,12 @@
 	</select>
 	
     <select id="getWithExam" resultMap="ExamRoom">
-		SELECT * FROM exam_room WHERE examination_basic_id_=#{examId} AND organ_id_ IN
-		<foreach collection="organIds" item="organId" separator="," open="(" close=")">
-			#{organId}
-		</foreach>
+		SELECT * FROM exam_room WHERE examination_basic_id_=#{examId}
+		<if test="organIds!=null">
+			AND organ_id_ IN
+			<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+				#{organId}
+			</foreach>
+		</if>
     </select>
 </mapper>

+ 13 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomStudentRelationMapper.xml

@@ -152,6 +152,18 @@
 		SELECT id_, examination_basic_id_, exam_room_id_, student_id_ FROM exam_room_student_relation WHERE exam_room_id_=#{examRoomId}
 	</select>
 	<select id="getExamRoomStudentRelation" resultMap="ExamRoomStudentRelation">
-		SELECT * FROM exam_room_student_relation WHERE exam_room_id_ = #{roomId} AND examination_basic_id_ = #{basicId} AND student_id_ = #{studentId} LIMIT 1
+		SELECT * FROM exam_room_student_relation
+		WHERE examination_basic_id_ = #{basicId} AND exam_room_id_ = #{roomId} AND student_id_ = #{studentId} LIMIT 1
+	</select>
+
+	<select id="getExamRoomStudentRelations" resultMap="ExamRoomStudentRelation">
+		SELECT * FROM exam_room_student_relation
+		WHERE examination_basic_id_ = #{basicId}
+		<if test="roomId!=null">
+			AND exam_room_id_ = #{roomId}
+		</if>
+		<if test="studentId">
+			AND student_id_ = #{studentId}
+		</if>
 	</select>
 </mapper>