|
|
@ -596,8 +596,21 @@ public class CompeteService implements ICompeteService{ |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<CompeteVo.EnrollPlayInfo> enrollPlayInfo(QueryDto<CompeteDto.CompeteType> params) { |
|
|
|
public String enrollPlayInfo(QueryDto<CompeteDto.CompeteType> params) { |
|
|
|
CompeteDto.CompeteType competeType = params.getParam(); |
|
|
|
List<String> filePath = new ArrayList<>(); |
|
|
|
//查询大赛id
|
|
|
|
CompeteVo.CompeteTime competeTimeByType = competeTimeDao.getCompeteTimeByType(competeType.getType(), System.currentTimeMillis()); |
|
|
|
// //查询此大赛是否关联wps
|
|
|
|
// WpsDto.VisitWpsUrl visitWpsUrl = new WpsDto.VisitWpsUrl();
|
|
|
|
// visitWpsUrl.setBusinessId(competeTimeByType.getId());
|
|
|
|
// visitWpsUrl.setBusinessType((byte) 11);
|
|
|
|
// visitWpsUrl.setUserId(params.getUserId());
|
|
|
|
// filePath = tallFeignClient.queryVisitUrls(visitWpsUrl);
|
|
|
|
// if(CollectionUtil.isNotEmpty(filePath)){
|
|
|
|
// //TODO 删除以前的关联信息
|
|
|
|
// }
|
|
|
|
//查询报名信息
|
|
|
|
int typeId = competeType.getType(); |
|
|
|
ArrayList<CompeteVo.EnrollPlayInfo> arrayList = new ArrayList(); |
|
|
|
//1:查询该类型下所有项目的id,name,team信息,排除level为1的
|
|
|
@ -622,20 +635,31 @@ public class CompeteService implements ICompeteService{ |
|
|
|
for (CompeteVo.Team team1 : teamList){ |
|
|
|
//6:获取团队下队员的详细信息
|
|
|
|
CompeteVo.EnrollPlayInfo enrollPlayInfo = competeEnrollDao.getPlayerAndProjectForTeam(team1.getPlayer_id()); |
|
|
|
enrollPlayInfo.setName(projectInfo.getName()); |
|
|
|
arrayList.add(enrollPlayInfo); |
|
|
|
if(ObjectUtil.isNotNull(enrollPlayInfo)) { |
|
|
|
enrollPlayInfo.setName(projectInfo.getName()); |
|
|
|
arrayList.add(enrollPlayInfo); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//7:将数据放入excel表格
|
|
|
|
InputStream inputStream = null; |
|
|
|
//excel表格行列对象
|
|
|
|
List<List<PoiUtil.PoiUtilCell>> list = new ArrayList<>(); |
|
|
|
List<PoiUtil.PoiUtilCell> title = new ArrayList<>(); |
|
|
|
title.add(new PoiUtil.PoiUtilCell()); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("比赛项目名称")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("组别")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("报名人姓名")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("身份证号")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("手机号")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("其他参赛人员")); |
|
|
|
list.add(title); |
|
|
|
try { |
|
|
|
Workbook workbook = new XSSFWorkbook(); |
|
|
|
int i = 1; |
|
|
|
for (CompeteVo.EnrollPlayInfo enrollPlayInfo : arrayList){ |
|
|
|
//行对象
|
|
|
|
List<PoiUtil.PoiUtilCell> cells = new ArrayList<>(); |
|
|
|
cells.add(new PoiUtil.PoiUtilCell(i+"",1,1,300,18)); |
|
|
|
//单元格对象
|
|
|
|
PoiUtil.PoiUtilCell poiUtilCel = new PoiUtil.PoiUtilCell(enrollPlayInfo.getName()); |
|
|
|
cells.add(poiUtilCel); |
|
|
@ -650,40 +674,47 @@ public class CompeteService implements ICompeteService{ |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel5 = new PoiUtil.PoiUtilCell(enrollPlayInfo.getOthersName()); |
|
|
|
cells.add(poiUtilCel5); |
|
|
|
list.add(cells); |
|
|
|
i++; |
|
|
|
} |
|
|
|
//生成excel表格对象,并将数据放入
|
|
|
|
Workbook wbs = PoiUtil.exportWB("Sheet1", list, workbook); |
|
|
|
Workbook wbs = PoiUtil.exportWB("总表", list, workbook); |
|
|
|
//8:关联金山在线文档
|
|
|
|
String name = "报名表" + ".xlsx"; |
|
|
|
String name = "跳绳比赛报名表" + ".xlsx"; |
|
|
|
String filepath = "mt/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
|
|
|
|
String path = PropUtil.path + filepath; |
|
|
|
File tmpFile = new File(path); |
|
|
|
if (!tmpFile.getParentFile().exists()) { |
|
|
|
tmpFile.getParentFile().mkdirs(); |
|
|
|
} |
|
|
|
//PropUtil.path获取配置文件中的path属性,拼接生成写入信息的文件名,
|
|
|
|
String path = PropUtil.path + File.separator + filepath; |
|
|
|
File file = new File(path); |
|
|
|
OutputStream stream = new FileOutputStream(file); |
|
|
|
wbs.write(stream); |
|
|
|
stream.close(); |
|
|
|
//获取比赛的第几届信息
|
|
|
|
CompeteVo.CompeteTime competeTimeByType = competeTimeDao.getCompeteTimeByType(competeType.getType(), System.currentTimeMillis()); |
|
|
|
//关联wps
|
|
|
|
WpsDto.Business business = new WpsDto.Business(); |
|
|
|
business.setBusinessId(competeTimeByType.getId()); |
|
|
|
business.setBusinessType((byte) 11); |
|
|
|
business.setFileName(name); |
|
|
|
business.setFilePath(filepath); |
|
|
|
business.setFilePath(path); |
|
|
|
business.setRealFilePath(path); |
|
|
|
business.setFileSize(file.length()); |
|
|
|
business.setUserId(params.getUserId()); |
|
|
|
business.setOperation(WebConstant.Wps.USER_OPERATION_NEW); |
|
|
|
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_READ); |
|
|
|
log.info("跳绳比赛报名表关联wps:{}",business); |
|
|
|
tallFeignClient.saveWpsFile(business); |
|
|
|
//查询wps
|
|
|
|
WpsDto.VisitWpsUrl visitWpsUrl = new WpsDto.VisitWpsUrl(); |
|
|
|
visitWpsUrl.setBusinessId(competeTimeByType.getId()); |
|
|
|
visitWpsUrl.setBusinessType((byte) 11); |
|
|
|
visitWpsUrl.setUserId(params.getUserId()); |
|
|
|
tallFeignClient.queryVisitUrls(visitWpsUrl); |
|
|
|
filePath = tallFeignClient.queryVisitUrls(visitWpsUrl); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
return arrayList; |
|
|
|
|
|
|
|
return filePath.get(0); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|