Joburgess %!s(int64=5) %!d(string=hai) anos
pai
achega
bbd67e8805

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

@@ -33,6 +33,9 @@ public interface ExamRoomStudentRelationDao extends BaseDAO<Long, ExamRoomStuden
      */
      */
     List<ExamRoomStudentRelation> findStudentsWithExamRoom(@Param("examRoomId") Long examRoomId);
     List<ExamRoomStudentRelation> findStudentsWithExamRoom(@Param("examRoomId") Long examRoomId);
 
 
+
+    List<ExamRoomStudentRelation> findStudentsWithExamRooms(@Param("examRoomIds") List<Long> examRoomIds);
+
     /**
     /**
      * @describe 删除指定教室的学员
      * @describe 删除指定教室的学员
      * @author Joburgess
      * @author Joburgess

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

@@ -12,6 +12,8 @@ public interface StudentExamResultDao extends BaseDAO<Long, StudentExamResult> {
 
 
     int batchInsert(@Param("results") List<StudentExamResult> results);
     int batchInsert(@Param("results") List<StudentExamResult> results);
 
 
+    int deleteWithRegists(@Param("registIds") List<Long> registIds);
+
     /**
     /**
      * @describe 查询考试结果
      * @describe 查询考试结果
      * @author Joburgess
      * @author Joburgess

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

@@ -23,15 +23,6 @@ public interface ExamTeacherSalaryService extends BaseService<Long, ExamTeacherS
     void teacherSalarySettlementWithExam(Long examId);
     void teacherSalarySettlementWithExam(Long examId);
 
 
     /**
     /**
-     * @describe 结算指定考试中教师的薪酬
-     * @author Joburgess
-     * @date 2020.07.01
-     * @param examIds:
-     * @return void
-     */
-    void teacherSalarySettlementWithExam(List<Long> examIds);
-
-    /**
      * @describe
      * @describe
      * @author Joburgess
      * @author Joburgess
      * @date 2020.07.08
      * @date 2020.07.08

+ 14 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java

@@ -11,6 +11,7 @@ import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.common.tenant.TenantContextHolder;
 import com.keao.edu.common.tenant.TenantContextHolder;
 import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.api.entity.ExamRoom;
+import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
 import com.keao.edu.user.api.enums.ExamModeEnum;
 import com.keao.edu.user.api.enums.ExamModeEnum;
 import com.keao.edu.user.dao.*;
 import com.keao.edu.user.dao.*;
 import com.keao.edu.user.dto.ExamRoomDto;
 import com.keao.edu.user.dto.ExamRoomDto;
@@ -51,6 +52,10 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 	private SysUserDao sysUserDao;
 	private SysUserDao sysUserDao;
 	@Autowired
 	@Autowired
 	private ExamTeacherSalaryService examTeacherSalaryService;
 	private ExamTeacherSalaryService examTeacherSalaryService;
+	@Autowired
+	private ExamCertificationDao examCertificationDao;
+	@Autowired
+	private StudentExamResultDao studentExamResultDao;
 
 
 	@Override
 	@Override
 	public BaseDAO<Long, ExamRoom> getDAO() {
 	public BaseDAO<Long, ExamRoom> getDAO() {
@@ -236,10 +241,18 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 
 
 		ExamRoom examRoom = examRoomDao.get(examRoomIds.get(0));
 		ExamRoom examRoom = examRoomDao.get(examRoomIds.get(0));
 
 
-		examRoomDao.batchDeleteExamRooms(examRoomIds);
+		List<ExamRoomStudentRelation> roomStudents = examRoomStudentRelationDao.findStudentsWithExamRooms(examRoomIds);
+		List<Long> registIds = roomStudents.stream().map(ExamRoomStudentRelation::getExamRegistrationId).collect(Collectors.toList());
+
 		examRoomStudentRelationDao.deleteWithExamRooms(examRoomIds);
 		examRoomStudentRelationDao.deleteWithExamRooms(examRoomIds);
 
 
+		examCertificationDao.deleteWithRegist(registIds);
+
+		studentExamResultDao.deleteWithRegists(registIds);
+
 		examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
 		examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
+
+		examRoomDao.batchDeleteExamRooms(examRoomIds);
 	}
 	}
 
 
 	@Override
 	@Override

+ 1 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -252,6 +252,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		}
 		}
 		List<Long> registIds = Arrays.asList(registIdsStr.split(",")).stream().map(e -> Long.valueOf(e)).collect(Collectors.toList());
 		List<Long> registIds = Arrays.asList(registIdsStr.split(",")).stream().map(e -> Long.valueOf(e)).collect(Collectors.toList());
 		examRoomStudentRelationDao.deleteStudentsFromExamRoom(examRoomId, registIds);
 		examRoomStudentRelationDao.deleteStudentsFromExamRoom(examRoomId, registIds);
+		studentExamResultDao.deleteWithRegists(registIds);
 		int deleteNum = examCertificationDao.deleteWithRegist(registIds);
 		int deleteNum = examCertificationDao.deleteWithRegist(registIds);
 		examRoom.setExamRoomStudentNum(examRoom.getExamRoomStudentNum()-deleteNum);
 		examRoom.setExamRoomStudentNum(examRoom.getExamRoomStudentNum()-deleteNum);
 		examRoomDao.update(examRoom);
 		examRoomDao.update(examRoom);

+ 0 - 49
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamTeacherSalaryServiceImpl.java

@@ -89,55 +89,6 @@ public class ExamTeacherSalaryServiceImpl extends BaseServiceImpl<Long, ExamTeac
 	}
 	}
 
 
 	@Override
 	@Override
-	public void teacherSalarySettlementWithExam(List<Long> examIds) {
-		if(CollectionUtils.isEmpty(examIds)){
-			return;
-		}
-		for (Long examId : examIds) {
-			List<ExamRoom> examRooms = examRoomDao.getWithExam(null, examId);
-			if(CollectionUtils.isEmpty(examRooms)){
-				return;
-			}
-
-			Map<Integer, List<ExamRoom>> teacherExamRoomMap=new HashMap<>();
-			for (ExamRoom examRoom : examRooms) {
-				if(!teacherExamRoomMap.containsKey(examRoom.getMainTeacherUserId())){
-					teacherExamRoomMap.put(examRoom.getMainTeacherUserId(), new ArrayList<>());
-				}
-				teacherExamRoomMap.get(examRoom.getMainTeacherUserId()).add(examRoom);
-				if(StringUtils.isBlank(examRoom.getAssistantTeacherUserIdList())){
-					continue;
-				}
-				for (String assistantTeacherId : examRoom.getAssistantTeacherUserIdList().split(",")) {
-					if(!teacherExamRoomMap.containsKey(Integer.valueOf(assistantTeacherId))){
-						teacherExamRoomMap.put(Integer.valueOf(assistantTeacherId), new ArrayList<>());
-					}
-					teacherExamRoomMap.get(Integer.valueOf(assistantTeacherId)).add(examRoom);
-				}
-			}
-
-			List<ExamRoomStudentRelation> examRoomStudentRelations = examRoomStudentRelationDao.getExamRoomStudentRelations(examId, null, null);
-
-			List<ExamTeacherSalary> examTeacherSalaries = examTeacherSalaryDao.queryWithExam(examId);
-			for (ExamTeacherSalary examTeacherSalary : examTeacherSalaries) {
-				List<ExamRoom> teacherExamRooms = teacherExamRoomMap.get(examTeacherSalary.getTeacherId());
-				if(CollectionUtils.isEmpty(teacherExamRooms)){
-					examTeacherSalary.setTotalInvigilationNum(0);
-					examTeacherSalary.setTotalInvigilationStudentNum(0);
-					examTeacherSalary.setTotalSettlementCost(BigDecimal.ZERO);
-					continue;
-				}
-				Set<Long> examRoomIds = teacherExamRooms.stream().map(ExamRoom::getId).collect(Collectors.toSet());
-				long studentNum = examRoomStudentRelations.stream().filter(e -> examRoomIds.contains(e.getExamRoomId())).count();
-				examTeacherSalary.setTotalInvigilationNum(examRoomIds.size());
-				examTeacherSalary.setTotalInvigilationStudentNum((int) studentNum);
-				examTeacherSalary.setTotalSettlementCost(examTeacherSalary.getShareProfitAmount().multiply(new BigDecimal(studentNum)));
-			}
-			examTeacherSalaryDao.batchUpdate(examTeacherSalaries);
-		}
-	}
-
-	@Override
 	public PageInfo<ExamTeacherSalaryDto> queryExamTeacherSalary(ExamTeacherSalaryQueryInfo queryInfo) {
 	public PageInfo<ExamTeacherSalaryDto> queryExamTeacherSalary(ExamTeacherSalaryQueryInfo queryInfo) {
 		PageInfo<ExamTeacherSalaryDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
 		PageInfo<ExamTeacherSalaryDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
 		Map<String, Object> params = new HashMap<String, Object>();
 		Map<String, Object> params = new HashMap<String, Object>();

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

@@ -218,6 +218,9 @@ public class ExaminationBasicServiceImpl extends BaseServiceImpl<Long, Examinati
         if(Objects.isNull(existsExam)){
         if(Objects.isNull(existsExam)){
             throw new BizException("考级项目不存在");
             throw new BizException("考级项目不存在");
         }
         }
+        if(ExamStatusEnum.SETTING.equals(existsExam.getStatus())){
+            throw new BizException("无法修改");
+        }
         if(ExamStatusEnum.RESULT_CONFIRM.equals(existsExam.getStatus())){
         if(ExamStatusEnum.RESULT_CONFIRM.equals(existsExam.getStatus())){
             throw new BizException("考级项目结果已确认");
             throw new BizException("考级项目结果已确认");
         }
         }

+ 9 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomStudentRelationMapper.xml

@@ -170,6 +170,15 @@
 	<select id="findStudentsWithExamRoom" resultMap="ExamRoomStudentRelation">
 	<select id="findStudentsWithExamRoom" resultMap="ExamRoomStudentRelation">
 		SELECT id_, exam_registration_id_, examination_basic_id_, exam_room_id_, student_id_ FROM exam_room_student_relation WHERE exam_room_id_=#{examRoomId}
 		SELECT id_, exam_registration_id_, examination_basic_id_, exam_room_id_, student_id_ FROM exam_room_student_relation WHERE exam_room_id_=#{examRoomId}
 	</select>
 	</select>
+
+	<select id="findStudentsWithExamRooms" resultMap="ExamRoomStudentRelation">
+		SELECT id_, exam_registration_id_, examination_basic_id_, exam_room_id_, student_id_
+		FROM exam_room_student_relation WHERE exam_room_id_ IN
+		<foreach collection="examRoomIds" item="examRoomId" separator="," open="(" close=")">
+			#{examRoomId}
+		</foreach>
+	</select>
+
 	<select id="getExamRoomStudentRelation" resultMap="ExamRoomStudentRelation">
 	<select id="getExamRoomStudentRelation" resultMap="ExamRoomStudentRelation">
 		SELECT * FROM exam_room_student_relation
 		SELECT * FROM exam_room_student_relation
 		WHERE examination_basic_id_ = #{basicId} AND exam_room_id_ = #{roomId} AND student_id_ = #{studentId} LIMIT 1
 		WHERE examination_basic_id_ = #{basicId} AND exam_room_id_ = #{roomId} AND student_id_ = #{studentId} LIMIT 1

+ 9 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/StudentExamResultMapper.xml

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