diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/controller/UserHomePageController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/controller/UserHomePageController.java index 8d4a5fef..15c5fe99 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/controller/UserHomePageController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/controller/UserHomePageController.java @@ -48,15 +48,15 @@ public class UserHomePageController { @AutoLog(value = "学校管理员-分析报告") @ApiOperation(value = "河南机电-学校综合报告", notes = "河南机电-学校综合报告") @GetMapping(value = "/report4School") - public Result report4School(boolean recreateFlag) { - Object result = homePageService.report4School(recreateFlag); + public Result report4School(String annualid, boolean recreateFlag) { + Object result = homePageService.report4School(annualid,recreateFlag); return Result.ok(result); } @AutoLog(value = "部门管理员-分析报告") @ApiOperation(value = "河南机电-部门综合报告", notes = "河南机电-部门综合报告") @GetMapping(value = "/report4Depart") - public Result report4Depart(String orgCode,boolean recreateFlag) { - return Result.ok(homePageService.report4Depart(orgCode, recreateFlag)); + public Result report4Depart(String annualid,String orgCode, boolean recreateFlag) { + return Result.ok(homePageService.report4Depart(annualid,orgCode, recreateFlag)); } } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageService.java index 05d7eaaa..b2cdd97f 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageService.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageService.java @@ -8,7 +8,7 @@ public interface UserHomePageService { Map homePage4School(); - Object report4School(boolean recreateFlag); + Object report4School(String year,boolean recreateFlag); - Object report4Depart(String orgCode, boolean recreateFlag); + Object report4Depart(String year,String orgCode, boolean recreateFlag); } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageServiceImpl.java index 752e17f5..e8f95ff0 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageServiceImpl.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/homepage/service/UserHomePageServiceImpl.java @@ -2,6 +2,7 @@ package org.jeecg.modules.demo.homepage.service; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.commons.lang3.StringUtils; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.util.ComputeUtils; import org.jeecg.common.util.DateUtils; @@ -362,24 +363,34 @@ public class UserHomePageServiceImpl implements UserHomePageService { } @Override - public Object report4School(boolean recreateFlag) { - - final String REPORT4SCHOOL = "report4School"; + public Object report4School(String annualId, boolean recreateFlag) { + String currentYear; + if (StringUtils.isNotBlank(annualId)) { + Annual annual = iAnnualService.getById(annualId); + currentYear = annual.getAnnualName(); + } else { + currentYear = DateUtils.getCurrentYear() + ""; + } + final String REPORT4SCHOOL = "report4School-" + currentYear; Map resultMap = new LinkedHashMap<>(); + boolean hasKey = redisUtil.hasKey(REPORT4SCHOOL); + if (hasKey && !recreateFlag) { + return redisUtil.get(REPORT4SCHOOL); + } if (recreateFlag) { - int currentYear = DateUtils.getCurrentYear(); - //当前年度 + //年度 Annual annual = iAnnualService.getOne(new LambdaQueryWrapper().eq(Annual::getAnnualName, currentYear + "")); - + if (ObjectUtils.isEmpty(annual)) return resultMap; List annualCompList = iAnnualCompService.list(new LambdaQueryWrapper() .eq(AnnualComp::getAnnualid, annual.getId())); Set compIds = Optional.ofNullable(annualCompList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); List annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper().in(!ObjectUtils.isEmpty(compIds), AnnualCompPoint::getAnnualCompId, compIds)); + if(ObjectUtil.isEmpty(annualCompPointList)) return resultMap; //当前年,所有项目id Set annualCompPointIds = Optional.ofNullable(annualCompPointList).orElse(new ArrayList<>()).stream().map(annualCompPoint -> annualCompPoint.getId()).collect(Collectors.toSet()); - + if(ObjectUtil.isEmpty(annualCompPointIds)) return resultMap; //未评奖的项目为进行中 List pj0PointList = Optional.ofNullable(annualCompPointList).orElse(new LinkedList<>()).stream().filter(bo -> "0".equals(bo.getIsPj())).collect(Collectors.toList()); Map countMap = this.convertProjectLevel(annualCompPointList); @@ -587,15 +598,15 @@ public class UserHomePageServiceImpl implements UserHomePageService { scoreList4Point.stream().sorted(Comparator.comparing(HomePageCompVo::getTotalScore)).collect(Collectors.toList()); resultMap.put("比赛学生积分况分析", scoreList4Point); redisUtil.set(REPORT4SCHOOL, resultMap); - return resultMap; - } else { + }/* else { boolean hasKey = redisUtil.hasKey(REPORT4SCHOOL); if (hasKey) { return redisUtil.get(REPORT4SCHOOL); } else { - return this.report4School(true); + return this.report4School(annualId, true); } - } + }*/ + return resultMap; } private List convertPoint4Depart(SysDepart depart) { @@ -613,11 +624,22 @@ public class UserHomePageServiceImpl implements UserHomePageService { } @Override - public Object report4Depart(String orgCode, boolean recreateFlag) { + public Object report4Depart(String annualId, String orgCode, boolean recreateFlag) { Assert.notNull(orgCode, "部门编号不能为空"); - final String REPORT4DEPART = "report4Depart"; Map resultMap = new LinkedHashMap<>(); + String currentYear; + if (StringUtils.isNotBlank(annualId)) { + Annual annual = iAnnualService.getById(annualId); + currentYear = annual.getAnnualName(); + } else { + currentYear = DateUtils.getCurrentYear() + ""; + } + final String REPORT4DEPART = "report4Depart-" + currentYear; + boolean hasKey = redisUtil.hasKey(REPORT4DEPART); + if (hasKey && !recreateFlag) { + return redisUtil.get(REPORT4DEPART); + } if (recreateFlag) { SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper().eq(SysDepart::getOrgCode, orgCode)); if (ObjectUtil.isNull(sysDepart)) { @@ -625,9 +647,10 @@ public class UserHomePageServiceImpl implements UserHomePageService { } String departId = sysDepart.getParentId(); - int currentYear = DateUtils.getCurrentYear(); //当前年度 Annual annual = iAnnualService.getOne(new LambdaQueryWrapper().eq(Annual::getAnnualName, currentYear + "")); + if (ObjectUtils.isEmpty(annual)) return resultMap; + List compList = iCompService.list(new LambdaQueryWrapper().eq(Comp::getCompOrgan, departId)); Set compIds = Optional.ofNullable(compList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); @@ -636,10 +659,13 @@ public class UserHomePageServiceImpl implements UserHomePageService { .in(!ObjectUtils.isEmpty(compIds), AnnualComp::getCompid, compIds)); Set annualCompIds = Optional.ofNullable(annualCompList).orElse(new LinkedList<>()).stream().map(obj -> obj.getId()).collect(Collectors.toSet()); + if(ObjectUtil.isEmpty(annualCompIds)) return resultMap; List annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper().in(AnnualCompPoint::getAnnualCompId, annualCompIds)); + if(ObjectUtil.isEmpty(annualCompPointList)) return resultMap; + //该部门,当前年,所有项目id Set annualCompPointIds = Optional.ofNullable(annualCompPointList).orElse(new ArrayList<>()).stream().map(annualCompPoint -> annualCompPoint.getId()).collect(Collectors.toSet()); - + if(ObjectUtil.isEmpty(annualCompPointIds)) return resultMap; //未评奖的项目为进行中 List pj0PointList = Optional.ofNullable(annualCompPointList).orElse(new LinkedList<>()).stream().filter(bo -> "0".equals(bo.getIsPj())).collect(Collectors.toList()); Map countMap = this.convertProjectLevel(annualCompPointList); @@ -807,15 +833,8 @@ public class UserHomePageServiceImpl implements UserHomePageService { } canSaiList.add(departMap); redisUtil.set(REPORT4DEPART, resultMap); - return resultMap; - } else { - boolean hasKey = redisUtil.hasKey(REPORT4DEPART); - if (hasKey) { - return redisUtil.get(REPORT4DEPART); - } else { - return this.report4Depart(orgCode, true); - } } + return resultMap; } Map convertProjectLevel(List annualCompPointList) { diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/controller/TeamSeqController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/controller/TeamSeqController.java index ca8b49ae..5fea5817 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/controller/TeamSeqController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/controller/TeamSeqController.java @@ -1,5 +1,6 @@ package org.jeecg.modules.demo.teamseq.controller; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -20,10 +21,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @Description: 团队赛队员积分计算配置 @@ -64,9 +62,12 @@ public class TeamSeqController extends JeecgController @ApiOperation(value = "团队赛队员积分计算配置-分页列表查询", notes = "团队赛队员积分计算配置-分页列表查询") @GetMapping(value = "/listByPointId") public Result queryPageList(String pointId) { - List list = teamSeqService.list(new LambdaQueryWrapper().eq(TeamSeq::getPointId, pointId)); - Map map = new LinkedHashMap<>(); - map.put("records",list); + Map map = new LinkedHashMap<>(); + List list =new LinkedList<>(); + if (StrUtil.isNotEmpty(pointId)) { + list = teamSeqService.list(new LambdaQueryWrapper().eq(TeamSeq::getPointId, pointId)); + } + map.put("records", list); return Result.OK(map); } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/service/impl/TeamSeqServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/service/impl/TeamSeqServiceImpl.java index 5bcd0ae5..7a5c6575 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/service/impl/TeamSeqServiceImpl.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/service/impl/TeamSeqServiceImpl.java @@ -1,12 +1,13 @@ package org.jeecg.modules.demo.teamseq.service.impl; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.demo.teamseq.entity.TeamSeq; import org.jeecg.modules.demo.teamseq.mapper.TeamSeqMapper; import org.jeecg.modules.demo.teamseq.service.ITeamSeqService; -import org.jeecg.modules.demo.teamseq.vo.TeamSeqVo; -import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.util.List; @@ -22,13 +23,15 @@ public class TeamSeqServiceImpl extends ServiceImpl impl @Override public void saveOrUpdate4TeamSeq(List list) { + if (ObjectUtil.isEmpty(list)) { + throw new JeecgBootException("配置对象不能为空!"); + } String pointId = list.get(0).getPointId(); + if (StrUtil.isEmpty(pointId)) { + throw new JeecgBootException("比赛项目不能为空!"); + } + this.remove(new LambdaQueryWrapper().eq(TeamSeq::getPointId, pointId)); -// TeamSeqVo vo = new TeamSeqVo(); -// BeanUtils.copyProperties(point, vo); -// vo.setPointId(point.getId()); -// TeamSeq teamSeq = new TeamSeq(); -// BeanUtils.copyProperties(vo, teamSeq); this.saveBatch(list); } } diff --git a/jeecgboot-vue3-master/src/api/common/api.ts b/jeecgboot-vue3-master/src/api/common/api.ts index 6ec6b129..58d6a46b 100644 --- a/jeecgboot-vue3-master/src/api/common/api.ts +++ b/jeecgboot-vue3-master/src/api/common/api.ts @@ -206,7 +206,8 @@ export const getComprehensiveReport = (params = {}) => { // http://localhost:18083/jeecg-boot/user/login/homepage/report4Depart export const getdepartmentReport = (params: any = {}) => { return defHttp.get({ - url: '/user/login/homepage/report4School', + url: '/user/login/homepage/report4Depart', params }) -} \ No newline at end of file +} +// 11111111 \ No newline at end of file diff --git a/jeecgboot-vue3-master/src/views/comprehensiveEvaluation/comprehensiveReport.vue b/jeecgboot-vue3-master/src/views/comprehensiveEvaluation/comprehensiveReport.vue index 287f93bb..8b44802c 100644 --- a/jeecgboot-vue3-master/src/views/comprehensiveEvaluation/comprehensiveReport.vue +++ b/jeecgboot-vue3-master/src/views/comprehensiveEvaluation/comprehensiveReport.vue @@ -1,7 +1,13 @@