Jelajahi Sumber

约场门票订单

Memory_LG 5 bulan lalu
induk
melakukan
8daa799bac
19 mengubah file dengan 652 tambahan dan 14 penghapusan
  1. 262 0
      qmjszx-admin/src/main/java/beilv/web/controller/bootacourse/bootACourseController.java
  2. 2 0
      qmjszx-admin/src/main/resources/templates/admissionticket/admissionTicket.html
  3. 7 0
      qmjszx-business/src/main/java/beilv/admissionticket/mapper/AdmissionTicketMapper.java
  4. 3 0
      qmjszx-business/src/main/java/beilv/admissionticket/service/IAdmissionTicketService.java
  5. 6 1
      qmjszx-business/src/main/java/beilv/admissionticket/service/impl/AdmissionTicketServiceImpl.java
  6. 90 0
      qmjszx-business/src/main/java/beilv/bootacourse/domain/BootACourse.java
  7. 44 0
      qmjszx-business/src/main/java/beilv/bootacourse/domain/BootACourseBO.java
  8. 16 0
      qmjszx-business/src/main/java/beilv/bootacourse/mapper/BootACourseMapper.java
  9. 20 0
      qmjszx-business/src/main/java/beilv/bootacourse/service/IBootACourseService.java
  10. 49 0
      qmjszx-business/src/main/java/beilv/bootacourse/service/impl/BootACourseServiceImpl.java
  11. 2 0
      qmjszx-business/src/main/java/beilv/competition/mapper/CompetitionMapper.java
  12. 0 5
      qmjszx-business/src/main/java/beilv/competition/service/impl/CompetitionServiceImpl.java
  13. 2 0
      qmjszx-business/src/main/java/beilv/competition/task/CloseReg.java
  14. 3 0
      qmjszx-business/src/main/java/beilv/stadium/service/impl/StadiumServiceImpl.java
  15. 25 6
      qmjszx-business/src/main/resources/mapper/admissionticket/AdmissionTicketMapper.xml
  16. 112 0
      qmjszx-business/src/main/resources/mapper/bootacourse/BootACourseMapper.xml
  17. 2 2
      qmjszx-business/src/main/resources/mapper/card/UserMembershipCardMapper.xml
  18. 6 0
      qmjszx-business/src/main/resources/mapper/competition/CompetitionMapper.xml
  19. 1 0
      qmjszx-business/src/main/resources/mapper/site/BeilvSiteMapper.xml

+ 262 - 0
qmjszx-admin/src/main/java/beilv/web/controller/bootacourse/bootACourseController.java

@@ -0,0 +1,262 @@
+package beilv.web.controller.bootacourse;
+
+import beilv.admissionticket.domain.AdmissionTicket;
+import beilv.admissionticket.service.IAdmissionTicketService;
+import beilv.bootacourse.domain.BootACourse;
+import beilv.bootacourse.domain.BootACourseBO;
+import beilv.bootacourse.service.IBootACourseService;
+import beilv.cardpurchaserecord.domain.CardPurchaseRecord;
+import beilv.cardpurchaserecord.service.ICardPurchaseRecordService;
+import beilv.carinformation.domain.CarInformation;
+import beilv.carinformation.service.ICarInformationService;
+import beilv.common.core.controller.BaseController;
+import beilv.common.core.domain.AjaxResult;
+import beilv.common.utils.DictUtils;
+import beilv.common.utils.uuid.IdUtils;
+import beilv.site.domain.BeilvSite;
+import beilv.site.service.IBeilvSiteService;
+import beilv.usermembershipcard.domain.MemberStream;
+import beilv.usermembershipcard.service.IUserMembershipCardService;
+import beilv.venue.domain.BeilvVenue;
+import beilv.venue.service.IBeilvVenueService;
+import org.apache.commons.collections4.MapUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
+@RestController
+@RequestMapping("/bootACourse")
+public class bootACourseController extends BaseController {
+
+    @Autowired
+    private IBeilvVenueService venueService;
+    @Autowired
+    private IBeilvSiteService siteService;
+    @Autowired
+    private IAdmissionTicketService ticketService;
+
+    @Autowired
+    private ICardPurchaseRecordService recordService;
+    @Autowired
+    private IUserMembershipCardService cardService;
+
+    @Autowired
+    private IBootACourseService courseService;
+
+    /**
+     * 查询基础信息
+     */
+    @PostMapping("/getVenueList")
+    public AjaxResult getVenueList(){
+        //获取球场列表
+        List<BeilvVenue> resultList = venueService.selectBeilvVenueList(new BeilvVenue());
+        return AjaxResult.success(resultList);
+    }
+
+    /**
+     * 根据场馆id获取下面的球场信息
+     * @param beilvSite venueId(场馆id)
+     */
+    @PostMapping("/getSiteList")
+    public AjaxResult getSiteList(@RequestBody BeilvSite beilvSite){
+        //根据球场id, 获取下面所有的场地信息
+        List<BeilvSite> beilvSites = siteService.selectBeilvSiteList(beilvSite);
+        Set<String> siteTypeSite = new HashSet<>();
+
+        //遍历场地信息, 获取球场下所有的场地类型
+        beilvSites.forEach(site->{
+            siteTypeSite.add(site.getSiteType());
+        });
+
+        List<String> siteTypeList = new ArrayList<>();
+        //遍历场地类型, 获取场地类型的Label
+        siteTypeSite.forEach(siteType->{
+            siteTypeList.add(DictUtils.getDictLabel("site_type",siteType));
+        });
+
+        HashMap<String, Object> result = new HashMap<>();
+        //放入LabelList
+        result.put("siteType", siteTypeList);
+        //放入球场List
+        result.put("siteList", beilvSites);
+        return AjaxResult.success(result);
+    }
+
+    /**
+     * 根据球场类型, 判断用户是否具有此类会员卡
+     * 有返回会员卡信息集合
+     * 没有返回空集合
+     */
+    @PostMapping("/hasClubCard")
+    public AjaxResult hasClubCard(@RequestBody BootACourseBO course){
+        CardPurchaseRecord cardPurchaseRecord = new CardPurchaseRecord();
+        cardPurchaseRecord.setUserId(course.getUserId());
+        cardPurchaseRecord.setCardType(course.getTicketType());
+        cardPurchaseRecord.setType("1");
+        return AjaxResult.success(recordService.selectCardPurchaseRecordList(cardPurchaseRecord));
+    }
+
+    /**
+     * 查询可购票的场次信息
+     * 请求参数:
+     *  日期: yyyy-MM-dd
+     *  场地类型: site_type字典
+     *  球场id:
+     */
+    @PostMapping("/getTicketList")
+    public AjaxResult getTicketList(@RequestBody AdmissionTicket admissionTicket){
+        //设置查询状态: 可以预定的时段
+        admissionTicket.setAdmissionTicketStatus("0");
+        //查询可用时段
+        List<AdmissionTicket> admissionTickets = ticketService.selectBeilvAdmissionTicketList(admissionTicket);
+        return AjaxResult.success(admissionTickets);
+    }
+
+    /**
+     * 购票接口
+     * 用户id, 场次id, 会员卡id
+     * @return
+     */
+    @PostMapping("/addCourse")
+    public AjaxResult addCourse(@RequestBody BootACourseBO course){
+        //根据场次id 关联球馆表, 获取球馆允许提前多少分钟可以退票
+        Date refund  = calculationTime(ticketService.getThresholdValue(course.getTicketId()));
+
+
+        //生成订单编号
+        String orderId = IdUtils.fastSimpleUUID();
+        //生成订单信息
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        BootACourse bootACourse = new BootACourse(
+                course.getUserId(), //用户id
+                course.getContactPeople(), //联系人
+                course.getContactNumber(), //联系电话
+                simpleDateFormat.format(new Date()), //下单时间
+                "payment_status_to_be_paid", //支付状态
+                orderId, //订单比那好
+                course.getTicketId(), //场次id
+                course.getTicketType(), //场地类型
+                course.getClubCardId(), //会员卡号
+                refund); //最晚退单时间
+
+
+        //验证场次是否可用
+        if(courseService.isOk(course)){
+            //调用会员卡接口减少次数
+            MemberStream memberStream = new MemberStream();
+            memberStream.setUserCardId(course.getClubCardId());
+            memberStream.setType("0");
+            memberStream.setOrderId(orderId);
+
+            cardService.addStream(memberStream);
+
+            //扣除成功后, 修改订单状态为已付款.
+            bootACourse.setPaymentTime(simpleDateFormat.format(new Date()));
+            bootACourse.setPaymentStatus("payment_status_have_paid");
+
+            //将门票信息修改为2: 线上预约的时段;
+            AdmissionTicket admissionTicket = new AdmissionTicket();
+            admissionTicket.setId(course.getTicketId());
+            admissionTicket.setAdmissionTicketStatus("2");
+            ticketService.updateBeilvAdmissionTicket(admissionTicket);
+
+            return toAjax(courseService.addCourse(bootACourse));
+        }else{
+           return AjaxResult.error("当前场次已被预订");
+        }
+    }
+
+    /**
+     * 查询订单
+     */
+    @PostMapping("/getCourseList")
+    public AjaxResult getCourseList(@RequestBody BootACourseBO courseBO){
+        return AjaxResult.success(courseService.getCourseList(courseBO));
+    }
+
+
+    /**
+     * 退票接口
+     * 用户id, 订单编号,
+     * @return
+     * 1: 订单已核销
+     * 2: 退票成功
+     */
+    @PostMapping("/remofeCourse")
+    public AjaxResult remofeCourse(@RequestBody BootACourseBO courseBo){
+        //通过orderId查询订单信息
+        BootACourse course = courseService.getCourseInfo(courseBo);
+
+        //判断最晚退单时间是否大于当前时间, 大于返回true
+        if(course.getRefund().after(new Date())){
+            //根据订单信息中的会员卡退次数
+            //调用会员卡接口减少次数
+            MemberStream memberStream = new MemberStream();
+            memberStream.setUserCardId(course.getClubCardId());
+            memberStream.setType("1");
+            cardService.addStream(memberStream);
+
+
+            //修改场次信息状态为0: 可以预定的时段;
+            AdmissionTicket admissionTicket = new AdmissionTicket();
+            admissionTicket.setId(course.getTicketId());
+            admissionTicket.setAdmissionTicketStatus("0");
+            ticketService.updateBeilvAdmissionTicket(admissionTicket);
+
+            //修改订单信息状态为退款,
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            course.setRefundTime(simpleDateFormat.format(new Date()));
+            course.setRefundInstructions(courseBo.getRefundInstructions());
+            course.setPaymentStatus("payment_status_refunded");
+            return toAjax(courseService.updateCourse(course));
+        }else{
+            return AjaxResult.error("当前订单超过最晚退单时间, 不允许退单");
+        }
+
+    }
+
+
+    private Date calculationTime(Map<String, Object> map){
+
+        String sessionStr = MapUtils.getString(map, "session").split("-")[0]; //12:15
+
+        String thresholdValueStr = MapUtils.getString(map, "thresholdValue");// 120
+
+        String ticketDate = MapUtils.getString(map, "ticketDate");// 2025-01-07
+
+        // 拼接 ticketDate 和 sessionStr 形成完整的时间字符串
+        String fullTimeStr = ticketDate + " " + sessionStr + ":00"; // 例如 "2025-01-07 12:15:00"
+
+        // 将完整的时间字符串解析为 Date 对象
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date date = null;
+        try {
+            date = dateFormat.parse(fullTimeStr);
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return null; // 如果解析失败,返回 null
+        }
+
+        // 将 thresholdValueStr 转换为整数
+        int thresholdValue = Integer.parseInt(thresholdValueStr);
+
+        // 使用 Calendar 类来减去 thresholdValue 分钟
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.MINUTE, -thresholdValue);
+
+        // 返回计算后的 Date 对象
+        return calendar.getTime();
+    }
+}

+ 2 - 0
qmjszx-admin/src/main/resources/templates/admissionticket/admissionTicket.html

@@ -104,6 +104,8 @@
                 return "已预定"
             }else if(row.admissionTicketStatus === "3"){
                 return "已锁定"
+            }else if(row.admissionTicketStatus === "4"){
+                return "已核销"
             }
             /*else {
                 return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';

+ 7 - 0
qmjszx-business/src/main/java/beilv/admissionticket/mapper/AdmissionTicketMapper.java

@@ -1,8 +1,11 @@
 package beilv.admissionticket.mapper;
 
 import beilv.admissionticket.domain.AdmissionTicket;
+import beilv.bootacourse.domain.BootACourseBO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 public interface AdmissionTicketMapper {
     int insertAdmissionTicketToList(List<AdmissionTicket> ticketList);
@@ -56,4 +59,8 @@ public interface AdmissionTicketMapper {
     public int deleteBeilvAdmissionTicketByIds(String[] ids);
 
     void updateTicketStatus(List<String> ids);
+
+    boolean isOk(BootACourseBO course);
+
+    Map<String, Object> getThresholdValue(@Param("ticketId") String ticketId);
 }

+ 3 - 0
qmjszx-business/src/main/java/beilv/admissionticket/service/IAdmissionTicketService.java

@@ -3,6 +3,7 @@ package beilv.admissionticket.service;
 import beilv.admissionticket.domain.AdmissionTicket;
 
 import java.util.List;
+import java.util.Map;
 
 public interface IAdmissionTicketService {
     int insertAdmissionTicketToList(List<AdmissionTicket> ticketList);
@@ -56,4 +57,6 @@ public interface IAdmissionTicketService {
     public int deleteBeilvAdmissionTicketById(String id);
 
     void updateTicketStatus(List<String> ids);
+
+    Map<String, Object> getThresholdValue(String ticketId);
 }

+ 6 - 1
qmjszx-business/src/main/java/beilv/admissionticket/service/impl/AdmissionTicketServiceImpl.java

@@ -4,11 +4,11 @@ import beilv.admissionticket.domain.AdmissionTicket;
 import beilv.admissionticket.mapper.AdmissionTicketMapper;
 import beilv.admissionticket.service.IAdmissionTicketService;
 import beilv.common.core.text.Convert;
-import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class AdmissionTicketServiceImpl implements IAdmissionTicketService {
@@ -100,4 +100,9 @@ public class AdmissionTicketServiceImpl implements IAdmissionTicketService {
     public void updateTicketStatus(List<String> ids) {
         beilvAdmissionTicketMapper.updateTicketStatus(ids);
     }
+
+    @Override
+    public Map<String, Object> getThresholdValue(String ticketId) {
+        return beilvAdmissionTicketMapper.getThresholdValue(ticketId);
+    }
 }

+ 90 - 0
qmjszx-business/src/main/java/beilv/bootacourse/domain/BootACourse.java

@@ -0,0 +1,90 @@
+package beilv.bootacourse.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.*;
+
+import java.util.Date;
+
+@Getter
+@Setter
+@ToString
+@AllArgsConstructor
+@NoArgsConstructor
+public class BootACourse {
+    /**
+     * 数据id
+     */
+    private Long id;
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 联系人
+     */
+    private String contactPeople;
+    /**
+     * 联系电话
+     */
+    private String contactNumber;
+    /**
+     * 下单时间
+     */
+    private String registrationTime;
+    /**
+     * 支付时间
+     */
+    private String paymentTime;
+    /**
+     * 取消时间
+     */
+    private String cancellationTime;
+    /**
+     * 退款时间
+     */
+    private String refundTime;
+    /**
+     * 支付状态
+     */
+    private String paymentStatus;
+    /**
+     * 订单编号
+     */
+    private String orderId;
+    /**
+     * 赛事id
+     */
+    private String ticketId;
+    /**
+     * 订单类型
+     */
+    private String orderType;
+    /**
+     * 退款说明
+     */
+    private String refundInstructions;
+    /**
+     * 会员卡id
+     */
+    private String clubCardId;
+    /**
+     * 最晚退单时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date refund;
+
+
+
+    public BootACourse(String userId, String contactPeople, String contactNumber, String registrationTime, String paymentStatus, String orderId, String ticketId, String orderType, String clubCardId, Date refund) {
+        this.userId = userId;
+        this.contactPeople = contactPeople;
+        this.contactNumber = contactNumber;
+        this.registrationTime = registrationTime;
+        this.paymentStatus = paymentStatus;
+        this.orderId = orderId;
+        this.ticketId = ticketId;
+        this.orderType = orderType;
+        this.clubCardId = clubCardId;
+        this.refund = refund;
+    }
+}

+ 44 - 0
qmjszx-business/src/main/java/beilv/bootacourse/domain/BootACourseBO.java

@@ -0,0 +1,44 @@
+package beilv.bootacourse.domain;
+
+import lombok.*;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class BootACourseBO {
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 联系人
+     */
+    private String contactPeople;
+    /**
+     * 联系电话
+     */
+    private String contactNumber;
+    /**
+     * 订单id
+     */
+    private String orderId;
+    /**
+     * 场次id
+     */
+    private String ticketId;
+    /**
+     * 场地类型
+     */
+    private String ticketType;
+    /**
+     * 会员卡Id
+     */
+    private String clubCardId;
+    /**
+     * 退款说明
+     */
+    private String refundInstructions;
+
+}

+ 16 - 0
qmjszx-business/src/main/java/beilv/bootacourse/mapper/BootACourseMapper.java

@@ -0,0 +1,16 @@
+package beilv.bootacourse.mapper;
+
+import beilv.bootacourse.domain.BootACourse;
+import beilv.bootacourse.domain.BootACourseBO;
+
+import java.util.List;
+
+public interface BootACourseMapper {
+    int addCourse(BootACourse bootACourse);
+
+    BootACourse getCourseInfo(BootACourseBO courseBo);
+
+    int updateCourse(BootACourse course);
+
+    List<BootACourse> getCourseList(BootACourseBO courseBO);
+}

+ 20 - 0
qmjszx-business/src/main/java/beilv/bootacourse/service/IBootACourseService.java

@@ -0,0 +1,20 @@
+package beilv.bootacourse.service;
+
+import beilv.bootacourse.domain.BootACourse;
+import beilv.bootacourse.domain.BootACourseBO;
+import beilv.common.core.domain.AjaxResult;
+
+import java.util.List;
+
+public interface IBootACourseService {
+    int addCourse(BootACourse course);
+
+    boolean isOk(BootACourseBO course);
+
+    BootACourse getCourseInfo(BootACourseBO courseBo);
+
+    int updateCourse(BootACourse course);
+
+    List<BootACourse> getCourseList(BootACourseBO courseBO);
+
+}

+ 49 - 0
qmjszx-business/src/main/java/beilv/bootacourse/service/impl/BootACourseServiceImpl.java

@@ -0,0 +1,49 @@
+package beilv.bootacourse.service.impl;
+
+import beilv.admissionticket.mapper.AdmissionTicketMapper;
+import beilv.bootacourse.domain.BootACourse;
+import beilv.bootacourse.domain.BootACourseBO;
+import beilv.bootacourse.mapper.BootACourseMapper;
+import beilv.bootacourse.service.IBootACourseService;
+import beilv.common.utils.uuid.IdUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class BootACourseServiceImpl implements IBootACourseService {
+
+    @Autowired
+    private BootACourseMapper courseMapper;
+
+    @Autowired
+    private AdmissionTicketMapper ticketMapper;
+
+    @Override
+    public int addCourse(BootACourse course) {
+        return courseMapper.addCourse(course);
+    }
+
+    @Override
+    public boolean isOk(BootACourseBO course) {
+        return ticketMapper.isOk(course);
+    }
+
+    @Override
+    public BootACourse getCourseInfo(BootACourseBO courseBo) {
+        return courseMapper.getCourseInfo(courseBo);
+    }
+
+    @Override
+    public int updateCourse(BootACourse course) {
+        return courseMapper.updateCourse(course);
+    }
+
+    @Override
+    public List<BootACourse> getCourseList(BootACourseBO courseBO) {
+        return courseMapper.getCourseList(courseBO);
+    }
+}

+ 2 - 0
qmjszx-business/src/main/java/beilv/competition/mapper/CompetitionMapper.java

@@ -65,4 +65,6 @@ public interface CompetitionMapper {
     List<Competition> getCompetitionList();
 
     boolean selectStadumIsOpenById(String id);
+
+    void updateBookARace(Integer id);
 }

+ 0 - 5
qmjszx-business/src/main/java/beilv/competition/service/impl/CompetitionServiceImpl.java

@@ -6,7 +6,6 @@ import beilv.competition.domain.Competition;
 import beilv.competition.mapper.CompetitionMapper;
 import beilv.competition.service.ICompetitionService;
 import beilv.competition.task.CloseReg;
-import beilv.stadium.mapper.StadiumMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -27,9 +26,6 @@ public class CompetitionServiceImpl implements ICompetitionService {
     @Autowired
     private CompetitionMapper competitionMapper;
 
-    @Autowired
-    private StadiumMapper stadiumMapper;
-
     private final static String DAI_FA_BU = "competiton_state_1";
     private final static String BAO_MING_ZHONG = "competiton_state_2";
     private final static String BAO_MING_JIE_SHU = "competiton_state_3";
@@ -128,7 +124,6 @@ public class CompetitionServiceImpl implements ICompetitionService {
 
     @Override
     public int publishCompetitionById(Competition competition) {
-//        Competition competition = new Competition();
         competition.setPublishTime(new Date());
         competition.setPublishBy(ShiroUtils.getSysUser().getUserId().toString());
         competition.setPublishName(ShiroUtils.getSysUser().getUserName());

+ 2 - 0
qmjszx-business/src/main/java/beilv/competition/task/CloseReg.java

@@ -22,5 +22,7 @@ public class CloseReg extends TimerTask {
         competition.setId(id);
         competition.setCompetitionState("competiton_state_3");
         this.competitionMapper.updateCompetition(competition);
+
+        this.competitionMapper.updateBookARace(id);
     }
 }

+ 3 - 0
qmjszx-business/src/main/java/beilv/stadium/service/impl/StadiumServiceImpl.java

@@ -53,6 +53,9 @@ public class StadiumServiceImpl implements IStadiumService {
 
     @Override
     public int havePaidStadium(Stadium stadium) {
+        //增加赛事退单时间验证,如果赛事报名已结束, 则直接设置支付状态为已核销
+
+
         //设置订单状态为已支付
         stadium.setPaymentStatus(YI_ZHI_FU);
         //设置支付时间

+ 25 - 6
qmjszx-business/src/main/resources/mapper/admissionticket/AdmissionTicketMapper.xml

@@ -51,21 +51,22 @@
         ts.price,
         ts.ticket_date,
         bv.venue_name,
-        ts.admission_ticket_status
+        ts.admission_ticket_status,
+        ts.sort
         from beilv_admission_ticket ts
         left join beilv_venue bv on ts.venue_id = bv.id
         left join beilv_site bs on ts.site_name = bs.id
         <where>
-            <if test="siteName != null and siteName != ''">and bs.name = #{siteName}</if>
-            <if test="siteType != null and siteType != ''">and site_type = #{siteType}</if>
-            <if test="ticketDate != null ">and ticket_date = #{ticketDate}</if>
+            <if test="siteName != null and siteName != ''">and bs.id = #{siteName}</if>
+            <if test="siteType != null and siteType != ''">and ts.site_type = #{siteType}</if>
+            <if test="ticketDate != null ">and ts.ticket_date = #{ticketDate}</if>
             <if test="admissionTicketStatus != null  and admissionTicketStatus != ''">
                 <choose>
                     <when test="admissionTicketStatus == -1">
-                        and admission_ticket_status in ('0', '1')
+                        and ts.admission_ticket_status in ('0', '1')
                     </when>
                     <otherwise>
-                        and admission_ticket_status = #{admissionTicketStatus}
+                        and ts.admission_ticket_status = #{admissionTicketStatus}
                     </otherwise>
                 </choose>
             </if>
@@ -148,4 +149,22 @@
         </foreach>
     </update>
 
+    <select id="isOk" parameterType="BootACourseBO" resultType="boolean">
+        select CASE
+                   WHEN admission_ticket_status = 0 THEN true
+                   ELSE false
+                   END AS result
+        FROM
+            beilv_admission_ticket
+        WHERE
+            id = #{ticketId}
+    </select>
+
+    <select id="getThresholdValue" parameterType="string" resultType="map">
+        select bv.threshold_value as thresholdValue, bat.session, bat.ticket_date as ticketDate
+        from beilv_admission_ticket bat
+        left join beilv_venue bv on bat.venue_id = bv.id
+        where bat.id = #{ticketId}
+    </select>
+
 </mapper>

+ 112 - 0
qmjszx-business/src/main/resources/mapper/bootacourse/BootACourseMapper.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="beilv.bootacourse.mapper.BootACourseMapper">
+
+    <resultMap type="BootACourse" id="BootACourseResult">
+        <result property="id" column="id"/>
+        <result property="userId" column="user_id"/>
+        <result property="contactPeople" column="contact_people"/>
+        <result property="contactNumber" column="contact_number"/>
+        <result property="registrationTime" column="registration_time"/>
+        <result property="paymentTime" column="payment_time"/>
+        <result property="cancellationTime" column="cancellation_time"/>
+        <result property="refundTime" column="refund_time"/>
+        <result property="paymentStatus" column="payment_status"/>
+        <result property="orderId" column="order_id"/>
+        <result property="ticketId" column="ticket_id"/>
+        <result property="orderType" column="order_type"/>
+        <result property="refundInstructions" column="refund_instructions"/>
+        <result property="clubCardId" column="club_card_id"/>
+        <result property="refund" column="refund"/>
+    </resultMap>
+
+
+    <insert id="addCourse" parameterType="bootACourse">
+        insert into beilv_book_a_course
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="userId != null">user_id,</if>
+            <if test="contactPeople != null">contact_people,</if>
+            <if test="contactNumber != null">contact_number,</if>
+            <if test="registrationTime != null">registration_time,</if>
+            <if test="paymentTime != null">payment_time,</if>
+            <if test="cancellationTime != null">cancellation_time,</if>
+            <if test="refundTime != null">refund_time,</if>
+            <if test="paymentStatus != null">payment_status,</if>
+            <if test="orderId != null">order_id,</if>
+            <if test="ticketId != null">ticket_id,</if>
+            <if test="orderType != null">order_type,</if>
+            <if test="refundInstructions != null">refund_instructions,</if>
+            <if test="clubCardId != null">club_card_id,</if>
+            <if test="refund != null">refund,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="userId != null">#{userId},</if>
+            <if test="contactPeople != null">#{contactPeople},</if>
+            <if test="contactNumber != null">#{contactNumber},</if>
+            <if test="registrationTime != null">#{registrationTime},</if>
+            <if test="paymentTime != null">#{paymentTime},</if>
+            <if test="cancellationTime != null">#{cancellationTime},</if>
+            <if test="refundTime != null">#{refundTime},</if>
+            <if test="paymentStatus != null">#{paymentStatus},</if>
+            <if test="orderId != null">#{orderId},</if>
+            <if test="ticketId != null">#{ticketId},</if>
+            <if test="orderType != null">#{orderType},</if>
+            <if test="refundInstructions != null">#{refundInstructions},</if>
+            <if test="clubCardId != null">#{clubCardId},</if>
+            <if test="refund != null">#{refund},</if>
+        </trim>
+    </insert>
+
+    <update id="updateCourse" parameterType="bootACourse">
+        update beilv_book_a_course
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="paymentTime != null">payment_time = #{paymentTime},</if>
+            <if test="cancellationTime != null">cancellation_time = #{cancellationTime},</if>
+            <if test="refundTime != null">refund_time = #{refundTime},</if>
+            <if test="paymentStatus != null">payment_status = #{paymentStatus},</if>
+            <if test="refundInstructions != null">refund_instructions = #{refundInstructions},</if>
+        </trim>
+        <where>
+            <if test="orderId != null and orderId != ''">
+                and order_id = #{orderId}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+        </where>
+    </update>
+
+    <select id="getCourseList" parameterType="bootACourseBO" resultMap="BootACourseResult">
+        select
+            user_id, contact_people, contact_number, registration_time, payment_time, cancellation_time, refund_time,
+            payment_status, order_id, ticket_id, order_type, refund_instructions, club_card_id, refund
+        from beilv_book_a_course
+        <where>
+            <if test="userId != null and userId != ''">
+                and user_id = #{userId}
+            </if>
+            <if test="orderType != null and orderType != ''">
+                and order_type = #{orderType}
+            </if>
+            <if test="paymentStatus != null and paymentStatus != ''">
+                and paymen_status = #{paymentStatus}
+            </if>
+        </where>
+        order by registration_time desc
+    </select>
+
+    <select id="getCourseInfo" parameterType="bootACourseBO" resultMap="BootACourseResult">
+        select * from beilv_book_a_course
+        <where>
+            <if test="competitionId != null and competitionId != ''">
+                and ticket_id = #{ticketId}
+            </if>
+            <if test="orderType != null and orderType != ''">
+                and order_type = #{orderType}
+            </if>
+        </where>
+        order by registration_time desc
+    </select>
+</mapper>

+ 2 - 2
qmjszx-business/src/main/resources/mapper/card/UserMembershipCardMapper.xml

@@ -165,9 +165,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="remainingNumber != null">
                 <choose>
                     <when test="remainingNumber == 0">
-                        remaining_number = (select remaining_number-1 from user_membership_card where id = #{id})
+                        remaining_number = remaining_number-1
                     </when>
-                    <otherwise>remaining_number = (select remaining_number+1 from user_membership_card where id = #{id})</otherwise>
+                    <otherwise>remaining_number = remaining_number+1</otherwise>
                 </choose>
             </if>
         </trim>

+ 6 - 0
qmjszx-business/src/main/resources/mapper/competition/CompetitionMapper.xml

@@ -172,4 +172,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND competition_id = #{id}
     </select>
 
+    <update id="updateBookARace" parameterType="int">
+        update beilv_book_a_race
+        set payment_status = 'payment_status_verification'
+        where competition_id = #{id} and payment_status = 'payment_status_have_paid'
+    </update>
+
 </mapper>

+ 1 - 0
qmjszx-business/src/main/resources/mapper/site/BeilvSiteMapper.xml

@@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>  
             <if test="name != null  and name != ''"> and bs.name like concat('%', #{name}, '%')</if>
             <if test="siteType != null  and siteType != ''"> and bs.site_type = #{siteType}</if>
+            <if test="venueId != null  and venueId != ''"> and bs.venue_id = #{venueId}</if>
         </where>
     </select>