hanfucheng 5 månader sedan
förälder
incheckning
089bc3796c

+ 14 - 0
qmjszx-admin/src/main/java/beilv/web/controller/usermembershipcard/UserMembershipCardController.java

@@ -113,4 +113,18 @@ public class UserMembershipCardController extends BaseController {
     public AjaxResult remove(String ids) {
         return toAjax(userMembershipCardService.deleteUserMembershipCardByIds(ids));
     }
+
+    /*
+    * 查看流水
+    *
+    * @author 韩福成
+    * @date 2025/1/6 下午3:47
+    */
+    @RequiresPermissions("system:card:stream")
+    @GetMapping("/stream/{id}")
+    public String stream(@PathVariable("id") Long id, ModelMap mmap) {
+        UserMembershipCard userMembershipCard = userMembershipCardService.selectUserMembershipCardById(id);
+        mmap.put("stream", userMembershipCard);
+        return prefix + "/stream";
+    }
 }

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

@@ -96,7 +96,7 @@ var table = {
                     pagination: options.pagination,                     // 是否显示分页(*)
                     paginationLoop: options.paginationLoop,             // 是否启用分页条无限循环的功能
                     pageNumber: 1,                                      // 初始化加载第一页,默认第一页
-                    pageSize: options.pageSize,                         // 每页的记录行数(*) 
+                    pageSize: options.pageSize,                         // 每页的记录行数(*)
                     pageList: options.pageList,                         // 可供选择的每页的行数(*)
                     firstLoad: options.firstLoad,                       // 是否首次请求加载数据,对于数据较大可以配置false
                     escape: options.escape,                             // 转义HTML字符串
@@ -158,7 +158,7 @@ var table = {
             // 获取实例ID,如存在多个返回#id1,#id2 delimeter分隔符
             getOptionsIds: function(separator) {
                 var _separator = $.common.isEmpty(separator) ? "," : separator;
-                var optionsIds = "";  
+                var optionsIds = "";
                 $.each(table.config, function(key, value){
                     optionsIds += "#" + key + _separator;
                 });
@@ -176,7 +176,7 @@ var table = {
                     isAsc:          params.order
                 };
                 var currentId = $.common.isEmpty(table.options.formId) ? $('form').attr('id') : table.options.formId;
-                return $.extend(curParams, $.common.formToJSON(currentId)); 
+                return $.extend(curParams, $.common.formToJSON(currentId));
             },
             // 请求获取数据后处理回调函数
             responseHandler: function(res) {
@@ -885,9 +885,9 @@ var table = {
             },
             // 弹出层指定参数选项
             openOptions: function (options) {
-                var _url = $.common.isEmpty(options.url) ? "/404.html" : options.url; 
-                var _title = $.common.isEmpty(options.title) ? "系统窗口" : options.title; 
-                var _width = $.common.isEmpty(options.width) ? "800" : options.width; 
+                var _url = $.common.isEmpty(options.url) ? "/404.html" : options.url;
+                var _title = $.common.isEmpty(options.title) ? "系统窗口" : options.title;
+                var _width = $.common.isEmpty(options.width) ? "800" : options.width;
                 var _height = $.common.isEmpty(options.height) ? ($(window).height() - 50) : options.height;
                 var _btn = ['<i class="fa fa-check"></i> 确认', '<i class="fa fa-close"></i> 关闭'];
                 // 如果是移动端,就使用自适应大小弹窗
@@ -1230,6 +1230,27 @@ var table = {
                     $.modal.openFull("修改" + table.options.modalName, $.operate.editUrl(id));
                 }
             },
+            release: function(id,type){
+                table.set();
+                var pop = ''
+                var data = ''
+                if (type === "release"){
+                    pop = "确定发布该条" + table.options.modalName + "吗?"
+                    data = { "id": id ,cardState : 1, releaseState :2 };
+                }else {
+                    pop = "确定下架该条" + table.options.modalName + "吗?"
+                    data = { "id": id ,cardState : 2 };
+                }
+                $.modal.confirm(pop, function() {
+                    var url = $.common.isEmpty(id) ? table.options.releaseUrl : table.options.releaseUrl.replace("{id}", id);
+                    console.log(url)
+                    if (table.options.type === table_type.bootstrapTreeTable) {
+                        $.operate.get(url);
+                    } else {
+                        $.operate.submit(url, "post", "json", data);
+                    }
+                });
+            },
             // 修改信息,以tab页展现
             editTab: function(id) {
                 table.set();
@@ -1846,4 +1867,4 @@ modal_status = {
     SUCCESS: "success",
     FAIL: "error",
     WARNING: "warning"
-};
+};

+ 19 - 13
qmjszx-admin/src/main/resources/templates/card/card.html

@@ -32,9 +32,9 @@
             </div>
 
             <div class="btn-group-sm" id="toolbar" role="group">
-                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:card:add">
-                    <i class="fa fa-plus"></i> 添加
-                </a>
+<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:card:add">-->
+<!--                    <i class="fa fa-plus"></i> 添加-->
+<!--                </a>-->
 <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:card:edit">-->
 <!--                    <i class="fa fa-edit"></i> 修改-->
 <!--                </a>-->
@@ -61,6 +61,7 @@
                 url: prefix + "/list",
                 createUrl: prefix + "/add",
                 updateUrl: prefix + "/edit/{id}",
+                stream: prefix + "/stream/{id}",
                 removeUrl: prefix + "/remove",
                 exportUrl: prefix + "/export",
                 modalName: "用户会员卡",
@@ -95,20 +96,25 @@
                 {
                     field: 'remainingNumber',
                     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('');
-                //     }
+                },
+                {
+                    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="stream(\'' + 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);
         });
+
+        function stream(id) {
+            table.set();
+            $.modal.open("查看流水", table.options.stream(id));
+        }
     </script>
 </body>
 </html>

+ 91 - 0
qmjszx-admin/src/main/resources/templates/card/stream.html

@@ -0,0 +1,91 @@
+<!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>用户id:</label>
+                                <input type="text" name="userId"/>
+                            </li>
+                            <li>
+                                <label>卡种id:</label>
+                                <input type="text" name="cardId"/>
+                            </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="system:stream:add">
+                    <i class="fa fa-plus"></i> 添加
+                </a>
+                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:stream:edit">
+                    <i class="fa fa-edit"></i> 修改
+                </a>
+                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:stream:remove">
+                    <i class="fa fa-remove"></i> 删除
+                </a>
+                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:stream: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:stream:edit')}]];
+        var removeFlag = [[${@permission.hasPermi('system:stream:remove')}]];
+        var prefix = ctx + "system/card";
+
+        $(function() {
+            var options = {
+                url: prefix + "/stream",
+                exportUrl: prefix + "/export",
+                modalName: "会员用卡流水",
+                columns: [{
+                    checkbox: true
+                },
+                {
+                    field: 'id',
+                    title: '主键',
+                    visible: false
+                },
+                {
+                    field: 'userId',
+                    title: '用户id'
+                },
+                {
+                    field: 'cardId',
+                    title: '卡种id'
+                },
+                {
+                    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>

+ 13 - 20
qmjszx-admin/src/main/resources/templates/information/add.html

@@ -35,38 +35,25 @@
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label is-required">价格:</label>
+                    <label class="col-sm-3 control-label is-required">价格:</label>
                     <div class="col-sm-8">
-                        <input name="price" class="form-control" type="number" min="0" step="0.01" maxlength="8" required>
+                        <input name="originalPrice" class="form-control" type="number" min="0" step="0.01" maxlength="8" required>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label is-required">单次积分:</label>
+                    <label class="col-sm-3 control-label is-required">会员价格:</label>
                     <div class="col-sm-8">
-                        <input name="point" class="form-control" type="number" min="0" step="1" maxlength="8" required>
+                        <input name="memberPrice" class="form-control" type="number" min="0" step="0.01" maxlength="8" required>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label is-required">有效期:</label>
-                    <div class="col-sm-8">
-                        <div class="input-group date">
-                            <input name="expirationDate" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
-                            <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 is-required">状态:</label>
+                    <label class="col-sm-3 control-label is-required">单次积分:</label>
                     <div class="col-sm-8">
-                        <select name="state" class="form-control" th:with="type=${@dict.getType('sys_job_status')}" required>
-                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
-                        </select>
+                        <input name="point" class="form-control" type="number" min="0" step="1" maxlength="8" required>
                     </div>
                 </div>
             </div>
@@ -93,7 +80,13 @@
 
         function submitHandler() {
             if ($.validate.form()) {
-                $.operate.save(prefix + "/add", $('#form-information-add').serialize());
+                const originalPrice = parseInt(document.getElementsByName("originalPrice")[0].value);
+                const memberPrice = parseInt(document.getElementsByName("memberPrice")[0].value);
+                if (memberPrice>originalPrice){
+                    alert("会员价格不能大于原价格")
+                }else {
+                    $.operate.save(prefix + "/add", $('#form-information-add').serialize());
+                }
             }
         }
 

+ 13 - 20
qmjszx-admin/src/main/resources/templates/information/edit.html

@@ -36,38 +36,25 @@
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label is-required">价格:</label>
+                    <label class="col-sm-3 control-label is-required">价格:</label>
                     <div class="col-sm-8">
-                        <input name="price" th:field="*{price}" class="form-control" type="number" min="0" step="0.01" maxlength="8">
+                        <input name="originalPrice" th:field="*{originalPrice}" class="form-control" type="number" min="0" step="0.01" maxlength="8">
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label is-required">单次积分:</label>
+                    <label class="col-sm-3 control-label is-required">会员价格:</label>
                     <div class="col-sm-8">
-                        <input name="point" th:field="*{point}" class="form-control" type="number" min="0" step="1" maxlength="8">
+                        <input name="memberPrice" th:field="*{memberPrice}" class="form-control" type="number" min="0" step="0.01" maxlength="8">
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label is-required">有效期:</label>
-                    <div class="col-sm-8">
-                        <div class="input-group date">
-                            <input name="expirationDate" th:value="${#dates.format(carInformation.expirationDate, '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 is-required">状态:</label>
+                    <label class="col-sm-3 control-label is-required">单次积分:</label>
                     <div class="col-sm-8">
-                        <select name="state" class="form-control" th:with="type=${@dict.getType('sys_job_status')}">
-                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{state}"></option>
-                        </select>
+                        <input name="point" th:field="*{point}" class="form-control" type="number" min="0" step="1" maxlength="8">
                     </div>
                 </div>
             </div>
@@ -94,7 +81,13 @@
 
         function submitHandler() {
             if ($.validate.form()) {
-                $.operate.save(prefix + "/edit", $('#form-information-edit').serialize());
+                const originalPrice = parseInt(document.getElementsByName("originalPrice")[0].value);
+                const memberPrice = parseInt(document.getElementsByName("memberPrice")[0].value);
+                if (memberPrice>originalPrice){
+                    alert("会员价格不能大于原价格")
+                }else {
+                    $.operate.save(prefix + "/edit", $('#form-information-edit').serialize());
+                }
             }
         }
 

+ 38 - 12
qmjszx-admin/src/main/resources/templates/information/information.html

@@ -23,8 +23,16 @@
                                 </select>
                             </li>
                             <li>
-                                <label>状态:</label>
-                                <select name="state" th:with="type=${@dict.getType('sys_job_status')}">
+                                <label>卡种状态:</label>
+                                <select name="cardState" th:with="type=${@dict.getType('goods_state')}">
+                                    <option value="">所有</option>
+                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
+                                            th:value="${dict.dictValue}"></option>
+                                </select>
+                            </li>
+                            <li>
+                                <label>发布状态:</label>
+                                <select name="releaseState" th:with="type=${@dict.getType('release_state')}">
                                     <option value="">所有</option>
                                     <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                             th:value="${dict.dictValue}"></option>
@@ -64,13 +72,15 @@
         var removeFlag = [[${@permission.hasPermi('system:information:remove')}]];
         var prefix = ctx + "information";
         var cardType = [[${@dict.getType('card_type')}]];
-        var sysJobStatus = [[${@dict.getType('sys_job_status')}]];
+        var sysJobStatus = [[${@dict.getType('goods_state')}]];
+        var releaseState = [[${@dict.getType('release_state')}]];
 
         $(function() {
             var options = {
                 url: prefix + "/list",
                 createUrl: prefix + "/add",
                 updateUrl: prefix + "/edit/{id}",
+                releaseUrl: prefix + "/edit",
                 removeUrl: prefix + "/remove",
                 exportUrl: prefix + "/export",
                 modalName: "卡种信息",
@@ -99,22 +109,29 @@
                     title: '可用次数'
                 },
                 {
-                    field: 'price',
-                    title: '价格'
+                    field: 'originalPrice',
+                    title: '原价格'
+                },
+                {
+                    field: 'memberPrice',
+                    title: '会员价格'
                 },
                 {
                     field: 'point',
                     title: '单次积分'
                 },
                 {
-                    field: 'expirationDate',
-                    title: '有效期'
+                    field: 'cardState',
+                    title: '卡种状态',
+                    formatter: function (value, row, index) {
+                        return $.table.selectDictLabel(sysJobStatus, value);
+                    }
                 },
                 {
-                    field: 'state',
-                    title: '状态',
+                    field: 'releaseState',
+                    title: '发布状态',
                     formatter: function (value, row, index) {
-                        return $.table.selectDictLabel(sysJobStatus, value);
+                        return $.table.selectDictLabel(releaseState, value);
                     }
                 },
                 {
@@ -122,8 +139,17 @@
                     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>');
+                        var type = '';
+                        if (row.releaseState==1){
+                            type = 'release'
+                            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>');
+                            actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.release(\'' + row.id + '\', \'' + type + '\')"><i class="fa fa-edit"></i>发布</a>');
+                        }
+                        if (row.cardState==1){
+                            type = 'card'
+                            actions.push('<a class="btn btn-large btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.release(\'' + row.id + '\', \'' + type + '\')"><i class="fa fa-remove"></i>下架</a>');
+                        }
                         return actions.join('');
                     }
                 }]

+ 11 - 7
qmjszx-admin/src/main/resources/templates/record/add.html

@@ -25,9 +25,9 @@
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">价格:</label>
+                    <label class="col-sm-3 control-label">会员价格:</label>
                     <div class="col-sm-8">
-                        <input name="price" class="form-control" type="text" disabled>
+                        <input name="memberPrice" class="form-control" type="text" disabled>
                     </div>
                 </div>
             </div>
@@ -85,9 +85,10 @@
 
         //卡种列表
         const cardSelect = document.getElementById('cardSelect');
-        const priceInput = document.getElementsByName("price")[0];
+        const priceInput = document.getElementsByName("memberPrice")[0];
+        let totalNumber = null;
         const requestData = {
-            state: "0"
+            cardState: "1"
         };
         $.ajax({
             url: "/information/list",
@@ -95,7 +96,8 @@
             dataType: "json",
             data: requestData,
             success: function (data) {
-                priceInput.value = data.rows[0].price
+                priceInput.value = data.rows[0].memberPrice
+                totalNumber = data.rows[0].totalNumber
                 // 在这里处理成功获取到的数据
                 data.rows.forEach(cardType => {
                     const option = document.createElement('option');
@@ -107,7 +109,8 @@
                     const selectedOption = cardSelect.options[cardSelect.selectedIndex];
                     const selectedCardType = data.rows.find(card => card.id === parseInt(selectedOption.value));
                     if (selectedCardType && priceInput) {
-                        priceInput.value = selectedCardType.price;
+                        priceInput.value = selectedCardType.memberPrice;
+                        totalNumber = selectedCardType.totalNumber
                     }
                 });
             },
@@ -121,7 +124,8 @@
         function submitHandler() {
             if ($.validate.form()) {
                 const cardName = cardSelect.options[cardSelect.selectedIndex].text
-                const request =  $('#form-record-add').serialize() + '&cardName='+cardName + '&price=' + priceInput.value
+                const request =  $('#form-record-add').serialize() + '&cardName='+cardName + '&price=' + priceInput.value + '&totalNumber='+totalNumber
+                console.log(request)
                 $.operate.save(prefix + "/add", request);
             }
         }

+ 2 - 2
qmjszx-admin/src/main/resources/templates/record/record.html

@@ -1,7 +1,7 @@
 <!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('购卡记录列表')"/>
+    <th:block th:include="include :: header('购卡/退卡记录列表')"/>
 </head>
 <body class="gray-bg">
 <div class="container-div">
@@ -71,7 +71,7 @@
             updateUrl: prefix + "/edit/{id}",
             removeUrl: prefix + "/remove",
             exportUrl: prefix + "/export",
-            modalName: "购卡记录",
+            modalName: "购卡/退卡记录",
             columns: [{
                 checkbox: true
             },

+ 10 - 0
qmjszx-business/src/main/java/beilv/cardpurchaserecord/domain/CardPurchaseRecord.java

@@ -75,6 +75,16 @@ public class CardPurchaseRecord extends BaseEntity
 //    @Excel(name = "版本")
     private String version;
 
+    private Integer totalNumber;
+
+    public Integer getTotalNumber() {
+        return totalNumber;
+    }
+
+    public void setTotalNumber(Integer totalNumber) {
+        this.totalNumber = totalNumber;
+    }
+
     public String getStateLabel() {
         return stateLabel;
     }

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

@@ -8,6 +8,8 @@ import beilv.common.utils.DateUtils;
 import beilv.common.utils.ShiroUtils;
 import beilv.common.utils.uuid.IdUtils;
 import beilv.system.service.ISysDictDataService;
+import beilv.usermembershipcard.domain.UserMembershipCard;
+import beilv.usermembershipcard.mapper.UserMembershipCardMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -26,6 +28,9 @@ public class CardPurchaseRecordServiceImpl implements ICardPurchaseRecordService
 
     @Autowired
     private ISysDictDataService dictDataService;
+
+    @Autowired
+    private UserMembershipCardMapper userMembershipCardMapper;
     /**
      * 查询购卡记录
      *
@@ -65,6 +70,15 @@ public class CardPurchaseRecordServiceImpl implements ICardPurchaseRecordService
         cardPurchaseRecord.setState("1");
         cardPurchaseRecord.setPaymentTime(DateUtils.getNowDate());
         cardPurchaseRecord.setVersion("0");
+        //新增会员管理
+        UserMembershipCard userMembershipCard = new UserMembershipCard();
+        userMembershipCard.setUserId(cardPurchaseRecord.getUserId());
+        userMembershipCard.setCardId(cardPurchaseRecord.getCardId());
+        userMembershipCard.setTotalNumber(cardPurchaseRecord.getTotalNumber());
+        userMembershipCard.setRemainingNumber(cardPurchaseRecord.getTotalNumber());
+        userMembershipCard.setCreateBy(ShiroUtils.getUserId().toString());
+        userMembershipCard.setCreateTime(DateUtils.getNowDate());
+        userMembershipCardMapper.insertUserMembershipCard(userMembershipCard);
         return cardPurchaseRecordMapper.insertCardPurchaseRecord(cardPurchaseRecord);
     }
 

+ 67 - 33
qmjszx-business/src/main/java/beilv/carinformation/domain/CarInformation.java

@@ -44,10 +44,16 @@ public class CarInformation extends BaseEntity {
     private Integer totalNumber;
 
     /**
-     * 价格
+     * 价格
      */
-    @Excel(name = "价格")
-    private BigDecimal price;
+    @Excel(name = "原价格")
+    private BigDecimal originalPrice;
+
+    /**
+     * 会员价格
+     */
+    @Excel(name = "会员价格")
+    private BigDecimal memberPrice;
 
     /**
      * 单次积分
@@ -69,27 +75,72 @@ public class CarInformation extends BaseEntity {
     private String notes;
 
     /**
-     * 状态(开启;关闭
+     * 状态(上架;下架
      */
-    private String state;
+    private String cardState;
 
-    @Excel(name = "状态")
-    private String stateLabel;
+    @Excel(name = "卡种状态")
+    private String cardStateLabel;
 
-    public String getTypeLabel() {
-        return typeLabel;
+    private String releaseState;
+
+    @Excel(name = "发布状态")
+    private String releaseStateLabel;
+
+    public BigDecimal getOriginalPrice() {
+        return originalPrice;
     }
 
-    public void setTypeLabel(String typeLabel) {
-        this.typeLabel = typeLabel;
+    public void setOriginalPrice(BigDecimal originalPrice) {
+        this.originalPrice = originalPrice;
+    }
+
+    public BigDecimal getMemberPrice() {
+        return memberPrice;
+    }
+
+    public void setMemberPrice(BigDecimal memberPrice) {
+        this.memberPrice = memberPrice;
+    }
+
+    public String getReleaseState() {
+        return releaseState;
+    }
+
+    public void setReleaseState(String releaseState) {
+        this.releaseState = releaseState;
+    }
+
+    public String getReleaseStateLabel() {
+        return releaseStateLabel;
+    }
+
+    public void setReleaseStateLabel(String releaseStateLabel) {
+        this.releaseStateLabel = releaseStateLabel;
     }
 
-    public String getStateLabel() {
-        return stateLabel;
+    public String getCardState() {
+        return cardState;
     }
 
-    public void setStateLabel(String stateLabel) {
-        this.stateLabel = stateLabel;
+    public void setCardState(String cardState) {
+        this.cardState = cardState;
+    }
+
+    public String getCardStateLabel() {
+        return cardStateLabel;
+    }
+
+    public void setCardStateLabel(String cardStateLabel) {
+        this.cardStateLabel = cardStateLabel;
+    }
+
+    public String getTypeLabel() {
+        return typeLabel;
+    }
+
+    public void setTypeLabel(String typeLabel) {
+        this.typeLabel = typeLabel;
     }
 
     public void setId(Long id) {
@@ -124,14 +175,6 @@ public class CarInformation extends BaseEntity {
         return totalNumber;
     }
 
-    public void setPrice(BigDecimal price) {
-        this.price = price;
-    }
-
-    public BigDecimal getPrice() {
-        return price;
-    }
-
     public void setPoint(Integer point) {
         this.point = point;
     }
@@ -156,14 +199,6 @@ public class CarInformation extends BaseEntity {
         return notes;
     }
 
-    public void setState(String state) {
-        this.state = state;
-    }
-
-    public String getState() {
-        return state;
-    }
-
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -171,11 +206,10 @@ public class CarInformation extends BaseEntity {
                 .append("name", getName())
                 .append("type", getType())
                 .append("totalNumber", getTotalNumber())
-                .append("price", getPrice())
                 .append("point", getPoint())
                 .append("expirationDate", getExpirationDate())
                 .append("notes", getNotes())
-                .append("state", getState())
+                .append("cardState", getCardState())
                 .append("createBy", getCreateBy())
                 .append("createTime", getCreateTime())
                 .append("updateBy", getUpdateBy())

+ 4 - 1
qmjszx-business/src/main/java/beilv/carinformation/service/impl/CarInformationServiceImpl.java

@@ -48,7 +48,8 @@ public class CarInformationServiceImpl implements ICarInformationService {
         List<CarInformation> carInformations = carInformationMapper.selectCarInformationList(carInformation);
         for (CarInformation carInformation1 : carInformations) {
             carInformation1.setTypeLabel(dictDataService.selectDictLabel("card_type",carInformation1.getType()));
-            carInformation1.setStateLabel(dictDataService.selectDictLabel("sys_job_status",carInformation1.getState()));
+            carInformation1.setCardStateLabel(dictDataService.selectDictLabel("goods_state",carInformation1.getCardState()));
+            carInformation1.setReleaseStateLabel(dictDataService.selectDictLabel("release_state",carInformation1.getReleaseState()));
         }
         return carInformations;
     }
@@ -63,6 +64,8 @@ public class CarInformationServiceImpl implements ICarInformationService {
     public int insertCarInformation(CarInformation carInformation) {
         carInformation.setCreateTime(DateUtils.getNowDate());
         carInformation.setCreateBy(ShiroUtils.getUserId().toString());
+        carInformation.setCardState("3");
+        carInformation.setReleaseState("1");
         return carInformationMapper.insertCarInformation(carInformation);
     }
 

+ 1 - 0
qmjszx-business/src/main/java/beilv/usermembershipcard/service/IUserMembershipCardService.java

@@ -58,4 +58,5 @@ public interface IUserMembershipCardService {
      * @return 结果
      */
     public int deleteUserMembershipCardById(Long id);
+
 }

+ 21 - 11
qmjszx-business/src/main/resources/mapper/card/CarInformationMapper.xml

@@ -9,11 +9,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="name"    column="name"    />
         <result property="type"    column="type"    />
         <result property="totalNumber"    column="total_number"    />
-        <result property="price"    column="price"    />
+        <result property="originalPrice"    column="original_price"    />
+        <result property="memberPrice"    column="member_price"    />
         <result property="point"    column="point"    />
         <result property="expirationDate"    column="expiration_date"    />
         <result property="notes"    column="notes"    />
-        <result property="state"    column="state"    />
+        <result property="cardState"    column="card_state"    />
+        <result property="releaseState"    column="release_state"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
@@ -21,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectCarInformationVo">
-        select id, name, type, total_number, price, point, expiration_date, notes, state, create_by, create_time, update_by, update_time from card_information
+        select id, name, type, total_number, original_price,member_price, point, expiration_date, notes, card_state,release_state, create_by, create_time, update_by, update_time from card_information
     </sql>
 
     <select id="selectCarInformationList" parameterType="CarInformation" resultMap="CarInformationResult">
@@ -30,11 +32,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
             <if test="type != null  and type != ''"> and type = #{type}</if>
             <if test="totalNumber != null "> and total_number = #{totalNumber}</if>
-            <if test="price != null "> and price = #{price}</if>
+            <if test="originalPrice != null "> and original_price = #{originalPrice}</if>
+            <if test="memberPrice != null "> and member_price = #{memberPrice}</if>
             <if test="point != null "> and point = #{point}</if>
             <if test="expirationDate != null "> and expiration_date = #{expirationDate}</if>
             <if test="notes != null  and notes != ''"> and notes = #{notes}</if>
-            <if test="state != null  and state != ''"> and state = #{state}</if>
+            <if test="cardState != null  and cardState != ''"> and card_state = #{cardState}</if>
+            <if test="releaseState != null  and releaseState != ''"> and release_state = #{releaseState}</if>
         </where>
         order by create_time desc
     </select>
@@ -51,11 +55,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">name,</if>
             <if test="type != null">type,</if>
             <if test="totalNumber != null">total_number,</if>
-            <if test="price != null">price,</if>
+            <if test="originalPrice != null">original_price,</if>
+            <if test="memberPrice != null">member_price,</if>
             <if test="point != null">point,</if>
             <if test="expirationDate != null">expiration_date,</if>
             <if test="notes != null">notes,</if>
-            <if test="state != null">state,</if>
+            <if test="cardState != null">card_state,</if>
+            <if test="releaseState != null">release_state,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
@@ -66,11 +72,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">#{name},</if>
             <if test="type != null">#{type},</if>
             <if test="totalNumber != null">#{totalNumber},</if>
-            <if test="price != null">#{price},</if>
+            <if test="originalPrice != null">#{originalPrice},</if>
+            <if test="memberPrice != null">#{memberPrice},</if>
             <if test="point != null">#{point},</if>
             <if test="expirationDate != null">#{expirationDate},</if>
             <if test="notes != null">#{notes},</if>
-            <if test="state != null">#{state},</if>
+            <if test="cardState != null">#{cardState},</if>
+            <if test="releaseState != null">#{releaseState},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -84,11 +92,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">name = #{name},</if>
             <if test="type != null">type = #{type},</if>
             <if test="totalNumber != null">total_number = #{totalNumber},</if>
-            <if test="price != null">price = #{price},</if>
+            <if test="originalPrice != null">original_price = #{originalPrice},</if>
+            <if test="memberPrice != null">member_price = #{memberPrice},</if>
             <if test="point != null">point = #{point},</if>
             <if test="expirationDate != null">expiration_date = #{expirationDate},</if>
             <if test="notes != null">notes = #{notes},</if>
-            <if test="state != null">state = #{state},</if>
+            <if test="cardState != null">card_state = #{cardState},</if>
+            <if test="releaseState != null">release_state = #{releaseState},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>