diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java index b23edd3a..e6f8e80b 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java @@ -459,7 +459,183 @@ public class AwardPersionController extends JeecgController sysRoleList = sysUserRoleService.getUserRoleByUserId(user.getId()); + if(sysRoleList.get(0).getId().equals("1724327596426760194")){ + //学生(上传证书和查询)(根据学号查询筛选) + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap()); + queryWrapper.eq("studentcode",sysUserService.getById(user.getId()).getWorkNo()); + // 过滤选中数据 + String selections = request.getParameter("selections"); + if (oConvertUtils.isNotEmpty(selections)) { + List selectionList = Arrays.asList(selections.split(",")); + queryWrapper.in("id",selectionList); + } + // Step.2 获取导出数据 + List 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 queryWrappercomp = QueryGenerator.initQueryWrapper(comp, request.getParameterMap()); + queryWrappercomp.eq("comp_admin",user.getUsername()); + if(awardPersion.getComType()!=null){ + queryWrappercomp.eq("comp_type_id",awardPersion.getComType()); + } + List list = compService.list(queryWrappercomp); + if(list.size()==0){ + return null; +/* if(awardPersion.getComType()==null){ + return Result.error("未绑定比赛"); + }else { + return Result.error("未绑定该比赛类型的比赛"); + }*/ + } + List ids = list.stream().map(Comp::getId).collect(Collectors.toList()); + QueryWrapper queryWrapperAnnual = new QueryWrapper<>(); + queryWrapperAnnual.in("compid",ids); + List listAnnual = annualCompService.list(queryWrapperAnnual); + if(listAnnual.size()==0){ + /*return Result.error("未创建年度比赛");*/ + return null; + } + List annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList()); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap()); + queryWrapper.in("annal_comp",annualIds); + + AnnualCompPoint annualCompPoint = new AnnualCompPoint(); + QueryWrapper 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 listacp = annualCompPointService.list(queryWrapperacp); + if(listacp.size()==0){ + /*if(awardPersion.getObjLevel()==null){ + return Result.error("未创建年度比赛项目"); + }else { + return Result.error("未创建该项目层次的年度比赛项目"); + }*/ + return null; + } + List 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 selectionList = Arrays.asList(selections.split(",")); + queryWrapper.in("id",selectionList); + } + // Step.2 获取导出数据 + List 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 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 selectionList = Arrays.asList(selections.split(",")); + queryWrapper.in("id",selectionList); + } + // Step.2 获取导出数据 + List 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 queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap()); + if (awardPersion.getComType() != null) { + QueryWrapper queryWrappercomp = new QueryWrapper<>(); + queryWrappercomp.eq("comp_type_id", awardPersion.getComType()); + List list = compService.list(queryWrappercomp); + if (list.size() == 0) { + return null; + } + List ids = list.stream().map(Comp::getId).collect(Collectors.toList()); + QueryWrapper queryWrapperAnnual = new QueryWrapper<>(); + queryWrapperAnnual.in("compid", ids); + List listAnnual = annualCompService.list(queryWrapperAnnual); + if (listAnnual.size() == 0) { + return null; + } + List annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList()); + queryWrapper.in("annal_comp", annualIds); + } + if (awardPersion.getObjLevel() != null) { + QueryWrapper queryWrapperacp = new QueryWrapper<>(); + queryWrapperacp.eq("obj_level", awardPersion.getObjLevel()); + List listacp = annualCompPointService.list(queryWrapperacp); + if (listacp.size() == 0) { + return null; + } + List 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 selectionList = Arrays.asList(selections.split(",")); + queryWrapper.in("id", selectionList); + } + // Step.2 获取导出数据 + List 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; + } + } /** diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/entity/AwardPersion.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/entity/AwardPersion.java index b16e7b15..74eece40 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/entity/AwardPersion.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/entity/AwardPersion.java @@ -118,7 +118,7 @@ public class AwardPersion implements Serializable { private String sczs; /**推荐*/ - @Excel(name = "是否推荐", width = 15, dicCode = "yn") + //@Excel(name = "是否推荐", width = 15, dicCode = "yn") @Dict(dicCode = "yn") @ApiModelProperty(value = "推荐") private String tj;