| | |
| | | import com.dsh.competition.entity.PaymentCompetition; |
| | | import com.dsh.competition.entity.UserCompetition; |
| | | import com.dsh.competition.feignclient.account.AppUserClient; |
| | | import com.dsh.competition.feignclient.account.StudentClient; |
| | | import com.dsh.competition.feignclient.account.StudentHonorClient; |
| | | import com.dsh.competition.feignclient.account.model.AppUser; |
| | | import com.dsh.competition.feignclient.account.model.StudentHonor; |
| | | import com.dsh.competition.feignclient.account.model.TStudent; |
| | | import com.dsh.competition.feignclient.course.CoursePackagePaymentClient; |
| | | import com.dsh.competition.feignclient.course.model.PaymentDeductionClassHour; |
| | | import com.dsh.competition.feignclient.model.*; |
| | |
| | | |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据门店ids 获取对应的赛事 根据赛事支付记录获取用户ids |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | |
| | | }) |
| | | |
| | | public synchronized ResultUtil paymentCompetition(PaymentCompetitionVo paymentCompetitionVo) { |
| | | try { |
| | | Competition byId = competitionService.getById(paymentCompetitionVo.getId()); |
| | | Date date = byId.getEndTime(); |
| | | // Assuming you have a Date object |
| | | // Check if the date is past the current time |
| | | boolean isPast = date.after(new Date()); |
| | | if (!isPast) { |
| | | return new ResultUtil(0, "已超过截至报名时间"); |
| | |
| | | if (null != map) { |
| | | String code = map.get("out_trade_no"); |
| | | String trade_no = map.get("trade_no"); |
| | | |
| | | PaymentCompetition paymentCompetition = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("code", code).eq("payType", 2)); |
| | | if (paymentCompetition.getPayStatus() == 1) { |
| | | paymentCompetition.setAppUserId(null); |
| | |
| | | paymentCompetition.setPayTime(new Date()); |
| | | paymentCompetition.setPayOrderNo(trade_no); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | |
| | | Competition competition = cttService.getById(paymentCompetition.getCompetitionId()); |
| | | competition.setApplicantsNumber(competition.getApplicantsNumber() + 1); |
| | | cttService.updateById(competition); |
| | |
| | | wrapper.lt(Competition::getStartTime, listQuery.getTime().split(" - ")[0] + " 00:00:00"); |
| | | wrapper.gt(Competition::getEndTime, listQuery.getTime().split(" - ")[1] + " 23:59:59"); |
| | | } |
| | | |
| | | if (ToolUtil.isNotEmpty(listQuery.getRegisterCondition())) { |
| | | wrapper.eq(Competition::getRegisterCondition, listQuery.getRegisterCondition()); |
| | | if(ToolUtil.isNotEmpty(listQuery.getRegisterCondition())){ |
| | | wrapper.eq(Competition::getRegisterCondition,listQuery.getRegisterCondition()); |
| | | } |
| | | |
| | | wrapper.in(Competition::getStoreId, listQuery.getIds()); |
| | | wrapper.eq(Competition::getAuditStatus, 2); |
| | | // 平台查询审核通过的赛事 |
| | | if (listQuery.getObj()==1){ |
| | | wrapper.eq(Competition::getAuditStatus,2); |
| | | } |
| | | // 赛事审核 |
| | | if (listQuery.getObj()==-1){ |
| | | wrapper.ne(Competition::getAuditStatus,2); |
| | | } |
| | | wrapper.in(Competition::getStoreId,listQuery.getIds()); |
| | | 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())); |
| | |
| | | } 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); |
| | | } |
| | | } |
| | | } |
| | | competition.setInsertTime(new Date()); |
| | | cttService.save(competition); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } 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(); |
| | | } |
| | |
| | | String refund_id = map.get("refund_id"); |
| | | paymentCompetition.setRefundOrderNo(refund_id); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | |
| | | storeClient.addBackRecord(paymentCompetition.getAmount() + "_" + paymentCompetition.getAppUserId()); |
| | | |
| | | |
| | | } |
| | | if (paymentCompetition.getPayType() == 2) {//支付宝支付 |
| | |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | @PostMapping("/base/competition/getPeopleFromId1") |
| | | public Page<CompetitionUser> getPeopleFromId1(@RequestBody GetPeopleQuery getPeopleQuery) { |
| | | try { |
| | | Page<CompetitionUser> page = participantService.getPeopleFromId1(getPeopleQuery.getOffset(), getPeopleQuery.getLimit(), getPeopleQuery.getId(), getPeopleQuery.getState()); |
| | | return page; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/base/competition/getPeoples") |
| | | @ResponseBody |
| | | public List<CompetitionUser> getPeoples(@RequestBody GetPeopleQuery getPeopleQuery) { |
| | |
| | | List<Integer> ids = queryDataFee.getIds(); |
| | | if (ids.size() == 0) { |
| | | ids.add(-1); |
| | | }else{ |
| | | List<Competition> list1 = competitionService.list(new QueryWrapper<Competition>().in("storeId", ids).eq("auditStatus", 2).eq("state", 1).ne("status", 4)); |
| | | ids = list1.stream().map(Competition::getId).collect(Collectors.toList()); |
| | | if (ids.size() == 0) { |
| | | ids.add(-1); |
| | | } |
| | | } |
| | | |
| | | LambdaQueryWrapper<PaymentCompetition> vipPaymentLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if (ToolUtil.isNotEmpty(data)) { |
| | | String stime = data.split(" - ")[0] + " 00:00:00"; |
| | | String etime = data.split(" - ")[1] + " 23:59:59"; |
| | | vipPaymentLambdaQueryWrapper.between(PaymentCompetition::getInsertTime, stime, etime); |
| | | } |
| | | vipPaymentLambdaQueryWrapper.in(PaymentCompetition::getAppUserId, ids); |
| | | vipPaymentLambdaQueryWrapper.in(PaymentCompetition::getCompetitionId, ids); |
| | | vipPaymentLambdaQueryWrapper.eq(PaymentCompetition::getPayStatus, 2); |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | |
| | | m = "0" + i; |
| | | } |
| | | String s = year + "-" + m; |
| | | int count = cttService.count(new LambdaQueryWrapper<Competition>().like(Competition::getInsertTime, s).ne(Competition::getOperatorId, operatorId)); |
| | | int count = cttService.count(new LambdaQueryWrapper<Competition>().like(Competition::getInsertTime, s).eq(Competition::getOperatorId, operatorId)); |
| | | int count1 = ucttService.count(new LambdaQueryWrapper<UserCompetition>().in(UserCompetition::getAppUserId, vo.getIds()).like(UserCompetition::getInsertTime, s)); |
| | | months.add(count); |
| | | monthsUser.add(count1); |
| | |
| | | return map; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/competition/queryAppUserId") |
| | | public List<Integer> queryAppUserId(@RequestBody List<Integer> storeIds){ |
| | | List<Competition> list = competitionService.list(new QueryWrapper<Competition>().in("storeId", storeIds).eq("auditStatus", 2).eq("state", 1)); |
| | | List<Integer> collect = list.stream().map(Competition::getId).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | return new ArrayList<>(); |
| | | } |
| | | List<PaymentCompetition> list1 = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>().eq("payStatus", 2).eq("state", 1).in("competitionId", collect)); |
| | | return list1.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |