|
@@ -22,6 +22,7 @@ import org.dromara.system.domain.GameTeam;
|
|
|
import org.dromara.system.domain.bo.GameTeamBo;
|
|
|
import org.dromara.system.domain.request.UpdateTeamAthletesRequest;
|
|
|
import org.dromara.system.domain.vo.GameTeamVo;
|
|
|
+import org.dromara.system.service.IGameEventService;
|
|
|
import org.dromara.system.service.IGameTeamService;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -30,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 参赛队伍
|
|
@@ -45,6 +47,7 @@ import java.util.List;
|
|
|
public class GameTeamController extends BaseController {
|
|
|
|
|
|
private final IGameTeamService gameTeamService;
|
|
|
+ private final IGameEventService gameEventService;
|
|
|
|
|
|
/**
|
|
|
* 查询参赛队伍列表
|
|
@@ -65,6 +68,13 @@ public class GameTeamController extends BaseController {
|
|
|
ExcelResult<GameTeamVo> excelResult = null;
|
|
|
try {
|
|
|
excelResult = ExcelUtil.importExcel(file.getInputStream(), GameTeamVo.class, true);
|
|
|
+ Map<String, Long> eventIdNameMap = gameEventService.getEventIdNameMap();
|
|
|
+ excelResult.getList().stream().forEach(item -> {
|
|
|
+ //根据导入的赛事名称查询对应的赛事ID
|
|
|
+ if (eventIdNameMap.containsKey(item.getEventName())){
|
|
|
+ item.setEventId(eventIdNameMap.get(item.getEventName()));
|
|
|
+ }
|
|
|
+ });
|
|
|
List<GameTeam> list = MapstructUtils.convert(excelResult.getList(), GameTeam.class);
|
|
|
gameTeamService.saveBatch(list);
|
|
|
} catch (IOException e) {
|