|
|
@ -9,6 +9,7 @@ import com.ccsens.mt.bean.dto.ScoreDto; |
|
|
|
import com.ccsens.mt.bean.po.*; |
|
|
|
import com.ccsens.mt.bean.vo.CompeteExcelVo; |
|
|
|
import com.ccsens.mt.bean.vo.CompeteVo; |
|
|
|
import com.ccsens.mt.bean.vo.ScoreVo; |
|
|
|
import com.ccsens.mt.bean.vo.TableVo; |
|
|
|
import com.ccsens.mt.persist.dao.*; |
|
|
|
import com.ccsens.mt.persist.mapper.*; |
|
|
@ -24,9 +25,12 @@ import com.ctc.wstx.util.DataUtil; |
|
|
|
import lombok.Data; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections.map.HashedMap; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import org.apache.commons.lang.time.DateUtils; |
|
|
|
import org.apache.poi.POIDocument; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
import org.eclipse.jetty.util.StringUtil; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -82,10 +86,11 @@ public class ExcelService implements IExcelService { |
|
|
|
private CompeteProjectConfigDao competeProjectConfigDao; |
|
|
|
@Resource |
|
|
|
private CompeteProjectDao competeProjectDao; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private CompeteScoreDao competeScoreDao; |
|
|
|
@Resource |
|
|
|
private ICompeteService competeService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public String dasaiduiwuxinxiWPS(QueryDto<CompeteDto.CompeteTime> params) { |
|
|
|
//这个里面包含联系人得信息
|
|
|
@ -1378,17 +1383,21 @@ public class ExcelService implements IExcelService { |
|
|
|
public String patternExpTable(ScoreDto.ShowResult param) { |
|
|
|
List<CompeteVo.TotalScoreDisplay> totalScoreDisplays = competeService.showResult(param); |
|
|
|
List<List<PoiUtil.PoiUtilCell>> list = new ArrayList<>(); |
|
|
|
List<PoiUtil.PoiUtilCell> zero=new ArrayList<>(); |
|
|
|
PoiUtil.PoiUtilCell zeroOne=new PoiUtil.PoiUtilCell("比赛成绩公示(花样赛)", 14, 1); |
|
|
|
zero.add(zeroOne); |
|
|
|
list.add(zero); |
|
|
|
List<PoiUtil.PoiUtilCell> one=new ArrayList<>(); |
|
|
|
PoiUtil.PoiUtilCell oneOne=new PoiUtil.PoiUtilCell("参赛单位", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell oneTwo=new PoiUtil.PoiUtilCell("参赛队员", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell oneThree=new PoiUtil.PoiUtilCell("创意编排分", 3, 1); |
|
|
|
PoiUtil.PoiUtilCell oneFour=new PoiUtil.PoiUtilCell("创意最后得分", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell oneFive=new PoiUtil.PoiUtilCell("完成质量分", 3, 1); |
|
|
|
PoiUtil.PoiUtilCell oneSix=new PoiUtil.PoiUtilCell("完成最后得分", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell oneSeven=new PoiUtil.PoiUtilCell("主裁判扣分", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell oneEight=new PoiUtil.PoiUtilCell("最后得分", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell oneNine=new PoiUtil.PoiUtilCell("名次", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell oneTen=new PoiUtil.PoiUtilCell("备注", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell oneSix=new PoiUtil.PoiUtilCell("完成最后得分", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneSeven=new PoiUtil.PoiUtilCell("主裁判扣分", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneEight=new PoiUtil.PoiUtilCell("最后得分", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneNine=new PoiUtil.PoiUtilCell("名次", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneTen=new PoiUtil.PoiUtilCell("备注", 1, 2); |
|
|
|
one.add(oneOne); |
|
|
|
one.add(oneTwo); |
|
|
|
one.add(oneThree); |
|
|
@ -1400,21 +1409,228 @@ public class ExcelService implements IExcelService { |
|
|
|
one.add(oneNine); |
|
|
|
one.add(oneTen); |
|
|
|
list.add(one); |
|
|
|
List<PoiUtil.PoiUtilCell> two = new ArrayList<>(); |
|
|
|
PoiUtil.PoiUtilCell twoOne = new PoiUtil.PoiUtilCell(); |
|
|
|
PoiUtil.PoiUtilCell twoTwo = new PoiUtil.PoiUtilCell(); |
|
|
|
PoiUtil.PoiUtilCell twoThree = new PoiUtil.PoiUtilCell("1", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoFour = new PoiUtil.PoiUtilCell("2", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoFive = new PoiUtil.PoiUtilCell("3", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoSix = new PoiUtil.PoiUtilCell(); |
|
|
|
PoiUtil.PoiUtilCell twoSeven = new PoiUtil.PoiUtilCell("1", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoEight = new PoiUtil.PoiUtilCell("2", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoNight = new PoiUtil.PoiUtilCell("3", 1, 1); |
|
|
|
two.add(twoOne); |
|
|
|
two.add(twoTwo); |
|
|
|
two.add(twoThree); |
|
|
|
two.add(twoFour); |
|
|
|
two.add(twoFive); |
|
|
|
two.add(twoSix); |
|
|
|
two.add(twoSeven); |
|
|
|
two.add(twoEight); |
|
|
|
two.add(twoNight); |
|
|
|
list.add(two); |
|
|
|
totalScoreDisplays.forEach(mes->{ |
|
|
|
List<PoiUtil.PoiUtilCell> three = new ArrayList<>(); |
|
|
|
PoiUtil.PoiUtilCell threeOne = new PoiUtil.PoiUtilCell(mes.getCompanyName(), 1, 1); |
|
|
|
PoiUtil.PoiUtilCell threeTwo = new PoiUtil.PoiUtilCell(mes.getPeopleName(), 1, 1); |
|
|
|
three.add(threeOne); |
|
|
|
three.add(threeTwo); |
|
|
|
if(mes.getRemark()==(byte)0){ |
|
|
|
PoiUtil.PoiUtilCell threeThree=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getReferee1()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeFive=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getReferee2()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeSix=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getReferee3()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeSeven=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getAvg1To3()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeEight=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getReferee4()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeNight=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getReferee5()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeTen=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getReferee6()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeEle=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getAvg4To6()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeTwe=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getReferee0()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeThir=new PoiUtil.PoiUtilCell((StringUtil.valueOf(mes.getResult())),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeFour=new PoiUtil.PoiUtilCell((StringUtil.valueOf(mes.getOrder())),1,1); |
|
|
|
three.add(threeThree); |
|
|
|
three.add(threeFive); |
|
|
|
three.add(threeSix); |
|
|
|
three.add(threeSeven); |
|
|
|
three.add(threeEight); |
|
|
|
three.add(threeNight); |
|
|
|
three.add(threeTen); |
|
|
|
three.add(threeEle); |
|
|
|
three.add(threeTwe); |
|
|
|
three.add(threeThir); |
|
|
|
three.add(threeFour); |
|
|
|
}else { |
|
|
|
PoiUtil.PoiUtilCell threeThree=new PoiUtil.PoiUtilCell("",1,1); |
|
|
|
PoiUtil.PoiUtilCell threeFive=new PoiUtil.PoiUtilCell("",1,1); |
|
|
|
PoiUtil.PoiUtilCell threeSix=new PoiUtil.PoiUtilCell("",1,1); |
|
|
|
PoiUtil.PoiUtilCell threeSeven=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getAvg1To3()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeEight=new PoiUtil.PoiUtilCell("",1,1); |
|
|
|
PoiUtil.PoiUtilCell threeNight=new PoiUtil.PoiUtilCell("",1,1); |
|
|
|
PoiUtil.PoiUtilCell threeTen=new PoiUtil.PoiUtilCell("",1,1); |
|
|
|
PoiUtil.PoiUtilCell threeEle=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getAvg4To6()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeTwe=new PoiUtil.PoiUtilCell("",1,1); |
|
|
|
PoiUtil.PoiUtilCell threeThir=new PoiUtil.PoiUtilCell((StringUtil.valueOf(mes.getResult())),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeFour=new PoiUtil.PoiUtilCell("",1,1); |
|
|
|
PoiUtil.PoiUtilCell threeFif=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL,1,1); |
|
|
|
if(mes.getRemark()==(byte)1){ |
|
|
|
threeFif.setValue("弃权"); |
|
|
|
}else { |
|
|
|
threeFif.setValue("取消比赛资格"); |
|
|
|
} |
|
|
|
three.add(threeThree); |
|
|
|
three.add(threeFive); |
|
|
|
three.add(threeSix); |
|
|
|
three.add(threeSeven); |
|
|
|
three.add(threeEight); |
|
|
|
three.add(threeNight); |
|
|
|
three.add(threeTen); |
|
|
|
three.add(threeEle); |
|
|
|
three.add(threeTwe); |
|
|
|
three.add(threeThir); |
|
|
|
three.add(threeFour); |
|
|
|
three.add(threeFif); |
|
|
|
} |
|
|
|
list.add(three); |
|
|
|
}); |
|
|
|
List<PoiUtil.PoiUtilCell> four = new ArrayList<>(); |
|
|
|
PoiUtil.PoiUtilCell fourOne = new PoiUtil.PoiUtilCell(); |
|
|
|
PoiUtil.PoiUtilCell fourTwo = new PoiUtil.PoiUtilCell(); |
|
|
|
PoiUtil.PoiUtilCell fourThree = new PoiUtil.PoiUtilCell("裁判1", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell fourFour = new PoiUtil.PoiUtilCell("裁判2", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell fourFive = new PoiUtil.PoiUtilCell("裁判3", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell fourSix = new PoiUtil.PoiUtilCell("创意分平均", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell fourSeven = new PoiUtil.PoiUtilCell("裁判1", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell fourEigth = new PoiUtil.PoiUtilCell("裁判2", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell fourNine = new PoiUtil.PoiUtilCell("裁判3", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell fourTen = new PoiUtil.PoiUtilCell("完成分平均", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell fourEle = new PoiUtil.PoiUtilCell("主裁", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell fourTwe = new PoiUtil.PoiUtilCell("=创意分平均+完成分平均-主裁判扣分", 1, 1); |
|
|
|
four.add(fourOne); |
|
|
|
four.add(fourTwo); |
|
|
|
four.add(fourThree); |
|
|
|
four.add(fourFour); |
|
|
|
four.add(fourFive); |
|
|
|
four.add(fourSix); |
|
|
|
four.add(fourSeven); |
|
|
|
four.add(fourEigth); |
|
|
|
four.add(fourNine); |
|
|
|
four.add(fourTen); |
|
|
|
four.add(fourEle); |
|
|
|
four.add(fourTwe); |
|
|
|
list.add(four); |
|
|
|
Workbook workbook = new XSSFWorkbook(); |
|
|
|
PoiUtil.exportWB("花样赛成绩表公示",list,workbook); |
|
|
|
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(); |
|
|
|
} |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public String countExpTable(ScoreDto.ShowResult param) { |
|
|
|
|
|
|
|
|
|
|
|
List<ScoreVo.CountScoreCurrentSite> countScoreCurrentSiteList = new ArrayList<>(); |
|
|
|
CompeteProject competeProject = competeProjectMapper.selectByPrimaryKey(param.getProjectId()); |
|
|
|
if(ObjectUtil.isNotNull(competeProject)) { |
|
|
|
if(competeProject.getTeam() == 0) { |
|
|
|
countScoreCurrentSiteList = competeScoreDao.queryCountScoreAll(param.getProjectId()); |
|
|
|
}else { |
|
|
|
countScoreCurrentSiteList = competeScoreDao.queryCountScoreAllByTeam(param.getProjectId()); |
|
|
|
} |
|
|
|
} |
|
|
|
List<ScoreVo.CountScoreCurrentSite> countScoreCurrentSites = countScoreCurrentSiteList; |
|
|
|
|
|
|
|
|
|
|
|
List<List<PoiUtil.PoiUtilCell>> list = new ArrayList<>(); |
|
|
|
List<PoiUtil.PoiUtilCell> zero=new ArrayList<>(); |
|
|
|
PoiUtil.PoiUtilCell zeroOne=new PoiUtil.PoiUtilCell("比赛成绩公示(计数赛)", 10, 1); |
|
|
|
zero.add(zeroOne); |
|
|
|
list.add(zero); |
|
|
|
List<PoiUtil.PoiUtilCell> one=new ArrayList<>(); |
|
|
|
PoiUtil.PoiUtilCell oneOne=new PoiUtil.PoiUtilCell("组别", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneTwo=new PoiUtil.PoiUtilCell("参赛单位", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneThree=new PoiUtil.PoiUtilCell("姓名", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneFour=new PoiUtil.PoiUtilCell("成绩", 2, 1); |
|
|
|
PoiUtil.PoiUtilCell oneFive=new PoiUtil.PoiUtilCell("总成绩", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneSix=new PoiUtil.PoiUtilCell("扣除次数", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneSeven=new PoiUtil.PoiUtilCell("最终成绩", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneEight=new PoiUtil.PoiUtilCell("名词", 1, 2); |
|
|
|
PoiUtil.PoiUtilCell oneNine=new PoiUtil.PoiUtilCell("备注", 1, 2); |
|
|
|
one.add(oneOne); |
|
|
|
one.add(oneTwo); |
|
|
|
one.add(oneThree); |
|
|
|
one.add(oneFour); |
|
|
|
one.add(oneFive); |
|
|
|
one.add(oneSix); |
|
|
|
one.add(oneSeven); |
|
|
|
one.add(oneEight); |
|
|
|
one.add(oneNine); |
|
|
|
list.add(one); |
|
|
|
List<PoiUtil.PoiUtilCell> two=new ArrayList<>(); |
|
|
|
PoiUtil.PoiUtilCell twoOne=new PoiUtil.PoiUtilCell(); |
|
|
|
PoiUtil.PoiUtilCell twoTwo=new PoiUtil.PoiUtilCell(); |
|
|
|
PoiUtil.PoiUtilCell twoThree=new PoiUtil.PoiUtilCell("1", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoFour=new PoiUtil.PoiUtilCell("2", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoFive=new PoiUtil.PoiUtilCell("3", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoSix=new PoiUtil.PoiUtilCell(); |
|
|
|
PoiUtil.PoiUtilCell twoSeven=new PoiUtil.PoiUtilCell("1", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoEight=new PoiUtil.PoiUtilCell("2", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoNight=new PoiUtil.PoiUtilCell("3", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoThree=new PoiUtil.PoiUtilCell(); |
|
|
|
PoiUtil.PoiUtilCell twoFour=new PoiUtil.PoiUtilCell("1", 1, 1); |
|
|
|
PoiUtil.PoiUtilCell twoFive=new PoiUtil.PoiUtilCell("2", 1, 1); |
|
|
|
two.add(twoOne); |
|
|
|
two.add(twoTwo); |
|
|
|
two.add(twoThree); |
|
|
|
two.add(twoFour); |
|
|
|
return null; |
|
|
|
two.add(twoFive); |
|
|
|
list.add(two); |
|
|
|
|
|
|
|
countScoreCurrentSites.forEach(mes->{ |
|
|
|
List<PoiUtil.PoiUtilCell> three=new ArrayList<>(); |
|
|
|
PoiUtil.PoiUtilCell threeOne=new PoiUtil.PoiUtilCell(mes.getGroupName(),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeTwo=new PoiUtil.PoiUtilCell(mes.getCompanyName(),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeThree=new PoiUtil.PoiUtilCell(mes.getName(),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeFour=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getMainOneScore()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeFive=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getMainTwoScore()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeSix=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getShouldScore()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeSeven=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getDeductTime()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeEight=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getFinalScore()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeNine=new PoiUtil.PoiUtilCell(StringUtil.valueOf(mes.getRangee()),1,1); |
|
|
|
PoiUtil.PoiUtilCell threeTen=new PoiUtil.PoiUtilCell(mes.getRemark(),1,1); |
|
|
|
three.add(threeOne); |
|
|
|
three.add(threeTwo); |
|
|
|
three.add(threeThree); |
|
|
|
three.add(threeFour); |
|
|
|
three.add(threeFive); |
|
|
|
three.add(threeSix); |
|
|
|
three.add(threeSeven); |
|
|
|
three.add(threeEight); |
|
|
|
three.add(threeNine); |
|
|
|
three.add(threeTen); |
|
|
|
list.add(three); |
|
|
|
}); |
|
|
|
Workbook workbook = new XSSFWorkbook(); |
|
|
|
PoiUtil.exportWB("计数赛成绩公示",list,workbook); |
|
|
|
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(); |
|
|
|
} |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|