|
|
|
@ -286,7 +286,56 @@ public class ScorePersionController extends JeecgController<ScorePersion, IScore |
|
|
|
|
//@RequiresPermissions("scorepersion:score_persion:exportXls")
|
|
|
|
|
@RequestMapping(value = "/exportXls") |
|
|
|
|
public ModelAndView exportXls(HttpServletRequest request, ScorePersion scorePersion) { |
|
|
|
|
return super.exportXls(request, scorePersion, ScorePersion.class, "成绩管理"); |
|
|
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
|
Comp comp = new Comp(); |
|
|
|
|
QueryWrapper<Comp> queryWrappercomp = QueryGenerator.initQueryWrapper(comp, request.getParameterMap()); |
|
|
|
|
queryWrappercomp.eq("comp_admin",user.getUsername()); |
|
|
|
|
List<Comp> list = compService.list(queryWrappercomp); |
|
|
|
|
if(list.size()==0){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList()); |
|
|
|
|
QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>(); |
|
|
|
|
queryWrapperAnnual.in(ids.size()!=0,"compid",ids); |
|
|
|
|
List<AnnualComp> listAnnual = annualCompService.list(queryWrapperAnnual); |
|
|
|
|
if(listAnnual.size()==0){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
List<String> annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList()); |
|
|
|
|
QueryWrapper<ScorePersion> queryWrapper = QueryGenerator.initQueryWrapper(scorePersion, request.getParameterMap()); |
|
|
|
|
queryWrapper.in("annual_compid",annualIds); |
|
|
|
|
|
|
|
|
|
AnnualCompPoint annualCompPoint = new AnnualCompPoint(); |
|
|
|
|
QueryWrapper<AnnualCompPoint> queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, request.getParameterMap()); |
|
|
|
|
queryWrapperacp.in("annual_comp_id",annualIds); |
|
|
|
|
queryWrapperacp.eq("annual_comp_switch","Y"); // 比赛必须是开启的
|
|
|
|
|
List<AnnualCompPoint> listacp = annualCompPointService.list(queryWrapperacp); |
|
|
|
|
if(listacp.size()==0){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
List<String> acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList()); |
|
|
|
|
queryWrapper.in(acpIds.size()!=0,"annual_comp_p",acpIds); |
|
|
|
|
// 过滤选中数据
|
|
|
|
|
String selections = request.getParameter("selections"); |
|
|
|
|
if (oConvertUtils.isNotEmpty(selections)) { |
|
|
|
|
List<String> selectionList = Arrays.asList(selections.split(",")); |
|
|
|
|
queryWrapper.in("id",selectionList); |
|
|
|
|
} |
|
|
|
|
// Step.2 获取导出数据
|
|
|
|
|
List<ScorePersion> exportList = scorePersionService.list(queryWrapper); |
|
|
|
|
|
|
|
|
|
// Step.3 AutoPoi 导出Excel
|
|
|
|
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
|
|
|
|
//此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
|
mv.addObject(NormalExcelConstants.FILE_NAME, "成绩管理"); |
|
|
|
|
mv.addObject(NormalExcelConstants.CLASS, ScorePersion.class); |
|
|
|
|
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
|
|
|
|
ExportParams exportParams=new ExportParams("成绩管理" + "报表", "导出人:" + user.getRealname(), "成绩管理"); |
|
|
|
|
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload()); |
|
|
|
|
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
|
|
|
|
mv.addObject(NormalExcelConstants.PARAMS,exportParams); |
|
|
|
|
mv.addObject(NormalExcelConstants.DATA_LIST, exportList); |
|
|
|
|
return mv; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|