|
|
@@ -43,8 +43,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -381,6 +383,37 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean syncStudentData(StudentReportPlan studentReportPlan) {
|
|
|
+ //先删除所有的
|
|
|
+ reportRecordMapper.deleteRecordByPlanId(studentReportPlan.getId());
|
|
|
+
|
|
|
+ //拷贝试读报到的数据过来
|
|
|
+ StudentReportPlan tryReadingReportPlan = reportPlanService.getOne(
|
|
|
+ new QueryWrapper<StudentReportPlan>().lambda()
|
|
|
+ .eq(StudentReportPlan::getCategory, 2)
|
|
|
+ .eq(StudentReportPlan::getBandingTaskId, studentReportPlan.getBandingTaskId())
|
|
|
+ );
|
|
|
+
|
|
|
+ List<StudentReportRecord> records = reportRecordMapper.selectList(
|
|
|
+ new QueryWrapper<StudentReportRecord>().lambda()
|
|
|
+ .eq(StudentReportRecord::getStudentReportPlanId, tryReadingReportPlan.getId())
|
|
|
+ );
|
|
|
+ Date createDate = new Date();
|
|
|
+ Set<Long> existInsertUserIds = new HashSet<>();
|
|
|
+ for (StudentReportRecord record : records) {
|
|
|
+ if(existInsertUserIds.contains(record.getUserId())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ record.setReportTime(null);
|
|
|
+ record.setModifyUserId(null);
|
|
|
+ record.setModifyDate(null);
|
|
|
+ record.setCreateDate(createDate);
|
|
|
+ record.setStudentReportPlanId(studentReportPlan.getId());
|
|
|
+ record.setId(null);
|
|
|
+ reportRecordMapper.insert(record);
|
|
|
+ existInsertUserIds.add(record.getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
List<SyncStudentDataListVo> syncStudentDataList = this.baseMapper.getSyncStudentDataList(studentReportPlan.getId());
|
|
|
List<Long> newStudentIds = syncStudentDataList.stream().map(SyncStudentDataListVo::getNewStudentId).collect(Collectors.toList());
|
|
|
|