diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompetitionprojectregistration/controller/AnnualCompetitionProjectRegistrationController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompetitionprojectregistration/controller/AnnualCompetitionProjectRegistrationController.java index 3d4d5d48..3a89a846 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompetitionprojectregistration/controller/AnnualCompetitionProjectRegistrationController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompetitionprojectregistration/controller/AnnualCompetitionProjectRegistrationController.java @@ -18,6 +18,8 @@ import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.demo.annual.service.IAnnualService; import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint; import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; +import org.jeecg.modules.demo.annualScore.service.IPersonalCompScoreService; import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.AnnualCompetitionProjectRegistration; @@ -92,6 +94,8 @@ public class AnnualCompetitionProjectRegistrationController { private ICompService compService; @Autowired private IAwardPersionService awardPersionService; + @Autowired + private IPersonalCompScoreService personalCompScoreService; /** @@ -983,223 +987,453 @@ public class AnnualCompetitionProjectRegistrationController { LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); Comp comp = new Comp(); QueryWrapper queryWrappercomp = QueryGenerator.initQueryWrapper(comp, req.getParameterMap()); - queryWrappercomp.like("comp_admin",user.getUsername()); + queryWrappercomp.like("comp_admin", user.getUsername()); List list = compService.list(queryWrappercomp); - List ids = list.stream().map(Comp::getId).collect(Collectors.toList()); - QueryWrapper queryWrapperAnnual = new QueryWrapper<>(); - queryWrapperAnnual.in(ids.size()!=0,"compid",ids); - queryWrapperAnnual.orderByDesc("create_time"); - List annualCompList = annualCompService.list(queryWrapperAnnual); - //List annualCompList = getZXAnnualComp(req); Map map = new HashMap<>(); - //年度比赛名称 - map.put("annualCompName",annualCompList.get(0).getName()); - //共多少届以及当前第几届 - map.put("sum",annualCompList.size()); - - AnnualCompPoint annualCompPoint = new AnnualCompPoint(); - QueryWrapper queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap()); - queryWrapperacp.eq("annual_comp_id",annualCompList.get(0).getId()); - queryWrapperacp.eq("annual_comp_switch","Y"); // 比赛必须是开启的 - //queryWrapperacp.orderByDesc("create_time"); - List listacp = annualCompPointService.list(queryWrapperacp); - //比赛项目数 - map.put("bsxmSum",listacp.size()); - //前五条项目名称数据以及对应的报名数 - List> xmListMap = new ArrayList<>(); - if(listacp.size()>5){ - for (int i = 0 ; i <5;i++){ - AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); - QueryWrapper queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); - queryWrapperbm.eq("annual_compid",listacp.get(i).getId()); - queryWrapperbm.eq("enroll_static", "2"); - List listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm); - Map map1 = new HashMap<>(); - map1.put("xmname",listacp.get(i).getObjName()); - map1.put("xmbmrs",listbm.size()); - xmListMap.add(map1); + if (list.size() > 0) { + List ids = list.stream().map(Comp::getId).collect(Collectors.toList()); + QueryWrapper queryWrapperAnnual = new QueryWrapper<>(); + queryWrapperAnnual.in(ids.size() != 0, "compid", ids); + queryWrapperAnnual.orderByDesc("create_time"); + List annualCompList = annualCompService.list(queryWrapperAnnual); + if (annualCompList.size() > 0) { + //年度比赛名称 + map.put("annualCompName", annualCompList.get(0).getName()); + //共多少届以及当前第几届 + map.put("sum", annualCompList.size()); + + AnnualCompPoint annualCompPoint = new AnnualCompPoint(); + QueryWrapper queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap()); + queryWrapperacp.eq("annual_comp_id", annualCompList.get(0).getId()); + queryWrapperacp.eq("annual_comp_switch", "Y"); // 比赛必须是开启的 + //queryWrapperacp.orderByDesc("create_time"); + List listacp = annualCompPointService.list(queryWrapperacp); + //比赛项目数 + map.put("bsxmSum", listacp.size()); + //前五条项目名称数据以及对应的报名数 + List> xmListMap = new ArrayList<>(); + if (listacp.size() > 5) { + for (int i = 0; i < 5; i++) { + AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); + QueryWrapper queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); + queryWrapperbm.eq("annual_compid", listacp.get(i).getId()); + queryWrapperbm.eq("enroll_static", "2"); + List listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm); + Map map1 = new HashMap<>(); + map1.put("xmname", listacp.get(i).getObjName()); + map1.put("xmbmrs", listbm.size()); + xmListMap.add(map1); + } + } else { + for (int m = 0; m < listacp.size(); m++) { + AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); + QueryWrapper queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); + queryWrapperbm.eq("annual_compid", listacp.get(m).getId()); + queryWrapperbm.eq("enroll_static", "2"); + List listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm); + Map map1 = new HashMap<>(); + map1.put("xmname", listacp.get(m).getObjName()); + map1.put("xmbmrs", listbm.size()); + xmListMap.add(map1); + } + } + + + map.put("qwtxmList", xmListMap); + //参加比赛队伍数(报名数) + if(listacp.size()>0){ + List acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList()); + AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); + QueryWrapper queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); + queryWrapperbm.in(acpIds.size() != 0, "annual_compid", acpIds); + queryWrapperbm.eq("enroll_static", "2"); + List listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm); + map.put("bmNumber", listbm.size()); + //参数人数 + if (listbm.size() == 0) { + map.put("csNumber", 0); + map.put("ydjNumber", 0); + map.put("edjNumber", 0); + map.put("sdjNumber", 0); + map.put("sidjNumber", 0); + map.put("wdjNumber", 0); + } else { + TeamManagement teamManagement = new TeamManagement(); + QueryWrapper queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); + List bmbhs = listbm.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList()); + queryWrappertm.in(bmbhs.size() != 0, "enroll_code", bmbhs); + List listtm = teamManagementService.list(queryWrappertm); + map.put("csNumber", listtm.size()); + //一等奖人数 + AwardPersion awardPersion1 = new AwardPersion(); + QueryWrapper queryWrapperap1 = QueryGenerator.initQueryWrapper(awardPersion1, req.getParameterMap()); + queryWrapperap1.eq("awardsort", 1); + queryWrapperap1.in(bmbhs.size() != 0, "enroll_code", bmbhs); + List list1 = awardPersionService.list(queryWrapperap1); + map.put("ydjNumber", list1.size()); + //二等奖人数 + AwardPersion awardPersion2 = new AwardPersion(); + QueryWrapper queryWrapperap2 = QueryGenerator.initQueryWrapper(awardPersion2, req.getParameterMap()); + queryWrapperap2.eq("awardsort", 2); + queryWrapperap2.in(bmbhs.size() != 0, "enroll_code", bmbhs); + List list2 = awardPersionService.list(queryWrapperap2); + map.put("edjNumber", list2.size()); + //三等奖人数 + AwardPersion awardPersion3 = new AwardPersion(); + QueryWrapper queryWrapperap3 = QueryGenerator.initQueryWrapper(awardPersion3, req.getParameterMap()); + queryWrapperap3.eq("awardsort", 3); + queryWrapperap3.in(bmbhs.size() != 0, "enroll_code", bmbhs); + List list3 = awardPersionService.list(queryWrapperap3); + map.put("sdjNumber", list3.size()); + //四等奖人数 + AwardPersion awardPersion4 = new AwardPersion(); + QueryWrapper queryWrapperap4 = QueryGenerator.initQueryWrapper(awardPersion4, req.getParameterMap()); + queryWrapperap4.eq("awardsort", 4); + queryWrapperap4.in(bmbhs.size() != 0, "enroll_code", bmbhs); + List list4 = awardPersionService.list(queryWrapperap4); + map.put("sidjNumber", list4.size()); + //五等奖人数 + AwardPersion awardPersion5 = new AwardPersion(); + QueryWrapper queryWrapperap5 = QueryGenerator.initQueryWrapper(awardPersion5, req.getParameterMap()); + queryWrapperap5.eq("awardsort", 5); + queryWrapperap5.in(bmbhs.size() != 0, "enroll_code", bmbhs); + List list5 = awardPersionService.list(queryWrapperap5); + map.put("wdjNumber", list5.size()); } - }else{ - for (int m = 0 ; m queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); - queryWrapperbm.eq("annual_compid",listacp.get(m).getId()); - queryWrapperbm.eq("enroll_static", "2"); - List listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm); - Map map1 = new HashMap<>(); - map1.put("xmname",listacp.get(m).getObjName()); - map1.put("xmbmrs",listbm.size()); - xmListMap.add(map1); + //参赛院系用到的list + List listcs = new ArrayList<>(); + //个人赛人数 + AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration1 = new AnnualCompetitionProjectRegistration(); + QueryWrapper queryWrapperbm1 = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration1, req.getParameterMap()); + queryWrapperbm1.in(acpIds.size() != 0, "annual_compid", acpIds); + queryWrapperbm1.eq("enroll_static", "2"); + queryWrapperbm1.eq("entry_format", "0"); + List listbm1 = annualCompetitionProjectRegistrationService.list(queryWrapperbm1); + if (listbm1.size() == 0) { + map.put("grsNumber", 0); + } else { + TeamManagement teamManagement = new TeamManagement(); + QueryWrapper queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); + List bmbhs = listbm1.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList()); + queryWrappertm.in(bmbhs.size() != 0, "enroll_code", bmbhs); + List listtm = teamManagementService.list(queryWrappertm); + map.put("grsNumber", listtm.size()); + listcs.addAll(listtm); + } + //团队赛人数 + AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration2 = new AnnualCompetitionProjectRegistration(); + QueryWrapper queryWrapperbm2 = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration2, req.getParameterMap()); + queryWrapperbm2.in(acpIds.size() != 0, "annual_compid", acpIds); + queryWrapperbm2.eq("enroll_static", "2"); + queryWrapperbm2.eq("entry_format", "1"); + List listbm2 = annualCompetitionProjectRegistrationService.list(queryWrapperbm2); + if (listbm2.size() == 0) { + map.put("tdsNumber", 0); + } else { + TeamManagement teamManagement = new TeamManagement(); + QueryWrapper queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); + List bmbhs = listbm2.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList()); + queryWrappertm.in(bmbhs.size() != 0, "enroll_code", bmbhs); + List listtm = teamManagementService.list(queryWrappertm); + map.put("tdsNumber", listtm.size()); + //查只是队长的用户id + queryWrappertm.eq("captain", "1"); + List listdz = teamManagementService.list(queryWrappertm); + listcs.addAll(listdz); + } + //参赛院系人数排名(只取前六条) + if (listcs.size() == 0) { + map.put("csyxbmpm", new ArrayList<>()); + map.put("bmxsxxList", new ArrayList<>()); + } else { + //拿到所有的userid + List userIds = listcs.stream().map(TeamManagement::getUserId).collect(Collectors.toList()); + QueryWrapper queryWrappersud = new QueryWrapper<>(); + queryWrappersud.select("dep_id,COUNT(*) as user_id"); + queryWrappersud.in("user_id", userIds); + queryWrappersud.groupBy("dep_id"); + queryWrappersud.orderByDesc("COUNT(*)"); + List listsud = sysUserDepartService.list(queryWrappersud); + List> csyxpmListMap = new ArrayList<>(); + if (listsud.size() > 6) { + for (int o = 0; o < 6; o++) { + Map map2 = new HashMap<>(); + map2.put("pm", o + 1); + map2.put("csyxid", listsud.get(o).getDepId()); + SysDepart depart = sysDepartService.query().eq("id", listsud.get(o).getDepId()).one(); + map2.put("csyxname", depart.getDepartName()); + map2.put("bms", listsud.get(o).getUserId()); + csyxpmListMap.add(map2); + } + map.put("csyxbmpm", csyxpmListMap); + } else { + for (int u = 0; u < listsud.size(); u++) { + Map map3 = new HashMap<>(); + map3.put("pm", u + 1); + map3.put("csyxid", listsud.get(u).getDepId()); + SysDepart depart = sysDepartService.query().eq("id", listsud.get(u).getDepId()).one(); + map3.put("csyxname", depart.getDepartName()); + map3.put("bms", listsud.get(u).getUserId()); + csyxpmListMap.add(map3); + } + map.put("csyxbmpm", csyxpmListMap); + } + //报名学生列表(只取前六条) + //根据userIds查询出六个学生信息 + List> bmxsxxListMap = new ArrayList<>(); + if (userIds.size() > 6) { + for (int p = 0; p < 6; p++) { + List userDeparts = sysUserDepartService.query().eq("user_id", userIds.get(p)).list(); + SysUser sysUser = sysUserService.query().eq("id", userIds.get(p)).one(); + SysDepart depart = sysDepartService.query().eq("id", userDeparts.get(0).getDepId()).one(); + Map map4 = new HashMap<>(); + map4.put("name", sysUser.getRealname()); + map4.put("xh", sysUser.getUsername()); + map4.put("szyx", depart.getDepartName()); + bmxsxxListMap.add(map4); + } + map.put("bmxsxxList", bmxsxxListMap); + } else { + for (int a = 0; a < userIds.size(); a++) { + List userDeparts = sysUserDepartService.query().eq("user_id", userIds.get(a)).list(); + SysUser sysUser = sysUserService.query().eq("id", userIds.get(a)).one(); + SysDepart depart = sysDepartService.query().eq("id", userDeparts.get(0).getDepId()).one(); + Map map5 = new HashMap<>(); + map5.put("name", sysUser.getRealname()); + map5.put("xh", sysUser.getUsername()); + map5.put("szyx", depart.getDepartName()); + bmxsxxListMap.add(map5); + } + map.put("bmxsxxList", bmxsxxListMap); + } + } } } + } + return Result.OK(map); + } - map.put("qwtxmList",xmListMap); - //参加比赛队伍数(报名数) - List acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList()); - AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); - QueryWrapper queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); - queryWrapperbm.in(acpIds.size()!=0,"annual_compid",acpIds); - queryWrapperbm.eq("enroll_static", "2"); - List listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm); - map.put("bmNumber",listbm.size()); - //参数人数 - if(listbm.size()==0){ - map.put("csNumber",0); - }else { - TeamManagement teamManagement = new TeamManagement(); - QueryWrapper queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); - List bmbhs = listbm.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList()); - queryWrappertm.in(bmbhs.size()!=0,"enroll_code",bmbhs); - List listtm = teamManagementService.list(queryWrappertm); - map.put("csNumber",listtm.size()); - //一等奖人数 + + /** + * 学生角色首页比赛数据接口 + * + * @param req + * @return + */ + @ApiOperation(value="学生角色首页比赛数据接口", notes="学生角色首页比赛数据接口") + @GetMapping(value = "/xssybsjs") + public Result xssybsjs( HttpServletRequest req) { + //获取当前登录用户 + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + TeamManagement teamManagement = new TeamManagement(); + QueryWrapper queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); + queryWrappertm.eq("user_id",user.getId()); + List listtm = teamManagementService.list(queryWrappertm); + Map map = new HashMap<>(); + if(listtm.size()!=0){ + //学生参加比赛的所有报名编号 + List bmbhs = listtm.stream().map(TeamManagement::getEnrollCode).collect(Collectors.toList()); + //查询报名表报名编号对应的所有年度比赛项目id + AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); + QueryWrapper queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); + queryWrapperbm.in("enroll_code",bmbhs); + queryWrapperbm.eq("enroll_static", "2"); + List listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm); + //参加比赛项目数量 + map.put("cjbsxmsl",listbm.size()); + + if(listbm.size()!=0){ + //年度比赛项目ids + List ndbsxmids = listbm.stream().map(AnnualCompetitionProjectRegistration::getAnnualCompid).collect(Collectors.toList()); + AnnualCompPoint annualCompPoint = new AnnualCompPoint(); + QueryWrapper queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap()); + queryWrapperacp.in("id",ndbsxmids); + List listacp = annualCompPointService.list(queryWrapperacp); + //报名比赛项目 + List> xmListMap = new ArrayList<>(); + + if(listacp.size()>6){ + for (int k = 0 ; k < 6 ; k++){ + Map map2 = new HashMap<>(); + //项目名称 + map2.put("xmname",listacp.get(k).getObjName()); + //参与形式 + map2.put("cyxs",listacp.get(k).getEntryForm().equals("N") ? "个人":"团队"); + //项目id + map2.put("xmid",listacp.get(k).getId()); + //状态 + Date date = new Date(); + if(date.getTime()>=listacp.get(k).getApplyStartTime().getTime()&&date.getTime()<=listacp.get(k).getApplyEndTime().getTime()){ + map2.put("zt","报名"); + } + if(date.getTime()>=listacp.get(k).getTopicStartTime().getTime()&&date.getTime()<=listacp.get(k).getTopicEndTime().getTime()){ + map2.put("zt","选题"); + } + if(date.getTime()>=listacp.get(k).getUploadStartTime().getTime()&&date.getTime()<=listacp.get(k).getUploadEndTime().getTime()){ + map2.put("zt","上传作品"); + } + if(date.getTime()>=listacp.get(k).getScoreStartTime().getTime()&&date.getTime()<=listacp.get(k).getScoreEndTime().getTime()){ + map2.put("zt","评分"); + } + if(date.getTime()>listacp.get(k).getScoreEndTime().getTime()){ + map2.put("zt","已结束"); + } + xmListMap.add(map2); + } + }else { + for (int o = 0 ; o < listacp.size() ; o++){ + Map map3 = new HashMap<>(); + //项目名称 + map3.put("xmname",listacp.get(o).getObjName()); + //参与形式 + map3.put("cyxs",listacp.get(o).getEntryForm().equals("N") ? "个人":"团队"); + //项目id + map3.put("xmid",listacp.get(o).getId()); + //状态 + Date date = new Date(); + if(date.getTime()>=listacp.get(o).getApplyStartTime().getTime()&&date.getTime()<=listacp.get(o).getApplyEndTime().getTime()){ + map3.put("zt","报名"); + } + if(date.getTime()>=listacp.get(o).getTopicStartTime().getTime()&&date.getTime()<=listacp.get(o).getTopicEndTime().getTime()){ + map3.put("zt","选题"); + } + if(date.getTime()>=listacp.get(o).getUploadStartTime().getTime()&&date.getTime()<=listacp.get(o).getUploadEndTime().getTime()){ + map3.put("zt","上传作品"); + } + if(date.getTime()>=listacp.get(o).getScoreStartTime().getTime()&&date.getTime()<=listacp.get(o).getScoreEndTime().getTime()){ + map3.put("zt","评分"); + } + if(date.getTime()>listacp.get(o).getScoreEndTime().getTime()){ + map3.put("zt","已结束"); + } + xmListMap.add(map3); + } + } + map.put("bmbsxm",xmListMap); + int gjj = 0; + int shengj = 0; + int shij = 0; + int xj = 0; + for (int i = 0 ; i < listacp.size() ; i++){ + if(listacp.get(i).getObjLevel().equals("1809121223401168898")){ + //国家 + gjj = gjj+1; + } + if(listacp.get(i).getObjLevel().equals("1809121301201313793")){ + //省 + shengj = shengj+1; + } + if(listacp.get(i).getObjLevel().equals("1809121356582903809")){ + //市 + shij = shij+1; + } + if(listacp.get(i).getObjLevel().equals("1809121454654119937")){ + //校 + xj = xj+1; + } + } + map.put("gjj",gjj); + map.put("shengj",shengj); + map.put("shij",shij); + map.put("xj",xj); + + }else{ + map.put("gjj",0); + map.put("shengj",0); + map.put("shij",0); + map.put("xj",0); + } + //获奖数 + //一等奖数 AwardPersion awardPersion1 = new AwardPersion(); QueryWrapper queryWrapperap1 = QueryGenerator.initQueryWrapper(awardPersion1, req.getParameterMap()); queryWrapperap1.eq("awardsort",1); + queryWrapperap1.eq("studentcode",user.getUsername()); queryWrapperap1.in(bmbhs.size()!=0,"enroll_code",bmbhs); List list1 = awardPersionService.list(queryWrapperap1); map.put("ydjNumber",list1.size()); - //二等奖人数 + //二等奖数 AwardPersion awardPersion2 = new AwardPersion(); QueryWrapper queryWrapperap2 = QueryGenerator.initQueryWrapper(awardPersion2, req.getParameterMap()); queryWrapperap2.eq("awardsort",2); + queryWrapperap2.eq("studentcode",user.getUsername()); queryWrapperap2.in(bmbhs.size()!=0,"enroll_code",bmbhs); List list2 = awardPersionService.list(queryWrapperap2); map.put("edjNumber",list2.size()); - //三等奖人数 + //三等奖数 AwardPersion awardPersion3 = new AwardPersion(); QueryWrapper queryWrapperap3 = QueryGenerator.initQueryWrapper(awardPersion3, req.getParameterMap()); queryWrapperap3.eq("awardsort",3); + queryWrapperap3.eq("studentcode",user.getUsername()); queryWrapperap3.in(bmbhs.size()!=0,"enroll_code",bmbhs); List list3 = awardPersionService.list(queryWrapperap3); map.put("sdjNumber",list3.size()); - //四等奖人数 + //四等奖数 AwardPersion awardPersion4 = new AwardPersion(); QueryWrapper queryWrapperap4 = QueryGenerator.initQueryWrapper(awardPersion4, req.getParameterMap()); queryWrapperap4.eq("awardsort",4); + queryWrapperap4.eq("studentcode",user.getUsername()); queryWrapperap4.in(bmbhs.size()!=0,"enroll_code",bmbhs); List list4 = awardPersionService.list(queryWrapperap4); map.put("sidjNumber",list4.size()); - //五等奖人数 + //五等奖数 AwardPersion awardPersion5 = new AwardPersion(); QueryWrapper queryWrapperap5 = QueryGenerator.initQueryWrapper(awardPersion5, req.getParameterMap()); queryWrapperap5.eq("awardsort",5); + queryWrapperap5.eq("studentcode",user.getUsername()); queryWrapperap5.in(bmbhs.size()!=0,"enroll_code",bmbhs); List list5 = awardPersionService.list(queryWrapperap5); map.put("wdjNumber",list5.size()); - } - //参赛院系用到的list - List listcs= new ArrayList<>(); - //个人赛人数 - AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration1 = new AnnualCompetitionProjectRegistration(); - QueryWrapper queryWrapperbm1 = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration1, req.getParameterMap()); - queryWrapperbm1.in(acpIds.size()!=0,"annual_compid",acpIds); - queryWrapperbm1.eq("enroll_static", "2"); - queryWrapperbm1.eq("entry_format", "0"); - List listbm1 = annualCompetitionProjectRegistrationService.list(queryWrapperbm1); - if(listbm1.size()==0){ - map.put("grsNumber",0); - }else { - TeamManagement teamManagement = new TeamManagement(); - QueryWrapper queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); - List bmbhs = listbm1.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList()); - queryWrappertm.in(bmbhs.size()!=0,"enroll_code",bmbhs); - List listtm = teamManagementService.list(queryWrappertm); - map.put("grsNumber",listtm.size()); - listcs.addAll(listtm); - } - //团队赛人数 - AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration2 = new AnnualCompetitionProjectRegistration(); - QueryWrapper queryWrapperbm2 = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration2, req.getParameterMap()); - queryWrapperbm2.in(acpIds.size()!=0,"annual_compid",acpIds); - queryWrapperbm2.eq("enroll_static", "2"); - queryWrapperbm2.eq("entry_format", "1"); - List listbm2 = annualCompetitionProjectRegistrationService.list(queryWrapperbm2); - if(listbm2.size()==0){ - map.put("tdsNumber",0); - }else { - TeamManagement teamManagement = new TeamManagement(); - QueryWrapper queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); - List bmbhs = listbm2.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList()); - queryWrappertm.in(bmbhs.size()!=0,"enroll_code",bmbhs); - List listtm = teamManagementService.list(queryWrappertm); - map.put("tdsNumber",listtm.size()); - //查只是队长的用户id - queryWrappertm.eq("captain","1"); - List listdz = teamManagementService.list(queryWrappertm); - listcs.addAll(listdz); - } - //参赛院系人数排名(只取前六条) - if(listcs.size()==0){ - map.put("csyxbmpm",new ArrayList<>()); - map.put("bmxsxxList",new ArrayList<>()); - }else { - //拿到所有的userid - List userIds = listcs.stream().map(TeamManagement::getUserId).collect(Collectors.toList()); - QueryWrapper queryWrappersud = new QueryWrapper<>(); - queryWrappersud.select("dep_id,COUNT(*) as user_id"); - queryWrappersud.in("user_id",userIds); - queryWrappersud.groupBy("dep_id"); - queryWrappersud.orderByDesc("COUNT(*)"); - List listsud = sysUserDepartService.list(queryWrappersud); - List> csyxpmListMap = new ArrayList<>(); - if(listsud.size()>6){ - for (int o = 0 ; o < 6 ; o++){ - Map map2 = new HashMap<>(); - map2.put("pm",o+1); - map2.put("csyxid",listsud.get(o).getDepId()); - SysDepart depart = sysDepartService.query().eq("id", listsud.get(o).getDepId()).one(); - map2.put("csyxname",depart.getDepartName()); - map2.put("bms",listsud.get(o).getUserId()); - csyxpmListMap.add(map2); - } - map.put("csyxbmpm",csyxpmListMap); - }else { - for (int u = 0 ; u map3 = new HashMap<>(); - map3.put("pm",u+1); - map3.put("csyxid",listsud.get(u).getDepId()); - SysDepart depart = sysDepartService.query().eq("id", listsud.get(u).getDepId()).one(); - map3.put("csyxname",depart.getDepartName()); - map3.put("bms",listsud.get(u).getUserId()); - csyxpmListMap.add(map3); - } - map.put("csyxbmpm",csyxpmListMap); - } - //报名学生列表(只取前六条) - //根据userIds查询出六个学生信息 - List> bmxsxxListMap = new ArrayList<>(); - if(userIds.size()>6){ - for (int p = 0 ; p < 6 ; p++){ - List userDeparts = sysUserDepartService.query().eq("user_id", userIds.get(p)).list(); - SysUser sysUser = sysUserService.query().eq("id", userIds.get(p)).one(); - SysDepart depart = sysDepartService.query().eq("id", userDeparts.get(0).getDepId()).one(); - Map map4 = new HashMap<>(); - map4.put("name",sysUser.getRealname()); - map4.put("xh",sysUser.getUsername()); - map4.put("szyx",depart.getDepartName()); - bmxsxxListMap.add(map4); + //所有奖项(前六条) + AwardPersion awardPersionAll = new AwardPersion(); + QueryWrapper queryWrapperapAll = QueryGenerator.initQueryWrapper(awardPersionAll, req.getParameterMap()); + queryWrapperapAll.eq("studentcode",user.getUsername()); + queryWrapperapAll.in(bmbhs.size()!=0,"enroll_code",bmbhs); + List listAll = awardPersionService.list(queryWrapperapAll); + List> allApListMap = new ArrayList<>(); + if(listAll.size()>6){ + for (int y = 0 ; y < 6; y++){ + Map mapall1 = new HashMap<>(); + mapall1.put("jxname",listAll.get(y).getAwardname()); + mapall1.put("ndbs",annualCompService.getById(listAll.get(y).getAnnalComp()).getName()); + mapall1.put("ndbsxm",annualCompPointService.getById(listAll.get(y).getAnnualCompP()).getObjName()); + QueryWrapper queryWrapperpcs = new QueryWrapper<>(); + queryWrapperpcs.eq("annual_comp_id",listAll.get(y).getAnnalComp()); + queryWrapperpcs.eq("annual_comp_p",listAll.get(y).getAnnualCompP()); + queryWrapperpcs.eq("work_on",user.getUsername()); + List listpcs = personalCompScoreService.list(queryWrapperpcs); + if(listpcs.size()==0){ + mapall1.put("jf",0); + }else { + mapall1.put("jf",listpcs.get(0).getScore()); + } + allApListMap.add(mapall1); + } - map.put("bmxsxxList",bmxsxxListMap); - }else { - for (int a = 0 ; a < userIds.size() ; a++){ - List userDeparts = sysUserDepartService.query().eq("user_id", userIds.get(a)).list(); - SysUser sysUser = sysUserService.query().eq("id", userIds.get(a)).one(); - SysDepart depart = sysDepartService.query().eq("id", userDeparts.get(0).getDepId()).one(); - Map map5 = new HashMap<>(); - map5.put("name",sysUser.getRealname()); - map5.put("xh",sysUser.getUsername()); - map5.put("szyx",depart.getDepartName()); - bmxsxxListMap.add(map5); + }else{ + for (int n = 0 ; n < listAll.size(); n++){ + Map mapall2 = new HashMap<>(); + mapall2.put("jxname",listAll.get(n).getAwardname()); + mapall2.put("ndbs",annualCompService.getById(listAll.get(n).getAnnalComp()).getName()); + mapall2.put("ndbsxm",annualCompPointService.getById(listAll.get(n).getAnnualCompP()).getObjName()); + QueryWrapper queryWrapperpcs = new QueryWrapper<>(); + queryWrapperpcs.eq("annual_comp_id",listAll.get(n).getAnnalComp()); + queryWrapperpcs.eq("annual_comp_p",listAll.get(n).getAnnualCompP()); + queryWrapperpcs.eq("work_on",user.getUsername()); + List listpcs = personalCompScoreService.list(queryWrapperpcs); + if(listpcs.size()==0){ + mapall2.put("jf",0); + }else { + mapall2.put("jf",listpcs.get(0).getScore()); + } + allApListMap.add(mapall2); } - map.put("bmxsxxList",bmxsxxListMap); } - - } - if(map.isEmpty()){ - return Result.error("无可用的比赛项目"); + map.put("allApList",allApListMap); } + + return Result.OK(map); } 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 9ddfbcf6..80251297 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 @@ -221,37 +221,17 @@ public class AwardPersionController extends JeecgController queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); queryWrappertm.eq("enroll_code",awardPersion.getEnrollCode()); List listtm = teamManagementService.list(queryWrappertm); - if(listtm.size()>1){ - TeamManagement teamManagement1 = new TeamManagement(); - QueryWrapper queryWrappertm1 = QueryGenerator.initQueryWrapper(teamManagement1, req.getParameterMap()); - queryWrappertm1.eq("enroll_code",awardPersion.getEnrollCode()); - queryWrappertm1.eq("captain","1"); - List listtm1 = teamManagementService.list(queryWrappertm1); - SysUser sysUser = sysUserService.getById(listtm1.get(0).getUserId()); - awardPersion.setStudentname(sysUser.getRealname()); - awardPersion.setStudentcode(sysUser.getUsername()); - awardPersion.setStudentorg(sysDepartService.queryDepartsByUsername(sysUser.getUsername()).get(0).getOrgCode()); - awardPersionService.save(awardPersion); - AnnualCompPoint annualCompPoint = annualCompPointService.getById(awardPersion.getAnnualCompP()); - annualCompPoint.setIsPj(1); - annualCompPointService.updateById(annualCompPoint); - return Result.OK("添加成功!"); - }else { - SysUser sysUser = sysUserService.getById(listtm.get(0).getUserId()); + for (int l = 0 ; l < listtm.size() ; l++){ + SysUser sysUser = sysUserService.getById(listtm.get(l).getUserId()); awardPersion.setStudentname(sysUser.getRealname()); awardPersion.setStudentcode(sysUser.getUsername()); awardPersion.setStudentorg(sysDepartService.queryDepartsByUsername(sysUser.getUsername()).get(0).getOrgCode()); awardPersionService.save(awardPersion); - AnnualCompPoint annualCompPoint = annualCompPointService.getById(awardPersion.getAnnualCompP()); - annualCompPoint.setIsPj(1); - annualCompPointService.updateById(annualCompPoint); - return Result.OK("添加成功!"); -/* SysUserDepart sysUserDepart = new SysUserDepart(null,null); - QueryWrapper queryWrappersud = QueryGenerator.initQueryWrapper(sysUserDepart, req.getParameterMap()); - queryWrappersud.eq("user_id",sysUser.getId()); - awardPersion.setStudentorg(sysDepartService.getById(sysUserDepartService.getOne(queryWrappersud).getDepId()).getOrgCode());*/ } - + AnnualCompPoint annualCompPoint = annualCompPointService.getById(awardPersion.getAnnualCompP()); + annualCompPoint.setIsPj(1); + annualCompPointService.updateById(annualCompPoint); + return Result.OK("添加成功!"); } } @@ -267,7 +247,7 @@ public class AwardPersionController extends JeecgController edit(@RequestBody AwardPersion awardPersion,HttpServletRequest req) { - AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); +/* AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); QueryWrapper queryWrappera = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); queryWrappera.eq("annual_compid",awardPersion.getAnnualCompP()); queryWrappera.eq("enroll_static","2"); @@ -306,7 +286,10 @@ public class AwardPersionController extends JeecgController list = ExcelImportUtil.importExcel(file.getInputStream(), AwardPersion.class, params); + List listsave = new ArrayList<>(); for(int i = 0 ; i < list.size() ; i++){ AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); QueryWrapper queryWrappera = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, request.getParameterMap()); @@ -525,71 +509,39 @@ public class AwardPersionController extends JeecgController queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, request.getParameterMap()); queryWrappertm.eq("enroll_code",list.get(i).getEnrollCode()); List listtm = teamManagementService.list(queryWrappertm); - if(listtm.size()>1){ - TeamManagement teamManagement1 = new TeamManagement(); - QueryWrapper queryWrappertm1 = QueryGenerator.initQueryWrapper(teamManagement1, request.getParameterMap()); - queryWrappertm1.eq("enroll_code",list.get(i).getEnrollCode()); - queryWrappertm1.eq("captain","1"); - List listtm1 = teamManagementService.list(queryWrappertm1); - SysUser sysUser = sysUserService.getById(listtm1.get(0).getUserId()); - list.get(i).setStudentorg(sysDepartService.queryDepartsByUsername(sysUser.getUsername()).get(0).getOrgCode()); - if(listaca.get(0).getFirstPrize().equals(list.get(i).getAwardname())){ - list.get(i).setAwardsort(1); - list.get(i).setAwardid(listaca.get(0).getId()); - list.get(i).setStudentcode(sysUser.getUsername()); - list.get(i).setStudentname(sysUser.getRealname()); - }else if(listaca.get(0).getSecondPrize().equals(list.get(i).getAwardname())){ - list.get(i).setAwardsort(2); - list.get(i).setAwardid(listaca.get(0).getId()); - list.get(i).setStudentcode(sysUser.getUsername()); - list.get(i).setStudentname(sysUser.getRealname()); - }else if(listaca.get(0).getThirdPrize().equals(list.get(i).getAwardname())){ - list.get(i).setAwardsort(3); - list.get(i).setAwardid(listaca.get(0).getId()); - list.get(i).setStudentcode(sysUser.getUsername()); - list.get(i).setStudentname(sysUser.getRealname()); - }else if(listaca.get(0).getFourthPrize().equals(list.get(i).getAwardname())){ - list.get(i).setAwardsort(4); - list.get(i).setAwardid(listaca.get(0).getId()); - list.get(i).setStudentcode(sysUser.getUsername()); - list.get(i).setStudentname(sysUser.getRealname()); - }else if(listaca.get(0).getFifthPrize().equals(list.get(i).getAwardname())){ - list.get(i).setAwardsort(5); - list.get(i).setAwardid(listaca.get(0).getId()); - list.get(i).setStudentcode(sysUser.getUsername()); - list.get(i).setStudentname(sysUser.getRealname()); - }else { - return Result.error("文件导入失败:第"+(i+1)+"行奖项名称不存在"); - } - - }else { - SysUser sysUser = sysUserService.getById(listtm.get(0).getUserId()); + for (int l = 0 ; l < listtm.size() ; l++){ + SysUser sysUser = sysUserService.getById(listtm.get(l).getUserId()); list.get(i).setStudentorg(sysDepartService.queryDepartsByUsername(sysUser.getUsername()).get(0).getOrgCode()); if(listaca.get(0).getFirstPrize().equals(list.get(i).getAwardname())){ list.get(i).setAwardsort(1); list.get(i).setAwardid(listaca.get(0).getId()); list.get(i).setStudentcode(sysUser.getUsername()); list.get(i).setStudentname(sysUser.getRealname()); + listsave.add(list.get(i)); }else if(listaca.get(0).getSecondPrize().equals(list.get(i).getAwardname())){ list.get(i).setAwardsort(2); list.get(i).setAwardid(listaca.get(0).getId()); list.get(i).setStudentcode(sysUser.getUsername()); list.get(i).setStudentname(sysUser.getRealname()); + listsave.add(list.get(i)); }else if(listaca.get(0).getThirdPrize().equals(list.get(i).getAwardname())){ list.get(i).setAwardsort(3); list.get(i).setAwardid(listaca.get(0).getId()); list.get(i).setStudentcode(sysUser.getUsername()); list.get(i).setStudentname(sysUser.getRealname()); + listsave.add(list.get(i)); }else if(listaca.get(0).getFourthPrize().equals(list.get(i).getAwardname())){ list.get(i).setAwardsort(4); list.get(i).setAwardid(listaca.get(0).getId()); list.get(i).setStudentcode(sysUser.getUsername()); list.get(i).setStudentname(sysUser.getRealname()); + listsave.add(list.get(i)); }else if(listaca.get(0).getFifthPrize().equals(list.get(i).getAwardname())){ list.get(i).setAwardsort(5); list.get(i).setAwardid(listaca.get(0).getId()); list.get(i).setStudentcode(sysUser.getUsername()); list.get(i).setStudentname(sysUser.getRealname()); + listsave.add(list.get(i)); }else { return Result.error("文件导入失败:第"+(i+1)+"行奖项名称不存在"); } @@ -597,7 +549,7 @@ public class AwardPersionController extends JeecgController - + - + - + - + - + - -