| | |
| | | public ResultUtil<List<CompetitionListVo>> queryCompetitionList(String cityCode, String content, Integer registerCondition, String heat){ |
| | | try { |
| | | List<CompetitionListVo> competitionListVos = cttService.queryCompetitionList(cityCode, content, registerCondition, heat); |
| | | return ResultUtil.success(competitionListVos); |
| | | List<CompetitionListVo> filteredList = competitionListVos.stream() |
| | | .filter(vo -> vo.getStatus() == 1 || vo.getStatus() == 2) |
| | | .collect(Collectors.toList()); |
| | | |
| | | return ResultUtil.success(filteredList); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | CompetitionInfo competitionInfo = cttService.queryCompetitionInfo(uid, id, lon, lat); |
| | | |
| | | |
| | | String dateString = competitionInfo.getRegisterEndTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Date date = sdf.parse(dateString); |
| | | if (new Date().after(date)){ |
| | | competitionInfo.setHasPass(1); |
| | | }else { |
| | | competitionInfo.setHasPass(0); |
| | | |
| | | } |
| | | |
| | | |
| | | return ResultUtil.success(competitionInfo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | if (byId.getRegisterCondition()==3){ |
| | | Integer counts = coursePackagePaymentClient.isHave(uid); |
| | | Integer counts = coursePackagePaymentClient.isHave(paymentCompetitionVo.getIds()); |
| | | if (counts==0){ |
| | | return new ResultUtil(0,"当前赛事仅限已购课学员报名"); |
| | | } |
| | |
| | | wrapper.orderByDesc(Competition::getInsertTime); |
| | | |
| | | Page<Competition> page = cttService.page(competitionPage, wrapper); |
| | | for (Competition record : page.getRecords()) { |
| | | |
| | | // 查询当前赛事有多少人报名了 |
| | | List<UserCompetition> competitionId = ucttService.list(new QueryWrapper<UserCompetition>() |
| | | .eq("competitionId", record.getId())); |
| | | // 报名数量 |
| | | int temp = competitionId.size(); |
| | | String value = String.valueOf(temp); |
| | | record.setCount(record.getApplicantsNumber()+"-"+value); |
| | | } |
| | | return page; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @PostMapping("/base/competition/add") |
| | | public void add(@RequestBody Competition competition){ |
| | | try { |
| | | if (competition.getStartTime().after(new Date())){ |
| | | competition.setStatus(1); |
| | | } |
| | | if (competition.getStartTime().before(new Date())){ |
| | | if (competition.getEndTime().after(new Date())){ |
| | | competition.setStatus(2); |
| | | }else{ |
| | | competition.setStatus(3); |
| | | } |
| | | } |
| | | competition.setInsertTime(new Date()); |
| | | cttService.save(competition); |
| | | }catch (Exception e){ |
| | |
| | | @PostMapping("/base/competition/update") |
| | | public void update(@RequestBody Competition competition){ |
| | | try { |
| | | if (competition.getStartTime().after(new Date())){ |
| | | competition.setStatus(1); |
| | | } |
| | | if (competition.getStartTime().before(new Date())){ |
| | | if (competition.getEndTime().after(new Date())){ |
| | | competition.setStatus(2); |
| | | }else{ |
| | | competition.setStatus(3); |
| | | } |
| | | } |
| | | cttService.updateById(competition); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |