| | |
| | | package com.dsh.competition.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.competition.entity.Competition; |
| | | import com.dsh.competition.entity.PaymentCompetition; |
| | | import com.dsh.competition.entity.UserCompetition; |
| | | import com.dsh.competition.feignclient.other.StoreClient; |
| | | import com.dsh.competition.feignclient.other.model.Store; |
| | | import com.dsh.competition.mapper.CompetitionMapper; |
| | | import com.dsh.competition.model.CompetitionInfo; |
| | | import com.dsh.competition.model.CompetitionListVo; |
| | | import com.dsh.competition.model.ParticipantVo; |
| | | import com.dsh.competition.service.CompetitionService; |
| | | import com.dsh.competition.service.IPaymentCompetitionService; |
| | | import com.dsh.competition.service.UserCompetitionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Competition> implements CompetitionService { |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | @Autowired |
| | | private IPaymentCompetitionService paymentCompetitionService; |
| | | |
| | | @Autowired |
| | | private UserCompetitionService userCompetitionService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取赛事列表 |
| | | * @param content |
| | | * @param registerCondition |
| | | * @param heat |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<CompetitionListVo> queryCompetitionList(String cityCode, String content, Integer registerCondition, Integer heat) throws Exception { |
| | | return this.baseMapper.queryCompetitionList(cityCode, content, registerCondition, heat); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取赛事详情 |
| | | * @param uid |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public CompetitionInfo queryCompetitionInfo(Integer uid, Integer id) throws Exception { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Competition competition = this.getById(id); |
| | | CompetitionInfo competitionInfo = new CompetitionInfo(); |
| | | competitionInfo.setId(competition.getId()); |
| | | 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.setRegisterEndTime(sdf.format(competition.getRegisterEndTime())); |
| | | competitionInfo.setStartTime(sdf.format(competition.getStartTime())); |
| | | competitionInfo.setEndTime(sdf.format(competition.getEndTime())); |
| | | competitionInfo.setAge(competition.getStartAge() + "-" + competition.getEndAge()); |
| | | competitionInfo.setProvince(competition.getEntryProvince()); |
| | | competitionInfo.setCity(competition.getEntryCity()); |
| | | competitionInfo.setAddress(competition.getEntryAddress()); |
| | | competitionInfo.setPayType(competition.getPayType()); |
| | | competitionInfo.setPrice(competition.getPrice().doubleValue()); |
| | | 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)); |
| | | if(null != one){ |
| | | competitionInfo.setApply(1); |
| | | List<ParticipantVo> participant = new ArrayList<>(); |
| | | // userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("competitionId", id).eq("")) |
| | | } |
| | | |
| | | |
| | | |
| | | return null; |
| | | } |
| | | } |