parent
4c461b5552
commit
1348c4d921
8 changed files with 438 additions and 7 deletions
@ -0,0 +1,47 @@ |
||||
package org.jeecg.modules.demo.bigScreen.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; |
||||
import org.jeecg.modules.demo.bigScreen.service.CompSystemBigScreenService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @Description: 比赛综合管理系统大屏 |
||||
* @Author: Z.H.C |
||||
* @CreateTime: 2023-11-28 16:45 |
||||
* @Version: 1.0 |
||||
*/ |
||||
|
||||
@Api(tags = "比赛系统大屏") |
||||
@RestController |
||||
@RequestMapping("/comp/bigScreen") |
||||
@Slf4j |
||||
public class CompSystemBigScreenController /*extends JeecgController*/ { |
||||
|
||||
@Autowired |
||||
private CompSystemBigScreenService compSystemBigScreenService; |
||||
|
||||
@ApiOperation(value = "院系综合大屏", notes = "院系综合大屏") |
||||
@GetMapping(value = "/depart") |
||||
public Result bigScreen4Depart(HttpServletRequest req) { |
||||
Map<String, Object> result = compSystemBigScreenService.bigScreen4Depart(); |
||||
return Result.ok(result); |
||||
} |
||||
|
||||
@ApiOperation(value = "学生个人能力大屏", notes = "学生个人能力大屏") |
||||
@GetMapping(value = "/student") |
||||
public Result bigScreen4Student(PersonalAbilityEvaluation personalAbilityEvaluation) { |
||||
Map<String, Object> result = compSystemBigScreenService.bigScreen4Student(personalAbilityEvaluation); |
||||
return Result.ok(result); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,11 @@ |
||||
package org.jeecg.modules.demo.bigScreen.service; |
||||
|
||||
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; |
||||
|
||||
import java.util.Map; |
||||
|
||||
public interface CompSystemBigScreenService { |
||||
Map<String, Object> bigScreen4Depart(); |
||||
|
||||
Map<String, Object> bigScreen4Student(PersonalAbilityEvaluation personalAbilityEvaluation); |
||||
} |
@ -0,0 +1,253 @@ |
||||
package org.jeecg.modules.demo.bigScreen.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import org.jeecg.common.util.DateUtils; |
||||
import org.jeecg.modules.demo.abilityEvaluation.entity.DepartAbilityEvaluation; |
||||
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; |
||||
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluationCollect; |
||||
import org.jeecg.modules.demo.abilityEvaluation.service.IDepartAbilityEvaluationService; |
||||
import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationCollectService; |
||||
import org.jeecg.modules.demo.annual.entity.Annual; |
||||
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.PersonalCompTotalScore; |
||||
import org.jeecg.modules.demo.annualScore.service.IPersonalCompTotalScoreService; |
||||
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; |
||||
import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; |
||||
import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.AnnualCompetitionProjectRegistration; |
||||
import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.TeamManagement; |
||||
import org.jeecg.modules.demo.annualcompetitionprojectregistration.service.IAnnualCompetitionProjectRegistrationService; |
||||
import org.jeecg.modules.demo.annualcompetitionprojectregistration.service.ITeamManagementService; |
||||
import org.jeecg.modules.demo.awardpersion.entity.AwardPersion; |
||||
import org.jeecg.modules.demo.awardpersion.service.IAwardPersionService; |
||||
import org.jeecg.modules.demo.bigScreen.vo.CompVo; |
||||
import org.jeecg.modules.demo.bigScreen.vo.Last5YearDataVo; |
||||
import org.jeecg.modules.demo.comp.entity.Comp; |
||||
import org.jeecg.modules.demo.comp.service.ICompService; |
||||
import org.jeecg.modules.system.entity.SysDepart; |
||||
import org.jeecg.modules.system.entity.SysUser; |
||||
import org.jeecg.modules.system.service.ISysDepartService; |
||||
import org.jeecg.modules.system.service.ISysUserService; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.util.Assert; |
||||
import org.springframework.util.ObjectUtils; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.*; |
||||
import java.util.concurrent.atomic.AtomicReference; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @Description: TODO |
||||
* @Author: Z.H.C |
||||
* @CreateTime: 2023-11-28 17:00 |
||||
* @Version: 1.0 |
||||
*/ |
||||
@Service |
||||
public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenService { |
||||
|
||||
@Autowired |
||||
private IAnnualCompPointService iAnnualCompPointService; |
||||
|
||||
@Autowired |
||||
private IAnnualCompService iAnnualCompService; |
||||
|
||||
@Autowired |
||||
private ICompService iCompService; |
||||
|
||||
@Autowired |
||||
private ISysDepartService iSysDepartService; |
||||
|
||||
@Autowired |
||||
private IAnnualCompetitionProjectRegistrationService iAnnualCompetitionProjectRegistrationService; |
||||
@Autowired |
||||
private ITeamManagementService iTeamManagementService; |
||||
|
||||
@Autowired |
||||
private IAwardPersionService iAwardPersionService; |
||||
|
||||
@Autowired |
||||
private ISysUserService iSysUserService; |
||||
|
||||
@Autowired |
||||
private IPersonalCompTotalScoreService iPersonalCompTotalScoreService; |
||||
|
||||
@Autowired |
||||
private IDepartAbilityEvaluationService iDepartAbilityEvaluationService; |
||||
|
||||
@Autowired |
||||
private IPersonalAbilityEvaluationCollectService iPersonalAbilityEvaluationCollectService; |
||||
|
||||
@Autowired |
||||
private IAnnualService iAnnualService; |
||||
|
||||
@Override |
||||
public Map<String, Object> bigScreen4Depart() { |
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>(); |
||||
|
||||
resultMap.put("compList", this.getCompList()); |
||||
|
||||
List<AwardPersion> awardPersionList = iAwardPersionService.list(new LambdaQueryWrapper<AwardPersion>().last("limit 30")); |
||||
Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).forEach(award -> { |
||||
// 根据报名编号查询参赛者信息,都是个人赛场景
|
||||
TeamManagement management = iTeamManagementService.getOne(new LambdaQueryWrapper<TeamManagement>() |
||||
.eq(TeamManagement::getEnrollCode, award.getEnrollCode()).last("limit 1")); |
||||
if (ObjectUtils.isEmpty(management)) return; |
||||
SysUser sysUser = iSysUserService.getById(management.getUserId()); |
||||
award.setStudentname(sysUser.getRealname()); |
||||
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getById(award.getAnnualCompP()); |
||||
award.setAnnualCompPname(annualCompPoint.getObjName()); |
||||
}); |
||||
resultMap.put("awardList", awardPersionList); |
||||
|
||||
List<PersonalCompTotalScore> personalCompScoreList = iPersonalCompTotalScoreService.list(new LambdaQueryWrapper<PersonalCompTotalScore>() |
||||
.orderByDesc(PersonalCompTotalScore::getScore) |
||||
.last("limit 50")); |
||||
resultMap.put("studentScore", personalCompScoreList); |
||||
|
||||
Map<String, Object> compCounts = new LinkedHashMap<>(); |
||||
Long compCount = iCompService.count(); |
||||
Long pointCount = iAnnualCompPointService.count(); |
||||
//比赛数
|
||||
compCounts.put("compCount", compCount); |
||||
//年度项目比赛数
|
||||
compCounts.put("pointCount", pointCount); |
||||
//总报名数数
|
||||
Long count = iAnnualCompetitionProjectRegistrationService.count(); |
||||
//学生人数
|
||||
Long personCount = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>() |
||||
.eq(AnnualCompetitionProjectRegistration::getEntryFormat, "0")); |
||||
compCounts.put("personCompCount", personCount); |
||||
//队伍数
|
||||
Long teamCount = count - personCount; |
||||
compCounts.put("teamCompCount", teamCount); |
||||
resultMap.put("compCounts", compCounts); |
||||
|
||||
List<DepartAbilityEvaluation> departAbilityEvaluations = iDepartAbilityEvaluationService.list(); |
||||
resultMap.put("departAbilityEvaluation", departAbilityEvaluations); |
||||
|
||||
List<Integer> years = DateUtils.getLast4Year(); |
||||
List<Annual> annualList = iAnnualService.list(new LambdaQueryWrapper<Annual>().in(Annual::getAnnualName, years).orderByAsc(Annual::getAnnualName)); |
||||
List<Last5YearDataVo> last5YearDataVos = new LinkedList<>(); |
||||
Optional.ofNullable(annualList).orElse(new LinkedList<>()).stream().forEach(annual -> { |
||||
Last5YearDataVo last5YearDataVo = new Last5YearDataVo(); |
||||
last5YearDataVo.setYear(annual.getAnnualName()); |
||||
AtomicReference<BigDecimal> personCount4Comp = new AtomicReference<>(BigDecimal.ZERO); |
||||
|
||||
List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>().eq(AnnualComp::getAnnualid, annual.getId())); |
||||
//比赛数
|
||||
last5YearDataVo.setCompCount(annualCompList.size()); |
||||
if (!ObjectUtils.isEmpty(annualCompList)) { |
||||
annualCompList.stream().forEach(ac -> { |
||||
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getOne(new LambdaQueryWrapper<AnnualCompPoint>().eq(AnnualCompPoint::getAnnualCompId, ac.getId())); |
||||
if (!ObjectUtils.isEmpty(annualCompPoint)) { |
||||
long personCount4CompTemp = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>(). |
||||
eq(AnnualCompetitionProjectRegistration::getAnnualCompid, annualCompPoint.getId())); |
||||
personCount4Comp.getAndUpdate(val -> val.add(new BigDecimal(personCount4CompTemp))); |
||||
} |
||||
}); |
||||
} |
||||
last5YearDataVo.setPersonCount(personCount4Comp.get().intValue()); |
||||
last5YearDataVos.add(last5YearDataVo); |
||||
}); |
||||
|
||||
resultMap.put("last5YearData", last5YearDataVos); |
||||
return resultMap; |
||||
} |
||||
|
||||
@Override |
||||
public Map<String, Object> bigScreen4Student(PersonalAbilityEvaluation person) { |
||||
|
||||
Assert.notNull(person.getWorkOn(), "学号不能为空"); |
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>(); |
||||
List<PersonalAbilityEvaluationCollect> personalAbilityEvaluationList = iPersonalAbilityEvaluationCollectService.list(new LambdaQueryWrapper<PersonalAbilityEvaluationCollect>() |
||||
.eq(PersonalAbilityEvaluationCollect::getWorkOn, person.getWorkOn())); |
||||
resultMap.put("studentAbilityEvaluation", personalAbilityEvaluationList); |
||||
|
||||
Map<String, Object> studentInfoMap = new LinkedHashMap<>(); |
||||
PersonalCompTotalScore compTotalScore = iPersonalCompTotalScoreService.getOne(new LambdaQueryWrapper<PersonalCompTotalScore>() |
||||
.eq(PersonalCompTotalScore::getWorkOn, person.getWorkOn())); |
||||
studentInfoMap.put("score", compTotalScore); |
||||
|
||||
|
||||
SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getWorkNo, person.getWorkOn())); |
||||
List<AwardPersion> awardPersions = iAwardPersionService.list(new LambdaQueryWrapper<AwardPersion>() |
||||
.eq(AwardPersion::getStudentcode, person.getWorkOn())); |
||||
Optional.ofNullable(awardPersions).orElse(new LinkedList<>()).forEach(award -> { |
||||
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getById(award.getAnnualCompP()); |
||||
award.setAnnualCompPname(annualCompPoint.getObjName()); |
||||
}); |
||||
|
||||
studentInfoMap.put("studentAwardList", awardPersions); |
||||
studentInfoMap.put("workNo", person.getWorkOn()); |
||||
studentInfoMap.put("name", sysUser.getRealname()); |
||||
studentInfoMap.put("major", "软件工程"); |
||||
studentInfoMap.put("grade", "202*级"); |
||||
studentInfoMap.put("class", "软工*班"); |
||||
resultMap.put("studentInfo", studentInfoMap); |
||||
|
||||
List<TeamManagement> studentEnrollCodeList = iTeamManagementService.list(new LambdaQueryWrapper<TeamManagement>() |
||||
.eq(TeamManagement::getUserId, sysUser.getId())); |
||||
List<String> enrollCodeList = studentEnrollCodeList.stream().map(en -> en.getEnrollCode()).collect(Collectors.toList()); |
||||
List<AnnualCompetitionProjectRegistration> registrationList = iAnnualCompetitionProjectRegistrationService.list(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>() |
||||
.in(AnnualCompetitionProjectRegistration::getEnrollCode, enrollCodeList)); |
||||
|
||||
List<CompVo> compVoList = new LinkedList<>(); |
||||
Optional.ofNullable(registrationList).orElse(new LinkedList<>()).forEach(r -> { |
||||
AnnualCompPoint p = iAnnualCompPointService.getById(r.getAnnualCompid()); |
||||
CompVo compVo = new CompVo(); |
||||
BeanUtils.copyProperties(p, compVo); |
||||
AwardPersion awardPersion = iAwardPersionService.getOne(new LambdaQueryWrapper<AwardPersion>() |
||||
.eq(AwardPersion::getEnrollCode, r.getEnrollCode()) |
||||
.eq(AwardPersion::getAnnualCompP, r.getAnnualCompid()) |
||||
); |
||||
if (ObjectUtils.isEmpty(awardPersion)) { |
||||
compVo.setAwardName("--"); |
||||
} else { |
||||
compVo.setAwardName(awardPersion.getAwardname()); |
||||
} |
||||
compVo.setCompName(p.getObjName()); |
||||
AnnualComp annualComp = iAnnualCompService.getById(p.getAnnualCompId()); |
||||
if (!ObjectUtils.isEmpty(annualComp)) { |
||||
Comp comp = iCompService.getById(annualComp.getCompid()); |
||||
if (!ObjectUtils.isEmpty(comp)) { |
||||
SysDepart sysDepart = iSysDepartService.getById(comp.getCompOrgan()); |
||||
compVo.setCompOrganName(sysDepart.getDepartName()); |
||||
} |
||||
} |
||||
compVoList.add(compVo); |
||||
}); |
||||
resultMap.put("compList", compVoList); |
||||
|
||||
return resultMap; |
||||
} |
||||
|
||||
List<CompVo> getCompList() { |
||||
List<AnnualCompPoint> annualCompPointList = iAnnualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>() |
||||
.eq(AnnualCompPoint::getRequireApply, "Y")); |
||||
List<CompVo> compVoList = new LinkedList<>(); |
||||
Optional.ofNullable(annualCompPointList).orElse(new LinkedList<>()).stream().forEach(p -> { |
||||
CompVo compVo = new CompVo(); |
||||
BeanUtils.copyProperties(p, compVo); |
||||
Long numberCount = iAnnualCompetitionProjectRegistrationService.count(new LambdaQueryWrapper<AnnualCompetitionProjectRegistration>() |
||||
.eq(AnnualCompetitionProjectRegistration::getAnnualCompid, p.getId())); |
||||
compVo.setNumber(numberCount.intValue()); |
||||
AnnualComp annualComp = iAnnualCompService.getById(p.getAnnualCompId()); |
||||
if (!ObjectUtils.isEmpty(annualComp)) { |
||||
Comp comp = iCompService.getById(annualComp.getCompid()); |
||||
if (!ObjectUtils.isEmpty(comp)) { |
||||
compVo.setCompName(comp.getCompName()); |
||||
SysDepart sysDepart = iSysDepartService.getById(comp.getCompOrgan()); |
||||
compVo.setCompOrganName(sysDepart.getDepartName()); |
||||
} |
||||
} |
||||
compVoList.add(compVo); |
||||
}); |
||||
return compVoList; |
||||
} |
||||
} |
@ -0,0 +1,33 @@ |
||||
package org.jeecg.modules.demo.bigScreen.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @Description: TODO |
||||
* @Author: Z.H.C |
||||
* @CreateTime: 2023-11-29 15:52 |
||||
* @Version: 1.0 |
||||
*/ |
||||
@Data |
||||
public class CompVo implements Serializable { |
||||
|
||||
@ApiModelProperty(value = "主键") |
||||
private String id; |
||||
|
||||
/** |
||||
* 比赛名称 |
||||
*/ |
||||
@ApiModelProperty(value = "比赛名称") |
||||
private String compName; |
||||
|
||||
@ApiModelProperty(value = "负责部门") |
||||
private String compOrganName; |
||||
|
||||
@ApiModelProperty(value = "奖项名称") |
||||
private java.lang.String awardName; |
||||
|
||||
private Integer number; |
||||
} |
@ -0,0 +1,36 @@ |
||||
package org.jeecg.modules.demo.bigScreen.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import io.swagger.models.auth.In; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @Description: TODO |
||||
* @Author: Z.H.C |
||||
* @CreateTime: 2023-11-30 16:08 |
||||
* @Version: 1.0 |
||||
*/ |
||||
|
||||
@Data |
||||
public class Last5YearDataVo implements Serializable { |
||||
|
||||
// @ApiModelProperty(value = "主键")
|
||||
// private String id;
|
||||
|
||||
/** |
||||
* 比赛名称 |
||||
*/ |
||||
// @ApiModelProperty(value = "比赛名称")
|
||||
// private String compName;
|
||||
|
||||
@ApiModelProperty(value = "年度") |
||||
private String year; |
||||
|
||||
@ApiModelProperty(value = "比赛数量") |
||||
private Integer compCount; |
||||
|
||||
@ApiModelProperty(value = "参赛人数量") |
||||
private Integer personCount; |
||||
} |
Loading…
Reference in new issue