|
@@ -16,6 +16,7 @@ import com.qmth.eds.common.enums.TaskStatusEnum;
|
|
|
import com.qmth.eds.common.tools.CloudMarkingUtil;
|
|
|
import com.qmth.eds.common.tools.WuhanUniversityUtils;
|
|
|
import com.qmth.eds.common.util.FileUtil;
|
|
|
+import com.qmth.eds.common.util.ServletUtil;
|
|
|
import com.qmth.eds.service.*;
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -186,7 +187,7 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
// 同步初始参数
|
|
|
TaskResultEnum result = null;
|
|
|
String errorMessage = "";
|
|
|
- Long schoolId = tbSyncTask.getSchoolId();
|
|
|
+ Long collegeId = tbSyncTask.getSchoolId();
|
|
|
Long semesterId = tbSyncTask.getSemesterId();
|
|
|
Long examTypeId = tbSyncTask.getExamTypeId();
|
|
|
File txtFile = null;
|
|
@@ -198,18 +199,18 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
|
|
|
Map<String, String> mapSource = new HashMap<>();
|
|
|
mapSource.put("examId", String.valueOf(examId));
|
|
|
- int totalCount = cloudMarkingUtil.getStudentCount(mapSource);
|
|
|
+ int totalCount = cloudMarkingUtil.getStudentCount(mapSource, collegeId);
|
|
|
List<CloudMarkingScore> cloudMarkingScoreList = new ArrayList<>();
|
|
|
if (totalCount > 0) {
|
|
|
int pageSize = SystemConstant.PAGE_SIZE;
|
|
|
int mod = totalCount % pageSize;
|
|
|
int pageNos = mod == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
|
|
|
for (int i = 1; i <= pageNos; i++) {
|
|
|
- List<JSONObject> students = cloudMarkingUtil.getStudentScore(mapSource, i, pageSize);
|
|
|
+ List<JSONObject> students = cloudMarkingUtil.getStudentScore(mapSource, collegeId, i, pageSize);
|
|
|
List<CloudMarkingScore> cloudMarkingScores = students.stream().map(m -> {
|
|
|
CloudMarkingScore cloudMarkingScore = new CloudMarkingScore();
|
|
|
cloudMarkingScore.setId(SystemConstant.getDbUuid());
|
|
|
- cloudMarkingScore.setSchoolId(schoolId);
|
|
|
+ cloudMarkingScore.setSchoolId(collegeId);
|
|
|
cloudMarkingScore.setSemesterId(semesterId);
|
|
|
cloudMarkingScore.setExamTypeId(examTypeId);
|
|
|
cloudMarkingScore.setExamId(examId);
|
|
@@ -239,7 +240,7 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
|
|
|
//2.调用教务系统接口回传成绩
|
|
|
if (!cloudMarkingScoreList.isEmpty()) {
|
|
|
- saveScoreData(schoolId, semesterId, examTypeId, examId, cloudMarkingScoreList);
|
|
|
+ saveScoreData(collegeId, semesterId, examTypeId, examId, cloudMarkingScoreList);
|
|
|
}
|
|
|
|
|
|
result = TaskResultEnum.SUCCESS;
|
|
@@ -268,10 +269,10 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
- public void saveScoreData(Long schoolId, Long semesterId, Long examTypeId, Integer examId, List<CloudMarkingScore> cloudMarkingScoreList) {
|
|
|
-
|
|
|
+ public void saveScoreData(Long collegeId, Long semesterId, Long examTypeId, Integer examId, List<CloudMarkingScore> cloudMarkingScoreList) {
|
|
|
+ Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
// 删除旧数据
|
|
|
- cloudMarkingScoreService.deleteByKeys(schoolId, semesterId, examTypeId, examId);
|
|
|
+ cloudMarkingScoreService.deleteByKeys(collegeId, semesterId, examTypeId, examId);
|
|
|
|
|
|
List<CloudMarkingScore> data = new ArrayList<>();
|
|
|
//1000条提交一次
|
|
@@ -302,21 +303,21 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
for (CloudMarkingScore cloudMarkingScore : cloudMarkingScoreList) {
|
|
|
Optional<ExamSyncStudent> optional = examSyncStudents.stream().filter(s -> s.getJxbmc().equals(cloudMarkingScore.getClassName()) && s.getKch().equals(cloudMarkingScore.getSubjectCode()) && s.getXh().equals(cloudMarkingScore.getStudentCode())).findFirst();
|
|
|
if (!optional.isPresent()) {
|
|
|
- cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(schoolId, semesterId, examTypeId, examId, null, null, cloudMarkingScore.getClassName(), cloudMarkingScore.getSubjectCode(), cloudMarkingScore.getSubjectName(), cloudMarkingScore.getStudentCode(), cloudMarkingScore.getTotalScore()));
|
|
|
+ cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, examId, null, null, cloudMarkingScore.getClassName(), cloudMarkingScore.getSubjectCode(), cloudMarkingScore.getSubjectName(), cloudMarkingScore.getStudentCode(), cloudMarkingScore.getTotalScore()));
|
|
|
} else {
|
|
|
ExamSyncStudent examSyncStudent = optional.get();
|
|
|
- cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(schoolId, semesterId, examTypeId, examId, examSyncStudent.getXnm(), examSyncStudent.getXqm(), examSyncStudent.getJxbId(), examSyncStudent.getKch(), examSyncStudent.getKcmc(), examSyncStudent.getXh(), cloudMarkingScore.getTotalScore()));
|
|
|
+ cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, examId, examSyncStudent.getXnm(), examSyncStudent.getXqm(), examSyncStudent.getJxbId(), examSyncStudent.getKch(), examSyncStudent.getKcmc(), examSyncStudent.getXh(), cloudMarkingScore.getTotalScore()));
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
for (CloudMarkingScore cloudMarkingScore : cloudMarkingScoreList) {
|
|
|
- cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(schoolId, semesterId, examTypeId, examId, null, null, cloudMarkingScore.getClassName(), cloudMarkingScore.getSubjectCode(), cloudMarkingScore.getSubjectName(), cloudMarkingScore.getStudentCode(), cloudMarkingScore.getTotalScore()));
|
|
|
+ cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, examId, null, null, cloudMarkingScore.getClassName(), cloudMarkingScore.getSubjectCode(), cloudMarkingScore.getSubjectName(), cloudMarkingScore.getStudentCode(), cloudMarkingScore.getTotalScore()));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 删除全量数据
|
|
|
UpdateWrapper<CloudMarkingScoreForeign> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().eq(CloudMarkingScoreForeign::getSchoolId, schoolId)
|
|
|
+ updateWrapper.lambda().eq(CloudMarkingScoreForeign::getSchoolId, collegeId)
|
|
|
.eq(CloudMarkingScoreForeign::getSemesterId, semesterId)
|
|
|
.eq(CloudMarkingScoreForeign::getExamTypeId, examTypeId)
|
|
|
.eq(CloudMarkingScoreForeign::getExamId, examId);
|