소스 검색

储值卡开卡

Memory_LG 1 개월 전
부모
커밋
23ae462195
23개의 변경된 파일1827개의 추가작업 그리고 210개의 파일을 삭제
  1. 78 6
      qmjszx-admin/src/main/java/beilv/web/controller/carinformation/cardAppController.java
  2. 126 0
      qmjszx-admin/src/main/java/beilv/web/controller/vipCard/VipCardController.java
  3. 116 0
      qmjszx-admin/src/main/java/beilv/web/controller/vipCardLog/VipCardLogController.java
  4. 2 2
      qmjszx-admin/src/main/resources/static/ruoyi/js/ry-ui.js
  5. 113 0
      qmjszx-admin/src/main/resources/templates/system/vipCardLog/add.html
  6. 114 0
      qmjszx-admin/src/main/resources/templates/system/vipCardLog/edit.html
  7. 114 0
      qmjszx-admin/src/main/resources/templates/system/vipCardLog/vipCardLog.html
  8. 76 0
      qmjszx-admin/src/main/resources/templates/vipCard/add.html
  9. 127 0
      qmjszx-admin/src/main/resources/templates/vipCard/card.html
  10. 50 0
      qmjszx-admin/src/main/resources/templates/vipCard/edit.html
  11. 46 202
      qmjszx-business/src/main/java/beilv/cardpurchaserecord/domain/CardPurchaseRecord.java
  12. 7 0
      qmjszx-business/src/main/java/beilv/cardpurchaserecord/service/impl/CardPurchaseRecordServiceImpl.java
  13. 22 0
      qmjszx-business/src/main/java/beilv/utils/UuidUtils.java
  14. 71 0
      qmjszx-business/src/main/java/beilv/vipCard/domain/VipCard.java
  15. 64 0
      qmjszx-business/src/main/java/beilv/vipCard/mapper/VipCardMapper.java
  16. 67 0
      qmjszx-business/src/main/java/beilv/vipCard/service/IVipCardService.java
  17. 112 0
      qmjszx-business/src/main/java/beilv/vipCard/service/impl/VipCardServiceImpl.java
  18. 84 0
      qmjszx-business/src/main/java/beilv/vipCardLog/domain/VipCardLog.java
  19. 64 0
      qmjszx-business/src/main/java/beilv/vipCardLog/mapper/VipCardLogMapper.java
  20. 66 0
      qmjszx-business/src/main/java/beilv/vipCardLog/service/IVipCardLogService.java
  21. 99 0
      qmjszx-business/src/main/java/beilv/vipCardLog/service/impl/VipCardLogServiceImpl.java
  22. 100 0
      qmjszx-business/src/main/resources/mapper/vipCard/VipCardMapper.xml
  23. 109 0
      qmjszx-business/src/main/resources/mapper/vipCardLog/VipCardLogMapper.xml

+ 78 - 6
qmjszx-admin/src/main/java/beilv/web/controller/carinformation/cardAppController.java

@@ -6,14 +6,18 @@ 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.DateUtils;
+import beilv.common.utils.StringUtils;
+import beilv.common.utils.uuid.IdUtils;
 import beilv.usermembershipcard.domain.UserMembershipCard;
 import beilv.usermembershipcard.service.IUserMembershipCardService;
+import beilv.vipCard.domain.VipCard;
+import beilv.vipCard.service.IVipCardService;
+import beilv.vipCardLog.domain.VipCardLog;
+import beilv.vipCardLog.service.IVipCardLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-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.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -24,7 +28,8 @@ import java.util.List;
  * @date 2025-01-02
  */
 @Controller
-@RequestMapping("/app-api/cardApp")
+//@RequestMapping("/app-api/cardApp")
+@RequestMapping("/cardApp")
 public class cardAppController extends BaseController {
 
     @Autowired
@@ -35,6 +40,73 @@ public class cardAppController extends BaseController {
 
     @Autowired
     private IUserMembershipCardService userMembershipCardService;
+
+    @Autowired
+    private IVipCardLogService vipCardLogService;
+
+    @Autowired
+    private IVipCardService vipCardService;
+
+    /**
+     * 新增充值记录
+     * userId
+     * practicalMoney
+     */
+    @PostMapping("/addVipCardLog")
+    @ResponseBody
+    public AjaxResult addSave(@RequestBody VipCardLog vipCardLog) {
+        String orderId = IdUtils.fastSimpleUUID();
+        vipCardLog.setId(IdUtils.fastSimpleUUID());
+        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);
+        } else {
+            return toAjax(0);
+        }
+    }
+
+
+    /**
+     * 充值回调
+     *
+     * @param vipCardLog orderId
+     *                   paymentStatus
+     * @return
+     */
+    @PostMapping("/addVipCardLogCallBack")
+    @ResponseBody
+    public AjaxResult addVipCardLogCallBack(@RequestBody VipCardLog vipCardLog) {
+        if (StringUtils.isEmpty(vipCardLog.getOrderId())) {
+            return AjaxResult.error("订单id不能为空!");
+        }
+
+        if ("payment_status_have_paid".equals(vipCardLog.getPaymentStatus())) {
+            //拉取订单信息
+            VipCardLog orderInfo = vipCardLogService.getOrderByOrderId(vipCardLog.getOrderId());
+
+            //获取会员卡信息
+            VipCard vipCard = vipCardService.selectVipCardByUserId(orderInfo.getUserId());
+
+            if (null == vipCard) {
+                //true 没有会员卡; 新增会员卡, 并且设置本次充值金额
+                vipCardService.insertVipCard(new VipCard(Long.parseLong(orderInfo.getUserId()), orderInfo.getPracticalMoney()));
+            } else {
+                //false 有会员卡,
+                long l = Long.parseLong(orderInfo.getPracticalMoney()) + Long.parseLong(vipCard.getBalance());
+                vipCardService.updateVipCard(new VipCard(Long.parseLong(orderInfo.getUserId()), String.valueOf(l)));
+            }
+
+            vipCardLog.setPaymentTime(DateUtils.getNowDate());
+            return toAjax(vipCardLogService.updateVipCardLogByOrderId(vipCardLog));
+        } else {
+            return AjaxResult.error("支付状态错误!");
+        }
+    }
+
+
     /**
      * 查询卡种信息列表
      */
@@ -91,7 +163,7 @@ public class cardAppController extends BaseController {
     @ResponseBody
     public AjaxResult refundCard(@RequestBody UserMembershipCard userMembershipCard) {
         int inserted = userMembershipCardService.refundCard(userMembershipCard);
-        if (inserted == -1){
+        if (inserted == -1) {
             return AjaxResult.error("退款金额小于0,不支持退款!");
         }
         return toAjax(inserted);

+ 126 - 0
qmjszx-admin/src/main/java/beilv/web/controller/vipCard/VipCardController.java

@@ -0,0 +1,126 @@
+package beilv.web.controller.vipCard;
+
+import beilv.common.annotation.Log;
+import beilv.common.core.controller.BaseController;
+import beilv.common.core.domain.AjaxResult;
+import beilv.common.core.page.TableDataInfo;
+import beilv.common.enums.BusinessType;
+import beilv.common.utils.poi.ExcelUtil;
+import beilv.vipCard.domain.VipCard;
+import beilv.vipCard.service.IVipCardService;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 储值会员卡Controller
+ *
+ * @author LG
+ * @date 2025-11-12
+ */
+@Controller
+@RequestMapping("/vipCard/card")
+public class VipCardController extends BaseController {
+    private String prefix = "vipCard";
+
+    @Autowired
+    private IVipCardService vipCardService;
+
+    @RequiresPermissions("business:card:view")
+    @GetMapping()
+    public String card() {
+        return prefix + "/card";
+    }
+
+    /**
+     * 查询储值会员卡列表
+     */
+    @RequiresPermissions("business:card:list")
+    @PostMapping("/list")
+    @ResponseBody
+    public TableDataInfo list(VipCard vipCard) {
+        startPage();
+        List<VipCard> list = vipCardService.selectVipCardList(vipCard);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出储值会员卡列表
+     */
+    @RequiresPermissions("business:card:export")
+    @Log(title = "储值会员卡", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(VipCard vipCard) {
+        List<VipCard> list = vipCardService.selectVipCardList(vipCard);
+        ExcelUtil<VipCard> util = new ExcelUtil<VipCard>(VipCard.class);
+        return util.exportExcel(list, "储值会员卡数据");
+    }
+
+    /**
+     * 新增储值会员卡
+     */
+    @RequiresPermissions("business:card:add")
+    @GetMapping("/add")
+    public String add() {
+        return prefix + "/add";
+    }
+
+    /**
+     * 新增保存储值会员卡
+     */
+    @RequiresPermissions("business:card:add")
+    @Log(title = "储值会员卡", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public AjaxResult addSave(VipCard vipCard) {
+        return toAjax(vipCardService.insertVipCard(vipCard));
+    }
+
+    /**
+     * 修改储值会员卡
+     */
+    @RequiresPermissions("business:card:edit")
+    @GetMapping("/edit/{id}")
+    public String edit(@PathVariable("id") String id, ModelMap mmap) {
+        VipCard vipCard = vipCardService.selectVipCardById(id);
+        mmap.put("vipCard", vipCard);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 修改保存储值会员卡
+     */
+    @RequiresPermissions("business:card:edit")
+    @Log(title = "储值会员卡", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    @ResponseBody
+    public AjaxResult editSave(VipCard vipCard) {
+        return toAjax(vipCardService.updateVipCard(vipCard));
+    }
+
+    /**
+     * 删除储值会员卡
+     */
+    @RequiresPermissions("business:card:remove")
+    @Log(title = "储值会员卡", businessType = BusinessType.DELETE)
+    @PostMapping("/remove")
+    @ResponseBody
+    public AjaxResult remove(String ids) {
+        return toAjax(vipCardService.deleteVipCardByIds(ids));
+    }
+
+
+    /**
+     * 退卡操作
+     */
+    @PostMapping("/refund")
+    @ResponseBody
+    public AjaxResult refund(VipCard vipCard){
+        return toAjax(vipCardService.refundById(vipCard));
+    }
+}

+ 116 - 0
qmjszx-admin/src/main/java/beilv/web/controller/vipCardLog/VipCardLogController.java

@@ -0,0 +1,116 @@
+package beilv.web.controller.vipCardLog;
+
+import beilv.common.annotation.Log;
+import beilv.common.core.controller.BaseController;
+import beilv.common.core.domain.AjaxResult;
+import beilv.common.core.page.TableDataInfo;
+import beilv.common.enums.BusinessType;
+import beilv.common.utils.poi.ExcelUtil;
+import beilv.vipCardLog.domain.VipCardLog;
+import beilv.vipCardLog.service.IVipCardLogService;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 充值记录Controller
+ *
+ * @author LG
+ * @date 2025-11-12
+ */
+@Controller
+@RequestMapping("/system/vipCardLog")
+public class VipCardLogController extends BaseController {
+    private String prefix = "system/vipCardLog";
+
+    @Autowired
+    private IVipCardLogService vipCardLogService;
+
+    @RequiresPermissions("system:vipCardLog:view")
+    @GetMapping()
+    public String vipCardLog() {
+        return prefix + "/vipCardLog";
+    }
+
+    /**
+     * 查询充值记录列表
+     */
+    @RequiresPermissions("system:vipCardLog:list")
+    @PostMapping("/list")
+    @ResponseBody
+    public TableDataInfo list(VipCardLog vipCardLog) {
+        startPage();
+        List<VipCardLog> list = vipCardLogService.selectVipCardLogList(vipCardLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出充值记录列表
+     */
+    @RequiresPermissions("system:vipCardLog:export")
+    @Log(title = "充值记录", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(VipCardLog vipCardLog) {
+        List<VipCardLog> list = vipCardLogService.selectVipCardLogList(vipCardLog);
+        ExcelUtil<VipCardLog> util = new ExcelUtil<VipCardLog>(VipCardLog.class);
+        return util.exportExcel(list, "充值记录数据");
+    }
+
+    /**
+     * 新增充值记录
+     */
+    @RequiresPermissions("system:vipCardLog:add")
+    @GetMapping("/add")
+    public String add() {
+        return prefix + "/add";
+    }
+
+    /**
+     * 新增保存充值记录
+     */
+    @RequiresPermissions("system:vipCardLog:add")
+    @Log(title = "充值记录", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public AjaxResult addSave(VipCardLog vipCardLog) {
+        return toAjax(vipCardLogService.insertVipCardLog(vipCardLog));
+    }
+
+    /**
+     * 修改充值记录
+     */
+    @RequiresPermissions("system:vipCardLog:edit")
+    @GetMapping("/edit/{id}")
+    public String edit(@PathVariable("id") String id, ModelMap mmap) {
+        VipCardLog vipCardLog = vipCardLogService.selectVipCardLogById(id);
+        mmap.put("vipCardLog", vipCardLog);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 修改保存充值记录
+     */
+    @RequiresPermissions("system:vipCardLog:edit")
+    @Log(title = "充值记录", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    @ResponseBody
+    public AjaxResult editSave(VipCardLog vipCardLog) {
+        return toAjax(vipCardLogService.updateVipCardLog(vipCardLog));
+    }
+
+    /**
+     * 删除充值记录
+     */
+    @RequiresPermissions("system:vipCardLog:remove")
+    @Log(title = "充值记录", businessType = BusinessType.DELETE)
+    @PostMapping("/remove")
+    @ResponseBody
+    public AjaxResult remove(String ids) {
+        return toAjax(vipCardLogService.deleteVipCardLogByIds(ids));
+    }
+}

+ 2 - 2
qmjszx-admin/src/main/resources/static/ruoyi/js/ry-ui.js

@@ -1107,12 +1107,12 @@ var table = {
             // 删除信息
             remove: function(id) {
                 table.set();
-                $.modal.confirm("确定删除该条" + table.options.modalName + "信息吗?", function() {
+                $.modal.confirm("确定执行退卡操作吗?", function() {
                     var url = $.common.isEmpty(id) ? table.options.removeUrl : table.options.removeUrl.replace("{id}", id);
                     if (table.options.type == table_type.bootstrapTreeTable) {
                         $.operate.get(url);
                     } else {
-                        var data = { "ids": id };
+                        var data = { "id": id };
                         $.operate.submit(url, "post", "json", data);
                     }
                 });

+ 113 - 0
qmjszx-admin/src/main/resources/templates/system/vipCardLog/add.html

@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('新增充值记录')" />
+    <th:block th:include="include :: datetimepicker-css" />
+</head>
+<body class="white-bg">
+    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
+        <form class="form-horizontal m" id="form-vipCardLog-add">
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">用户id:</label>
+                    <div class="col-sm-8">
+                        <input name="userId" class="form-control" type="text">
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">支付时间:</label>
+                    <div class="col-sm-8">
+                        <div class="input-group date">
+                            <input name="paymentTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">取消时间:</label>
+                    <div class="col-sm-8">
+                        <div class="input-group date">
+                            <input name="cancellationTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">支付状态(字段值: payment_status):</label>
+                    <div class="col-sm-8">
+                        <div class="radio-box" th:each="dict : ${@dict.getType('payment_status')}">
+                            <input type="radio" th:id="${'paymentStatus_' + dict.dictCode}" name="paymentStatus" th:value="${dict.dictValue}" th:checked="${dict.default}">
+                            <label th:for="${'paymentStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">订单编号:</label>
+                    <div class="col-sm-8">
+                        <input name="orderId" class="form-control" type="text">
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">退款时间:</label>
+                    <div class="col-sm-8">
+                        <div class="input-group date">
+                            <input name="refundTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">支付金额:</label>
+                    <div class="col-sm-8">
+                        <input name="ticketId" class="form-control" type="text">
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+    <th:block th:include="include :: footer" />
+    <th:block th:include="include :: datetimepicker-js" />
+    <script th:inline="javascript">
+        var prefix = ctx + "system/vipCardLog"
+        $("#form-vipCardLog-add").validate({
+            focusCleanup: true
+        });
+
+        function submitHandler() {
+            if ($.validate.form()) {
+                $.operate.save(prefix + "/add", $('#form-vipCardLog-add').serialize());
+            }
+        }
+
+        $("input[name='paymentTime']").datetimepicker({
+            format: "yyyy-mm-dd",
+            minView: "month",
+            autoclose: true
+        });
+
+        $("input[name='cancellationTime']").datetimepicker({
+            format: "yyyy-mm-dd",
+            minView: "month",
+            autoclose: true
+        });
+
+        $("input[name='refundTime']").datetimepicker({
+            format: "yyyy-mm-dd",
+            minView: "month",
+            autoclose: true
+        });
+    </script>
+</body>
+</html>

+ 114 - 0
qmjszx-admin/src/main/resources/templates/system/vipCardLog/edit.html

@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('修改充值记录')" />
+    <th:block th:include="include :: datetimepicker-css" />
+</head>
+<body class="white-bg">
+    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
+        <form class="form-horizontal m" id="form-vipCardLog-edit" th:object="${vipCardLog}">
+            <input name="id" th:field="*{id}" type="hidden">
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">用户id:</label>
+                    <div class="col-sm-8">
+                        <input name="userId" th:field="*{userId}" class="form-control" type="text">
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">支付时间:</label>
+                    <div class="col-sm-8">
+                        <div class="input-group date">
+                            <input name="paymentTime" th:value="${#dates.format(vipCardLog.paymentTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">取消时间:</label>
+                    <div class="col-sm-8">
+                        <div class="input-group date">
+                            <input name="cancellationTime" th:value="${#dates.format(vipCardLog.cancellationTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">支付状态(字段值: payment_status):</label>
+                    <div class="col-sm-8">
+                        <div class="radio-box" th:each="dict : ${@dict.getType('payment_status')}">
+                            <input type="radio" th:id="${'paymentStatus_' + dict.dictCode}" name="paymentStatus" th:value="${dict.dictValue}" th:field="*{paymentStatus}">
+                            <label th:for="${'paymentStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">订单编号:</label>
+                    <div class="col-sm-8">
+                        <input name="orderId" th:field="*{orderId}" class="form-control" type="text">
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">退款时间:</label>
+                    <div class="col-sm-8">
+                        <div class="input-group date">
+                            <input name="refundTime" th:value="${#dates.format(vipCardLog.refundTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="col-xs-12">
+                <div class="form-group">
+                    <label class="col-sm-3 control-label">支付金额:</label>
+                    <div class="col-sm-8">
+                        <input name="ticketId" th:field="*{ticketId}" class="form-control" type="text">
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+    <th:block th:include="include :: footer" />
+    <th:block th:include="include :: datetimepicker-js" />
+    <script th:inline="javascript">
+        var prefix = ctx + "system/vipCardLog";
+        $("#form-vipCardLog-edit").validate({
+            focusCleanup: true
+        });
+
+        function submitHandler() {
+            if ($.validate.form()) {
+                $.operate.save(prefix + "/edit", $('#form-vipCardLog-edit').serialize());
+            }
+        }
+
+        $("input[name='paymentTime']").datetimepicker({
+            format: "yyyy-mm-dd",
+            minView: "month",
+            autoclose: true
+        });
+
+        $("input[name='cancellationTime']").datetimepicker({
+            format: "yyyy-mm-dd",
+            minView: "month",
+            autoclose: true
+        });
+
+        $("input[name='refundTime']").datetimepicker({
+            format: "yyyy-mm-dd",
+            minView: "month",
+            autoclose: true
+        });
+    </script>
+</body>
+</html>

+ 114 - 0
qmjszx-admin/src/main/resources/templates/system/vipCardLog/vipCardLog.html

@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+    <th:block th:include="include :: header('充值记录列表')" />
+</head>
+<body class="gray-bg">
+     <div class="container-div">
+        <div class="row">
+            <div class="col-sm-12 search-collapse">
+                <form id="formId">
+                    <div class="select-list">
+                        <ul>
+                            <li>
+                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
+                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
+                            </li>
+                        </ul>
+                    </div>
+                </form>
+            </div>
+
+            <div class="btn-group-sm" id="toolbar" role="group">
+                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:vipCardLog:add">
+                    <i class="fa fa-plus"></i> 添加
+                </a>
+                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:vipCardLog:edit">
+                    <i class="fa fa-edit"></i> 修改
+                </a>
+                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:vipCardLog:remove">
+                    <i class="fa fa-remove"></i> 删除
+                </a>
+                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:vipCardLog:export">
+                    <i class="fa fa-download"></i> 导出
+                </a>
+            </div>
+            <div class="col-sm-12 select-table table-striped">
+                <table id="bootstrap-table"></table>
+            </div>
+        </div>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+        var editFlag = [[${@permission.hasPermi('system:vipCardLog:edit')}]];
+        var removeFlag = [[${@permission.hasPermi('system:vipCardLog:remove')}]];
+        var paymentStatusDatas = [[${@dict.getType('payment_status')}]];
+        var prefix = ctx + "system/vipCardLog";
+
+        $(function() {
+            var options = {
+                url: prefix + "/list",
+                createUrl: prefix + "/add",
+                updateUrl: prefix + "/edit/{id}",
+                removeUrl: prefix + "/remove",
+                exportUrl: prefix + "/export",
+                modalName: "充值记录",
+                columns: [{
+                    checkbox: true
+                },
+                {
+                    field: 'id',
+                    title: '序号',
+                    visible: false
+                },
+                {
+                    field: 'userId',
+                    title: '用户id'
+                },
+                {
+                    field: 'orderType',
+                    title: '记录类型(充值, 退卡)'
+                },
+                {
+                    field: 'paymentTime',
+                    title: '支付时间'
+                },
+                {
+                    field: 'cancellationTime',
+                    title: '取消时间'
+                },
+                {
+                    field: 'paymentStatus',
+                    title: '支付状态(字段值: payment_status)',
+                    formatter: function(value, row, index) {
+                       return $.table.selectDictLabel(paymentStatusDatas, value);
+                    }
+                },
+                {
+                    field: 'orderId',
+                    title: '订单编号'
+                },
+                {
+                    field: 'refundTime',
+                    title: '退款时间'
+                },
+                {
+                    field: 'ticketId',
+                    title: '支付金额'
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function(value, row, index) {
+                        var actions = [];
+                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        return actions.join('');
+                    }
+                }]
+            };
+            $.table.init(options);
+        });
+    </script>
+</body>
+</html>

+ 76 - 0
qmjszx-admin/src/main/resources/templates/vipCard/add.html

@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <th:block th:include="include :: header('新增储值会员卡')"/>
+    <th:block th:include="include :: datetimepicker-css"/>
+</head>
+<body class="white-bg">
+<div class="wrapper wrapper-content animated fadeInRight ibox-content">
+    <form class="form-horizontal m" id="form-card-add">
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">用户id:</label>
+                <div class="col-sm-8">
+                    <input name="userId" class="form-control" type="text">
+                </div>
+            </div>
+        </div>
+        <!--<div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">会员等级:</label>
+                <div class="col-sm-8">
+                    <input name="vipLevel" class="form-control" type="text">
+                </div>
+            </div>
+        </div>-->
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">卡内余额:</label>
+                <div class="col-sm-8">
+                    <input name="balance" class="form-control" type="text">
+                </div>
+            </div>
+        </div>
+        <!--<div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">退卡时间:</label>
+                <div class="col-sm-8">
+                    <div class="input-group date">
+                        <input name="refundTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                    </div>
+                </div>
+            </div>
+        </div>-->
+        <!--<div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">会员卡状态:</label>
+                <div class="col-sm-8">
+                    <input name="cardState" class="form-control" type="text">
+                </div>
+            </div>
+        </div>-->
+    </form>
+</div>
+<th:block th:include="include :: footer"/>
+<th:block th:include="include :: datetimepicker-js"/>
+<script th:inline="javascript">
+    var prefix = ctx + "vipCard/card"
+    $("#form-card-add").validate({
+        focusCleanup: true
+    });
+
+    function submitHandler() {
+        if ($.validate.form()) {
+            $.operate.save(prefix + "/add", $('#form-card-add').serialize());
+        }
+    }
+
+    $("input[name='refundTime']").datetimepicker({
+        format: "yyyy-mm-dd",
+        minView: "month",
+        autoclose: true
+    });
+</script>
+</body>
+</html>

+ 127 - 0
qmjszx-admin/src/main/resources/templates/vipCard/card.html

@@ -0,0 +1,127 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+    <th:block th:include="include :: header('储值会员卡列表')"/>
+</head>
+<body class="gray-bg">
+<div class="container-div">
+    <div class="row">
+        <div class="col-sm-12 search-collapse">
+            <form id="formId">
+                <div class="select-list">
+                    <ul>
+                        <li>
+                            <label>用户名:</label>
+                            <input type="text" name="username"/>
+                        </li>
+                        <li>
+                            <label>联系电话:</label>
+                            <input type="text" name="mobile"/>
+                        </li>
+                        <!--<li>
+                            <label>会员卡状态:</label>
+                            <input type="text" name="cardState"/>
+                        </li>-->
+                        <li>
+                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
+                                    class="fa fa-search"></i>&nbsp;搜索</a>
+                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
+                                    class="fa fa-refresh"></i>&nbsp;重置</a>
+                        </li>
+                    </ul>
+                </div>
+            </form>
+        </div>
+
+        <div class="btn-group-sm" id="toolbar" role="group">
+            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="business:card:add">
+                <i class="fa fa-plus"></i> 添加
+            </a>
+            <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()"
+               shiro:hasPermission="business:card:edit">
+                <i class="fa fa-edit"></i> 修改
+            </a>
+            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
+               shiro:hasPermission="business:card:remove">
+                <i class="fa fa-remove"></i> 删除
+            </a>
+            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:card:export">
+                <i class="fa fa-download"></i> 导出
+            </a>-->
+        </div>
+        <div class="col-sm-12 select-table table-striped">
+            <table id="bootstrap-table"></table>
+        </div>
+    </div>
+</div>
+<th:block th:include="include :: footer"/>
+<script th:inline="javascript">
+    var editFlag = [[${@permission.hasPermi('business:card:edit')}]];
+    var removeFlag = [[${@permission.hasPermi('business:card:remove')}]];
+    var cardStateDatas = [[${@dict.getType('vip_card_state')}]];
+    var prefix = ctx + "vipCard/card";
+
+    $(function () {
+        var options = {
+            url: prefix + "/list",
+            createUrl: prefix + "/add",
+            updateUrl: prefix + "/edit/{id}",
+            removeUrl: prefix + "/refund",
+            exportUrl: prefix + "/export",
+            modalName: "储值会员卡",
+            columns: [{
+                checkbox: true
+            },
+                {
+                    field: 'id',
+                    title: '会员卡号',
+                    // visible: true
+                },
+                {
+                    field: 'username',
+                    title: '用户名'
+                },{
+                    field: 'mobile',
+                    title: '联系电话'
+                },
+                {
+                    field: 'vipLevel',
+                    title: '会员等级'
+                },
+                {
+                    field: 'balance',
+                    title: '卡内余额'
+                },
+                {
+                    field: 'createTime',
+                    title: '开通时间'
+                },
+                {
+                    field: 'refundTime',
+                    title: '退卡时间'
+                },
+                {
+                    field: 'cardState',
+                    title: '会员卡状态',
+                    formatter: function (value, row, index) {
+                        return $.table.selectDictLabel(cardStateDatas, value);
+                    }
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function (value, row, index) {
+                        var actions = [];
+                        if(row.cardState === "vip_card_state_open"){
+                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>退卡</a>');
+                        }
+                        return actions.join('');
+                    }
+                }]
+        };
+        $.table.init(options);
+    });
+</script>
+</body>
+</html>

+ 50 - 0
qmjszx-admin/src/main/resources/templates/vipCard/edit.html

@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <th:block th:include="include :: header('修改储值会员卡')"/>
+</head>
+<body class="white-bg">
+<div class="wrapper wrapper-content animated fadeInRight ibox-content">
+    <form class="form-horizontal m" id="form-card-edit" th:object="${vipCard}">
+        <input name="id" th:field="*{id}" type="hidden">
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">用户id:</label>
+                <div class="col-sm-8">
+                    <input name="username" th:field="*{username}" class="form-control" type="text" disabled>
+                </div>
+            </div>
+        </div>
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">会员等级:</label>
+                <div class="col-sm-8">
+                    <input name="vipLevel" th:field="*{vipLevel}" class="form-control" type="text">
+                </div>
+            </div>
+        </div>
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">卡内余额:</label>
+                <div class="col-sm-8">
+                    <input name="balance" th:field="*{balance}" class="form-control" type="text">
+                </div>
+            </div>
+        </div>
+    </form>
+</div>
+<th:block th:include="include :: footer"/>
+<script th:inline="javascript">
+    var prefix = ctx + "vipCard/card";
+    $("#form-card-edit").validate({
+        focusCleanup: true
+    });
+
+    function submitHandler() {
+        if ($.validate.form()) {
+            $.operate.save(prefix + "/edit", $('#form-card-edit').serialize());
+        }
+    }
+</script>
+</body>
+</html>

+ 46 - 202
qmjszx-business/src/main/java/beilv/cardpurchaserecord/domain/CardPurchaseRecord.java

@@ -1,12 +1,13 @@
 package beilv.cardpurchaserecord.domain;
 
-import java.math.BigDecimal;
-import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import beilv.common.annotation.Excel;
 import beilv.common.core.domain.BaseEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.*;
+import org.apache.ibatis.type.Alias;
+
+import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * 购卡记录对象 card_purchase_record
@@ -14,31 +15,44 @@ import beilv.common.core.domain.BaseEntity;
  * @author ruoyi
  * @date 2025-01-02
  */
-public class CardPurchaseRecord extends BaseEntity
-{
+@Setter
+@Getter
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+@Alias("CardPurchaseRecord")
+public class CardPurchaseRecord extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 主键 */
+    /**
+     * 主键
+     */
     private Long id;
 
-    /** 用户id */
+    /**
+     * 用户id
+     */
 //    @Excel(name = "用户id")
     private String userId;
 
     @Excel(name = "用户账户")
     private String userName;
 
-//    @Excel(name = "姓名")
+    //    @Excel(name = "姓名")
     private String realName;
 
     @Excel(name = "手机号码")
     private String mobile;
 
-    /** 卡种id */
+    /**
+     * 卡种id
+     */
 //    @Excel(name = "卡种id")
     private String cardId;
 
-    /** 卡种名称 */
+    /**
+     * 卡种名称
+     */
     @Excel(name = "卡种名称")
     private String cardName;
 
@@ -51,222 +65,52 @@ public class CardPurchaseRecord extends BaseEntity
 
     private BigDecimal originalPrice;
 
-    /** 价格 */
+    /**
+     * 价格
+     */
     @Excel(name = "价格")
     private BigDecimal memberPrice;
 
     private String point;
 
-    /** 时间 */
+    /**
+     * 时间
+     */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date time;
 
-    /** 支付方式 */
+    /**
+     * 支付方式
+     */
     @Excel(name = "支付方式")
     private String paymentWay;
 
-    /** 状态(待支付:payment_status_to_be_paid、已支付:payment_status_have_paid、已取消:payment_status_cancelled、已退款:payment_status_refunded) */
+    /**
+     * 状态(待支付:payment_status_to_be_paid、已支付:payment_status_have_paid、已取消:payment_status_cancelled、已退款:payment_status_refunded)
+     */
     private String type;
 
     @Excel(name = "状态")
     private String typeLabel;
 
-    /** 备注 */
+    /**
+     * 备注
+     */
     @Excel(name = "备注")
     private String notes;
 
-    /** 版本 */
+    /**
+     * 版本
+     */
 //    @Excel(name = "版本")
     private String version;
 
     //订单号
     private String orderId;
 
-    public String getOrderId() {
-        return orderId;
-    }
-
-    public void setOrderId(String orderId) {
-        this.orderId = orderId;
-    }
-
-    public String getCardTypeLabel() {
-        return cardTypeLabel;
-    }
-
-    public void setCardTypeLabel(String cardTypeLabel) {
-        this.cardTypeLabel = cardTypeLabel;
-    }
-
-    public BigDecimal getOriginalPrice() {
-        return originalPrice;
-    }
-
-    public void setOriginalPrice(BigDecimal originalPrice) {
-        this.originalPrice = originalPrice;
-    }
-
-    public String getPoint() {
-        return point;
-    }
-
-    public void setPoint(String point) {
-        this.point = point;
-    }
-
-    public String getCardType() {
-        return cardType;
-    }
-
-    public void setCardType(String cardType) {
-        this.cardType = cardType;
-    }
-
-    public BigDecimal getMemberPrice() {
-        return memberPrice;
-    }
-
-    public void setMemberPrice(BigDecimal memberPrice) {
-        this.memberPrice = memberPrice;
-    }
-
-    public Date getTime() {
-        return time;
-    }
-
-    public void setTime(Date time) {
-        this.time = time;
-    }
-
-    public Integer getTotalNumber() {
-        return totalNumber;
-    }
-
-    public void setTotalNumber(Integer totalNumber) {
-        this.totalNumber = totalNumber;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public String getTypeLabel() {
-        return typeLabel;
-    }
-
-    public void setTypeLabel(String typeLabel) {
-        this.typeLabel = typeLabel;
-    }
-
-    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 void setId(Long id)
-    {
-        this.id = id;
-    }
-
-    public Long getId()
-    {
-        return id;
-    }
-
-    public void setUserId(String userId)
-    {
-        this.userId = userId;
-    }
-
-    public String getUserId()
-    {
-        return userId;
-    }
-
-    public String getCardId() {
-        return cardId;
-    }
-
-    public void setCardId(String cardId) {
-        this.cardId = cardId;
-    }
-
-    public String getCardName() {
-        return cardName;
-    }
-
-    public void setCardName(String cardName) {
-        this.cardName = cardName;
-    }
-
-    public void setPaymentWay(String paymentWay)
-    {
-        this.paymentWay = paymentWay;
-    }
-
-    public String getPaymentWay()
-    {
-        return paymentWay;
-    }
-
-    public void setNotes(String notes)
-    {
-        this.notes = notes;
-    }
-
-    public String getNotes()
-    {
-        return notes;
-    }
-
-    public void setVersion(String version)
-    {
-        this.version = version;
-    }
+    private String vipCardId;
 
-    public String getVersion()
-    {
-        return version;
-    }
+    private BigDecimal practicalPrice;
 
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("userId", getUserId())
-            .append("carId", getCardId())
-            .append("carName", getCardName())
-            .append("paymentWay", getPaymentWay())
-            .append("notes", getNotes())
-            .append("version", getVersion())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .toString();
-    }
 }

+ 7 - 0
qmjszx-business/src/main/java/beilv/cardpurchaserecord/service/impl/CardPurchaseRecordServiceImpl.java

@@ -79,6 +79,13 @@ public class CardPurchaseRecordServiceImpl implements ICardPurchaseRecordService
         cardPurchaseRecord.setTime(DateUtils.getNowDate());
         cardPurchaseRecord.setVersion("0");
         cardPurchaseRecord.setOrderId(UUID.randomUUID().toString());
+
+        if("会员卡".equals(cardPurchaseRecord.getPaymentWay())){
+            //扣除会员卡金额
+
+            //写入支付记录
+        }
+
         cardPurchaseRecordMapper.insertCardPurchaseRecord(cardPurchaseRecord);
         return cardPurchaseRecord.getOrderId();
     }

+ 22 - 0
qmjszx-business/src/main/java/beilv/utils/UuidUtils.java

@@ -0,0 +1,22 @@
+package beilv.utils;
+
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+public class UuidUtils {
+    private static final Random random = new Random();
+    public static String getVipCardId() {
+        String cardNumber;
+            // 生成时间戳部分
+            long timestamp = System.currentTimeMillis();
+            // 生成随机数部分
+            int randomPart = random.nextInt(900000) + 100000; // 生成一个6位随机数
+            String formattedRandomPart = String.format("%06d", randomPart);
+            // 拼接卡号
+            cardNumber = timestamp + formattedRandomPart;
+
+        // 将生成的卡号添加到集合中
+        return cardNumber;
+    }
+}

+ 71 - 0
qmjszx-business/src/main/java/beilv/vipCard/domain/VipCard.java

@@ -0,0 +1,71 @@
+package beilv.vipCard.domain;
+
+import beilv.common.annotation.Excel;
+import beilv.common.core.domain.BaseEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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;
+
+/**
+ * 储值会员卡对象 beilv_vip_card
+ *
+ * @author LG
+ * @date 2025-11-12
+ */
+@Setter
+@Getter
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+@Alias("VipCard")
+public class VipCard extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 会员卡号
+     */
+    private String id;
+
+    /**
+     * 用户id
+     */
+    @Excel(name = "用户id")
+    private Long userId;
+
+    /**
+     * 会员等级
+     */
+    @Excel(name = "会员等级")
+    private String vipLevel;
+
+    /**
+     * 卡内余额
+     */
+    @Excel(name = "卡内余额")
+    private String balance;
+
+    /**
+     * 退卡时间
+     */
+    @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 = "会员卡状态")
+    private String cardState;
+
+    private String username;
+    private String mobile;
+
+    public VipCard(Long userId, String balance) {
+        this.userId = userId;
+        this.balance = balance;
+    }
+}

+ 64 - 0
qmjszx-business/src/main/java/beilv/vipCard/mapper/VipCardMapper.java

@@ -0,0 +1,64 @@
+package beilv.vipCard.mapper;
+
+import beilv.vipCard.domain.VipCard;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 储值会员卡Mapper接口
+ *
+ * @author LG
+ * @date 2025-11-12
+ */
+public interface VipCardMapper {
+    /**
+     * 查询储值会员卡
+     *
+     * @param id 储值会员卡主键
+     * @return 储值会员卡
+     */
+    public VipCard selectVipCardById(String id);
+
+    /**
+     * 查询储值会员卡列表
+     *
+     * @param vipCard 储值会员卡
+     * @return 储值会员卡集合
+     */
+    public List<VipCard> selectVipCardList(VipCard vipCard);
+
+    /**
+     * 新增储值会员卡
+     *
+     * @param vipCard 储值会员卡
+     * @return 结果
+     */
+    public int insertVipCard(VipCard vipCard);
+
+    /**
+     * 修改储值会员卡
+     *
+     * @param vipCard 储值会员卡
+     * @return 结果
+     */
+    public int updateVipCard(VipCard vipCard);
+
+    /**
+     * 删除储值会员卡
+     *
+     * @param id 储值会员卡主键
+     * @return 结果
+     */
+    public int deleteVipCardById(String id);
+
+    /**
+     * 批量删除储值会员卡
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteVipCardByIds(String[] ids);
+
+    VipCard selectVipCardByUserId(@Param("userId") String userId);
+}

+ 67 - 0
qmjszx-business/src/main/java/beilv/vipCard/service/IVipCardService.java

@@ -0,0 +1,67 @@
+package beilv.vipCard.service;
+
+import beilv.vipCard.domain.VipCard;
+
+import java.util.List;
+
+/**
+ * 储值会员卡Service接口
+ *
+ * @author LG
+ * @date 2025-11-12
+ */
+public interface IVipCardService {
+    /**
+     * 查询储值会员卡
+     *
+     * @param id 储值会员卡主键
+     * @return 储值会员卡
+     */
+    public VipCard selectVipCardById(String id);
+
+    /**
+     * 查询储值会员卡列表
+     *
+     * @param vipCard 储值会员卡
+     * @return 储值会员卡集合
+     */
+    public List<VipCard> selectVipCardList(VipCard vipCard);
+
+    /**
+     * 新增储值会员卡
+     *
+     * @param vipCard 储值会员卡
+     * @return 结果
+     */
+    public int insertVipCard(VipCard vipCard);
+
+    /**
+     * 修改储值会员卡
+     *
+     * @param vipCard 储值会员卡
+     * @return 结果
+     */
+    public int updateVipCard(VipCard vipCard);
+
+    /**
+     * 批量删除储值会员卡
+     *
+     * @param ids 需要删除的储值会员卡主键集合
+     * @return 结果
+     */
+    public int deleteVipCardByIds(String ids);
+
+    /**
+     * 删除储值会员卡信息
+     *
+     * @param id 储值会员卡主键
+     * @return 结果
+     */
+    public int deleteVipCardById(String id);
+
+    int refundById(VipCard vipCard);
+
+    boolean haveVipCard(String userId);
+
+    VipCard selectVipCardByUserId(String userId);
+}

+ 112 - 0
qmjszx-business/src/main/java/beilv/vipCard/service/impl/VipCardServiceImpl.java

@@ -0,0 +1,112 @@
+package beilv.vipCard.service.impl;
+
+import beilv.common.core.text.Convert;
+import beilv.common.utils.DateUtils;
+import beilv.utils.UuidUtils;
+import beilv.vipCard.domain.VipCard;
+import beilv.vipCard.mapper.VipCardMapper;
+import beilv.vipCard.service.IVipCardService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 储值会员卡Service业务层处理
+ *
+ * @author LG
+ * @date 2025-11-12
+ */
+@Service
+public class VipCardServiceImpl implements IVipCardService {
+    @Autowired
+    private VipCardMapper vipCardMapper;
+
+    /**
+     * 查询储值会员卡
+     *
+     * @param id 储值会员卡主键
+     * @return 储值会员卡
+     */
+    @Override
+    public VipCard selectVipCardById(String id) {
+        return vipCardMapper.selectVipCardById(id);
+    }
+
+    /**
+     * 查询储值会员卡列表
+     *
+     * @param vipCard 储值会员卡
+     * @return 储值会员卡
+     */
+    @Override
+    public List<VipCard> selectVipCardList(VipCard vipCard) {
+        return vipCardMapper.selectVipCardList(vipCard);
+    }
+
+    /**
+     * 新增储值会员卡
+     *
+     * @param vipCard 储值会员卡
+     * @return 结果
+     */
+    @Override
+    public int insertVipCard(VipCard vipCard) {
+        vipCard.setId(UuidUtils.getVipCardId());
+        vipCard.setCreateTime(DateUtils.getNowDate());
+        vipCard.setCardState("vip_card_state_open");
+        vipCard.setVipLevel("普通会员");
+        return vipCardMapper.insertVipCard(vipCard);
+    }
+
+    /**
+     * 修改储值会员卡
+     *
+     * @param vipCard 储值会员卡
+     * @return 结果
+     */
+    @Override
+    public int updateVipCard(VipCard vipCard) {
+        return vipCardMapper.updateVipCard(vipCard);
+    }
+
+    /**
+     * 批量删除储值会员卡
+     *
+     * @param ids 需要删除的储值会员卡主键
+     * @return 结果
+     */
+    @Override
+    public int deleteVipCardByIds(String ids) {
+        return vipCardMapper.deleteVipCardByIds(Convert.toStrArray(ids));
+    }
+
+    /**
+     * 删除储值会员卡信息
+     *
+     * @param id 储值会员卡主键
+     * @return 结果
+     */
+    @Override
+    public int deleteVipCardById(String id) {
+        return vipCardMapper.deleteVipCardById(id);
+    }
+
+    @Override
+    public int refundById(VipCard vipCard) {
+        vipCard.setBalance("0");
+        vipCard.setRefundTime(DateUtils.getNowDate());
+        vipCard.setCardState("vip_card_state_close");
+        return vipCardMapper.updateVipCard(vipCard);
+    }
+
+    @Override
+    public boolean haveVipCard(String userId) {
+        return null != vipCardMapper.selectVipCardByUserId(userId);
+    }
+
+    @Override
+    public VipCard selectVipCardByUserId(String userId) {
+        return vipCardMapper.selectVipCardByUserId(userId);
+    }
+}

+ 84 - 0
qmjszx-business/src/main/java/beilv/vipCardLog/domain/VipCardLog.java

@@ -0,0 +1,84 @@
+package beilv.vipCardLog.domain;
+
+import beilv.common.annotation.Excel;
+import beilv.common.core.domain.BaseEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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;
+
+/**
+ * 充值记录对象 beilv_vip_card_log
+ *
+ * @author LG
+ * @date 2025-11-12
+ */
+@Setter
+@Getter
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+@Alias("VipCardLog")
+public class VipCardLog extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 序号
+     */
+    private String id;
+
+    /**
+     * 用户id
+     */
+    @Excel(name = "用户id")
+    private String userId;
+
+    /**
+     * 记录类型(充值, 退卡)
+     */
+    @Excel(name = "记录类型(充值, 退卡)")
+    private String orderType;
+
+    /**
+     * 支付时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date paymentTime;
+
+    /**
+     * 取消时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @Excel(name = "取消时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date cancellationTime;
+
+    /**
+     * 支付状态(字段值: payment_status)
+     */
+    @Excel(name = "支付状态(字段值: payment_status)")
+    private String paymentStatus;
+
+    /**
+     * 订单编号
+     */
+    @Excel(name = "订单编号")
+    private String orderId;
+
+    /**
+     * 退款时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @Excel(name = "退款时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date refundTime;
+
+    /**
+     * 支付金额
+     */
+    @Excel(name = "支付金额")
+    private String practicalMoney;
+
+}

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

@@ -0,0 +1,64 @@
+package beilv.vipCardLog.mapper;
+
+import beilv.vipCardLog.domain.VipCardLog;
+
+import java.util.List;
+
+/**
+ * 充值记录Mapper接口
+ *
+ * @author LG
+ * @date 2025-11-12
+ */
+public interface VipCardLogMapper {
+    /**
+     * 查询充值记录
+     *
+     * @param id 充值记录主键
+     * @return 充值记录
+     */
+    public VipCardLog selectVipCardLogById(String id);
+
+    /**
+     * 查询充值记录列表
+     *
+     * @param vipCardLog 充值记录
+     * @return 充值记录集合
+     */
+    public List<VipCardLog> selectVipCardLogList(VipCardLog vipCardLog);
+
+    /**
+     * 新增充值记录
+     *
+     * @param vipCardLog 充值记录
+     * @return 结果
+     */
+    public int insertVipCardLog(VipCardLog vipCardLog);
+
+    /**
+     * 修改充值记录
+     *
+     * @param vipCardLog 充值记录
+     * @return 结果
+     */
+    public int updateVipCardLog(VipCardLog vipCardLog);
+
+    /**
+     * 删除充值记录
+     *
+     * @param id 充值记录主键
+     * @return 结果
+     */
+    public int deleteVipCardLogById(String id);
+
+    /**
+     * 批量删除充值记录
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteVipCardLogByIds(String[] ids);
+
+    VipCardLog getOrderByOrderId(String orderId);
+
+}

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

@@ -0,0 +1,66 @@
+package beilv.vipCardLog.service;
+
+
+import beilv.vipCardLog.domain.VipCardLog;
+
+import java.util.List;
+
+/**
+ * 充值记录Service接口
+ *
+ * @author LG
+ * @date 2025-11-12
+ */
+public interface IVipCardLogService {
+    /**
+     * 查询充值记录
+     *
+     * @param id 充值记录主键
+     * @return 充值记录
+     */
+    public VipCardLog selectVipCardLogById(String id);
+
+    /**
+     * 查询充值记录列表
+     *
+     * @param vipCardLog 充值记录
+     * @return 充值记录集合
+     */
+    public List<VipCardLog> selectVipCardLogList(VipCardLog vipCardLog);
+
+    /**
+     * 新增充值记录
+     *
+     * @param vipCardLog 充值记录
+     * @return 结果
+     */
+    public int insertVipCardLog(VipCardLog vipCardLog);
+
+    /**
+     * 修改充值记录
+     *
+     * @param vipCardLog 充值记录
+     * @return 结果
+     */
+    public int updateVipCardLog(VipCardLog vipCardLog);
+
+    /**
+     * 批量删除充值记录
+     *
+     * @param ids 需要删除的充值记录主键集合
+     * @return 结果
+     */
+    public int deleteVipCardLogByIds(String ids);
+
+    /**
+     * 删除充值记录信息
+     *
+     * @param id 充值记录主键
+     * @return 结果
+     */
+    public int deleteVipCardLogById(String id);
+
+    VipCardLog getOrderByOrderId(String orderId);
+
+    int updateVipCardLogByOrderId(VipCardLog vipCardLog);
+}

+ 99 - 0
qmjszx-business/src/main/java/beilv/vipCardLog/service/impl/VipCardLogServiceImpl.java

@@ -0,0 +1,99 @@
+package beilv.vipCardLog.service.impl;
+
+import beilv.common.core.text.Convert;
+import beilv.common.utils.uuid.IdUtils;
+import beilv.vipCardLog.domain.VipCardLog;
+import beilv.vipCardLog.mapper.VipCardLogMapper;
+import beilv.vipCardLog.service.IVipCardLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 充值记录Service业务层处理
+ *
+ * @author LG
+ * @date 2025-11-12
+ */
+@Service
+public class VipCardLogServiceImpl implements IVipCardLogService {
+    @Autowired
+    private VipCardLogMapper vipCardLogMapper;
+
+    /**
+     * 查询充值记录
+     *
+     * @param id 充值记录主键
+     * @return 充值记录
+     */
+    @Override
+    public VipCardLog selectVipCardLogById(String id) {
+        return vipCardLogMapper.selectVipCardLogById(id);
+    }
+
+    /**
+     * 查询充值记录列表
+     *
+     * @param vipCardLog 充值记录
+     * @return 充值记录
+     */
+    @Override
+    public List<VipCardLog> selectVipCardLogList(VipCardLog vipCardLog) {
+        return vipCardLogMapper.selectVipCardLogList(vipCardLog);
+    }
+
+    /**
+     * 新增充值记录
+     *
+     * @param vipCardLog 充值记录
+     * @return 结果
+     */
+    @Override
+    public int insertVipCardLog(VipCardLog vipCardLog) {
+        return vipCardLogMapper.insertVipCardLog(vipCardLog);
+    }
+
+    /**
+     * 修改充值记录
+     *
+     * @param vipCardLog 充值记录
+     * @return 结果
+     */
+    @Override
+    public int updateVipCardLog(VipCardLog vipCardLog) {
+        return vipCardLogMapper.updateVipCardLog(vipCardLog);
+    }
+
+    /**
+     * 批量删除充值记录
+     *
+     * @param ids 需要删除的充值记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteVipCardLogByIds(String ids) {
+        return vipCardLogMapper.deleteVipCardLogByIds(Convert.toStrArray(ids));
+    }
+
+    /**
+     * 删除充值记录信息
+     *
+     * @param id 充值记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteVipCardLogById(String id) {
+        return vipCardLogMapper.deleteVipCardLogById(id);
+    }
+
+    @Override
+    public VipCardLog getOrderByOrderId(String orderId) {
+        return vipCardLogMapper.getOrderByOrderId(orderId);
+    }
+
+    @Override
+    public int updateVipCardLogByOrderId(VipCardLog vipCardLog) {
+        return vipCardLogMapper.updateVipCardLog(vipCardLog);
+    }
+}

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

@@ -0,0 +1,100 @@
+<?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.vipCard.mapper.VipCardMapper">
+
+    <resultMap type="VipCard" id="VipCardResult">
+        <result property="id" column="id"/>
+        <result property="userId" column="user_id"/>
+        <result property="vipLevel" column="vip_level"/>
+        <result property="balance" column="balance"/>
+        <result property="createTime" column="create_time"/>
+        <result property="refundTime" column="refund_time"/>
+        <result property="cardState" column="card_state"/>
+        <result property="username" column="username"/>
+        <result property="mobile" column="mobile"/>
+    </resultMap>
+
+    <sql id="selectVipCardVo">
+        select id, user_id, vip_level, balance, create_time, refund_time, card_state
+        from beilv_vip_card
+    </sql>
+
+    <select id="selectVipCardList" parameterType="VipCard" resultMap="VipCardResult">
+        select a.id, a.vip_level, a.balance, a.create_time, a.refund_time, a.card_state, b.username, b.mobile
+        from beilv_vip_card a
+        left join sys_member b on a.user_id = b.id
+        <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>
+        </where>
+    </select>
+
+    <select id="selectVipCardById" parameterType="String" resultMap="VipCardResult">
+        select a.id, a.vip_level, a.balance, a.create_time, a.refund_time, a.card_state, b.username, b.mobile
+        from beilv_vip_card a
+                 left join sys_member b on a.user_id = b.id
+        where a.id = #{id}
+    </select>
+
+    <insert id="insertVipCard" parameterType="VipCard">
+        insert into beilv_vip_card
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="vipLevel != null">vip_level,</if>
+            <if test="balance != null">balance,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="refundTime != null">refund_time,</if>
+            <if test="cardState != null">card_state,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="vipLevel != null">#{vipLevel},</if>
+            <if test="balance != null">#{balance},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="refundTime != null">#{refundTime},</if>
+            <if test="cardState != null">#{cardState},</if>
+        </trim>
+    </insert>
+
+    <update id="updateVipCard" parameterType="VipCard">
+        update beilv_vip_card
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="vipLevel != null">vip_level = #{vipLevel},</if>
+            <if test="balance != null">balance = #{balance},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="refundTime != null">refund_time = #{refundTime},</if>
+            <if test="cardState != null">card_state = #{cardState},</if>
+        </trim>
+        <where>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="userId != null and userId != ''">
+                and user_id = #{userId}
+            </if>
+        </where>
+    </update>
+
+    <delete id="deleteVipCardById" parameterType="String">
+        delete
+        from beilv_vip_card
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteVipCardByIds" parameterType="String">
+        delete from beilv_vip_card where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="selectVipCardByUserId" parameterType="string" resultMap="VipCardResult">
+        select * from beilv_vip_card where user_id = #{userId}
+    </select>
+
+</mapper>

+ 109 - 0
qmjszx-business/src/main/resources/mapper/vipCardLog/VipCardLogMapper.xml

@@ -0,0 +1,109 @@
+<?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.vipCardLog.mapper.VipCardLogMapper">
+
+    <resultMap type="VipCardLog" id="VipCardLogResult">
+        <result property="id" column="id"/>
+        <result property="userId" column="user_id"/>
+        <result property="orderType" column="order_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="refundTime" column="refund_time"/>
+        <result property="practicalMoney" column="practical_money"/>
+    </resultMap>
+
+    <sql id="selectVipCardLogVo">
+        select id,
+               user_id,
+               order_type,
+               payment_time,
+               cancellation_time,
+               payment_status,
+               order_id,
+               refund_time,
+               practical_money
+        from beilv_vip_card_log
+    </sql>
+
+    <select id="selectVipCardLogList" parameterType="VipCardLog" resultMap="VipCardLogResult">
+        <include refid="selectVipCardLogVo"/>
+        <where>
+        </where>
+    </select>
+
+    <select id="selectVipCardLogById" parameterType="String" resultMap="VipCardLogResult">
+        <include refid="selectVipCardLogVo"/>
+        where id = #{id}
+    </select>
+
+    <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="userId != null">user_id,</if>
+            <if test="orderType != null">order_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="refundTime != null">refund_time,</if>
+            <if test="practicalMoney != null">practical_money,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="orderType != null">#{orderType},</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="refundTime != null">#{refundTime},</if>
+            <if test="practicalMoney != null">#{practicalMoney},</if>
+        </trim>
+    </insert>
+
+    <update id="updateVipCardLog" parameterType="VipCardLog">
+        update beilv_vip_card_log
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="orderType != null">order_type = #{orderType},</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="refundTime != null">refund_time = #{refundTime},</if>
+            <if test="practicalMoney != null">practical_money = #{practicalMoney},</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>
+    </update>
+
+    <delete id="deleteVipCardLogById" parameterType="String">
+        delete
+        from beilv_vip_card_log
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteVipCardLogByIds" parameterType="String">
+        delete from beilv_vip_card_log where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="getOrderByOrderId" parameterType="String" resultMap="VipCardLogResult">
+        <include refid="selectVipCardLogVo"/>
+        where order_id = #{orderId}
+    </select>
+
+</mapper>