Merge remote-tracking branch 'origin/main'

main
王家东 4 months ago
commit c07593f694
  1. 148
      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<AnnualCompPoint,
}
/**
* 专家角色首页比赛数据接口
*
* @param req
* @return
*/
@ApiOperation(value="专家角色首页比赛数据接口", notes="专家角色首页比赛数据接口")
@GetMapping(value = "/zjsybsjs")
public Result<?> zjsybsjs( HttpServletRequest req) {
//获取当前登录用户
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Map<String, Object> map = new HashMap<>();
QueryWrapper<Expert> exqueryWrapper = new QueryWrapper<>();
exqueryWrapper.eq("user_id", user.getId());
Expert expert = expertService.getOne(exqueryWrapper);
if(expert!=null){
QueryWrapper<CompExp> coexqueryWrapper = new QueryWrapper<>();
coexqueryWrapper.eq("expid", expert.getId());
List<CompExp> compExpList = compExpService.list(coexqueryWrapper);
if(compExpList.size()>0){
List<String> compids = compExpList.stream().map(CompExp::getCompid).collect(Collectors.toList());
QueryWrapper<AnnualComp> anncoqueryWrapper = new QueryWrapper<>();
anncoqueryWrapper.in("compid",compids);
List<AnnualComp> annualCompList = annualCompService.list(anncoqueryWrapper);
List<Map<String,Object>> jxzListMap = new ArrayList<>();
List<Map<String,Object>> lsListMap = new ArrayList<>();
if(annualCompList.size()>0){
List<String> ndbsids = annualCompList.stream().map(AnnualComp::getId).collect(Collectors.toList());
//进行中年度比赛项目
AnnualCompPoint annualCompPoint = new AnnualCompPoint();
QueryWrapper<AnnualCompPoint> queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap());
queryWrapperacp.in("annual_comp_id",ndbsids);
queryWrapperacp.le("starttime",new Date());
queryWrapperacp.ge("endtime",new Date());
List<AnnualCompPoint> listacp = annualCompPointService.list(queryWrapperacp);
map.put("jxzndbsxmNumber",listacp.size());
if(listacp.size()>6){
for (int p = 0 ; p < 6 ; p++){
Map<String, Object> 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<String, Object> 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<AnnualCompPoint> queryWrapperacpls = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap());
queryWrapperacpls.in("annual_comp_id",ndbsids);
queryWrapperacpls.lt("endtime",new Date());
List<AnnualCompPoint> listacpls = annualCompPointService.list(queryWrapperacpls);
map.put("lsndbsxmNumber",listacpls.size());
if(listacpls.size()>6){
for (int q = 0 ; q < 6 ; q++){
Map<String, Object> 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<String, Object> 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);
}
}

Loading…
Cancel
Save