From aa43a92c7ec9053dbaef92fe5ccb3011b670442c Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 12 七月 2023 11:46:21 +0800 Subject: [PATCH] 更新线上视频奖励模块接口 --- cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java | 40 ++++++++++++++++++++++++++++------------ 1 files changed, 28 insertions(+), 12 deletions(-) diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java index cae574a..b0f2838 100644 --- a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java +++ b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java @@ -104,16 +104,18 @@ competitionInfo.setImgs(competition.getImgs()); competitionInfo.setName(competition.getName()); competitionInfo.setRegisterCondition(competition.getRegisterCondition()); - Store store = storeClient.queryStoreById(competition.getStoreId()); - competitionInfo.setStoreName(store.getName()); - competitionInfo.setStoreAddress(store.getAddress()); - competitionInfo.setStoreLon(store.getLon()); - competitionInfo.setStoreLat(store.getLat()); - competitionInfo.setStoreCoverDrawing(store.getCoverDrawing()); - if(ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ - Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); - double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); - competitionInfo.setDistance(wgs84); + if(null != competition.getStoreId()){ + Store store = storeClient.queryStoreById(competition.getStoreId()); + competitionInfo.setStoreName(store.getName()); + competitionInfo.setStoreAddress(store.getAddress()); + competitionInfo.setStoreLon(store.getLon()); + competitionInfo.setStoreLat(store.getLat()); + competitionInfo.setStoreCoverDrawing(store.getCoverDrawing()); + if(ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ + Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); + double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + competitionInfo.setDistance(wgs84); + } } competitionInfo.setRegisterEndTime(sdf.format(competition.getRegisterEndTime())); competitionInfo.setStartTime(sdf.format(competition.getStartTime())); @@ -127,11 +129,12 @@ competitionInfo.setIntroduction(competition.getIntroduction()); competitionInfo.setRegistrationNotes(competition.getRegistrationNotes()); competitionInfo.setApply(0); - PaymentCompetition one = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("competitionId", id).eq("appUserId", uid).eq("payStatus", 2)); + competitionInfo.setStatus(competition.getStatus()); + PaymentCompetition one = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("competitionId", id).eq("appUserId", uid).ne("payStatus", 1).orderByDesc("insertTime").last(" limit 1")); if(null != one){ competitionInfo.setApply(1); List<ParticipantVo> participant = new ArrayList<>(); - List<UserCompetition> list = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("competitionId", id).eq("appUserId", uid)); + List<UserCompetition> list = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("paymentCompetitionId", one.getId())); List<Integer> collect = list.stream().map(UserCompetition::getParticipantId).collect(Collectors.toList()); List<Participant> participants = participantService.listByIds(collect); SimpleDateFormat sdf_year = new SimpleDateFormat("yyyy"); @@ -145,6 +148,9 @@ participant.add(participantVo); } competitionInfo.setParticipant(participant); + if(one.getPayStatus() == 3){ + competitionInfo.setStatus(4); + } } return competitionInfo; } @@ -369,4 +375,14 @@ } return alipay; } + + + /** + * 定时任务修改赛事状态 + */ + @Override + public void taskSetStatus() { + this.baseMapper.taskSetStatusStart(); + this.baseMapper.taskSetStatusEnd(); + } } -- Gitblit v1.7.1