|
|
|
@ -1,28 +1,22 @@
|
|
|
|
|
package com.tz.platform.competitiion.pc.biz;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
|
import com.alibaba.excel.enums.CellExtraTypeEnum;
|
|
|
|
|
import com.alibaba.excel.read.listener.PageReadListener;
|
|
|
|
|
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.competitiion.pc.bo.PersonImport;
|
|
|
|
|
import com.tz.platform.competitiion.pc.bo.TeamImport;
|
|
|
|
|
import com.tz.platform.competitiion.pc.bo.TeamInfo;
|
|
|
|
|
import com.tz.platform.competitiion.pc.helper.ExcelAnalysisHelper;
|
|
|
|
|
import com.tz.platform.competitiion.pc.helper.UploadDataListener;
|
|
|
|
|
import com.tz.platform.competitiion.pc.vo.ImportTeamMemberVO;
|
|
|
|
|
import com.tz.platform.entity.Competition;
|
|
|
|
|
import com.tz.platform.entity.CompetitionMember;
|
|
|
|
|
import com.tz.platform.entity.CompetitionTeam;
|
|
|
|
|
import com.tz.platform.feign.IFeignProvince;
|
|
|
|
|
import com.tz.platform.feign.IFeignStudentLevel;
|
|
|
|
|
import com.tz.platform.entity.User;
|
|
|
|
|
import com.tz.platform.feign.user.IFeignUser;
|
|
|
|
|
import com.tz.platform.feign.vo.ProvinceVO;
|
|
|
|
|
import com.tz.platform.feign.vo.StudentLevelVo;
|
|
|
|
|
import com.tz.platform.repository.CompetitionDao;
|
|
|
|
|
import com.tz.platform.repository.CompetitionMemberDao;
|
|
|
|
|
import com.tz.platform.repository.CompetitionTeamDao;
|
|
|
|
|
import com.tz.platform.repository.UserDao;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@ -33,6 +27,7 @@ import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
@ -43,7 +38,8 @@ public class TeamMemberImportBiz {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IFeignUser user;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserDao userDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private CompetitionTeamDao teamDao;
|
|
|
|
@ -52,42 +48,132 @@ public class TeamMemberImportBiz {
|
|
|
|
|
private CompetitionMemberDao memberDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private CompetitionDao competitionDao;
|
|
|
|
|
CompetitionDao competitionDao;
|
|
|
|
|
|
|
|
|
|
public Result<String> uploadPersonExcel(MultipartFile file, Long competitionId, Integer stageId, Long userId) {
|
|
|
|
|
if (file == null) {
|
|
|
|
|
return Result.error("请上传文件");
|
|
|
|
|
}
|
|
|
|
|
if (competitionId == null || stageId == null) {
|
|
|
|
|
return Result.error("大赛或赛段不能为空");
|
|
|
|
|
}
|
|
|
|
|
ExcelAnalysisHelper<PersonImport> excelAnalysisHelper = new ExcelAnalysisHelper<>();
|
|
|
|
|
List<PersonImport> personList = null;
|
|
|
|
|
try {
|
|
|
|
|
personList = excelAnalysisHelper.getList(file.getInputStream(), PersonImport.class, 0, 1); //表格数据转换成list
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Result<String> teamImport(MultipartFile file ,Long userNo,Long competitionId,Integer stageId){
|
|
|
|
|
if(competitionId==null||stageId == null){
|
|
|
|
|
List<String> collect = personList.stream().map(p -> p.getStudentNo()).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
|
|
List<User> allStu = userDao.findAllByStudentNoIn(collect);
|
|
|
|
|
if (allStu.isEmpty()){
|
|
|
|
|
return Result.error("表中用户不存在");
|
|
|
|
|
}
|
|
|
|
|
// 对personList进行分组,以studentNo和schoolName作为key
|
|
|
|
|
Map<String, List<PersonImport>> groupedByStudentNoAndSchoolName = personList.stream()
|
|
|
|
|
.collect(Collectors.groupingBy(personImport -> {
|
|
|
|
|
String studentNo = StringUtils.trimAllWhitespace(filter(personImport.getStudentNo()));
|
|
|
|
|
String schoolName = StringUtils.trimAllWhitespace(filter(personImport.getSchoolName()));
|
|
|
|
|
return studentNo + "_" + schoolName;
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
// 过滤掉studentNo和schoolName同时重复的数据
|
|
|
|
|
List<PersonImport> filteredPersonImports = groupedByStudentNoAndSchoolName.values().stream()
|
|
|
|
|
.filter(list -> list.size() == 1)
|
|
|
|
|
.flatMap(List::stream)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//找出数据库表和导入表格匹配的用户数据
|
|
|
|
|
List<PersonImport> matchedPersonImports = filteredPersonImports.stream()
|
|
|
|
|
.filter(personImport -> {
|
|
|
|
|
String studentNo = StringUtils.trimAllWhitespace(filter(personImport.getStudentNo()));
|
|
|
|
|
String name = StringUtils.trimAllWhitespace(filter(personImport.getName()));
|
|
|
|
|
String className = StringUtils.trimAllWhitespace(filter(personImport.getClassName()));
|
|
|
|
|
String schoolName = StringUtils.trimAllWhitespace(filter(personImport.getSchoolName()));
|
|
|
|
|
|
|
|
|
|
return allStu.stream()
|
|
|
|
|
.anyMatch(user -> user.getStudentNo().toString().equals(studentNo)
|
|
|
|
|
&& user.getName().equals(name)
|
|
|
|
|
&& user.getClassName().equals(className)
|
|
|
|
|
&& user.getSchool().equals(schoolName));
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//将过滤后的数据复制到对应的对象
|
|
|
|
|
List<CompetitionMember> competitionMembers = matchedPersonImports.stream()
|
|
|
|
|
.map(matchedPersonImport -> {
|
|
|
|
|
CompetitionMember competitionMember = new CompetitionMember();
|
|
|
|
|
competitionMember.setStageId(stageId);
|
|
|
|
|
competitionMember.setTeamId(0); // 个人赛
|
|
|
|
|
competitionMember.setTeamName("个人赛");
|
|
|
|
|
// 寻找匹配的 User 对象,并设置对应的 userId
|
|
|
|
|
allStu.stream()
|
|
|
|
|
.filter(user -> user.getStudentNo().toString().equals(StringUtils.trimAllWhitespace(filter(matchedPersonImport.getStudentNo())))
|
|
|
|
|
&& user.getName().equals(StringUtils.trimAllWhitespace(filter(matchedPersonImport.getName())))
|
|
|
|
|
&& user.getClassName().equals(StringUtils.trimAllWhitespace(filter(matchedPersonImport.getClassName())))
|
|
|
|
|
&& user.getSchool().equals(StringUtils.trimAllWhitespace(filter(matchedPersonImport.getSchoolName()))))
|
|
|
|
|
.findFirst().ifPresent(matchedUser -> {
|
|
|
|
|
competitionMember.setUserId(matchedUser.getId());
|
|
|
|
|
competitionMember.setClassId(matchedUser.getClassId());
|
|
|
|
|
});
|
|
|
|
|
competitionMember.setSchool(matchedPersonImport.getSchoolName());
|
|
|
|
|
competitionMember.setClassName(matchedPersonImport.getClassName());
|
|
|
|
|
competitionMember.setName(matchedPersonImport.getName());
|
|
|
|
|
competitionMember.setStudentNo(matchedPersonImport.getStudentNo());
|
|
|
|
|
competitionMember.setCompetitionId(competitionId);
|
|
|
|
|
return competitionMember;
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//批量新增入库
|
|
|
|
|
List<CompetitionMember> newMembers = competitionMembers.stream()
|
|
|
|
|
.filter(member -> memberDao.findByCompetitionIdAndStudentNoAndSchool(competitionId,member.getStudentNo(), member.getSchool()).isEmpty())
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
if (!newMembers.isEmpty()) {
|
|
|
|
|
memberDao.saveAll(newMembers);
|
|
|
|
|
updatePeopleCount(competitionId);
|
|
|
|
|
return Result.success("success");
|
|
|
|
|
} else {
|
|
|
|
|
return Result.success("No new members to save.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Result<String> teamImport(MultipartFile file, Long userNo, Long competitionId, Integer stageId) {
|
|
|
|
|
if (competitionId == null || stageId == null) {
|
|
|
|
|
return Result.error("大赛或赛段不能为空");
|
|
|
|
|
}
|
|
|
|
|
ExcelAnalysisHelper<TeamImport> excelAnalysisHelper = new ExcelAnalysisHelper<>();
|
|
|
|
|
List<TeamImport> teamList = null;
|
|
|
|
|
try {
|
|
|
|
|
teamList = excelAnalysisHelper.getList(file.getInputStream(), TeamImport.class,0,1);
|
|
|
|
|
} catch (IOException e) {e.printStackTrace();
|
|
|
|
|
teamList = excelAnalysisHelper.getList(file.getInputStream(), TeamImport.class, 0, 1);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
List<MemberImport> neesSave = new ArrayList<>();
|
|
|
|
|
String temName = "";
|
|
|
|
|
List<String> teamNameList = new ArrayList<>();
|
|
|
|
|
List<TeamInfo> temamList = new ArrayList<>();
|
|
|
|
|
for(int i = 0;i<teamList.size();i++){
|
|
|
|
|
for (int i = 0; i < teamList.size(); i++) {
|
|
|
|
|
TeamImport team = teamList.get(i);
|
|
|
|
|
|
|
|
|
|
String teamName = StringUtils.trimAllWhitespace(filter(team.getTeam()));
|
|
|
|
|
String teacher = StringUtils.trimAllWhitespace(team.getTeacher1());
|
|
|
|
|
String teacher2 =StringUtils.trimAllWhitespace(team.getTeacher2());
|
|
|
|
|
if(StringUtils.hasText(teacher2)){
|
|
|
|
|
teacher+=","+teacher2;
|
|
|
|
|
String teacher2 = StringUtils.trimAllWhitespace(team.getTeacher2());
|
|
|
|
|
if (StringUtils.hasText(teacher2)) {
|
|
|
|
|
teacher += "," + teacher2;
|
|
|
|
|
}
|
|
|
|
|
String school = StringUtils.trimAllWhitespace(team.getSchool());
|
|
|
|
|
String className = StringUtils.trimAllWhitespace(team.getClassName());
|
|
|
|
|
String province =StringUtils.trimAllWhitespace(team.getProvince());
|
|
|
|
|
String province = StringUtils.trimAllWhitespace(team.getProvince());
|
|
|
|
|
String level = StringUtils.trimAllWhitespace(team.getLevel());
|
|
|
|
|
String studentNo = StringUtils.trimAllWhitespace(dealStudentNo(team.getStudentNo()));
|
|
|
|
|
boolean exsit = false;
|
|
|
|
|
MemberImport memberImport = neesSave.stream().filter(memberImport1 -> memberImport1.getStudentNo().equals(studentNo)).findFirst().orElse(null);
|
|
|
|
|
if(memberImport == null){
|
|
|
|
|
if (memberImport == null) {
|
|
|
|
|
memberImport = new MemberImport();
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
exsit = true;
|
|
|
|
|
}
|
|
|
|
|
memberImport.setLevel(level);
|
|
|
|
@ -97,15 +183,15 @@ public class TeamMemberImportBiz {
|
|
|
|
|
memberImport.setProvince(province);
|
|
|
|
|
memberImport.setClassName(className);
|
|
|
|
|
memberImport.setTeacher(teacher);
|
|
|
|
|
if(exsit == false){
|
|
|
|
|
if (exsit == false) {
|
|
|
|
|
neesSave.add(memberImport);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isEmpty(teamName)){
|
|
|
|
|
if (StringUtils.isEmpty(teamName)) {
|
|
|
|
|
// System.out.println(JSONUtil.toJsonStr(teamList.get(i)));
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(!teamNameList.contains(teamName)){
|
|
|
|
|
if (!teamNameList.contains(teamName)) {
|
|
|
|
|
teamNameList.add(teamName);
|
|
|
|
|
TeamInfo ti = new TeamInfo();
|
|
|
|
|
ti.setTeamName(teamName);
|
|
|
|
@ -118,7 +204,7 @@ public class TeamMemberImportBiz {
|
|
|
|
|
tmp.add(memberImport);
|
|
|
|
|
ti.setMemberList(tmp);
|
|
|
|
|
temamList.add(ti);
|
|
|
|
|
}else if(!temName.equals(teamName)){
|
|
|
|
|
} else if (!temName.equals(teamName)) {
|
|
|
|
|
teamNameList.add(teamName);
|
|
|
|
|
TeamInfo ti = new TeamInfo();
|
|
|
|
|
ti.setClassName(className);
|
|
|
|
@ -131,25 +217,25 @@ public class TeamMemberImportBiz {
|
|
|
|
|
tmp.add(memberImport);
|
|
|
|
|
ti.setMemberList(tmp);
|
|
|
|
|
temamList.add(ti);
|
|
|
|
|
}else{
|
|
|
|
|
TeamInfo ti = temamList.get(temamList.size()-1);
|
|
|
|
|
} else {
|
|
|
|
|
TeamInfo ti = temamList.get(temamList.size() - 1);
|
|
|
|
|
ti.getMemberList().add(memberImport);
|
|
|
|
|
}
|
|
|
|
|
temName = teamName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MemberInfo> mList = user.batchInsert(neesSave);
|
|
|
|
|
List<MemberInfo> mList = user.batchInsert(neesSave);
|
|
|
|
|
|
|
|
|
|
temamList.forEach(team->{
|
|
|
|
|
temamList.forEach(team -> {
|
|
|
|
|
try {
|
|
|
|
|
if (StringUtils.isEmpty(team.getTeamName())) {
|
|
|
|
|
System.out.println("团队名称为空 " + JSONUtil.toJsonStr(team));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
String skey = team.getMemberList().stream().map(MemberImport::getStudentNo).sorted().collect(Collectors.joining(","));
|
|
|
|
|
CompetitionTeam t =teamDao.getBySkeyAndCompetitionIdAndStageId(skey,competitionId,stageId);
|
|
|
|
|
if(t== null){
|
|
|
|
|
t= new CompetitionTeam();
|
|
|
|
|
CompetitionTeam t = teamDao.getBySkeyAndCompetitionIdAndStageId(skey, competitionId, stageId);
|
|
|
|
|
if (t == null) {
|
|
|
|
|
t = new CompetitionTeam();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t.setCompetitionId(competitionId);
|
|
|
|
@ -160,7 +246,7 @@ public class TeamMemberImportBiz {
|
|
|
|
|
t.setClassName(team.getClassName());
|
|
|
|
|
t.setSkey(skey);
|
|
|
|
|
t.setMemberCount(team.getMemberList().size());
|
|
|
|
|
if(team.getMemberList().size()== 0 ){
|
|
|
|
|
if (team.getMemberList().size() == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
CompetitionTeam teamInfo = teamDao.save(t);
|
|
|
|
@ -194,7 +280,7 @@ public class TeamMemberImportBiz {
|
|
|
|
|
if (memberList.size() > 0) {
|
|
|
|
|
memberDao.saveAll(memberList);
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -204,42 +290,42 @@ public class TeamMemberImportBiz {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String filter(String str) {
|
|
|
|
|
public String filter(String str) {
|
|
|
|
|
|
|
|
|
|
if(str.trim().isEmpty()){
|
|
|
|
|
if (str.trim().isEmpty()) {
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
String pattern="[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]";
|
|
|
|
|
String reStr="";
|
|
|
|
|
Pattern emoji=Pattern.compile(pattern);
|
|
|
|
|
Matcher emojiMatcher=emoji.matcher(str);
|
|
|
|
|
str=emojiMatcher.replaceAll(reStr);
|
|
|
|
|
String pattern = "[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]";
|
|
|
|
|
String reStr = "";
|
|
|
|
|
Pattern emoji = Pattern.compile(pattern);
|
|
|
|
|
Matcher emojiMatcher = emoji.matcher(str);
|
|
|
|
|
str = emojiMatcher.replaceAll(reStr);
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String dealStudentNo(String studentNo){
|
|
|
|
|
if(studentNo==null){
|
|
|
|
|
private String dealStudentNo(String studentNo) {
|
|
|
|
|
if (studentNo == null) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
studentNo =studentNo.trim();
|
|
|
|
|
if(studentNo.contains("'")){
|
|
|
|
|
studentNo = studentNo.replace("'","");
|
|
|
|
|
studentNo = studentNo.trim();
|
|
|
|
|
if (studentNo.contains("'")) {
|
|
|
|
|
studentNo = studentNo.replace("'", "");
|
|
|
|
|
}
|
|
|
|
|
if(studentNo.contains(" ")){
|
|
|
|
|
studentNo = studentNo.replaceAll(" ","");
|
|
|
|
|
if (studentNo.contains(" ")) {
|
|
|
|
|
studentNo = studentNo.replaceAll(" ", "");
|
|
|
|
|
}
|
|
|
|
|
return studentNo;
|
|
|
|
|
return studentNo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updatePeopleCount(Long competitionId){
|
|
|
|
|
int peopleCount = memberDao.countByCompetitionId(competitionId);
|
|
|
|
|
private void updatePeopleCount(Long competitionId) {
|
|
|
|
|
int peopleCount = memberDao.countByCompetitionId(competitionId);
|
|
|
|
|
int teamCount = teamDao.countByCompetitionId(competitionId);
|
|
|
|
|
competitionDao.updatePeopleCount(peopleCount,teamCount,competitionId);
|
|
|
|
|
competitionDao.updatePeopleCount(peopleCount, teamCount, competitionId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
|
public Result<String> teamMemberImport(ImportTeamMemberVO vo){
|
|
|
|
|
public Result<String> teamMemberImport(ImportTeamMemberVO vo) {
|
|
|
|
|
List<MemberImport> neesSave = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
vo.getMemberList().forEach(importMemberInfo -> {
|
|
|
|
@ -254,12 +340,12 @@ public class TeamMemberImportBiz {
|
|
|
|
|
neesSave.add(memberImport);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
List<MemberInfo> mList = user.batchInsert(neesSave);
|
|
|
|
|
List<MemberInfo> mList = user.batchInsert(neesSave);
|
|
|
|
|
|
|
|
|
|
String skey = mList.stream().map(MemberInfo::getStudentNo).collect(Collectors.joining(","));
|
|
|
|
|
CompetitionTeam t =teamDao.getBySkey(skey);
|
|
|
|
|
if(t==null){
|
|
|
|
|
t= new CompetitionTeam();
|
|
|
|
|
CompetitionTeam t = teamDao.getBySkey(skey);
|
|
|
|
|
if (t == null) {
|
|
|
|
|
t = new CompetitionTeam();
|
|
|
|
|
}
|
|
|
|
|
t.setCompetitionId(vo.getCompId());
|
|
|
|
|
t.setStageId(vo.getStageId());
|
|
|
|
@ -270,9 +356,9 @@ public class TeamMemberImportBiz {
|
|
|
|
|
t.setMemberCount(mList.size());
|
|
|
|
|
CompetitionTeam teamInfo = teamDao.save(t);
|
|
|
|
|
List<CompetitionMember> memberList = new ArrayList<>();
|
|
|
|
|
mList.forEach(memberInfo->{
|
|
|
|
|
CompetitionMember member = memberDao.getByCompetitionIdAndStageIdAndUserIdAndTeamId(vo.getCompId(), vo.getStageId(), memberInfo.getId(),teamInfo.getId());
|
|
|
|
|
if(member == null){
|
|
|
|
|
mList.forEach(memberInfo -> {
|
|
|
|
|
CompetitionMember member = memberDao.getByCompetitionIdAndStageIdAndUserIdAndTeamId(vo.getCompId(), vo.getStageId(), memberInfo.getId(), teamInfo.getId());
|
|
|
|
|
if (member == null) {
|
|
|
|
|
member = new CompetitionMember();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -291,21 +377,21 @@ public class TeamMemberImportBiz {
|
|
|
|
|
memberList.add(member);
|
|
|
|
|
});
|
|
|
|
|
memberDao.saveAll(memberList);
|
|
|
|
|
return Result.success("导入成功");
|
|
|
|
|
return Result.success("导入成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
ExcelAnalysisHelper<TeamImport> excelAnalysisHelper = new ExcelAnalysisHelper<>();
|
|
|
|
|
List<TeamImport> teamList = excelAnalysisHelper.getList("/Users/tianchengjun/Desktop/资料/导入数据表2/报名汇总.xlsx",TeamImport.class,0,1);
|
|
|
|
|
List<TeamImport> teamList = excelAnalysisHelper.getList("/Users/tianchengjun/Desktop/资料/导入数据表2/报名汇总.xlsx", TeamImport.class, 0, 1);
|
|
|
|
|
// teamList.forEach(teamImport -> {
|
|
|
|
|
// System.out.println(JSONUtil.toJsonStr(teamImport));
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
Map<String,List<TeamImport>> tmpMap = teamList.stream().collect(Collectors.groupingBy(TeamImport::getStudentNo,Collectors.toList()));
|
|
|
|
|
tmpMap.forEach((k,v)->{
|
|
|
|
|
if(v.size()!=1){
|
|
|
|
|
System.out.println(k+":"+v.size());
|
|
|
|
|
Map<String, List<TeamImport>> tmpMap = teamList.stream().collect(Collectors.groupingBy(TeamImport::getStudentNo, Collectors.toList()));
|
|
|
|
|
tmpMap.forEach((k, v) -> {
|
|
|
|
|
if (v.size() != 1) {
|
|
|
|
|
System.out.println(k + ":" + v.size());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -377,4 +463,5 @@ public class TeamMemberImportBiz {
|
|
|
|
|
// });
|
|
|
|
|
// System.out.println("团队总数:"+temamList.size()+" 团队成员数量:"+teamList.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|