|
|
|
@ -1,7 +1,6 @@ |
|
|
|
|
package com.huoran.competition.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
@ -10,10 +9,12 @@ import com.huoran.api.UserClient; |
|
|
|
|
import com.huoran.common.aop.annotation.NoRepeatSubmit; |
|
|
|
|
import com.huoran.common.constant.DelConstant; |
|
|
|
|
import com.huoran.common.response.R; |
|
|
|
|
import com.huoran.common.utils.DateUtils; |
|
|
|
|
import com.huoran.common.utils.TokenUtils; |
|
|
|
|
import com.huoran.competition.entity.*; |
|
|
|
|
import com.huoran.competition.entity.req.*; |
|
|
|
|
import com.huoran.competition.entity.req.AfterLoginPageCompetitionListReq; |
|
|
|
|
import com.huoran.competition.entity.req.CompetitionDetailReq; |
|
|
|
|
import com.huoran.competition.entity.req.DisableEnableCompetitionReq; |
|
|
|
|
import com.huoran.competition.entity.req.PageCompetitionListReq; |
|
|
|
|
import com.huoran.competition.entity.vo.CompetitionDetailsVO; |
|
|
|
|
import com.huoran.competition.entity.vo.CompetitionVO; |
|
|
|
|
import com.huoran.competition.service.*; |
|
|
|
@ -23,9 +24,9 @@ import io.swagger.annotations.ApiOperation; |
|
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate; |
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.script.ScriptException; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
@ -35,13 +36,13 @@ import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* <p> |
|
|
|
|
* 赛事信息表 前端控制器 |
|
|
|
|
* 活动信息表 前端控制器 |
|
|
|
|
* </p> |
|
|
|
|
* |
|
|
|
|
* @author cheney |
|
|
|
|
* @since 2022-11-16 |
|
|
|
|
*/ |
|
|
|
|
@Api(tags = "赛事信息管理") |
|
|
|
|
@Api(tags = "kindergarten-活动信息管理") |
|
|
|
|
@RestController |
|
|
|
|
@RequestMapping("/competition/management") |
|
|
|
|
public class CompetitionController { |
|
|
|
@ -87,74 +88,69 @@ public class CompetitionController { |
|
|
|
|
@Autowired |
|
|
|
|
private NakadaiClient nakadaiClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@ApiOperation(value = "创建赛事") |
|
|
|
|
@ApiOperation(value = "创建活动") |
|
|
|
|
@PostMapping("/addCompetition") |
|
|
|
|
public R addCompetition(@ApiParam(name = "Competition", value = "赛事对象", required = true) @RequestBody Competition competition, HttpServletRequest request) { |
|
|
|
|
public R addCompetition(@ApiParam(name = "Competition", value = "活动对象", required = true) @RequestBody Competition competition, HttpServletRequest request) { |
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
|
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
|
|
|
competition.setSchoolId(schoolId); |
|
|
|
|
competition.setFounderId(Integer.valueOf(accountId)); |
|
|
|
|
competition.setFounderName(userClient.getUserName(Integer.valueOf(accountId))); |
|
|
|
|
return competitionService.addCompetition(competition); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@ApiOperation(value = "修改赛事") |
|
|
|
|
@ApiOperation(value = "修改活动") |
|
|
|
|
@PostMapping("/editCompetition") |
|
|
|
|
public R editCompetition(@ApiParam(name = "competition", value = "赛事对象", required = true) @RequestBody Competition competition) { |
|
|
|
|
boolean update = competitionService.updateById(competition); |
|
|
|
|
public R editCompetition(@ApiParam(name = "competition", value = "活动对象", required = true) @RequestBody Competition competition) { |
|
|
|
|
|
|
|
|
|
//赛事类型为完整赛事,更新其他信息
|
|
|
|
|
if (competition.getCompleteCompetitionSetup() != null) { |
|
|
|
|
completeCompetitionSetupService.updateById(competition.getCompleteCompetitionSetup()); |
|
|
|
|
} |
|
|
|
|
QueryWrapper<CompetitionAnnex> annexUpdateWrapper = new QueryWrapper<>(); |
|
|
|
|
annexUpdateWrapper.eq("competition_id", competition.getId()); |
|
|
|
|
competitionAnnexService.remove(annexUpdateWrapper); |
|
|
|
|
|
|
|
|
|
if (competition.getCompetitionScope() == 2) { |
|
|
|
|
if (competition.getCompetitionRangeList().size() > 0) { |
|
|
|
|
//1.首先删除原有的大赛范围选择
|
|
|
|
|
UpdateWrapper<CompetitionRange> annexUpdateWrapper = new UpdateWrapper<>(); |
|
|
|
|
annexUpdateWrapper.set("is_del", DelConstant.IS_DEL); |
|
|
|
|
annexUpdateWrapper.eq("Competition_id", competition.getId()); |
|
|
|
|
boolean delCompetitionAnnex = competitionRangeService.update(new CompetitionRange(), annexUpdateWrapper); |
|
|
|
|
|
|
|
|
|
//2.重新保存比赛范围
|
|
|
|
|
competition.getCompetitionRangeList().forEach(CompetitionRange -> { |
|
|
|
|
CompetitionRange.setCompetitionId(competition.getId()); |
|
|
|
|
boolean saveCompetitionRange = competitionRangeService.save(CompetitionRange);//保存比赛范围
|
|
|
|
|
if (competition.getCompetitionAnnexList().size() > 0) { |
|
|
|
|
competition.getCompetitionAnnexList().forEach(competitionAnnex -> { |
|
|
|
|
competitionAnnex.setCompetitionId(competition.getId()); |
|
|
|
|
competitionAnnexService.save(competitionAnnex); // Save competition annex
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
boolean update = competitionService.updateById(competition); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return update ? R.ok() : R.error(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@ApiOperation(value = "根据id删除赛事") |
|
|
|
|
@ApiOperation(value = "根据id删除活动") |
|
|
|
|
@PostMapping("/deleteCompetition") |
|
|
|
|
public R deleteCompetition(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam Integer competitionId) { |
|
|
|
|
//删除赛事下的定时
|
|
|
|
|
public R deleteCompetition(@ApiParam(name = "competitionId", value = "活动ID", required = true) @RequestParam Integer competitionId) { |
|
|
|
|
//删除活动下的定时
|
|
|
|
|
competitionReleaseTimeService.remove(new QueryWrapper<CompetitionReleaseTime>().eq("competition_id", competitionId)); |
|
|
|
|
boolean remove = competitionService.removeCompetition(competitionId); |
|
|
|
|
return remove ? R.ok() : R.error(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@ApiOperation(value = "批量删除赛事") |
|
|
|
|
@ApiOperation(value = "批量删除活动") |
|
|
|
|
@PostMapping("/batchDeleteCompetition") |
|
|
|
|
public R deleteCompetition(@ApiParam(name = "competitionIds", value = "赛事ID", required = true) @RequestParam List<Integer> competitionIds) { |
|
|
|
|
public R deleteCompetition(@ApiParam(name = "competitionIds", value = "活动ID", required = true) @RequestParam List<Integer> competitionIds) { |
|
|
|
|
competitionIds.forEach(competitionId -> { |
|
|
|
|
//删除赛事下的定时
|
|
|
|
|
//删除活动下的定时
|
|
|
|
|
competitionReleaseTimeService.remove(new QueryWrapper<CompetitionReleaseTime>().eq("competition_id", competitionId)); |
|
|
|
|
competitionService.removeCompetition(competitionId); |
|
|
|
|
}); |
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "根据id查询赛事", response = Competition.class) |
|
|
|
|
@ApiOperation(value = "根据id查询活动", response = Competition.class) |
|
|
|
|
@PostMapping("/getCompetition") |
|
|
|
|
public R getCompetition(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam("competitionId") String competitionId, HttpServletRequest request) { |
|
|
|
|
public R getCompetition(@ApiParam(name = "competitionId", value = "活动ID", required = true) @RequestParam("competitionId") String competitionId, HttpServletRequest request) { |
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
|
Competition competition = competitionService.getById(competitionId); |
|
|
|
|
// 查询赛事报名表
|
|
|
|
|
// 查询活动报名表
|
|
|
|
|
QueryWrapper<CompetitionRegistration> wrapper = new QueryWrapper<>(); |
|
|
|
|
wrapper.eq("competition_id", competitionId); |
|
|
|
|
wrapper.eq("account_id", accountId); |
|
|
|
@ -172,35 +168,36 @@ public class CompetitionController { |
|
|
|
|
competition.setCompetitionRegistration(registration); |
|
|
|
|
List<CompetitionAnnex> CompetitionAnnexList = competitionAnnexService.getCompetitionAnnexByCompetitionId(competitionId); |
|
|
|
|
List<CompetitionRange> CompetitionRangeList = competitionRangeService.getCompetitionRangeByCompetitionId(competitionId); |
|
|
|
|
if (CompetitionRangeList.size() > 0) { |
|
|
|
|
/*if (CompetitionRangeList.size() > 0) { |
|
|
|
|
competition.setCompetitionRangeList(CompetitionRangeList); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
if (CompetitionAnnexList.size() > 0) { |
|
|
|
|
competition.setCompetitionAnnexList(CompetitionAnnexList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (competition.getCompetitionScope() == 1) { |
|
|
|
|
//活动范围(1:全平台 5:幼儿园,6:供应商)
|
|
|
|
|
/*if (competition.getCompetitionScope() == 1) { |
|
|
|
|
competition.setRange("全平台"); |
|
|
|
|
} else if (competition.getCompetitionScope() == 2) { |
|
|
|
|
competition.setRange("指定范围"); |
|
|
|
|
//依据赛事id查询指定范围的省、市、学校
|
|
|
|
|
competition.setCompetitionRangeRespList(competitionRangeService.getRangeByCompetitionId(competition.getId())); |
|
|
|
|
} |
|
|
|
|
} else if (competition.getCompetitionScope() == 5) { |
|
|
|
|
competition.setRange("幼儿园"); |
|
|
|
|
}else if (competition.getCompetitionScope() == 6) { |
|
|
|
|
competition.setRange("供应商"); |
|
|
|
|
}*/ |
|
|
|
|
// if (competition.getReleaseType()==1){
|
|
|
|
|
QueryWrapper<CompleteCompetitionSetup> setupQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
/*QueryWrapper<CompleteCompetitionSetup> setupQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
setupQueryWrapper.eq("competition_id", competitionId); |
|
|
|
|
CompleteCompetitionSetup competitionSetup = completeCompetitionSetupService.getOne(setupQueryWrapper); |
|
|
|
|
competition.setCompleteCompetitionSetup(competitionSetup); |
|
|
|
|
competition.setCompleteCompetitionSetup(competitionSetup);*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<CompetitionRule> ruleQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
/* QueryWrapper<CompetitionRule> ruleQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
ruleQueryWrapper.eq("setup_id", competitionSetup.getSetupId()); |
|
|
|
|
CompetitionRule one = competitionRuleService.getOne(ruleQueryWrapper); |
|
|
|
|
if (one != null) { |
|
|
|
|
competition.setRule(one.getRule()); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
// }
|
|
|
|
|
//查询赛事阶段内容数据
|
|
|
|
|
/* //查询活动阶段内容数据
|
|
|
|
|
List<CompetitionStage> stages = competitionService.queryCompetitionStage(competitionId, accountId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -232,135 +229,71 @@ public class CompetitionController { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
return R.ok().put("competition", competition); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@ApiOperation(value = "发布赛事") |
|
|
|
|
@ApiOperation(value = "发布活动") |
|
|
|
|
@PostMapping("/publishCompetition") |
|
|
|
|
public R publishCompetition(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam("competitionId") Integer competitionId, @ApiParam(name = "publishStatus", value = "发布状态", required = true) @RequestParam("publishStatus") Integer publishStatus) { |
|
|
|
|
public R publishCompetition(@ApiParam(name = "competitionId", value = "活动ID", required = true) @RequestParam("competitionId") Integer competitionId, @ApiParam(name = "publishStatus", value = "发布状态", required = true) @RequestParam("publishStatus") Integer publishStatus) { |
|
|
|
|
Competition getDetail = competitionService.getById(competitionId); |
|
|
|
|
getDetail.setPublishStatus(publishStatus); |
|
|
|
|
getDetail.setZtOpen(0); |
|
|
|
|
/* getDetail.setZtOpen(0);*/ |
|
|
|
|
boolean ret = competitionService.updateById(getDetail); |
|
|
|
|
return ret ? R.ok() : R.error(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NoRepeatSubmit |
|
|
|
|
@ApiOperation(value = "赛事禁启用", response = CompetitionRange.class) |
|
|
|
|
@ApiOperation(value = "活动禁启用", response = CompetitionRange.class) |
|
|
|
|
@PostMapping("/disabledEvents") |
|
|
|
|
public R disabledEvents(@RequestBody DisableEnableCompetitionReq req) { |
|
|
|
|
|
|
|
|
|
Competition getDetail = competitionService.getById(req.getCompetitionId()); |
|
|
|
|
Competition competition = new Competition(); |
|
|
|
|
competition.setId(req.getCompetitionId()); |
|
|
|
|
//禁用平台来源(0中台,1职站)
|
|
|
|
|
switch (req.getType()) { |
|
|
|
|
case 0: |
|
|
|
|
competition.setZtOpen(req.getIsOpen()); |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
//原型需求:
|
|
|
|
|
// 客户创建的大赛,禁用时职站首页以及学生登录后的大赛模块看不到对应的比赛,创建的老师在大赛管理还是可以看到该大赛,可以编辑,但是无法启用。
|
|
|
|
|
// 即中台禁用的大赛,即使是该院校老师创建的,老师端也不能自己启用,需要中台启用。
|
|
|
|
|
//1.判断当前院校禁启用状态为要启用时候再判断当前赛事中台禁启用的状态
|
|
|
|
|
if (req.getIsOpen() == 0) { |
|
|
|
|
if (getDetail.getZtOpen() == 1) { |
|
|
|
|
return R.error("当前赛事已被平台禁用,请联系平台管理员!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
competition.setIsOpen(req.getIsOpen()); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
boolean ret = competitionService.updateById(competition); |
|
|
|
|
|
|
|
|
|
//保存的key名
|
|
|
|
|
String key = "competitionDisabled"; |
|
|
|
|
//保存到缓存中
|
|
|
|
|
redisTemplate.opsForValue().set(key, "true"); |
|
|
|
|
boolean ret = competitionService.updateById(competition); |
|
|
|
|
return ret ? R.ok() : R.error(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/getRedisCache") |
|
|
|
|
@ApiOperation(value = "获取Redis缓存(返回true 刷新)") |
|
|
|
|
public R getRedisCache() { |
|
|
|
|
//保存的key名
|
|
|
|
|
String key = "competitionDisabled"; |
|
|
|
|
//查看缓存是否有数据
|
|
|
|
|
String returnValue = redisTemplate.opsForValue().get(key); |
|
|
|
|
|
|
|
|
|
//使用缓存返回数据
|
|
|
|
|
if (returnValue != null) { |
|
|
|
|
|
|
|
|
|
//设置key过期时间
|
|
|
|
|
redisTemplate.expire(key, 5000, TimeUnit.MILLISECONDS);//设置过期时间
|
|
|
|
|
return R.ok().put("data", returnValue); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "赛事样例数据") |
|
|
|
|
@PostMapping("/eventSampleData") |
|
|
|
|
public boolean eventSampleData(@RequestParam("accountId") @ApiParam(value = "账号id") Integer accountId, @RequestParam("schoolId") @ApiParam(value = "学校id") Integer schoolId) { |
|
|
|
|
Competition competition = new Competition(); |
|
|
|
|
competition.setFounderId(accountId); |
|
|
|
|
competition.setName("样例赛事"); |
|
|
|
|
competition.setCoverUrl("https://huoran.oss-cn-shenzhen.aliyuncs.com/20220509/png/1523606505516457984.png"); |
|
|
|
|
competition.setCarouselUrl("https://huoran.oss-cn-shenzhen.aliyuncs.com/20220310/png/1501818796133343232.png"); |
|
|
|
|
competition.setSponsor("主办方"); |
|
|
|
|
competition.setUndertaker("承办方"); |
|
|
|
|
competition.setDescription("样例赛事,仅供参考!"); |
|
|
|
|
competition.setPublishStatus(1); |
|
|
|
|
competition.setPlayStartTime(DateUtils.getDateByDay(15)); |
|
|
|
|
competition.setPlayEndTime(DateUtils.getDateByDay(18)); |
|
|
|
|
competition.setSignUpStartTime(new Date()); |
|
|
|
|
competition.setSignUpEndTime(DateUtils.getDateByDay(10)); |
|
|
|
|
competition.setSchoolId(schoolId); |
|
|
|
|
competition.setPlatformSource(1);//平台来源(0:中台,1:职站)
|
|
|
|
|
competition.setCompetitionScope(0);//大赛范围(0:本校内 1:全平台 2:指定区域、院校)
|
|
|
|
|
return competitionService.save(competition); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "职站——赛事列表(教师端赛事管理)") |
|
|
|
|
/* @ApiOperation(value = "职站——活动列表(教师端活动管理)") |
|
|
|
|
@PostMapping("/competitionPageConditionQueryByOccupationlab") |
|
|
|
|
public R CompetitionPageConditionQueryByOccupationlab(@RequestBody PageCompetitionListReq pageCompetitionListReq, HttpServletRequest request) { |
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
|
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
|
|
|
pageCompetitionListReq.setSchoolId(schoolId); |
|
|
|
|
if (!accountId.equals("")) { |
|
|
|
|
if (!ObjectUtils.isEmpty(accountId)) { |
|
|
|
|
pageCompetitionListReq.setAccountId(Integer.valueOf(accountId)); |
|
|
|
|
} |
|
|
|
|
return competitionService.competitionPageConditionQueryByOccupationlab(pageCompetitionListReq); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "中台——赛事列表分页条件查询(赛事广场)") |
|
|
|
|
@PostMapping("/competitionPageConditionQueryByNakadai") |
|
|
|
|
public R competitionPageConditionQueryByNakadai(@RequestBody PageCompetitionListReq pageCompetitionListReq, HttpServletRequest request) { |
|
|
|
|
return competitionService.competitionPageConditionQueryByNakadai(pageCompetitionListReq); |
|
|
|
|
@ApiOperation(value = "后台活动列表") |
|
|
|
|
@PostMapping("/backgroundActivityList") |
|
|
|
|
public R backgroundActivityList(@RequestBody PageCompetitionListReq pageCompetitionListReq, HttpServletRequest request) { |
|
|
|
|
return competitionService.backgroundActivityList(pageCompetitionListReq); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询赛事状态(返回为false时表示当前赛事在教师端已禁用)") |
|
|
|
|
@ApiOperation(value = "查询活动状态(返回为false时表示当前活动在教师端已禁用)") |
|
|
|
|
@PostMapping("/checkTheStatusOfTheCompetition") |
|
|
|
|
public boolean checkTheStatusOfTheCompetition(@ApiParam(name = "competitionId", value = "赛事ID", required = true) @RequestParam String competitionId) { |
|
|
|
|
public boolean checkTheStatusOfTheCompetition(@ApiParam(name = "competitionId", value = "活动ID", required = true) @RequestParam String competitionId) { |
|
|
|
|
Competition competition = competitionService.getById(competitionId); |
|
|
|
|
//是否开启(0开启 1未开启 默认0)
|
|
|
|
|
return competition.getIsOpen() != 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "职站(学生端)——登录前竞赛", response = CompetitionVO.class) |
|
|
|
|
/* @ApiOperation(value = "职站(学生端)——登录前活动", response = CompetitionVO.class) |
|
|
|
|
@PostMapping("/notLoggedInBeforeStudentEvents") |
|
|
|
|
public R notLoggedInBeforeStudentEvents(@RequestBody PageCompetitionListReq pageCompetitionListReq, HttpServletRequest request) throws ExecutionException, InterruptedException { |
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
|
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
|
|
|
if (!accountId.equals("")) { |
|
|
|
|
if (!ObjectUtils.isEmpty(accountId)) { |
|
|
|
|
pageCompetitionListReq.setSchoolId(schoolId); |
|
|
|
|
pageCompetitionListReq.setAccountId(Integer.valueOf(accountId)); |
|
|
|
|
} else { |
|
|
|
@ -368,61 +301,34 @@ public class CompetitionController { |
|
|
|
|
} |
|
|
|
|
Future<IPage<CompetitionVO>> pageFuture = competitionService.notLoggedInBeforeStudentEvents(pageCompetitionListReq); |
|
|
|
|
IPage<CompetitionVO> pageList = pageFuture.get(); |
|
|
|
|
return R.ok().put("data",pageList); |
|
|
|
|
return R.ok().put("data", pageList); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "职站(学生端)——登录后竞赛", response = CompetitionVO.class) |
|
|
|
|
@PostMapping("/competitionAfterLogin") |
|
|
|
|
public R competitionAfterLogin(@RequestBody AfterLoginPageCompetitionListReq pageCompetitionListReq, HttpServletRequest request) throws ExecutionException, InterruptedException { |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "小程序—登录后活动", response = CompetitionVO.class) |
|
|
|
|
@PostMapping("/postLoginActivity") |
|
|
|
|
public R postLoginActivity(@RequestBody AfterLoginPageCompetitionListReq pageCompetitionListReq, HttpServletRequest request) throws ExecutionException, InterruptedException { |
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
|
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
|
|
|
if (!accountId.equals("")) { |
|
|
|
|
if (!ObjectUtils.isEmpty(accountId)) { |
|
|
|
|
pageCompetitionListReq.setSchoolId(schoolId); |
|
|
|
|
pageCompetitionListReq.setAccountId(Integer.valueOf(accountId)); |
|
|
|
|
} |
|
|
|
|
Future<IPage<CompetitionVO>> pageFuture = competitionService.competitionAfterLogin(pageCompetitionListReq); |
|
|
|
|
IPage<CompetitionVO> pageList = pageFuture.get(); |
|
|
|
|
return R.ok().put("data",pageList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "大赛阶段详情", response = CompetitionDetailsVO.class) |
|
|
|
|
@PostMapping("/detailsOfCompetitionStage") |
|
|
|
|
public R detailsOfCompetitionStage(@RequestBody CompetitionDetailReq req, HttpServletRequest request) { |
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
|
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
|
|
|
return competitionService.detailsOfCompetitionStage(req); |
|
|
|
|
|
|
|
|
|
return R.ok().put("data", pageList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "是否允许参加赛事(淘汰赛制)", response = CompetitionDetailsVO.class) |
|
|
|
|
@PostMapping("/allowedParticipateCompetition") |
|
|
|
|
public R allowedParticipateCompetition(@RequestBody AllowedParticipateCompetitionReq req, HttpServletRequest request) throws ScriptException { |
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
|
req.setAccountId(accountId); |
|
|
|
|
return competitionService.allowedParticipateCompetition(req); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "是否为参赛人员(团队赛)", response = CompetitionDetailsVO.class) |
|
|
|
|
@PostMapping("/isParticipant") |
|
|
|
|
public R isParticipant(@RequestBody IsParticipantReq req, HttpServletRequest request) { |
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
|
req.setAccountId(accountId); |
|
|
|
|
return competitionService.isParticipant(req); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取当前时间") |
|
|
|
|
@GetMapping("/getCurrentTime") |
|
|
|
|
public R getCurrentTime() { |
|
|
|
|
return R.ok().put("currentTime",new Date()); |
|
|
|
|
return R.ok().put("currentTime", new Date()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// @XxlJob("competitionStop")
|
|
|
|
|
// public void competitionStop() {
|
|
|
|
|
// //通知收卷
|
|
|
|
|
// nakadaiClient.refreshPageNotification("系统通知","all","1");
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|