|
|
|
@ -459,7 +459,183 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward |
|
|
|
|
//@RequiresPermissions("awardpersion:award_persion:exportXls")
|
|
|
|
|
@RequestMapping(value = "/exportXls") |
|
|
|
|
public ModelAndView exportXls(HttpServletRequest request, AwardPersion awardPersion) { |
|
|
|
|
return super.exportXls(request, awardPersion, AwardPersion.class, "获奖管理"); |
|
|
|
|
|
|
|
|
|
//逻辑变动:奖项管理针对学生(上传证书和查询),组委会(全部都可以),学院(上传和查询),学校(教务处)(全部都可以),做一下数据筛选以及操作列权限
|
|
|
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
|
List<SysRole> sysRoleList = sysUserRoleService.getUserRoleByUserId(user.getId()); |
|
|
|
|
if(sysRoleList.get(0).getId().equals("1724327596426760194")){ |
|
|
|
|
//学生(上传证书和查询)(根据学号查询筛选)
|
|
|
|
|
QueryWrapper<AwardPersion> queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap()); |
|
|
|
|
queryWrapper.eq("studentcode",sysUserService.getById(user.getId()).getWorkNo()); |
|
|
|
|
// 过滤选中数据
|
|
|
|
|
String selections = request.getParameter("selections"); |
|
|
|
|
if (oConvertUtils.isNotEmpty(selections)) { |
|
|
|
|
List<String> selectionList = Arrays.asList(selections.split(",")); |
|
|
|
|
queryWrapper.in("id",selectionList); |
|
|
|
|
} |
|
|
|
|
// Step.2 获取导出数据
|
|
|
|
|
List<AwardPersion> exportList = awardPersionService.list(queryWrapper); |
|
|
|
|
|
|
|
|
|
// Step.3 AutoPoi 导出Excel
|
|
|
|
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
|
|
|
|
//此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
|
mv.addObject(NormalExcelConstants.FILE_NAME, "获奖管理"); |
|
|
|
|
mv.addObject(NormalExcelConstants.CLASS, AwardPersion.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; |
|
|
|
|
}else if(sysRoleList.get(0).getId().equals("1693451972151386114")){ |
|
|
|
|
//组委会(全部都可以)(根据比赛负责人查询比赛id筛选)
|
|
|
|
|
Comp comp = new Comp(); |
|
|
|
|
QueryWrapper<Comp> queryWrappercomp = QueryGenerator.initQueryWrapper(comp, request.getParameterMap()); |
|
|
|
|
queryWrappercomp.eq("comp_admin",user.getUsername()); |
|
|
|
|
if(awardPersion.getComType()!=null){ |
|
|
|
|
queryWrappercomp.eq("comp_type_id",awardPersion.getComType()); |
|
|
|
|
} |
|
|
|
|
List<Comp> list = compService.list(queryWrappercomp); |
|
|
|
|
if(list.size()==0){ |
|
|
|
|
return null; |
|
|
|
|
/* if(awardPersion.getComType()==null){ |
|
|
|
|
return Result.error("未绑定比赛"); |
|
|
|
|
}else { |
|
|
|
|
return Result.error("未绑定该比赛类型的比赛"); |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList()); |
|
|
|
|
QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>(); |
|
|
|
|
queryWrapperAnnual.in("compid",ids); |
|
|
|
|
List<AnnualComp> listAnnual = annualCompService.list(queryWrapperAnnual); |
|
|
|
|
if(listAnnual.size()==0){ |
|
|
|
|
/*return Result.error("未创建年度比赛");*/ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
List<String> annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList()); |
|
|
|
|
QueryWrapper<AwardPersion> queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap()); |
|
|
|
|
queryWrapper.in("annal_comp",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"); // 比赛必须是开启的
|
|
|
|
|
if(awardPersion.getObjLevel()!=null){ |
|
|
|
|
queryWrapperacp.eq("obj_level",awardPersion.getObjLevel()); |
|
|
|
|
} |
|
|
|
|
List<AnnualCompPoint> listacp = annualCompPointService.list(queryWrapperacp); |
|
|
|
|
if(listacp.size()==0){ |
|
|
|
|
/*if(awardPersion.getObjLevel()==null){ |
|
|
|
|
return Result.error("未创建年度比赛项目"); |
|
|
|
|
}else { |
|
|
|
|
return Result.error("未创建该项目层次的年度比赛项目"); |
|
|
|
|
}*/ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
List<String> acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList()); |
|
|
|
|
queryWrapper.in("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<AwardPersion> exportList = awardPersionService.list(queryWrapper); |
|
|
|
|
|
|
|
|
|
// Step.3 AutoPoi 导出Excel
|
|
|
|
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
|
|
|
|
//此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
|
mv.addObject(NormalExcelConstants.FILE_NAME, "获奖管理"); |
|
|
|
|
mv.addObject(NormalExcelConstants.CLASS, AwardPersion.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; |
|
|
|
|
}else if(sysRoleList.get(0).getId().equals("1693452352310517762")){ |
|
|
|
|
//学院(上传和查询)(根据部门查询数据,该学院下所有学生的获奖信息)
|
|
|
|
|
QueryWrapper<AwardPersion> queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap()); |
|
|
|
|
queryWrapper.eq("studentorg",sysDepartService.queryDepartsByUsername(user.getUsername()).get(0).getId()); |
|
|
|
|
|
|
|
|
|
// 过滤选中数据
|
|
|
|
|
String selections = request.getParameter("selections"); |
|
|
|
|
if (oConvertUtils.isNotEmpty(selections)) { |
|
|
|
|
List<String> selectionList = Arrays.asList(selections.split(",")); |
|
|
|
|
queryWrapper.in("id",selectionList); |
|
|
|
|
} |
|
|
|
|
// Step.2 获取导出数据
|
|
|
|
|
List<AwardPersion> exportList = awardPersionService.list(queryWrapper); |
|
|
|
|
|
|
|
|
|
// Step.3 AutoPoi 导出Excel
|
|
|
|
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
|
|
|
|
//此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
|
mv.addObject(NormalExcelConstants.FILE_NAME, "获奖管理"); |
|
|
|
|
mv.addObject(NormalExcelConstants.CLASS, AwardPersion.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; |
|
|
|
|
}else { |
|
|
|
|
//学校和超级管理员(全部都可以)(查全部数据)
|
|
|
|
|
QueryWrapper<AwardPersion> queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap()); |
|
|
|
|
if (awardPersion.getComType() != null) { |
|
|
|
|
QueryWrapper<Comp> queryWrappercomp = new QueryWrapper<>(); |
|
|
|
|
queryWrappercomp.eq("comp_type_id", awardPersion.getComType()); |
|
|
|
|
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("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.in("annal_comp", annualIds); |
|
|
|
|
} |
|
|
|
|
if (awardPersion.getObjLevel() != null) { |
|
|
|
|
QueryWrapper<AnnualCompPoint> queryWrapperacp = new QueryWrapper<>(); |
|
|
|
|
queryWrapperacp.eq("obj_level", awardPersion.getObjLevel()); |
|
|
|
|
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("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<AwardPersion> exportList = awardPersionService.list(queryWrapper); |
|
|
|
|
|
|
|
|
|
// Step.3 AutoPoi 导出Excel
|
|
|
|
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
|
|
|
|
//此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
|
mv.addObject(NormalExcelConstants.FILE_NAME, "获奖管理"); |
|
|
|
|
mv.addObject(NormalExcelConstants.CLASS, AwardPersion.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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|