|
|
|
@ -4,6 +4,7 @@ import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.tz.platform.common.core.base.Result;
|
|
|
|
|
import com.tz.platform.common.core.bo.MemberImport;
|
|
|
|
|
import com.tz.platform.common.core.bo.MemberInfo;
|
|
|
|
|
import com.tz.platform.common.core.tools.BeanUtils;
|
|
|
|
|
import com.tz.platform.competitiion.pc.bo.PersonImport;
|
|
|
|
|
import com.tz.platform.competitiion.pc.bo.TeamImport;
|
|
|
|
|
import com.tz.platform.competitiion.pc.bo.TeamInfo;
|
|
|
|
@ -76,7 +77,7 @@ public class TeamMemberImportBiz {
|
|
|
|
|
//
|
|
|
|
|
List<String> collect = personList.stream().map(p -> p.getStudentNo()).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
|
|
List<User> allStu = userDao.findAllByStudentNoIn(collect);
|
|
|
|
|
if (allStu.isEmpty()){
|
|
|
|
|
if (allStu.isEmpty()) {
|
|
|
|
|
return Result.error("表中用户不存在");
|
|
|
|
|
}
|
|
|
|
|
// 对personList进行分组,以studentNo和schoolName作为key
|
|
|
|
@ -136,7 +137,7 @@ public class TeamMemberImportBiz {
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//批量新增入库
|
|
|
|
|
List<CompetitionMember> newMembers = competitionMembers.stream()
|
|
|
|
|
.filter(member -> memberDao.findByCompetitionIdAndStudentNoAndSchool(competitionId,member.getStudentNo(), member.getSchool()).isEmpty())
|
|
|
|
|
.filter(member -> memberDao.findByCompetitionIdAndStudentNoAndSchool(competitionId, member.getStudentNo(), member.getSchool()).isEmpty())
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
if (!competitionMembers.isEmpty()) {
|
|
|
|
|
memberDao.saveAll(competitionMembers);
|
|
|
|
@ -158,8 +159,18 @@ public class TeamMemberImportBiz {
|
|
|
|
|
teamList = excelAnalysisHelper.getList(file.getInputStream(), TeamImport.class, 0, 1);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//用户校验
|
|
|
|
|
assert teamList != null;
|
|
|
|
|
List<String> collect = teamList.stream().map(TeamImport::getStudentNo).collect(Collectors.toList());
|
|
|
|
|
List<User> studentNoList = userDao.findAllByStudentNoIn(collect);
|
|
|
|
|
System.out.println(studentNoList);
|
|
|
|
|
if (studentNoList == null || studentNoList.isEmpty()
|
|
|
|
|
|| studentNoList.size() < teamList.size()) {
|
|
|
|
|
return Result.error("用户不存在!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MemberImport> neesSave = new ArrayList<>();
|
|
|
|
|
String temName = "";
|
|
|
|
|
List<String> teamNameList = new ArrayList<>();
|
|
|
|
@ -233,7 +244,10 @@ public class TeamMemberImportBiz {
|
|
|
|
|
temName = teamName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MemberInfo> mList = user.batchInsert(neesSave);
|
|
|
|
|
//售卖版不做新增操作,大赛版本直接新增用户
|
|
|
|
|
// List<MemberInfo> mList = user.batchInsert(neesSave);
|
|
|
|
|
|
|
|
|
|
List<MemberInfo> mList = BeanUtils.copyProperties(studentNoList, MemberInfo.class);
|
|
|
|
|
|
|
|
|
|
temamList.forEach(team -> {
|
|
|
|
|
try {
|
|
|
|
|