diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualCompPoint/controller/AnnualCompPointController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualCompPoint/controller/AnnualCompPointController.java index 77afcbe8..8ba7429c 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualCompPoint/controller/AnnualCompPointController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualCompPoint/controller/AnnualCompPointController.java @@ -68,10 +68,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.time.LocalDateTime; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -1038,5 +1036,147 @@ public class AnnualCompPointController extends JeecgController zjsybsjs( HttpServletRequest req) { + //获取当前登录用户 + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + Map map = new HashMap<>(); + QueryWrapper exqueryWrapper = new QueryWrapper<>(); + exqueryWrapper.eq("user_id", user.getId()); + Expert expert = expertService.getOne(exqueryWrapper); + if(expert!=null){ + QueryWrapper coexqueryWrapper = new QueryWrapper<>(); + coexqueryWrapper.eq("expid", expert.getId()); + List compExpList = compExpService.list(coexqueryWrapper); + if(compExpList.size()>0){ + List compids = compExpList.stream().map(CompExp::getCompid).collect(Collectors.toList()); + QueryWrapper anncoqueryWrapper = new QueryWrapper<>(); + anncoqueryWrapper.in("compid",compids); + List annualCompList = annualCompService.list(anncoqueryWrapper); + List> jxzListMap = new ArrayList<>(); + List> lsListMap = new ArrayList<>(); + if(annualCompList.size()>0){ + List ndbsids = annualCompList.stream().map(AnnualComp::getId).collect(Collectors.toList()); + //进行中年度比赛项目 + AnnualCompPoint annualCompPoint = new AnnualCompPoint(); + QueryWrapper queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap()); + queryWrapperacp.in("annual_comp_id",ndbsids); + queryWrapperacp.le("starttime",new Date()); + queryWrapperacp.ge("endtime",new Date()); + List listacp = annualCompPointService.list(queryWrapperacp); + map.put("jxzndbsxmNumber",listacp.size()); + if(listacp.size()>6){ + for (int p = 0 ; p < 6 ; p++){ + Map mapall1 = new HashMap<>(); + mapall1.put("xh",p+1); + mapall1.put("ndbs",annualCompService.getById(listacp.get(p).getAnnualCompId()).getName()); + mapall1.put("ndbsxm",listacp.get(p).getObjName()); + jxzListMap.add(mapall1); + } + }else{ + for (int o = 0 ; o < listacp.size() ; o++){ + Map mapall2 = new HashMap<>(); + mapall2.put("xh",o+1); + mapall2.put("ndbs",annualCompService.getById(listacp.get(o).getAnnualCompId()).getName()); + mapall2.put("ndbsxm",listacp.get(o).getObjName()); + jxzListMap.add(mapall2); + } + } + map.put("jxzndbsxmList",jxzListMap); + + //历史年度比赛项目 + QueryWrapper queryWrapperacpls = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap()); + queryWrapperacpls.in("annual_comp_id",ndbsids); + queryWrapperacpls.lt("endtime",new Date()); + List listacpls = annualCompPointService.list(queryWrapperacpls); + map.put("lsndbsxmNumber",listacpls.size()); + if(listacpls.size()>6){ + for (int q = 0 ; q < 6 ; q++){ + Map mapall3 = new HashMap<>(); + mapall3.put("xh",q+1); + mapall3.put("ndbs",annualCompService.getById(listacpls.get(q).getAnnualCompId()).getName()); + mapall3.put("ndbsxm",listacpls.get(q).getObjName()); + lsListMap.add(mapall3); + } + }else{ + for (int w = 0 ; w < listacpls.size() ; w++){ + Map mapall4 = new HashMap<>(); + mapall4.put("xh",w+1); + mapall4.put("ndbs",annualCompService.getById(listacpls.get(w).getAnnualCompId()).getName()); + mapall4.put("ndbsxm",listacpls.get(w).getObjName()); + lsListMap.add(mapall4); + } + } + map.put("lsndbsxmList",lsListMap); + //进行中 国 省 市 校 + 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); + //历史 国 省 市 校 + int gjjls = 0; + int shengjls = 0; + int shijls = 0; + int xjls = 0; + for (int k = 0 ; k < listacpls.size() ; k++){ + if(listacpls.get(k).getObjLevel().equals("1809121223401168898")){ + //国家 + gjjls = gjjls+1; + } + if(listacpls.get(k).getObjLevel().equals("1809121301201313793")){ + //省 + shengjls = shengjls+1; + } + if(listacpls.get(k).getObjLevel().equals("1809121356582903809")){ + //市 + shijls = shijls+1; + } + if(listacpls.get(k).getObjLevel().equals("1809121454654119937")){ + //校 + xjls = xjls+1; + } + } + map.put("gjjls",gjjls); + map.put("shengjls",shengjls); + map.put("shijls",shijls); + map.put("xjls",xjls); + + } + } + + } + return Result.OK(map); + + } + }