|
@@ -29,18 +29,19 @@ import com.qmth.teachcloud.mark.dto.mark.ScoreItem;
|
|
import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
import com.qmth.teachcloud.mark.service.MarkPaperService;
|
|
import com.qmth.teachcloud.mark.service.MarkPaperService;
|
|
import com.qmth.teachcloud.mark.service.MarkStudentService;
|
|
import com.qmth.teachcloud.mark.service.MarkStudentService;
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -153,10 +154,13 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
|
|
}
|
|
}
|
|
if (!CollectionUtils.isEmpty(tcFinalScoreList)) {
|
|
if (!CollectionUtils.isEmpty(tcFinalScoreList)) {
|
|
successData.add("共导入" + tcFinalScoreList.size() + "条数据");
|
|
successData.add("共导入" + tcFinalScoreList.size() + "条数据");
|
|
- tcFinalScoreService.remove(examId, courseCode, paperNumber);
|
|
|
|
- tcFinalScoreService.saveBatch(tcFinalScoreList);
|
|
|
|
- trExamStudentService.remove(examId, courseCode, paperNumber);
|
|
|
|
- trBasicInfoService.remove(examId, courseCode, paperNumber);
|
|
|
|
|
|
+ List<TCFinalScore> tcFinalScoreDbSourceList = tcFinalScoreService.queryDbSourceList(examId, courseCode, paperNumber);
|
|
|
|
+ if (CollectionUtils.isEmpty(tcFinalScoreDbSourceList) || !CollectionUtils.isEqualCollection(tcFinalScoreDbSourceList, tcFinalScoreList)) {
|
|
|
|
+ tcFinalScoreService.removeByIds(tcFinalScoreDbSourceList.stream().map(s -> s.getId()).collect(Collectors.toList()));
|
|
|
|
+ tcFinalScoreService.saveBatch(tcFinalScoreList);
|
|
|
|
+ trExamStudentService.remove(examId, courseCode, paperNumber);
|
|
|
|
+ trBasicInfoService.remove(examId, courseCode, paperNumber);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");
|
|
messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");
|
|
@@ -272,10 +276,13 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
|
|
}
|
|
}
|
|
if (!CollectionUtils.isEmpty(tcFinalScoreList)) {
|
|
if (!CollectionUtils.isEmpty(tcFinalScoreList)) {
|
|
successData.add("共同步" + tcFinalScoreList.size() + "条数据");
|
|
successData.add("共同步" + tcFinalScoreList.size() + "条数据");
|
|
- tcFinalScoreService.remove(examId, courseCode, paperNumber);
|
|
|
|
- tcFinalScoreService.saveBatch(tcFinalScoreList);
|
|
|
|
- trExamStudentService.remove(examId, courseCode, paperNumber);
|
|
|
|
- trBasicInfoService.remove(examId, courseCode, paperNumber);
|
|
|
|
|
|
+ List<TCFinalScore> tcFinalScoreDbSourceList = tcFinalScoreService.queryDbSourceList(examId, courseCode, paperNumber);
|
|
|
|
+ if (CollectionUtils.isEmpty(tcFinalScoreDbSourceList) || !CollectionUtils.isEqualCollection(tcFinalScoreDbSourceList, tcFinalScoreList)) {
|
|
|
|
+ tcFinalScoreService.removeByIds(tcFinalScoreDbSourceList.stream().map(s -> s.getId()).collect(Collectors.toList()));
|
|
|
|
+ tcFinalScoreService.saveBatch(tcFinalScoreList);
|
|
|
|
+ trExamStudentService.remove(examId, courseCode, paperNumber);
|
|
|
|
+ trBasicInfoService.remove(examId, courseCode, paperNumber);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");
|
|
messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");
|
|
@@ -310,4 +317,19 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
|
|
.eq(TCFinalScore::getCourseCode, courseCode)
|
|
.eq(TCFinalScore::getCourseCode, courseCode)
|
|
.eq(TCFinalScore::getPaperNumber, paperNumber));
|
|
.eq(TCFinalScore::getPaperNumber, paperNumber));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据考试id/课程编码/试卷编码查询数据库数据
|
|
|
|
+ *
|
|
|
|
+ * @param examId
|
|
|
|
+ * @param courseCode
|
|
|
|
+ * @param paperNumber
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public List<TCFinalScore> queryDbSourceList(Long examId, String courseCode, String paperNumber) {
|
|
|
|
+ return tcFinalScoreService.list(new QueryWrapper<TCFinalScore>().lambda().eq(TCFinalScore::getExamId, examId)
|
|
|
|
+ .eq(TCFinalScore::getCourseCode, courseCode)
|
|
|
|
+ .eq(TCFinalScore::getPaperNumber, paperNumber));
|
|
|
|
+ }
|
|
}
|
|
}
|