From 5561c92140cdb594a84c4702bfb44f3c0b75eab4 Mon Sep 17 00:00:00 2001 From: zy_Java <654600784@qq.com> Date: Wed, 25 Nov 2020 17:07:48 +0800 Subject: [PATCH 1/4] 20201125v1.3 --- .../java/com/ccsens/mt/bean/vo/TableVo.java | 9 ++ .../com/ccsens/mt/service/ExcelService.java | 8 +- mt/src/main/resources/application.yml | 4 +- .../resources/mapper_dao/CompetePlayerDao.xml | 93 +++++++++---------- .../resources/mapper_dao/CompeteVideoDao.xml | 2 - tall/src/main/resources/application.yml | 4 +- 6 files changed, 62 insertions(+), 58 deletions(-) diff --git a/mt/src/main/java/com/ccsens/mt/bean/vo/TableVo.java b/mt/src/main/java/com/ccsens/mt/bean/vo/TableVo.java index 1a7f20ff..97127509 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/vo/TableVo.java +++ b/mt/src/main/java/com/ccsens/mt/bean/vo/TableVo.java @@ -2,6 +2,8 @@ package com.ccsens.mt.bean.vo; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.IdcardUtil; +import cn.hutool.core.util.StrUtil; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -46,6 +48,13 @@ public class TableVo { private String bodyProtect; @ApiModelProperty("参赛队伍") private String joinTeam; + + public int getAge(){ + if(StrUtil.isNotEmpty(idCard) && age == 0){ + return IdcardUtil.getAgeByIdCard(idCard); + } + return age; + } } diff --git a/mt/src/main/java/com/ccsens/mt/service/ExcelService.java b/mt/src/main/java/com/ccsens/mt/service/ExcelService.java index ab453062..5bb8a383 100644 --- a/mt/src/main/java/com/ccsens/mt/service/ExcelService.java +++ b/mt/src/main/java/com/ccsens/mt/service/ExcelService.java @@ -916,14 +916,14 @@ public class ExcelService implements IExcelService { List competeAllCountList = new ArrayList<>(); if(ObjectUtil.isNotNull(competeTime)){ //查询个人赛的数量统计 - List nums = competePlayerDao.getJoinNumByType(competeTime.getType()); - competeAllCountList.addAll(nums); +// List nums = competePlayerDao.getJoinNumByType(competeTime.getType()); +// competeAllCountList.addAll(nums); //查询限制组别的团体赛的统计 List groupRuleNum = competePlayerDao.getJoinRuleTeamNumByType(competeTime.getType()); competeAllCountList.addAll(groupRuleNum); //查询团体赛的数量统计 - List groupNum = competePlayerDao.getJoinTeamNumByType(competeTime.getType()); - competeAllCountList.addAll(groupNum); +// List groupNum = competePlayerDao.getJoinTeamNumByType(competeTime.getType()); +// competeAllCountList.addAll(groupNum); } CollectionUtil.sort(competeAllCountList,(t1,t2)-> (int)(t1.getProjectId() - t2.getProjectId())); return competeAllCountList; diff --git a/mt/src/main/resources/application.yml b/mt/src/main/resources/application.yml index b9b264a7..4ecd13fd 100644 --- a/mt/src/main/resources/application.yml +++ b/mt/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: prod - include: common, util-prod + active: dev + include: common, util-dev diff --git a/mt/src/main/resources/mapper_dao/CompetePlayerDao.xml b/mt/src/main/resources/mapper_dao/CompetePlayerDao.xml index 0a52901b..5cd8e03f 100644 --- a/mt/src/main/resources/mapper_dao/CompetePlayerDao.xml +++ b/mt/src/main/resources/mapper_dao/CompetePlayerDao.xml @@ -405,64 +405,61 @@ \ No newline at end of file diff --git a/mt/src/main/resources/mapper_dao/CompeteVideoDao.xml b/mt/src/main/resources/mapper_dao/CompeteVideoDao.xml index 3dcd0872..afe3cafe 100644 --- a/mt/src/main/resources/mapper_dao/CompeteVideoDao.xml +++ b/mt/src/main/resources/mapper_dao/CompeteVideoDao.xml @@ -30,8 +30,6 @@ - - ) tcpl on tcpl.company_id=tcc.id where tct.id= #{param.id} diff --git a/tall/src/main/resources/application.yml b/tall/src/main/resources/application.yml index e75cc2c3..b5408a3a 100644 --- a/tall/src/main/resources/application.yml +++ b/tall/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: prod - include: util-prod,common + active: dev + include: util-dev,common From 1e2c4f162c31f61572592fb3266b14057309734b Mon Sep 17 00:00:00 2001 From: wang0018 <1007152140@qq.com> Date: Wed, 25 Nov 2020 17:33:55 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=AF=94=E8=B5=9B=E5=87=BA=E5=9C=BA?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ccsens/mt/bean/vo/CompeteExcelVo.java | 2 +- .../mt/persist/dao/CompeteScoreDao.java | 6 + .../com/ccsens/mt/service/ExcelService.java | 285 ++++++------------ mt/src/main/resources/application.yml | 4 +- .../resources/mapper_dao/CompeteScoreDao.xml | 110 +++++++ tall/src/main/resources/application.yml | 4 +- 6 files changed, 206 insertions(+), 205 deletions(-) diff --git a/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteExcelVo.java b/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteExcelVo.java index afc375ca..f1fd1a83 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteExcelVo.java +++ b/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteExcelVo.java @@ -32,7 +32,7 @@ public class CompeteExcelVo { @ApiModelProperty("单位名称") private String companyName; @ApiModelProperty("团队选手名字") - private String playerNames; + private String playerName; } @Data diff --git a/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteScoreDao.java b/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteScoreDao.java index 98dbefd7..cbdba9a9 100644 --- a/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteScoreDao.java +++ b/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteScoreDao.java @@ -104,4 +104,10 @@ public interface CompeteScoreDao { * @return */ List selCanSaiDuiWuMes(); + + /** + * 查询出场顺序表(导出表格用) + * @return + */ + List selAllOrder(@Param("type") byte type); } diff --git a/mt/src/main/java/com/ccsens/mt/service/ExcelService.java b/mt/src/main/java/com/ccsens/mt/service/ExcelService.java index ab453062..edcb533a 100644 --- a/mt/src/main/java/com/ccsens/mt/service/ExcelService.java +++ b/mt/src/main/java/com/ccsens/mt/service/ExcelService.java @@ -696,212 +696,97 @@ public class ExcelService implements IExcelService { */ @Override public String iCompetitionOrderService(QueryDto params) { - List competeProjectList= competeCompanyDao.selectProjectByType(params.getParam().getCompeteTimeId()); - for (int i=0;i singleOrderPlayerList=competePlayerDao.selectSinglePlayerByProjectId(competeProject.getId()); - size = singleOrderPlayerList.stream().mapToInt(singleOrderPlayer -> singleOrderPlayer.getCompanyNameList().size()).sum(); - competeProject.setProjectList(singleOrderPlayerList); - }else { - List teamOrderPlayerList= competeTeamDao.selectTeamMemberByProjectId(competeProject.getId()); - size = teamOrderPlayerList.stream().mapToInt(teamOrderPlayer -> teamOrderPlayer.getCompanyNameList().size()).sum(); - competeProject.setProjectList(teamOrderPlayerList); - } - competeProject.setSize(size); - } - String dasia=competeTimeDao.selectByPrimaryKey(params.getParam().getCompeteTimeId()).getName(); - //创建excle表格对象 - List> biao = new ArrayList<>(); - List one = new ArrayList<>(); - PoiUtil.PoiUtilCell yuandongyuan=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 6, 1); - yuandongyuan.setValue(dasia+"出场顺序表"); - one.add(yuandongyuan); - biao.add(one); - - - for (int j=0 ;j three = new ArrayList<>(); - PoiUtil.PoiUtilCell threeDate=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 6, 1); - if(j==0){ - threeDate.setValue(competeProjectList.get(j).getYear()); - three.add(threeDate); - biao.add(three); - List two = new ArrayList<>(); - PoiUtil.PoiUtilCell two1=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two1.setValue("时间"); - PoiUtil.PoiUtilCell two2=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two2.setValue("项目"); - PoiUtil.PoiUtilCell two3=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two3.setValue("组别"); - PoiUtil.PoiUtilCell two4=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two4.setValue("场次/场地"); - PoiUtil.PoiUtilCell two5=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two5.setValue("参赛单位"); - PoiUtil.PoiUtilCell two6=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two6.setValue("参赛人员"); - two.add(two1); - two.add(two2); - two.add(two3); - two.add(two4); - two.add(two5); - two.add(two6); - biao.add(two); - }else{ - if (!competeProjectList.get(j).getYear().equals(competeProjectList.get(j-1).getYear())){ - threeDate.setValue(competeProjectList.get(j).getYear()); - three.add(threeDate); - biao.add(three); - List two = new ArrayList<>(); - PoiUtil.PoiUtilCell two1=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two1.setValue("时间"); - PoiUtil.PoiUtilCell two2=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two2.setValue("项目"); - PoiUtil.PoiUtilCell two3=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two3.setValue("组别"); - PoiUtil.PoiUtilCell two4=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two4.setValue("场次/场地"); - PoiUtil.PoiUtilCell two5=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two5.setValue("参赛单位"); - PoiUtil.PoiUtilCell two6=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - two6.setValue("参赛人员"); - two.add(two1); - two.add(two2); - two.add(two3); - two.add(two4); - two.add(two5); - two.add(two6); - biao.add(two); - } - } - //m行循环 是16次 k 是组次数得循环 4 次 n是组里面得循环 - for(int k=0,m=0,n=0;m four = new ArrayList<>(); - if(m==0){ - PoiUtil.PoiUtilCell fourOne=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, competeProjectList.get(j).getSize()); - fourOne.setValue(competeProjectList.get(j).getStartTimeStr()+"-"+competeProjectList.get(j).getEndTimeStr()); - four.add(fourOne); - PoiUtil.PoiUtilCell fourTwo=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, competeProjectList.get(j).getSize()); - fourTwo.setValue(competeProjectList.get(j).getProjectName()); - four.add(fourTwo); - }else { - four.add(new PoiUtil.PoiUtilCell()); - four.add(new PoiUtil.PoiUtilCell()); - } - - PoiUtil.PoiUtilCell fourThree=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, competeProjectList.get(j).getProjectList().get(k).getCompanyNameList().size()); - if(n>0){ - fourThree=new PoiUtil.PoiUtilCell(); - }else { - fourThree.setValue(competeProjectList.get(j).getProjectList().get(k++).getGroupName()); - n++; - } - if(n==competeProjectList.get(j).getProjectList().get(k-1).getCompanyNameList().size()){ - n=0; - //k++ + CompeteTime competeTime = competeTimeDao.selectByPrimaryKey(params.getParam().getCompeteTimeId()); + + if(competeTime!=null){ + List allProjectList = competeScoreDao.selAllOrder(competeTime.getType()); + List> biao = new ArrayList<>(); + List one = new ArrayList<>(); + PoiUtil.PoiUtilCell yuandongyuan=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 6, 1); + yuandongyuan.setValue(competeTime.getName()+"出场顺序表"); + one.add(yuandongyuan); + biao.add(one); + List two = new ArrayList<>(); + PoiUtil.PoiUtilCell two1=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); + two1.setValue("时间"); + PoiUtil.PoiUtilCell two2=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); + two2.setValue("项目"); + PoiUtil.PoiUtilCell two3=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); + two3.setValue("组别"); + PoiUtil.PoiUtilCell two4=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); + two4.setValue("场次/场地"); + PoiUtil.PoiUtilCell two5=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); + two5.setValue("参赛单位"); + PoiUtil.PoiUtilCell two6=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); + two6.setValue("参赛人员"); + two.add(two1); + two.add(two2); + two.add(two3); + two.add(two4); + two.add(two5); + two.add(two6); + biao.add(two); + for (CompeteExcelVo.Project project : allProjectList) { + int j = 0, q = 0;//一个项目得长度 项目循环 + for (CompeteExcelVo.TeamOrderPlayer teamOrderPlayer : project.getProjectList()) { + j += teamOrderPlayer.getCompanyNameList().size(); } - four.add(fourThree); - - PoiUtil.PoiUtilCell fourFour=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - int x=competeProjectList.get(j).getTeam(); - if(x<=0){ - x=2; - } - if((m+1)%x==0){ - fourFour.setValue(""+((m+1)/x)+"--"+x); - }else { - fourFour.setValue(""+((m+1)/x+1)+"--"+((m+1)%x)); - } - four.add(fourFour); - PoiUtil.PoiUtilCell fourFive=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - if(n==0){ - log.info("j:{}, k:{}, n:{}", j,k,n); - fourFive.setValue(competeProjectList.get(j).getProjectList().get(k-1).getCompanyNameList().get(n).getCompanyName()); - }else { - fourFive.setValue(competeProjectList.get(j).getProjectList().get(k-1).getCompanyNameList().get(n-1).getCompanyName()); - } - four.add(fourFive); - PoiUtil.PoiUtilCell fourSix=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL, 1, 1); - if(n==0){ - fourSix.setValue(competeProjectList.get(j).getProjectList().get(k-1).getCompanyNameList().get(n).getPlayerNames()); - }else { - fourSix.setValue(competeProjectList.get(j).getProjectList().get(k-1).getCompanyNameList().get(n-1).getPlayerNames()); + for (int k = 0; k < project.getProjectList().size(); k++) { + int t = 0;//组别得长度 组别循环 + for (int m = 0; m < project.getProjectList().get(k).getCompanyNameList().size(); m++) { + List three = new ArrayList<>(); + PoiUtil.PoiUtilCell three1; + PoiUtil.PoiUtilCell three2; + if (q == 0) { + three1 = new PoiUtil.PoiUtilCell(project.getStartTime(), 1, j); + three2 = new PoiUtil.PoiUtilCell(project.getProjectName(), 1, j); + q++; + } else { + three1 = new PoiUtil.PoiUtilCell(); + three2 = new PoiUtil.PoiUtilCell(); + } + PoiUtil.PoiUtilCell three3; + if (t == 0) { + three3 = new PoiUtil.PoiUtilCell(project.getProjectList().get(k).getGroupName(), 1, project.getProjectList().get(k).getCompanyNameList().size()); + ++t; + } else { + three3 = new PoiUtil.PoiUtilCell(); + } + PoiUtil.PoiUtilCell three4 = new PoiUtil.PoiUtilCell(project.getProjectList().get(k).getCompanyNameList().get(m).getStartOrder(), 1, 1); + PoiUtil.PoiUtilCell three5 = new PoiUtil.PoiUtilCell(project.getProjectList().get(k).getCompanyNameList().get(m).getCompanyName(), 1, 1); + PoiUtil.PoiUtilCell three6 = new PoiUtil.PoiUtilCell(project.getProjectList().get(k).getCompanyNameList().get(m).getPlayerName(), 1, 1); + three.add(three1); + three.add(three2); + three.add(three3); + three.add(three4); + three.add(three5); + three.add(three6); + biao.add(three); + } } - four.add(fourSix); - biao.add(four); } + Workbook workbook = new XSSFWorkbook(); + PoiUtil.exportWB("出场顺序表",biao,workbook); + String filepath = "mt/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".xlsx"; + String path = PropUtil.path + filepath; + String path1="C:/d/"+filepath;//本地的路径 + File tmpFile = new File(path); + if (!tmpFile.getParentFile().exists()) { + tmpFile.getParentFile().mkdirs(); + } + File file = new File(path); + try { + OutputStream outputStream = new FileOutputStream(file); + workbook.write(outputStream); + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return PropUtil.domain + "file/download/know?path="+path; } - - Workbook workbook = new XSSFWorkbook(); - PoiUtil.exportWB("出场顺序",biao,workbook); - String filepath = "mt/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".xlsx"; - String path = PropUtil.path + filepath; - String path1="C:/d/"+filepath;//本地的路径 - File tmpFile = new File(path); - if (!tmpFile.getParentFile().exists()) { - tmpFile.getParentFile().mkdirs(); - } - File file = new File(path); - try { - OutputStream outputStream = new FileOutputStream(file); - workbook.write(outputStream); - outputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - return PropUtil.domain + "file/download/know?path="+path; + return ""; } - - -// private List competeAllCountList(CompeteDto.CompeteTime params){ -// //根据大赛查类型 -// Long competeTimeId = params.getCompeteTimeId(); -// CompeteTime competeTime = competeTimeDao.selectByPrimaryKey(competeTimeId); -// int type = competeTime.getType(); -// Byte level = 2; -// CompeteProjectExample competeProjectExample = new CompeteProjectExample(); -// competeProjectExample.createCriteria().andTypeEqualTo((byte) type).andLevelEqualTo(level); -// //获取参赛项目集合 -// List competeProjectList = competeProjectMapper.selectByExample(competeProjectExample); -// CompeteGroupExample competeGroupExample = new CompeteGroupExample(); -// competeGroupExample.createCriteria().andTypeEqualTo((byte) type); -// //获取组别集合 -// List competeGroupList = competeGroupMapper.selectByExample(competeGroupExample); -// for (CompeteProject competeProject : competeProjectList){ -// //若不是团队项目 -// if (competeProject.getTeam() == 0){ -// TableVo.CompeteAllCount competeAllCount = new TableVo.CompeteAllCount(); -// //项目名赋值 -// competeAllCount.setProjectName(competeProject.getName()); -// //遍历组别集合 -// int i = 0; -// for(CompeteGroup competeGroup : competeGroupList){ -// CompetePlayerExample competePlayerExample = new CompetePlayerExample(); -// competePlayerExample.createCriteria().andCompeteGroupIdEqualTo(competeGroup.getId()); -// //计算每个组别人数 -// long count = competePlayerDao.countByExample(competePlayerExample); -// } -// } -// } -// return null; -// } - - private List competeAllCountList(CompeteDto.CompeteTime params){ //查询个人赛的数量统计 diff --git a/mt/src/main/resources/application.yml b/mt/src/main/resources/application.yml index b9b264a7..4ecd13fd 100644 --- a/mt/src/main/resources/application.yml +++ b/mt/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: prod - include: common, util-prod + active: dev + include: common, util-dev diff --git a/mt/src/main/resources/mapper_dao/CompeteScoreDao.xml b/mt/src/main/resources/mapper_dao/CompeteScoreDao.xml index c060d25d..5bde88b5 100644 --- a/mt/src/main/resources/mapper_dao/CompeteScoreDao.xml +++ b/mt/src/main/resources/mapper_dao/CompeteScoreDao.xml @@ -862,6 +862,116 @@ ORDER BY tt.id + + + + + + + + + + + + + + + +