| | |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.poi.excel.ExcelUtil; |
| | | import cn.mb.cloud.common.core.exception.BusinessException; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | List<Integer> operatorId = cttService.list(new QueryWrapper<Competition>() |
| | | .eq("operatorId", operatorId1)).stream().map(Competition::getId).collect(Collectors.toList()); |
| | | query.setUserIds(operatorId); |
| | | } else if (query.getStoreId() != null) { |
| | | List<Competition> list = cttService.list(new QueryWrapper<Competition>()); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Competition competition : list) { |
| | | for (String s : competition.getStoreId().split(",")) { |
| | | if (s.equals(""+query.getStoreId())){ |
| | | integers.add(competition.getId()); |
| | | } |
| | | } |
| | | } |
| | | if (integers.isEmpty()){ |
| | | integers.add(-1); |
| | | } |
| | | query.setUserIds(integers); |
| | | } |
| | | List<PaymentCompetition> paymentCompetitions = paymentCompetitionService.listAll(query); |
| | | List<PaymentCompetition> result = new ArrayList<>(); |
| | |
| | | } |
| | | return result; |
| | | } else if (query.getStoreId() != null) { |
| | | for (PaymentCompetition paymentCompetition : paymentCompetitions) { |
| | | Integer competitionId = paymentCompetition.getCompetitionId(); |
| | | Competition byId = cttService.getById(competitionId); |
| | | if (byId != null) { |
| | | String storeId = byId.getStoreId(); |
| | | if (storeId.contains(query.getStoreId().toString())) { |
| | | result.add(paymentCompetition); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | return paymentCompetitions; |
| | | } |
| | | return paymentCompetitions; |
| | | } |
| | |
| | | wrapper.ne(Competition::getAuditStatus,2); |
| | | } |
| | | wrapper.in(Competition::getStoreId,listQuery.getIds()); |
| | | wrapper.orderByDesc(Competition::getInsertTime); |
| | | wrapper.orderByDesc(Competition::getInsertTime) |
| | | .orderByDesc(Competition::getId); |
| | | Page<Competition> page = cttService.page(competitionPage, wrapper); |
| | | for (Competition record : page.getRecords()) { |
| | | // 查询当前赛事有多少人报名了 |
| | |
| | | integers.add(1); |
| | | integers.add(3); |
| | | wrapper.in(Competition::getAuditStatus, integers); |
| | | wrapper.orderByDesc(Competition::getInsertTime); |
| | | wrapper.orderByDesc(Competition::getInsertTime) |
| | | .orderByDesc(Competition::getId); |
| | | |
| | | Page<Competition> page = cttService.page(competitionPage, wrapper); |
| | | return page; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 更新活动配置。 |
| | | * |
| | | * @param competition 管理端提交的活动信息 |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | | if(competition.getStatus() == 2){ |
| | | //添加勋章数据 |
| | | List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>() |
| | | .eq("competitionId", competition.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | Set<Integer> collect = list.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toSet()); |
| | | for (Integer integer : collect) { |
| | | int count = paymentCompetitionService.count(new QueryWrapper<PaymentCompetition>() |
| | | .eq("appUserId", integer).eq("payStatus", 2).eq("state", 1)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(integer); |
| | | studentHonor.setHonorType(2); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | } |
| | | } |
| | | cttService.updateById(competition); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | public void update(@RequestBody Competition competition) throws BusinessException { |
| | | cttService.updateCompetition(competition); |
| | | } |
| | | |
| | | @Resource |
| | |
| | | return list1.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |