package com.yangli.service.Impl.FunctionBar;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yangli.entity.FunctionBar.SportRace;
import com.yangli.entity.FunctionBar.SportRacePrize;
import com.yangli.entity.FunctionBar.SysDictData;
import com.yangli.entity.PersonalPage.SportTeam;
import com.yangli.entity.PersonalPage.SportTeamUser;
import com.yangli.entity.RaceApplication.SportRaceApplication;
import com.yangli.entity.RaceApplication.SportRaceDept;
import com.yangli.entity.ResponseResult;
import com.yangli.entity.SysDept;
import com.yangli.entity.SysUser;
import com.yangli.mapper.FunctionBar.SportRaceMapper;
import com.yangli.mapper.FunctionBar.SportRacePrizeMapper;
import com.yangli.mapper.FunctionBar.SysDictDataMapper;
import com.yangli.mapper.PersonalPage.SportTeamMapper;
import com.yangli.mapper.PersonalPage.SportTeamUserMapper;
import com.yangli.mapper.RaceApplication.SportRaceApplicationMapper;
import com.yangli.mapper.RaceApplication.SportRaceDeptMapper;
import com.yangli.mapper.SysDeptMapper;
import com.yangli.mapper.SysUserMapper;
import com.yangli.service.FunctionBar.SportRaceService;
import com.yangli.util.GetUserIdUtil;
import com.yangli.vo.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* -- IntelliJ IDEA
*
* @author yangli
* @date 2024/5/1 18:23
* @email 488281804@qq.com
* @since JDK1.8
*/
@Service
public class SportRaceServiceImpl implements SportRaceService {
@Resource
private SportRaceMapper sportRaceMapper;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private SportRaceDeptMapper sportRaceDeptMapper;
@Autowired
private SysDictDataMapper sysDictDataMapper;
@Autowired
private SportRaceApplicationMapper sportRaceApplicationMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Resource
private SportTeamUserMapper sportTeamUserMapper;
@Resource
private SportTeamMapper sportTeamMapper;
@Resource
private SportRacePrizeMapper sportRacePrizeMapper;
@Override
public boolean addSportRace(SportRace sportRace) {
return sportRaceMapper.addSportRace(sportRace);
}
@Override
public Integer getKey() {
return sportRaceMapper.getKey();
}
@Override
public boolean updateSportRace(SportRace sportRace) {
return sportRaceMapper.updateSportRace(sportRace);
}
@Override
public SportRace getSportRaceById(long raceId) {
return sportRaceMapper.getSportRaceById(raceId);
}
@Override
public List<SportRace> getSportRaceByPlaceId(String place) {
return sportRaceMapper.getSportRaceByPlaceId(place);
}
@Override
public List<SportRace> getSportRaceByCreateBy(String create_by) {
return sportRaceMapper.getSportRaceByCreateBy(create_by);
}
//汪
@Override
public ResponseResult getScoreBoardList(listQuery lq) {
if(Objects.isNull(lq.getKey())){
return ResponseResult.fail();
}
Integer page = lq.getPage();
Integer limit = lq.getLimit();
lq.setPage((page-1)*limit);
//获取整个学校的积分榜
if(lq.getDept().equals(0L)){
return ResponseResult.success(getscoreBoardVosList(lq),200L);
}
//获取当前登录用户
Long userId = GetUserIdUtil.GetUserId(SecurityContextHolder.getContext().getAuthentication());
//获取个人部门积分榜
lq.setDept(userId);
return ResponseResult.success(getscoreBoardVosList(lq),200L);
}
public List<ScoreBoardVo> getscoreBoardVosList(listQuery lq){
List<ScoreBoardVo> scoreBoardVosList = new ArrayList<>();
List<SysUser> userByIntegral = sysUserMapper.getUserByIntegral(lq);
for (SysUser user : userByIntegral) {
ScoreBoardVo scoreBoardVo = new ScoreBoardVo();
BeanUtils.copyProperties(user,scoreBoardVo);
SysDept sysDept = sysDeptMapper.selectOne(new LambdaQueryWrapper<SysDept>().eq(SysDept::getDeptId, user.getDeptId()));
scoreBoardVo.setDept(sysDept.getDeptName());
scoreBoardVosList.add(scoreBoardVo);
}
return scoreBoardVosList;
}
@Override
public ResponseResult getSportRace(listQuery lq) {
if(Objects.isNull(lq)){
return ResponseResult.fail();
}
Integer page = lq.getPage();
Integer limit = lq.getLimit();
lq.setPage((page-1)*limit);
LambdaQueryWrapper<SportRace> sportRaceLambdaQueryWrapper = new LambdaQueryWrapper<>();
sportRaceLambdaQueryWrapper.orderBy(true,lq.isSort(),SportRace::getApplicationStart);
List<SportRace> sportRaceList = sportRaceMapper.selectList(sportRaceLambdaQueryWrapper);
if(Objects.isNull(sportRaceList)){
return ResponseResult.fail();
}
return ResponseResult.success(getSportRaceVo(sportRaceList),200L);
}
@Override
public ResponseResult Search(listQuery lq) {
if(Objects.isNull(lq.getKey())){
return ResponseResult.fail();
}
List<SportRace> sportRaceList = new ArrayList<>();
//完整的比赛名搜索
SportRace sportRace = sportRaceMapper.selectOne(new LambdaQueryWrapper<SportRace>().eq(SportRace::getTitle, lq.getKey()));
if(!Objects.isNull(sportRace))
{
sportRaceList.add(sportRace);
return ResponseResult.success(getSportRaceVo(sportRaceList),200L);
}
//模糊搜索
List<SportRace> sportRaceList1 = sportRaceMapper.selectList(new LambdaQueryWrapper<SportRace>()
.like(SportRace::getTitle, lq.getKey())
.orderBy(true, lq.isSort(), SportRace::getApplicationStart)
);
if(!Objects.isNull(sportRaceList1))
return ResponseResult.success(getSportRaceVo(sportRaceList1),200L);
return ResponseResult.fail();
}
public List<SportRaceVo> getSportRaceVo(List<SportRace> sportRaceList){
List<SportRaceVo> sportRaceVoList = new ArrayList<>();
if(sportRaceList.isEmpty()){
return null;
}
for (SportRace sportRace : sportRaceList) {
SportRaceVo sportRaceVo =new SportRaceVo();
BeanUtils.copyProperties(sportRace,sportRaceVo);
sportRaceVo.setDept(getSysDeptVo(sportRace));
SysDictData sysDictData = sysDictDataMapper.selectOne(new LambdaQueryWrapper<SysDictData>()
.eq(SysDictData::getDictValue, sportRaceVo.getPlace())
.eq(SysDictData::getDictType,"sport_place_list")
);
sportRaceVo.setPlace(sysDictData.getDictLabel());
sportRaceVoList.add(sportRaceVo);
}
return sportRaceVoList;
}
//获取组织名字
public List<SysDeptVo> getSysDeptVo(SportRace sportRace){
List<SysDeptVo> sysDeptVoList = new ArrayList<>();
List<SportRaceDept> sportRaceDepts = sportRaceDeptMapper.selectList(new LambdaQueryWrapper<SportRaceDept>()
.eq(SportRaceDept::getRaceId, sportRace.getRaceId()));
if(sportRaceDepts.isEmpty())
return null;
for (SportRaceDept sportRaceDept : sportRaceDepts) {
SysDept sysDept = sysDeptMapper.selectOne(new LambdaQueryWrapper<SysDept>()
.eq(SysDept::getDeptId, sportRaceDept.getDeptId()));
SysDeptVo sysDeptVo = new SysDeptVo();
BeanUtils.copyProperties(sysDept,sysDeptVo);
sysDeptVoList.add(sysDeptVo);
}
return sysD
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于Java语言的体育管理系统2设计源码 (321个子文件)
SportRaceServiceImpl.class 18KB
SysUser.class 17KB
SportRace.class 11KB
SportRaceVo.class 10KB
SysMenu.class 10KB
LoginController.class 10KB
SysDept.class 9KB
PreMatchReservationController.class 9KB
SysDictData.class 8KB
SysDeptVo.class 7KB
FunctionBarController.class 7KB
SysUser$SysUserBuilder.class 6KB
ResponseResult.class 6KB
WebSecurityConfig.class 5KB
FunctionBarControllerTest.class 5KB
RacePrizeVo.class 5KB
ScoreBoardVo.class 5KB
WebSocketImpl.class 5KB
SportReservationVo.class 5KB
SportRaceApplicationController.class 4KB
SportRacePrize.class 4KB
SecuritySysUserServiceImpl.class 4KB
SportReservation.class 4KB
SportTeam.class 4KB
SportRaceApplication.class 4KB
SysDept$SysDeptBuilder.class 4KB
InformRaceVo.class 4KB
SysUserServiceImpl.class 4KB
listQuery.class 4KB
RacesTime.class 4KB
SportTeamVo.class 4KB
SportTeamUser.class 3KB
LoginControllerTest.class 3KB
PersonalPageControllerTest.class 3KB
SportReservationVo$SportReservationVoBuilder.class 3KB
SportRaceMapper.class 3KB
SysUserMapper.class 2KB
SportReservation$SportReservationBuilder.class 2KB
SportRaceApplicationServiceImpl.class 2KB
SportRaceApplicationMapper.class 2KB
SportRaceDept.class 2KB
SportTeamMapper.class 2KB
SportReservationServiceImpl.class 2KB
SportRaceApplicationControllerTest.class 2KB
SecuritySysUser.class 2KB
SportTeamServiceImpl.class 2KB
RacesTime$RacesTimeBuilder.class 2KB
SysRoleMenu.class 2KB
SysUserPost.class 2KB
SysUserRole.class 2KB
TaskService.class 2KB
SysDeptServiceImpl.class 2KB
SportSocket.class 2KB
MyAuthenticationFailureHandler.class 2KB
MyAuthenticationSuccessHandler.class 2KB
MyAccessDeniedHandler.class 1KB
GetUserIdUtil.class 1KB
SportReservationMapper.class 1KB
JSONUtils.class 1KB
ResponseUtils.class 1KB
MyKey.class 1KB
SysDeptMapper.class 1KB
SportRaceApplicationService.class 1KB
SysDictDataServiceImpl.class 1KB
SportTeamUserServiceImpl.class 1KB
SysUserRoleServiceImpl.class 1KB
SportRaceService.class 1KB
PreMatchReservationControllerTest.class 1003B
SportTeamService.class 977B
SportReservationService.class 960B
SysUserService.class 959B
SysDictDataMapper.class 929B
SysRoleMenuServiceImpl.class 857B
SysDeptService.class 828B
TyglServiceApplication.class 827B
SportTeamUserMapper.class 820B
SysUserPostServiceImpl.class 806B
SysMenuServiceImpl.class 769B
WebSocket.class 767B
SysUserRoleMapper.class 763B
WebSocketConfig.class 708B
TyglServiceApplicationTests.class 540B
SysRoleMenuMapper.class 490B
SportRaceDeptMapper.class 430B
SysUserPostMapper.class 425B
SportRacePrizeMapper.class 425B
SysDictDataService.class 425B
SysMenuMapper.class 415B
SportTeamUserService.class 354B
SysUserRoleService.class 304B
SysRoleMenuService.class 282B
SysUserPostService.class 220B
SysMenuService.class 214B
.gitignore 182B
tygl-service.iml 15KB
SportRaceServiceImpl.java 14KB
LoginController.java 8KB
PreMatchReservationController.java 8KB
WebConfig.java 7KB
FunctionBarController.java 7KB
共 321 条
- 1
- 2
- 3
- 4
资源评论
lsx202406
- 粉丝: 2581
- 资源: 5604
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- USTC 并行程序设计实验
- 【Unity插件】Shiny SSR 2 - Screen Space Reflections
- C#高校宿舍管理系统源码数据库 SQL2008源码类型 WinForm
- 基于华为昇腾Atlas 200I DK A2+YOLOv5S研究的机械臂目标检测系统(源码)
- 课程实验-基于FPGA的8x8x8光立方+源码+文档说明(高分作品)
- 基于YOLO v11进行目标检测的项目,训练的数据集是AIRcraft,训练效果可以很好的识别合成孔径雷达(SAR)图像中飞机(整套源码)
- 韩智祥毕业设计.doc
- unity的学习方式和网站
- 城市大脑-淮南市“城市大脑”项目项目采购需求.pdf
- 通过代码写rtf(设置RTF头部信息、添加文本到RTF、添加结束标记)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功