Parcourir la source

下单流程升级

Memory_LG il y a 1 mois
Parent
commit
063d939571

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

@@ -113,148 +113,148 @@ public class bootACourseController extends BaseController {
      *
      * @return
      */
-    @PostMapping("/addCourse")
-    public AjaxResult addCourse(@RequestBody BootACourseBO course) {
-        //根据场次id 关联球馆表, 获取球馆允许提前多少分钟可以退票
-        Date refund = calculationTime(ticketService.getThresholdValue(course.getTicketId()));
-
-
-        //生成订单编号
-        String orderId = IdUtils.fastSimpleUUID();
-        //生成订单信息
-        BootACourse bootACourse = new BootACourse(
-                course.getUserId(), //用户id
-                course.getContactPeople(), //联系人
-                course.getContactNumber(), //联系电话
-                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);
-            memberStream.setCreateBy(course.getUserId());
-
-            int i = cardService.addStream(memberStream);
-            if(i == -1){
-                return AjaxResult.error("会员卡次数不足");
-            }
-
-            //扣除成功后, 修改订单状态为已付款.
-            bootACourse.setPaymentTime(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("当前场次已被预订");
-        }
-    }
-
-    /**
-     * 查询订单
-     */
-    @GetMapping("/getCourseList")
-    public AjaxResult getCourseList(BootACourseBO courseBO) {
-        startPage();
-        List<BootACourse> courseList = courseService.getCourseList(courseBO);
-        Map<String, String> paymentStatus = DictUtils.getDictCacheToMap("payment_status");
-        courseList.forEach(course->{
-            course.setPaymentStatusLabel(paymentStatus.get(course.getPaymentStatus()));
-            course.setCoverList(course.getCover().split(","));
-        });
-        return AjaxResult.success(courseList);
-    }
-
-
-    /**
-     * 退票接口
-     * 用户id, 订单编号,
-     *
-     * @return 1: 订单已核销
-     * 2: 退票成功
-     */
-    @PostMapping("/remofeCourse")
-    public AjaxResult remofeCourse(@RequestBody BootACourseBO courseBo) {
-        //通过orderId查询订单信息
-        BootACourse course = courseService.getCourseInfo(courseBo);
-
-        //判断最晚退单时间大于当前时间, 并且订单状态为已支付
-        if (course.getRefund().after(new Date()) && "payment_status_have_paid".equals(course.getPaymentStatus())) {
-            //根据订单信息中的会员卡退次数
-            //调用会员卡接口减少次数
-            MemberStream memberStream = new MemberStream();
-            memberStream.setUserCardId(course.getClubCardId());
-            memberStream.setType("1");
-            memberStream.setOrderId(course.getOrderId());
-            cardService.addStream(memberStream);
-
-
-            //修改场次信息状态为0: 可以预定的时段;
-            AdmissionTicket admissionTicket = new AdmissionTicket();
-            admissionTicket.setId(course.getTicketId());
-            admissionTicket.setAdmissionTicketStatus("0");
-            ticketService.updateBeilvAdmissionTicket(admissionTicket);
-
-            //修改订单信息状态为退款,
-            course.setRefundTime(new Date());
-            course.setRefundInstructions(courseBo.getRefundInstructions());
-            course.setPaymentStatus("payment_status_refunded");
-            return toAjax(courseService.updateCourse(course));
-        } else {
-            if ("payment_status_verification".equals(course.getPaymentStatus())) {
-                return AjaxResult.error("订单已核销");
-            } else if (course.getRefund().after(new Date())) {
-                return AjaxResult.error("当前订单超过最晚退单时间, 不允许退单");
-            }
-            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();
-    }
+//    @PostMapping("/addCourse")
+//    public AjaxResult addCourse(@RequestBody BootACourseBO course) {
+//        //根据场次id 关联球馆表, 获取球馆允许提前多少分钟可以退票
+//        Date refund = calculationTime(ticketService.getThresholdValue(course.getTicketId()));
+//
+//
+//        //生成订单编号
+//        String orderId = IdUtils.fastSimpleUUID();
+//        //生成订单信息
+//        BootACourse bootACourse = new BootACourse(
+//                course.getUserId(), //用户id
+//                course.getContactPeople(), //联系人
+//                course.getContactNumber(), //联系电话
+//                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);
+//            memberStream.setCreateBy(course.getUserId());
+//
+//            int i = cardService.addStream(memberStream);
+//            if(i == -1){
+//                return AjaxResult.error("会员卡次数不足");
+//            }
+//
+//            //扣除成功后, 修改订单状态为已付款.
+//            bootACourse.setPaymentTime(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("当前场次已被预订");
+//        }
+//    }
+//
+//    /**
+//     * 查询订单
+//     */
+//    @GetMapping("/getCourseList")
+//    public AjaxResult getCourseList(BootACourseBO courseBO) {
+//        startPage();
+//        List<BootACourse> courseList = courseService.getCourseList(courseBO);
+//        Map<String, String> paymentStatus = DictUtils.getDictCacheToMap("payment_status");
+//        courseList.forEach(course->{
+//            course.setPaymentStatusLabel(paymentStatus.get(course.getPaymentStatus()));
+//            course.setCoverList(course.getCover().split(","));
+//        });
+//        return AjaxResult.success(courseList);
+//    }
+//
+//
+//    /**
+//     * 退票接口
+//     * 用户id, 订单编号,
+//     *
+//     * @return 1: 订单已核销
+//     * 2: 退票成功
+//     */
+//    @PostMapping("/remofeCourse")
+//    public AjaxResult remofeCourse(@RequestBody BootACourseBO courseBo) {
+//        //通过orderId查询订单信息
+//        BootACourse course = courseService.getCourseInfo(courseBo);
+//
+//        //判断最晚退单时间大于当前时间, 并且订单状态为已支付
+//        if (course.getRefund().after(new Date()) && "payment_status_have_paid".equals(course.getPaymentStatus())) {
+//            //根据订单信息中的会员卡退次数
+//            //调用会员卡接口减少次数
+//            MemberStream memberStream = new MemberStream();
+//            memberStream.setUserCardId(course.getClubCardId());
+//            memberStream.setType("1");
+//            memberStream.setOrderId(course.getOrderId());
+//            cardService.addStream(memberStream);
+//
+//
+//            //修改场次信息状态为0: 可以预定的时段;
+//            AdmissionTicket admissionTicket = new AdmissionTicket();
+//            admissionTicket.setId(course.getTicketId());
+//            admissionTicket.setAdmissionTicketStatus("0");
+//            ticketService.updateBeilvAdmissionTicket(admissionTicket);
+//
+//            //修改订单信息状态为退款,
+//            course.setRefundTime(new Date());
+//            course.setRefundInstructions(courseBo.getRefundInstructions());
+//            course.setPaymentStatus("payment_status_refunded");
+//            return toAjax(courseService.updateCourse(course));
+//        } else {
+//            if ("payment_status_verification".equals(course.getPaymentStatus())) {
+//                return AjaxResult.error("订单已核销");
+//            } else if (course.getRefund().after(new Date())) {
+//                return AjaxResult.error("当前订单超过最晚退单时间, 不允许退单");
+//            }
+//            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();
+//    }
 }

+ 239 - 70
qmjszx-admin/src/main/java/beilv/web/controller/carinformation/cardAppController.java

@@ -1,7 +1,9 @@
 package beilv.web.controller.carinformation;
 
-import beilv.cardpurchaserecord.domain.CardPurchaseRecord;
-import beilv.cardpurchaserecord.service.ICardPurchaseRecordService;
+import beilv.admissionticket.domain.AdmissionTicket;
+import beilv.admissionticket.service.IAdmissionTicketService;
+import beilv.bootacourse.domain.BootACourseBO;
+import beilv.bootacourse.service.IBootACourseService;
 import beilv.carinformation.domain.CarInformation;
 import beilv.carinformation.service.ICarInformationService;
 import beilv.common.core.controller.BaseController;
@@ -9,6 +11,9 @@ import beilv.common.core.domain.AjaxResult;
 import beilv.common.utils.DateUtils;
 import beilv.common.utils.StringUtils;
 import beilv.common.utils.uuid.IdUtils;
+import beilv.competition.domain.Competition;
+import beilv.competition.service.ICompetitionService;
+import beilv.site.service.IBeilvSiteService;
 import beilv.usermembershipcard.domain.UserMembershipCard;
 import beilv.usermembershipcard.service.IUserMembershipCardService;
 import beilv.vipCard.domain.VipCard;
@@ -23,7 +28,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import java.math.RoundingMode;
-import java.util.List;
 
 /**
  * 会员卡AppController
@@ -32,17 +36,14 @@ import java.util.List;
  * @date 2025-01-02
  */
 @Controller
-//@RequestMapping("/app-api/cardApp")
-@RequestMapping("/cardApp")
+@RequestMapping("/app-api/cardApp")
+//@RequestMapping("/cardApp")
 public class cardAppController extends BaseController {
 
     @Autowired
     private ICarInformationService carInformationService;
 
     @Autowired
-    private ICardPurchaseRecordService cardPurchaseRecordService;
-
-    @Autowired
     private IUserMembershipCardService userMembershipCardService;
 
     @Autowired
@@ -51,22 +52,143 @@ public class cardAppController extends BaseController {
     @Autowired
     private IVipCardService vipCardService;
 
+    @Autowired
+    private IBeilvSiteService siteService;
+
+    @Autowired
+    private IBootACourseService courseService;
+
+    @Autowired
+    private IAdmissionTicketService ticketService;
+
+    @Autowired
+    private ICompetitionService competitionService;
+
     /**
      * 新增充值记录
-     * userId
-     * practicalMoney
+     * id                   生成的数据标识(后续交互的关键信息)
+     * user_id              用户id
+     * bus_id               业务关联id(根据支付方式不同, 写入的值不同)
+     * order_type           订单类型(充值:chongzhi; 约球:yueqiu; 购卡:gouka; 报名参赛:cansai; 观看门票:menpiao)
+     * payment_status       支付状态: 生成订单, 默认为待支付:payment_status_to_be_paid
+     * create_time          订单生成时间
+     * payment_type         支付类型(微信:weChart; 会员卡:vipCard; 次卡:numCard)
+     * payment_time         支付时间: 如果支付类型为微信, 则回调接口设置时间; 如果是会员卡或次卡, 直接设置为订单生成时间
+     * cancellation_time    取消时间: 支付类型为微信支付, 则回调接口设置时间; 如果是会员卡或次卡, 则不会产生数据
+     * verify_time          核销时间: 定时任务核销
+     * refund_time          退款时间: 用户发起退款时生成的时间
+     * practical_money      实际支付金额
+     * ooriginal_price      原价
+     * member_price         会员价
      */
     @PostMapping("/addVipCardLog")
     @ResponseBody
     public AjaxResult addSave(@RequestBody VipCardLog vipCardLog) {
-        String orderId = IdUtils.fastSimpleUUID();
-        vipCardLog.setId(IdUtils.fastSimpleUUID());
+        String uuid = IdUtils.fastSimpleUUID();
+        vipCardLog.setId(uuid);
+        vipCardLog.setBusId(IdUtils.fastSimpleUUID());
+        vipCardLog.setOrderType("chongzhi");
         vipCardLog.setPaymentStatus("payment_status_to_be_paid");
-        vipCardLog.setOrderId(orderId);
-        vipCardLog.setOrderType("1");
-        int i = vipCardLogService.insertVipCardLog(vipCardLog);
-        if (i > 0) {
-            return AjaxResult.success("添加成功!", orderId);
+        vipCardLog.setCreateTime(DateUtils.getNowDate());
+        vipCardLog.setPaymentType("weChart");
+        if (vipCardLogService.insertVipCardLog(vipCardLog) > 0) {
+            return AjaxResult.success("操作成功!", uuid);
+        } else {
+            return toAjax(0);
+        }
+    }
+
+    /**
+     * 新增其他订单记录
+     * id                   生成的数据标识(后续交互的关键信息)
+     * user_id              用户id
+     * bus_id               业务关联id
+     * (当支付方式为微信时: 约球: 场地id; 购卡: 卡片id; 报名参赛: 赛事id; 门票: 赛事id)
+     * (当支付方式为会员卡时: 会员卡id)
+     * (当支付方式为次卡时: 次卡id)
+     * order_type           订单类型(充值:chongzhi; 约球:yueqiu; 购卡:gouka; 报名参赛:cansai; 观看门票:menpiao)
+     * payment_status       支付状态: 生成订单, 默认为待支付:payment_status_to_be_paid
+     * create_time          订单生成时间
+     * payment_type         支付类型(微信:weChart; 会员卡:vipCard; 次卡:numCard)
+     * payment_time         支付时间: 如果支付类型为微信, 则回调接口设置时间; 如果是会员卡或次卡, 直接设置为订单生成时间
+     * cancellation_time    取消时间: 支付类型为微信支付, 则回调接口设置时间; 如果是会员卡或次卡, 则不会产生数据
+     * verify_time          核销时间: 定时任务核销
+     * refund_time          退款时间: 用户发起退款时生成的时间
+     * practical_money      实际支付金额
+     * ooriginal_price      原价
+     * member_price         会员价
+     */
+    @PostMapping("/addOrderLog")
+    @ResponseBody
+    public AjaxResult addOrderLog(@RequestBody VipCardLog vipCardLog) {
+        String uuid = IdUtils.fastSimpleUUID();
+        vipCardLog.setId(uuid);//设置订单编号
+        vipCardLog.setCreateTime(DateUtils.getNowDate());//设置订单生成时间
+
+
+        //验证购票种类及对应的信息是否可用
+        String orderType = vipCardLog.getOrderType();
+        if ("yueqiu".equals(orderType)) {
+            //约球, 验证场次是否可用, 如果可用将其锁定
+            if (courseService.isOk(new BootACourseBO(vipCardLog.getBusId()))) {
+                //将门票信息修改为2: 线上预约的时段;
+                AdmissionTicket admissionTicket = new AdmissionTicket();
+                admissionTicket.setId(vipCardLog.getBusId());
+                admissionTicket.setAdmissionTicketStatus("2");
+                ticketService.updateBeilvAdmissionTicket(admissionTicket);
+            } else {
+                return AjaxResult.error("当前场次已被预订!");
+            }
+        } else if ("cansai".equals(orderType)) {
+            //参赛, 验证赛事报名是否结束, 参赛人员是否已满. 如果可用则锁定名额
+
+            //查询赛事信息.
+            Competition competition = competitionService.selectCompetitionById(Integer.valueOf(vipCardLog.getBusId()));
+            String competitionState = competition.getCompetitionState();
+            if ("competiton_state_3".equals(competitionState)) {
+                return AjaxResult.error("赛事报名结束!");
+            } else if ("competiton_state_4".equals(competitionState)) {
+                return AjaxResult.error("赛事已关闭!");
+            } else {
+                //查询已经报名的人数会团队数
+                int registrantsNumber = vipCardLogService.getRegistrantsNumber(vipCardLog);
+                if (registrantsNumber >= competition.getTeamMax()) {
+                    return AjaxResult.error("参赛人(团队)数已满!");
+                }
+            }
+        }
+
+
+        //验证支付方式
+        String paymentType = vipCardLog.getPaymentType();
+        if ("weChart".equals(paymentType)) {
+            //微信支付, 状态为待支付.
+            vipCardLog.setPaymentStatus("payment_status_to_be_paid");
+        } else {
+            //其他支付, 状态已支付
+            vipCardLog.setPaymentStatus("payment_status_have_paid");
+            vipCardLog.setPaymentTime(vipCardLog.getCreateTime());//支付时间同订单生成时间
+            if ("vipCard".equals(paymentType)) {
+                //如果是会员卡, 进行会员卡扣费
+                VipCard vipCard = vipCardService.selectVipCardById(vipCardLog.getPaymentId());
+                vipCard.setBalance(vipCard.getBalance().subtract(vipCardLog.getPracticalMoney()).setScale(2, RoundingMode.HALF_UP));
+                vipCardService.updateVipCard(vipCard);
+            } else if ("numCard".equals(paymentType)) {
+                //如果是次卡, 进行次卡扣次数
+                UserMembershipCard userMembershipCard = userMembershipCardService.selectUserMembershipCardById(Long.valueOf(vipCardLog.getPaymentId()));
+                if (userMembershipCard.getRemainingNumber() == 0) {
+                    return AjaxResult.error("次数不足!");
+                }
+                userMembershipCard.setRemainingNumber(userMembershipCard.getRemainingNumber() - 1);
+                userMembershipCardService.updateUserMembershipCard(userMembershipCard);
+
+            } else {
+                return AjaxResult.error("未知支付类型!");
+            }
+
+        }
+        if (vipCardLogService.insertVipCardLog(vipCardLog) > 0) {
+            return AjaxResult.success("操作成功!", uuid);
         } else {
             return toAjax(0);
         }
@@ -83,13 +205,13 @@ public class cardAppController extends BaseController {
     @PostMapping("/addVipCardLogCallBack")
     @ResponseBody
     public AjaxResult addVipCardLogCallBack(@RequestBody VipCardLog vipCardLog) {
-        if (StringUtils.isEmpty(vipCardLog.getOrderId())) {
+        if (StringUtils.isEmpty(vipCardLog.getId())) {
             return AjaxResult.error("订单号不能为空!");
         }
 
         if ("payment_status_have_paid".equals(vipCardLog.getPaymentStatus())) {
             //拉取订单信息
-            VipCardLog orderInfo = vipCardLogService.getOrderByOrderId(vipCardLog.getOrderId());
+            VipCardLog orderInfo = vipCardLogService.selectVipCardLogById(vipCardLog.getId());
 
             //获取会员卡信息
             VipCard vipCard = vipCardService.selectVipCardByUserId(orderInfo.getUserId());
@@ -99,10 +221,8 @@ public class cardAppController extends BaseController {
                 vipCardService.insertVipCard(new VipCard(Long.parseLong(orderInfo.getUserId()), orderInfo.getPracticalMoney()));
             } else {
                 //false 有会员卡,
-
                 vipCardService.updateVipCard(new VipCard(Long.parseLong(orderInfo.getUserId()), orderInfo.getPracticalMoney().add(vipCard.getBalance()).setScale(2, RoundingMode.HALF_UP)));
             }
-
             vipCardLog.setPaymentTime(DateUtils.getNowDate());
         } else if ("payment_status_cancelled".equals(vipCardLog.getPaymentStatus())) {
             vipCardLog.setCancellationTime(DateUtils.getNowDate());
@@ -112,66 +232,115 @@ public class cardAppController extends BaseController {
         return toAjax(vipCardLogService.updateVipCardLogByOrderId(vipCardLog));
     }
 
-
     /**
-     * 查询卡种信息列表
+     * 其他支付回调
      */
-    @PostMapping("/cardInformationlist")
+    @PostMapping("/addOrderLogCallBack")
     @ResponseBody
-    public AjaxResult cardInformationlist(@RequestBody CarInformation carInformation) {
-        return AjaxResult.success(carInformationService.selectCarInformationList(carInformation));
-    }
+    public AjaxResult addOrderLogCallBack(@RequestBody VipCardLog vipCardLog) {
+        if (StringUtils.isEmpty(vipCardLog.getId())) {
+            return AjaxResult.error("订单号不能为空!");
+        }
 
-    /**
-     * 查询购卡记录列表
-     */
-    @PostMapping("/getRecordlist")
-    @ResponseBody
-    public AjaxResult list(@RequestBody CardPurchaseRecord cardPurchaseRecord) {
-        List<CardPurchaseRecord> list = cardPurchaseRecordService.selectCardPurchaseRecordList(cardPurchaseRecord);
-        return AjaxResult.success(list);
-    }
+        //拉取订单信息
+        VipCardLog orderInfo = vipCardLogService.selectVipCardLogById(vipCardLog.getId());
 
-    /**
-     * 购卡生成订单
-     */
-    @PostMapping("/addCard")
-    @ResponseBody
-    public AjaxResult addCard(@RequestBody CardPurchaseRecord cardPurchaseRecord) {
-        return AjaxResult.success(cardPurchaseRecordService.insertCardPurchaseRecord(cardPurchaseRecord));
-    }
+        if ("payment_status_have_paid".equals(vipCardLog.getPaymentStatus())) {
+            vipCardLog.setPaymentTime(DateUtils.getNowDate());
+            String orderType = orderInfo.getOrderType();
 
-    /**
-     * 购卡回调(购卡、取消订单)
-     */
-    @PostMapping("/addCardCallback")
-    @ResponseBody
-    public AjaxResult addCardCallback(@RequestBody CardPurchaseRecord cardPurchaseRecord) {
-        return toAjax(cardPurchaseRecordService.addCardCallback(cardPurchaseRecord));
+            if ("gouka".equals(orderType)) {
+                CarInformation carInformation = carInformationService.selectCarInformationById(Long.valueOf(orderInfo.getBusId()));
+                //购卡订单, 支付成功, 生成卡片写入到次卡表
+                userMembershipCardService.insertUserMembershipCard(new UserMembershipCard(orderInfo.getUserId(), vipCardLog.getId(), carInformation.getTotalNumber(), "0", "3", DateUtils.getNowDate()));
+            }
+        } else if ("payment_status_cancelled".equals(vipCardLog.getPaymentStatus())) {
+            vipCardLog.setCancellationTime(DateUtils.getNowDate());
+
+            if ("yueqiu".equals(vipCardLog.getOrderType())) {
+                AdmissionTicket admissionTicket = new AdmissionTicket();
+                admissionTicket.setId(vipCardLog.getBusId());
+                admissionTicket.setAdmissionTicketStatus("0");
+                ticketService.updateBeilvAdmissionTicket(admissionTicket);
+            }
+
+        } else {
+            return AjaxResult.error("支付状态错误!");
+        }
+        return toAjax(vipCardLogService.updateVipCardLogByOrderId(vipCardLog));
     }
 
     /**
-     * 查询用户会员卡列表
+     * 查询我的订单
      */
-    @PostMapping("/getUserCardList")
+    @PostMapping("/selectOrderList")
     @ResponseBody
-    public AjaxResult getUserCardList(@RequestBody UserMembershipCard userMembershipCard) {
-        return AjaxResult.success(userMembershipCardService.selectUserMembershipCardList(userMembershipCard));
+    public AjaxResult selectOrderList(@RequestBody VipCardLog vipCardLog) {
+        return AjaxResult.success(vipCardLogService.selectVipCardLogList(vipCardLog));
     }
 
-    /*
-     * 退卡
-     *
-     * @author 韩福成
-     * @date 2025/1/7 上午10:46
-     */
-    @PostMapping("/refundCard")
-    @ResponseBody
-    public AjaxResult refundCard(@RequestBody UserMembershipCard userMembershipCard) {
-        int inserted = userMembershipCardService.refundCard(userMembershipCard);
-        if (inserted == -1) {
-            return AjaxResult.error("退款金额小于0,不支持退款!");
-        }
-        return toAjax(inserted);
-    }
+
+//
+//
+//    /**
+//     * 查询卡种信息列表
+//     */
+//    @PostMapping("/cardInformationlist")
+//    @ResponseBody
+//    public AjaxResult cardInformationlist(@RequestBody CarInformation carInformation) {
+//        return AjaxResult.success(carInformationService.selectCarInformationList(carInformation));
+//    }
+//
+//    /**
+//     * 查询购卡记录列表
+//     */
+//    @PostMapping("/getRecordlist")
+//    @ResponseBody
+//    public AjaxResult list(@RequestBody CardPurchaseRecord cardPurchaseRecord) {
+//        List<CardPurchaseRecord> list = cardPurchaseRecordService.selectCardPurchaseRecordList(cardPurchaseRecord);
+//        return AjaxResult.success(list);
+//    }
+//
+//    /**
+//     * 购卡生成订单
+//     */
+//    @PostMapping("/addCard")
+//    @ResponseBody
+//    public AjaxResult addCard(@RequestBody CardPurchaseRecord cardPurchaseRecord) {
+//        return AjaxResult.success(cardPurchaseRecordService.insertCardPurchaseRecord(cardPurchaseRecord));
+//    }
+//
+//    /**
+//     * 购卡回调(购卡、取消订单)
+//     */
+//    @PostMapping("/addCardCallback")
+//    @ResponseBody
+//    public AjaxResult addCardCallback(@RequestBody CardPurchaseRecord cardPurchaseRecord) {
+//        return toAjax(cardPurchaseRecordService.addCardCallback(cardPurchaseRecord));
+//    }
+//
+//    /**
+//     * 查询用户会员卡列表
+//     */
+//    @PostMapping("/getUserCardList")
+//    @ResponseBody
+//    public AjaxResult getUserCardList(@RequestBody UserMembershipCard userMembershipCard) {
+//        return AjaxResult.success(userMembershipCardService.selectUserMembershipCardList(userMembershipCard));
+//    }
+//
+//    /*
+//     * 退卡
+//     *
+//     * @author 韩福成
+//     * @date 2025/1/7 上午10:46
+//     */
+//    @PostMapping("/refundCard")
+//    @ResponseBody
+//    public AjaxResult refundCard(@RequestBody UserMembershipCard userMembershipCard) {
+//        int inserted = userMembershipCardService.refundCard(userMembershipCard);
+//        if (inserted == -1) {
+//            return AjaxResult.error("退款金额小于0,不支持退款!");
+//        }
+//        return toAjax(inserted);
+//    }
 }

+ 56 - 56
qmjszx-admin/src/main/java/beilv/web/controller/stadium/StadiumController.java

@@ -59,62 +59,62 @@ public class StadiumController extends BaseController {
             return AjaxResult.error("下单失败");
         }
     }
-
-    /**
-     * 通过订单id取消订单
-     * 调用者传递参数: 订单id,
-     * 注:  取消订单时在下单后没有支付时, 可以执行的操作. 如果已经支付了, 则需要调用申请退款接口
-     */
-    @PostMapping("/cancellStadium")
-    public AjaxResult cancellStadium(@RequestBody Stadium stadium) {
-        return toAjax(stadiumService.cancellStadium(stadium));
-    }
-
-    /**
-     * 查询订单
-     * 调用者传递参数: 用户id, 订单状态, 订单类型
-     */
-    @GetMapping("/getStadiumList")
-    public AjaxResult getStadiumList(StadiumBO stadiumBO) {
-        startPage();
-        Map<String, String> paymentStatus = DictUtils.getDictCacheToMap("payment_status");
-        Map<String, String> competitionType = DictUtils.getDictCacheToMap("competition_type");
-        List<Stadium> stadiumList = stadiumService.getStadiumList(stadiumBO);
-        stadiumList.forEach(stadium -> {
-            stadium.setPaymentStatusLabel(paymentStatus.get(stadium.getPaymentStatus()));
-            stadium.setCompetitionTypeLabel(competitionType.get(stadium.getCompetitionType()));
-        });
-        return AjaxResult.success(getDataTable(stadiumList));
-    }
-
-    /**
-     * 支付回调
-     * 调用着传递: 订单编号, 支付状态
-     */
-    @PostMapping("/havePaidStadium")
-    public AjaxResult havePaidStadium(@RequestBody Stadium stadium) {
-        return toAjax(stadiumService.havePaidStadium(stadium));
-    }
-
-    /**
-     * 退款回调
-     * 调用者传递参数: 订单id, 用户id
-     */
-    @PostMapping("/refundStadium")
-    public AjaxResult refundStadium(@RequestBody Stadium stadium) {
-        return toAjax(stadiumService.refundStadium(stadium));
-    }
-
-    /**
-     * 支付验证
-     * 支付之前调用方法, 检测是否可以进行支付
-     *
-     * @return Boolean  true: 可以支付; false: 不可以支付
-     */
-    @PostMapping("/paymentVerification")
-    public Boolean paymentVerification(@RequestBody Stadium stadium) {
-        return stadiumService.paymentVerification(stadium);
-    }
+//
+//    /**
+//     * 通过订单id取消订单
+//     * 调用者传递参数: 订单id,
+//     * 注:  取消订单时在下单后没有支付时, 可以执行的操作. 如果已经支付了, 则需要调用申请退款接口
+//     */
+//    @PostMapping("/cancellStadium")
+//    public AjaxResult cancellStadium(@RequestBody Stadium stadium) {
+//        return toAjax(stadiumService.cancellStadium(stadium));
+//    }
+//
+//    /**
+//     * 查询订单
+//     * 调用者传递参数: 用户id, 订单状态, 订单类型
+//     */
+//    @GetMapping("/getStadiumList")
+//    public AjaxResult getStadiumList(StadiumBO stadiumBO) {
+//        startPage();
+//        Map<String, String> paymentStatus = DictUtils.getDictCacheToMap("payment_status");
+//        Map<String, String> competitionType = DictUtils.getDictCacheToMap("competition_type");
+//        List<Stadium> stadiumList = stadiumService.getStadiumList(stadiumBO);
+//        stadiumList.forEach(stadium -> {
+//            stadium.setPaymentStatusLabel(paymentStatus.get(stadium.getPaymentStatus()));
+//            stadium.setCompetitionTypeLabel(competitionType.get(stadium.getCompetitionType()));
+//        });
+//        return AjaxResult.success(getDataTable(stadiumList));
+//    }
+//
+//    /**
+//     * 支付回调
+//     * 调用着传递: 订单编号, 支付状态
+//     */
+//    @PostMapping("/havePaidStadium")
+//    public AjaxResult havePaidStadium(@RequestBody Stadium stadium) {
+//        return toAjax(stadiumService.havePaidStadium(stadium));
+//    }
+//
+//    /**
+//     * 退款回调
+//     * 调用者传递参数: 订单id, 用户id
+//     */
+//    @PostMapping("/refundStadium")
+//    public AjaxResult refundStadium(@RequestBody Stadium stadium) {
+//        return toAjax(stadiumService.refundStadium(stadium));
+//    }
+//
+//    /**
+//     * 支付验证
+//     * 支付之前调用方法, 检测是否可以进行支付
+//     *
+//     * @return Boolean  true: 可以支付; false: 不可以支付
+//     */
+//    @PostMapping("/paymentVerification")
+//    public Boolean paymentVerification(@RequestBody Stadium stadium) {
+//        return stadiumService.paymentVerification(stadium);
+//    }
 
 
 

+ 3 - 3
qmjszx-admin/src/main/java/beilv/web/controller/system/AppMemberController.java

@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*;
 import java.util.List;
 
 /**
- * 小程序会员用户信息Controller
+ * 小程序用户信息Controller
  *
  * @author ruoyi
  * @date 2025-01-02
@@ -33,7 +33,7 @@ public class AppMemberController extends BaseController {
     /**
      * app查询会员用户信息
      */
-    @Log(title = "app查询会员用户信息", businessType = BusinessType.UPDATE)
+    @Log(title = "app查询用户信息", businessType = BusinessType.UPDATE)
     @GetMapping("/getById/{id}")
     public AjaxResult getById(@PathVariable("id") Long id) {
         return AjaxResult.success(sysMemberService.selectSysMemberById(id));
@@ -42,7 +42,7 @@ public class AppMemberController extends BaseController {
     /**
      * app修改保存会员用户信息
      */
-    @Log(title = "app修改保存会员用户信息", businessType = BusinessType.UPDATE)
+    @Log(title = "app修改保存用户信息", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
     @ResponseBody
     public AjaxResult editSave(@RequestBody SysMember sysMember) {

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

@@ -44,4 +44,8 @@ public class BootACourseBO {
      * 支付状态
      */
     private String paymentStatus;
+
+    public BootACourseBO(String busId) {
+        this.ticketId = busId;
+    }
 }

+ 16 - 124
qmjszx-business/src/main/java/beilv/usermembershipcard/domain/UserMembershipCard.java

@@ -2,8 +2,12 @@ package beilv.usermembershipcard.domain;
 
 import beilv.common.annotation.Excel;
 import beilv.common.core.domain.BaseEntity;
+import lombok.*;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.ibatis.type.Alias;
+
+import java.util.Date;
 
 /**
  * 用户会员卡对象 user_membership_card
@@ -11,6 +15,12 @@ import org.apache.commons.lang3.builder.ToStringStyle;
  * @author ruoyi
  * @date 2025-01-02
  */
+@Setter
+@Getter
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+@Alias("UserMembershipCard")
 public class UserMembershipCard extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
@@ -82,131 +92,13 @@ public class UserMembershipCard extends BaseEntity {
     @Excel(name = "状态")
     private String stateLabel;
 
-    public String getCardType() {
-        return cardType;
-    }
-
-    public void setCardType(String cardType) {
-        this.cardType = cardType;
-    }
-
-    public String getCardTypeLable() {
-        return cardTypeLable;
-    }
-
-    public void setCardTypeLable(String cardTypeLable) {
-        this.cardTypeLable = cardTypeLable;
-    }
-
-    public String getStateLabel() {
-
-        return stateLabel;
-    }
-
-    public void setStateLabel(String stateLabel) {
-        this.stateLabel = stateLabel;
-    }
-
-    public String getState() {
-        return state;
-    }
-
-    public void setState(String state) {
-        this.state = state;
-    }
-
-    public String getRecordId() {
-        return recordId;
-    }
-
-    public void setRecordId(String recordId) {
-        this.recordId = recordId;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public String getRealName() {
-        return realName;
-    }
-
-    public void setRealName(String realName) {
-        this.realName = realName;
-    }
-
-    public String getMobile() {
-        return mobile;
-    }
-
-    public void setMobile(String mobile) {
-        this.mobile = mobile;
-    }
-
-    public String getCardName() {
-        return cardName;
-    }
-
-    public void setCardName(String cardName) {
-        this.cardName = cardName;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setUserId(String userId) {
+    public UserMembershipCard(String userId, String id, Integer totalNumber, String version, String state, Date nowDate) {
         this.userId = userId;
-    }
-
-    public String getUserId() {
-        return userId;
-    }
-
-    public void setTotalNumber(Integer totalNumber) {
-        this.totalNumber = totalNumber;
-    }
-
-    public Integer getTotalNumber() {
-        return totalNumber;
-    }
-
-    public void setRemainingNumber(Integer remainingNumber) {
-        this.remainingNumber = remainingNumber;
-    }
-
-    public Integer getRemainingNumber() {
-        return remainingNumber;
-    }
-
-    public void setVersion(String version) {
+        this.recordId = id;
+        this.remainingNumber = totalNumber;
         this.version = version;
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-                .append("id", getId())
-                .append("userId", getUserId())
-                .append("totalNumber", getTotalNumber())
-                .append("remainingNumber", getRemainingNumber())
-                .append("version", getVersion())
-                .append("createBy", getCreateBy())
-                .append("createTime", getCreateTime())
-                .append("updateBy", getUpdateBy())
-                .append("updateTime", getUpdateTime())
-                .toString();
+        this.state = state;
+        this.setCreateTime(nowDate);
+        this.setCreateBy(userId);
     }
 }

+ 49 - 22
qmjszx-business/src/main/java/beilv/vipCardLog/domain/VipCardLog.java

@@ -15,7 +15,7 @@ import java.util.Date;
  * 充值记录对象 beilv_vip_card_log
  *
  * @author LG
- * @date 2025-11-12
+ * @date 2025-11-13
  */
 @Setter
 @Getter
@@ -27,8 +27,9 @@ public class VipCardLog extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
     /**
-     * 
+     * 订单编
      */
+    @Excel(name = "订单编号")
     private String id;
 
     /**
@@ -38,51 +39,77 @@ public class VipCardLog extends BaseEntity {
     private String userId;
 
     /**
-     * 记录类型(充值, 退卡)
+     * 订单编号
      */
-    @Excel(name = "记录类型(充值, 退卡)")
+    @Excel(name = "业务id")
+    private String busId;
+
+    /**
+     * 订单类型
+     */
+    @Excel(name = "订单类型")
     private String orderType;
 
     /**
+     * 支付状态
+     */
+    @Excel(name = "支付状态")
+    private String paymentStatus;
+
+    /**
+     * 支付类型
+     */
+    @Excel(name = "支付类型")
+    private String paymentType;
+
+    /**
      * 支付时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date paymentTime;
 
     /**
      * 取消时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    @Excel(name = "取消时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @Excel(name = "取消时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date cancellationTime;
 
     /**
-     * 支付状态(字段值: payment_status)
+     * 核销时间
      */
-    @Excel(name = "支付状态(字段值: payment_status)")
-    private String paymentStatus;
-
-    /**
-     * 订单编号
-     */
-    @Excel(name = "订单编号")
-    private String orderId;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @Excel(name = "核销时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date verifyTime;
 
     /**
      * 退款时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    @Excel(name = "退款时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @Excel(name = "退款时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date refundTime;
 
     /**
-     * 支付金额
+     * 实际支付金额
      */
-    @Excel(name = "支付金额")
+    @Excel(name = "实际支付金额")
     private BigDecimal practicalMoney;
 
+    /**
+     * 原价
+     */
+    @Excel(name = "原价")
+    private BigDecimal originalPrice;
+
+    /**
+     * 会员价
+     */
+    @Excel(name = "会员价")
+    private BigDecimal memberPrice;
+
+    private String paymentId;
     private String username;
     private String mobile;
-
+    
 }

+ 1 - 1
qmjszx-business/src/main/java/beilv/vipCardLog/mapper/VipCardLogMapper.java

@@ -59,6 +59,6 @@ public interface VipCardLogMapper {
      */
     public int deleteVipCardLogByIds(String[] ids);
 
-    VipCardLog getOrderByOrderId(String orderId);
 
+    int getRegistrantsNumber(VipCardLog vipCardLog);
 }

+ 2 - 2
qmjszx-business/src/main/java/beilv/vipCardLog/service/IVipCardLogService.java

@@ -60,7 +60,7 @@ public interface IVipCardLogService {
      */
     public int deleteVipCardLogById(String id);
 
-    VipCardLog getOrderByOrderId(String orderId);
-
     int updateVipCardLogByOrderId(VipCardLog vipCardLog);
+
+    int getRegistrantsNumber(VipCardLog vipCardLog);
 }

+ 5 - 4
qmjszx-business/src/main/java/beilv/vipCardLog/service/impl/VipCardLogServiceImpl.java

@@ -87,13 +87,14 @@ public class VipCardLogServiceImpl implements IVipCardLogService {
         return vipCardLogMapper.deleteVipCardLogById(id);
     }
 
-    @Override
-    public VipCardLog getOrderByOrderId(String orderId) {
-        return vipCardLogMapper.getOrderByOrderId(orderId);
-    }
 
     @Override
     public int updateVipCardLogByOrderId(VipCardLog vipCardLog) {
         return vipCardLogMapper.updateVipCardLog(vipCardLog);
     }
+
+    @Override
+    public int getRegistrantsNumber(VipCardLog vipCardLog) {
+        return vipCardLogMapper.getRegistrantsNumber(vipCardLog);
+    }
 }

+ 0 - 1
qmjszx-business/src/main/resources/mapper/vipCard/VipCardMapper.xml

@@ -96,5 +96,4 @@
     <select id="selectVipCardByUserId" parameterType="string" resultMap="VipCardResult">
         select * from beilv_vip_card where user_id = #{userId}
     </select>
-
 </mapper>

+ 68 - 32
qmjszx-business/src/main/resources/mapper/vipCardLog/VipCardLogMapper.xml

@@ -7,28 +7,24 @@
     <resultMap type="VipCardLog" id="VipCardLogResult">
         <result property="id" column="id"/>
         <result property="userId" column="user_id"/>
+        <result property="busId" column="bus_id"/>
         <result property="orderType" column="order_type"/>
+        <result property="paymentStatus" column="payment_status"/>
+        <result property="createTime" column="create_time"/>
+        <result property="paymentType" column="payment_type"/>
         <result property="paymentTime" column="payment_time"/>
         <result property="cancellationTime" column="cancellation_time"/>
-        <result property="paymentStatus" column="payment_status"/>
-        <result property="orderId" column="order_id"/>
+        <result property="verifyTime" column="verify_time"/>
         <result property="refundTime" column="refund_time"/>
         <result property="practicalMoney" column="practical_money"/>
-        <result property="username" column="username"/>
-        <result property="mobile" column="mobile"/>
+        <result property="originalPrice" column="original_price"/>
+        <result property="memberPrice" column="member_price"/>
+        <result property="paymentId" column="payment_id"/>
     </resultMap>
 
     <sql id="selectVipCardLogVo">
-        select a.id,
-               a.user_id,
-               a.order_type,
-               a.payment_time,
-               a.cancellation_time,
-               a.payment_status,
-               a.order_id,
-               a.refund_time,
-               a.practical_money
-        from beilv_vip_card_log a
+        select a.id, a.user_id, a.bus_id, a.order_type, a.payment_status, a.create_time, a.payment_type, a.payment_time, a.cancellation_time,
+               a.verify_time, a.refund_time, a.practical_money, a.original_price, a.member_price, a.payment_id from beilv_vip_card_log a
     </sql>
 
     <select id="selectVipCardLogList" parameterType="VipCardLog" resultMap="VipCardLogResult">
@@ -37,7 +33,20 @@
         <where>
             <if test="username != null and username != ''">and b.username like concat('%',#{username},'%')</if>
             <if test="mobile != null  and mobile != ''">and b.mobile like concat('%',#{mobile},'%')</if>
+            <if test="paymentStatus != null and paymentStatus != ''">
+                and a.payment_status = #{paymentStatus}
+            </if>
+            <if test="paymentType != null and paymentType != ''">
+                and a.payment_type = #{paymentType}
+            </if>
+            <if test="orderType != null and orderType != ''">
+                and a.order_type = #{orderType}
+            </if>
+            <if test="userId != null and userId != ''">
+                and a.user_id = #{userId}
+            </if>
         </where>
+        order by a.create_time desc
     </select>
 
     <select id="selectVipCardLogById" parameterType="String" resultMap="VipCardLogResult">
@@ -48,26 +57,38 @@
     <insert id="insertVipCardLog" parameterType="VipCardLog" useGeneratedKeys="true" keyProperty="id">
         insert into beilv_vip_card_log
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="id != null and id != ''">id,</if>
+            <if test="id != null">id,</if>
             <if test="userId != null">user_id,</if>
+            <if test="busId != null">bus_id,</if>
             <if test="orderType != null">order_type,</if>
+            <if test="paymentStatus != null">payment_status,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="paymentType != null">payment_type,</if>
             <if test="paymentTime != null">payment_time,</if>
             <if test="cancellationTime != null">cancellation_time,</if>
-            <if test="paymentStatus != null">payment_status,</if>
-            <if test="orderId != null">order_id,</if>
+            <if test="verifyTime != null">verify_time,</if>
             <if test="refundTime != null">refund_time,</if>
             <if test="practicalMoney != null">practical_money,</if>
+            <if test="originalPrice != null">original_price,</if>
+            <if test="memberPrice != null">member_price,</if>
+            <if test="paymentId != null">payment_id,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="id != null and id != ''">#{id},</if>
+            <if test="id != null">#{id},</if>
             <if test="userId != null">#{userId},</if>
+            <if test="busId != null">#{busId},</if>
             <if test="orderType != null">#{orderType},</if>
+            <if test="paymentStatus != null">#{paymentStatus},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="paymentType != null">#{paymentType},</if>
             <if test="paymentTime != null">#{paymentTime},</if>
             <if test="cancellationTime != null">#{cancellationTime},</if>
-            <if test="paymentStatus != null">#{paymentStatus},</if>
-            <if test="orderId != null">#{orderId},</if>
+            <if test="verifyTime != null">#{verifyTime},</if>
             <if test="refundTime != null">#{refundTime},</if>
             <if test="practicalMoney != null">#{practicalMoney},</if>
+            <if test="originalPrice != null">#{originalPrice},</if>
+            <if test="memberPrice != null">#{memberPrice},</if>
+            <if test="paymentId != null">#{paymentId},</if>
         </trim>
     </insert>
 
@@ -75,22 +96,28 @@
         update beilv_vip_card_log
         <trim prefix="SET" suffixOverrides=",">
             <if test="userId != null">user_id = #{userId},</if>
+            <if test="busId != null">bus_id = #{busId},</if>
             <if test="orderType != null">order_type = #{orderType},</if>
+            <if test="paymentStatus != null">payment_status = #{paymentStatus},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="paymentType != null">payment_type = #{paymentType},</if>
             <if test="paymentTime != null">payment_time = #{paymentTime},</if>
             <if test="cancellationTime != null">cancellation_time = #{cancellationTime},</if>
-            <if test="paymentStatus != null">payment_status = #{paymentStatus},</if>
-            <if test="orderId != null">order_id = #{orderId},</if>
+            <if test="verifyTime != null">verify_time = #{verifyTime},</if>
             <if test="refundTime != null">refund_time = #{refundTime},</if>
             <if test="practicalMoney != null">practical_money = #{practicalMoney},</if>
+            <if test="originalPrice != null">original_price = #{originalPrice},</if>
+            <if test="memberPrice != null">member_price = #{memberPrice},</if>
+            <if test="paymentId != null">payment_id = #{paymentId},</if>
         </trim>
-            <where>
-                <if test="id != null and id != ''">
-                    and id = #{id}
-                </if>
-                <if test="orderId != null and orderId != ''">
-                    and order_id = #{orderId}
-                </if>
-            </where>
+        <where>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="busId != null and busId != ''">
+                and bus_id = #{busId}
+            </if>
+        </where>
     </update>
 
     <delete id="deleteVipCardLogById" parameterType="String">
@@ -106,9 +133,18 @@
         </foreach>
     </delete>
 
-    <select id="getOrderByOrderId" parameterType="String" resultMap="VipCardLogResult">
+    <select id="getOrderBybusId" parameterType="String" resultMap="VipCardLogResult">
         <include refid="selectVipCardLogVo"/>
-        where order_id = #{orderId}
+        where bus_id = #{busId}
+    </select>
+
+    <select id="getRegistrantsNumber" parameterType="VipCardLog" resultType="int">
+        select count(id) from beilv_vip_card_log
+        where
+            order_type = #{orderType}
+          and bus_id = #{busId}
+          and
+            (payment_status = 'payment_status_to_be_paid' or payment_status = 'payment_status_have_paid')
     </select>
 
 </mapper>