Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8e3d5b15ac
44
fuintAdmin/src/api/EventMarketing/cardExchange.js
Normal file
44
fuintAdmin/src/api/EventMarketing/cardExchange.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询兑换券列表
|
||||
export function listExchange(query) {
|
||||
return request({
|
||||
url: '/system/exchange/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询兑换券详细
|
||||
export function getExchange(id) {
|
||||
return request({
|
||||
url: '/system/exchange/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增兑换券
|
||||
export function addExchange(data) {
|
||||
return request({
|
||||
url: '/system/exchange',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改兑换券
|
||||
export function updateExchange(data) {
|
||||
return request({
|
||||
url: '/system/exchange',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除兑换券
|
||||
export function delExchange(id) {
|
||||
return request({
|
||||
url: '/system/exchange/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
44
fuintAdmin/src/api/EventMarketing/cardExchangeRecord.js
Normal file
44
fuintAdmin/src/api/EventMarketing/cardExchangeRecord.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询兑换券领取记录列表
|
||||
export function listRecord(query) {
|
||||
return request({
|
||||
url: '/system/record/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询兑换券领取记录详细
|
||||
export function getRecord(id) {
|
||||
return request({
|
||||
url: '/system/record/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增兑换券领取记录
|
||||
export function addRecord(data) {
|
||||
return request({
|
||||
url: '/system/record',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改兑换券领取记录
|
||||
export function updateRecord(data) {
|
||||
return request({
|
||||
url: '/system/record',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除兑换券领取记录
|
||||
export function delRecord(id) {
|
||||
return request({
|
||||
url: '/system/record/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
390
fuintAdmin/src/views/EventMarketing/cardExchange/index.vue
Normal file
390
fuintAdmin/src/views/EventMarketing/cardExchange/index.vue
Normal file
@ -0,0 +1,390 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="所属连锁店id" prop="chainStorId">
|
||||
<el-input
|
||||
v-model="queryParams.chainStorId"
|
||||
placeholder="请输入所属连锁店id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属店铺id" prop="storeId">
|
||||
<el-input
|
||||
v-model="queryParams.storeId"
|
||||
placeholder="请输入所属店铺id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否在线 0:在线 1: 下线" prop="isonline">
|
||||
<el-input
|
||||
v-model="queryParams.isonline"
|
||||
placeholder="请输入是否在线 0:在线 1: 下线"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="兑换券名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入兑换券名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="兑换礼品名" prop="giftName">
|
||||
<el-input
|
||||
v-model="queryParams.giftName"
|
||||
placeholder="请输入兑换礼品名"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="卡券有效期" prop="validity">
|
||||
<el-input
|
||||
v-model="queryParams.validity"
|
||||
placeholder="请输入卡券有效期"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用说明" prop="useInstructions">
|
||||
<el-input
|
||||
v-model="queryParams.useInstructions"
|
||||
placeholder="请输入使用说明"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="二维码链接" prop="qrCodeLink">
|
||||
<el-input
|
||||
v-model="queryParams.qrCodeLink"
|
||||
placeholder="请输入二维码链接"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="参与次数" prop="count">
|
||||
<el-input
|
||||
v-model="queryParams.count"
|
||||
placeholder="请输入参与次数"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="到期时间" prop="outTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.outTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择到期时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:exchange:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:exchange:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:exchange:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:exchange:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="exchangeList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键id" align="center" prop="id" />
|
||||
<el-table-column label="所属连锁店id" align="center" prop="chainStorId" />
|
||||
<el-table-column label="所属店铺id" align="center" prop="storeId" />
|
||||
<el-table-column label="是否在线 0:在线 1: 下线" align="center" prop="isonline" />
|
||||
<el-table-column label="兑换券状态 0:启用 1: 禁用" align="center" prop="status" />
|
||||
<el-table-column label="兑换券名称" align="center" prop="name" />
|
||||
<el-table-column label="兑换券类型 0:兑换券 1:洗车券 2:洗车卡" align="center" prop="type" />
|
||||
<el-table-column label="兑换礼品名" align="center" prop="giftName" />
|
||||
<el-table-column label="卡券有效期" align="center" prop="validity" />
|
||||
<el-table-column label="使用说明" align="center" prop="useInstructions" />
|
||||
<el-table-column label="二维码链接" align="center" prop="qrCodeLink" />
|
||||
<el-table-column label="参与次数" align="center" prop="count" />
|
||||
<el-table-column label="到期时间" align="center" prop="outTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.outTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:exchange:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:exchange:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改兑换券对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="所属连锁店id" prop="chainStorId">
|
||||
<el-input v-model="form.chainStorId" placeholder="请输入所属连锁店id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属店铺id" prop="storeId">
|
||||
<el-input v-model="form.storeId" placeholder="请输入所属店铺id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否在线 0:在线 1: 下线" prop="isonline">
|
||||
<el-input v-model="form.isonline" placeholder="请输入是否在线 0:在线 1: 下线" />
|
||||
</el-form-item>
|
||||
<el-form-item label="兑换券名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入兑换券名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="兑换礼品名" prop="giftName">
|
||||
<el-input v-model="form.giftName" placeholder="请输入兑换礼品名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="卡券有效期" prop="validity">
|
||||
<el-input v-model="form.validity" placeholder="请输入卡券有效期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="使用说明" prop="useInstructions">
|
||||
<el-input v-model="form.useInstructions" placeholder="请输入使用说明" />
|
||||
</el-form-item>
|
||||
<el-form-item label="二维码链接" prop="qrCodeLink">
|
||||
<el-input v-model="form.qrCodeLink" placeholder="请输入二维码链接" />
|
||||
</el-form-item>
|
||||
<el-form-item label="参与次数" prop="count">
|
||||
<el-input v-model="form.count" placeholder="请输入参与次数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="到期时间" prop="outTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.outTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择到期时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listExchange, getExchange, delExchange, addExchange, updateExchange } from "@/api/system/exchange";
|
||||
|
||||
export default {
|
||||
name: "Exchange",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 兑换券表格数据
|
||||
exchangeList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
chainStorId: null,
|
||||
storeId: null,
|
||||
isonline: null,
|
||||
status: null,
|
||||
name: null,
|
||||
type: null,
|
||||
giftName: null,
|
||||
validity: null,
|
||||
useInstructions: null,
|
||||
qrCodeLink: null,
|
||||
count: null,
|
||||
outTime: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询兑换券列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listExchange(this.queryParams).then(response => {
|
||||
this.exchangeList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
chainStorId: null,
|
||||
storeId: null,
|
||||
isonline: null,
|
||||
status: null,
|
||||
name: null,
|
||||
type: null,
|
||||
giftName: null,
|
||||
validity: null,
|
||||
useInstructions: null,
|
||||
qrCodeLink: null,
|
||||
count: null,
|
||||
outTime: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加兑换券";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getExchange(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改兑换券";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateExchange(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addExchange(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除兑换券编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delExchange(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/exchange/export', {
|
||||
...this.queryParams
|
||||
}, `exchange_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
484
fuintAdmin/src/views/EventMarketing/cardExchangeRecord/index.vue
Normal file
484
fuintAdmin/src/views/EventMarketing/cardExchangeRecord/index.vue
Normal file
@ -0,0 +1,484 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="兑换券id" prop="cardExchangeId">
|
||||
<el-input
|
||||
v-model="queryParams.cardExchangeId"
|
||||
placeholder="请输入兑换券id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工id" prop="mtStaffId">
|
||||
<el-input
|
||||
v-model="queryParams.mtStaffId"
|
||||
placeholder="请输入员工id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工姓名" prop="realName">
|
||||
<el-input
|
||||
v-model="queryParams.realName"
|
||||
placeholder="请输入员工姓名"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工手机号码" prop="staffMobile">
|
||||
<el-input
|
||||
v-model="queryParams.staffMobile"
|
||||
placeholder="请输入员工手机号码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员id" prop="mtUserId">
|
||||
<el-input
|
||||
v-model="queryParams.mtUserId"
|
||||
placeholder="请输入会员id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员名字" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入会员名字"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员手机号码" prop="mobile">
|
||||
<el-input
|
||||
v-model="queryParams.mobile"
|
||||
placeholder="请输入会员手机号码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员头像" prop="photo">
|
||||
<el-input
|
||||
v-model="queryParams.photo"
|
||||
placeholder="请输入会员头像"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="券名称" prop="exchangeName">
|
||||
<el-input
|
||||
v-model="queryParams.exchangeName"
|
||||
placeholder="请输入券名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="券码" prop="ticketCode">
|
||||
<el-input
|
||||
v-model="queryParams.ticketCode"
|
||||
placeholder="请输入券码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="券来源" prop="exchangeFrom">
|
||||
<el-input
|
||||
v-model="queryParams.exchangeFrom"
|
||||
placeholder="请输入券来源"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="到期时间" prop="outTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.outTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择到期时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="核销时间" prop="cancelTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.cancelTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择核销时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.startTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择开始时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.endTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择结束时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:record:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:record:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:record:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:record:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键id" align="center" prop="id" />
|
||||
<el-table-column label="兑换券id" align="center" prop="cardExchangeId" />
|
||||
<el-table-column label="员工id" align="center" prop="mtStaffId" />
|
||||
<el-table-column label="员工姓名" align="center" prop="realName" />
|
||||
<el-table-column label="员工手机号码" align="center" prop="staffMobile" />
|
||||
<el-table-column label="会员id" align="center" prop="mtUserId" />
|
||||
<el-table-column label="会员名字" align="center" prop="name" />
|
||||
<el-table-column label="会员手机号码" align="center" prop="mobile" />
|
||||
<el-table-column label="会员头像" align="center" prop="photo" />
|
||||
<el-table-column label="券名称" align="center" prop="exchangeName" />
|
||||
<el-table-column label="券码" align="center" prop="ticketCode" />
|
||||
<el-table-column label="券来源" align="center" prop="exchangeFrom" />
|
||||
<el-table-column label="使用状态 :0 :未使用 1:已使用 " align="center" prop="status" />
|
||||
<el-table-column label="到期时间" align="center" prop="outTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.outTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="核销时间" align="center" prop="cancelTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.cancelTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始时间" align="center" prop="startTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束时间" align="center" prop="endTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:record:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:record:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改兑换券领取记录对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="兑换券id" prop="cardExchangeId">
|
||||
<el-input v-model="form.cardExchangeId" placeholder="请输入兑换券id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="员工id" prop="mtStaffId">
|
||||
<el-input v-model="form.mtStaffId" placeholder="请输入员工id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="员工姓名" prop="realName">
|
||||
<el-input v-model="form.realName" placeholder="请输入员工姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="员工手机号码" prop="staffMobile">
|
||||
<el-input v-model="form.staffMobile" placeholder="请输入员工手机号码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="会员id" prop="mtUserId">
|
||||
<el-input v-model="form.mtUserId" placeholder="请输入会员id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="会员名字" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入会员名字" />
|
||||
</el-form-item>
|
||||
<el-form-item label="会员手机号码" prop="mobile">
|
||||
<el-input v-model="form.mobile" placeholder="请输入会员手机号码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="会员头像" prop="photo">
|
||||
<el-input v-model="form.photo" placeholder="请输入会员头像" />
|
||||
</el-form-item>
|
||||
<el-form-item label="券名称" prop="exchangeName">
|
||||
<el-input v-model="form.exchangeName" placeholder="请输入券名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="券码" prop="ticketCode">
|
||||
<el-input v-model="form.ticketCode" placeholder="请输入券码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="券来源" prop="exchangeFrom">
|
||||
<el-input v-model="form.exchangeFrom" placeholder="请输入券来源" />
|
||||
</el-form-item>
|
||||
<el-form-item label="到期时间" prop="outTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.outTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择到期时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="核销时间" prop="cancelTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.cancelTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择核销时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.startTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择开始时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.endTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择结束时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listRecord, getRecord, delRecord, addRecord, updateRecord } from "@/api/system/record";
|
||||
|
||||
export default {
|
||||
name: "Record",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 兑换券领取记录表格数据
|
||||
recordList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
cardExchangeId: null,
|
||||
mtStaffId: null,
|
||||
realName: null,
|
||||
staffMobile: null,
|
||||
mtUserId: null,
|
||||
name: null,
|
||||
mobile: null,
|
||||
photo: null,
|
||||
exchangeName: null,
|
||||
ticketCode: null,
|
||||
exchangeFrom: null,
|
||||
status: null,
|
||||
outTime: null,
|
||||
cancelTime: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询兑换券领取记录列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRecord(this.queryParams).then(response => {
|
||||
this.recordList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
cardExchangeId: null,
|
||||
mtStaffId: null,
|
||||
realName: null,
|
||||
staffMobile: null,
|
||||
mtUserId: null,
|
||||
name: null,
|
||||
mobile: null,
|
||||
photo: null,
|
||||
exchangeName: null,
|
||||
ticketCode: null,
|
||||
exchangeFrom: null,
|
||||
status: null,
|
||||
outTime: null,
|
||||
cancelTime: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加兑换券领取记录";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getRecord(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改兑换券领取记录";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateRecord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addRecord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除兑换券领取记录编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delRecord(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/record/export', {
|
||||
...this.queryParams
|
||||
}, `record_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,92 @@
|
||||
package com.fuint.business.marketingActivity.cardExchange.controller;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
|
||||
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 兑换券(CardExchange)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-06 14:14:17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("business/marketingActivity/cardExchange")
|
||||
public class CardExchangeController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private CardExchangeService cardExchangeService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cardExchange
|
||||
* @return
|
||||
*/
|
||||
@GetMapping
|
||||
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("cardFuelDiesel") CardExchange cardExchange) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
return getSuccessResult(this.cardExchangeService.select(page, cardExchange));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject selectOne(@PathVariable Serializable id) {
|
||||
return getSuccessResult(this.cardExchangeService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param cardExchange 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody CardExchange cardExchange) throws Exception {
|
||||
return getSuccessResult(this.cardExchangeService.add(cardExchange));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param cardExchange 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject update(@RequestBody CardExchange cardExchange) {
|
||||
return getSuccessResult(this.cardExchangeService.updateById(cardExchange));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
||||
return getSuccessResult(this.cardExchangeService.removeByIds(idList));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,105 @@
|
||||
package com.fuint.business.marketingActivity.cardExchange.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
|
||||
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 兑换券领取记录表(CardExchangeRecord)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-06 14:15:07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("business/marketingActivity/cardExchangeRecord")
|
||||
public class CardExchangeRecordController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private CardExchangeRecordService cardExchangeRecordService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cardExchangeRecord
|
||||
* @return
|
||||
*/
|
||||
@GetMapping
|
||||
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("cardFuelDiesel") CardExchangeRecord cardExchangeRecord) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
return getSuccessResult(this.cardExchangeRecordService.select(page,cardExchangeRecord));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询已使用兑换券
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cardExchangeRecord
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("list")
|
||||
public ResponseObject selectIsUsed(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("cardFuelDiesel") CardExchangeRecord cardExchangeRecord) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
return getSuccessResult(this.cardExchangeRecordService.selectIsUsed(page,cardExchangeRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject selectOne(@PathVariable Serializable id) {
|
||||
return getSuccessResult(this.cardExchangeRecordService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param cardExchangeRecord 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody CardExchangeRecord cardExchangeRecord) {
|
||||
return getSuccessResult(this.cardExchangeRecordService.save(cardExchangeRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param cardExchangeRecord 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject update(@RequestBody CardExchangeRecord cardExchangeRecord) {
|
||||
return getSuccessResult(this.cardExchangeRecordService.updateById(cardExchangeRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
||||
return getSuccessResult(this.cardExchangeRecordService.removeByIds(idList));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,206 @@
|
||||
package com.fuint.business.marketingActivity.cardExchange.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 兑换券(CardExchange)表实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-06 14:14:17
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CardExchange extends Model<CardExchange> {
|
||||
//主键id
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
//所属连锁店id
|
||||
private Integer chainStorId;
|
||||
//所属店铺id
|
||||
private Integer storeId;
|
||||
//是否在线 0:在线 1: 下线
|
||||
private String isonline;
|
||||
//兑换券状态 0:启用 1: 禁用
|
||||
private String status;
|
||||
//兑换券名称
|
||||
private String name;
|
||||
//兑换券类型 0:兑换券 1:洗车券 2:洗车卡
|
||||
private String type;
|
||||
//兑换礼品名
|
||||
private String giftName;
|
||||
//卡券有效期
|
||||
private Integer validity;
|
||||
//使用说明
|
||||
private String useInstructions;
|
||||
//二维码链接
|
||||
private String qrCodeLink;
|
||||
//参与次数
|
||||
private Integer count;
|
||||
//过期时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date outTime;
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getChainStorId() {
|
||||
return chainStorId;
|
||||
}
|
||||
|
||||
public void setChainStorId(Integer chainStorId) {
|
||||
this.chainStorId = chainStorId;
|
||||
}
|
||||
|
||||
public Integer getStoreId() {
|
||||
return storeId;
|
||||
}
|
||||
|
||||
public void setStoreId(Integer storeId) {
|
||||
this.storeId = storeId;
|
||||
}
|
||||
|
||||
public String getIsonline() {
|
||||
return isonline;
|
||||
}
|
||||
|
||||
public void setIsonline(String isonline) {
|
||||
this.isonline = isonline;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getGiftName() {
|
||||
return giftName;
|
||||
}
|
||||
|
||||
public void setGiftName(String giftName) {
|
||||
this.giftName = giftName;
|
||||
}
|
||||
|
||||
public Integer getValidity() {
|
||||
return validity;
|
||||
}
|
||||
|
||||
public void setValidity(Integer validity) {
|
||||
this.validity = validity;
|
||||
}
|
||||
|
||||
public String getUseInstructions() {
|
||||
return useInstructions;
|
||||
}
|
||||
|
||||
public void setUseInstructions(String useInstructions) {
|
||||
this.useInstructions = useInstructions;
|
||||
}
|
||||
|
||||
public String getQrCodeLink() {
|
||||
return qrCodeLink;
|
||||
}
|
||||
|
||||
public void setQrCodeLink(String qrCodeLink) {
|
||||
this.qrCodeLink = qrCodeLink;
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Integer count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Date getOutTime() {
|
||||
return outTime;
|
||||
}
|
||||
|
||||
public void setOutTime(Date outTime) {
|
||||
this.outTime = outTime;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,235 @@
|
||||
package com.fuint.business.marketingActivity.cardExchange.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 兑换券领取记录表(CardExchangeRecord)表实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-06 14:15:07
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CardExchangeRecord extends Model<CardExchangeRecord> {
|
||||
//主键id
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
//兑换券id
|
||||
private Integer cardExchangeId;
|
||||
//员工id
|
||||
private Integer mtStaffId;
|
||||
//员工姓名
|
||||
private String realName;
|
||||
//员工手机号码
|
||||
private String staffMobile;
|
||||
//会员id
|
||||
private Integer mtUserId;
|
||||
//会员手机号码
|
||||
private String mobile;
|
||||
//会员头像
|
||||
private String photo;
|
||||
//券名称
|
||||
private String exchangeName;
|
||||
//券码
|
||||
private String ticketCode;
|
||||
//券来源
|
||||
private String exchangeFrom;
|
||||
//使用状态 :0 :未使用 1:已使用
|
||||
private String status;
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
private Date updateTime;
|
||||
//到期时间
|
||||
private Date outTime;
|
||||
//核销时间
|
||||
private Date cancelTime;
|
||||
|
||||
//创建时间
|
||||
private Date startTime;
|
||||
|
||||
//创建时间
|
||||
private Date endTime;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getCardExchangeId() {
|
||||
return cardExchangeId;
|
||||
}
|
||||
|
||||
public void setCardExchangeId(Integer cardExchangeId) {
|
||||
this.cardExchangeId = cardExchangeId;
|
||||
}
|
||||
|
||||
public Integer getMtStaffId() {
|
||||
return mtStaffId;
|
||||
}
|
||||
|
||||
public void setMtStaffId(Integer mtStaffId) {
|
||||
this.mtStaffId = mtStaffId;
|
||||
}
|
||||
|
||||
public String getRealName() {
|
||||
return realName;
|
||||
}
|
||||
|
||||
public void setRealName(String realName) {
|
||||
this.realName = realName;
|
||||
}
|
||||
|
||||
public String getStaffMobile() {
|
||||
return staffMobile;
|
||||
}
|
||||
|
||||
public void setStaffMobile(String staffMobile) {
|
||||
this.staffMobile = staffMobile;
|
||||
}
|
||||
|
||||
public Integer getMtUserId() {
|
||||
return mtUserId;
|
||||
}
|
||||
|
||||
public void setMtUserId(Integer mtUserId) {
|
||||
this.mtUserId = mtUserId;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public String getPhoto() {
|
||||
return photo;
|
||||
}
|
||||
|
||||
public void setPhoto(String photo) {
|
||||
this.photo = photo;
|
||||
}
|
||||
|
||||
public String getExchangeName() {
|
||||
return exchangeName;
|
||||
}
|
||||
|
||||
public void setExchangeName(String exchangeName) {
|
||||
this.exchangeName = exchangeName;
|
||||
}
|
||||
|
||||
public String getTicketCode() {
|
||||
return ticketCode;
|
||||
}
|
||||
|
||||
public void setTicketCode(String ticketCode) {
|
||||
this.ticketCode = ticketCode;
|
||||
}
|
||||
|
||||
public String getExchangeFrom() {
|
||||
return exchangeFrom;
|
||||
}
|
||||
|
||||
public void setExchangeFrom(String exchangeFrom) {
|
||||
this.exchangeFrom = exchangeFrom;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Date getOutTime() {
|
||||
return outTime;
|
||||
}
|
||||
|
||||
public void setOutTime(Date outTime) {
|
||||
this.outTime = outTime;
|
||||
}
|
||||
|
||||
public Date getCancelTime() {
|
||||
return cancelTime;
|
||||
}
|
||||
|
||||
public void setCancelTime(Date cancelTime) {
|
||||
this.cancelTime = cancelTime;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.fuint.business.marketingActivity.cardExchange.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
|
||||
|
||||
/**
|
||||
* 兑换券(CardExchange)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-06 14:14:17
|
||||
*/
|
||||
public interface CardExchangeMapper extends BaseMapper<CardExchange> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.fuint.business.marketingActivity.cardExchange.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
|
||||
|
||||
/**
|
||||
* 兑换券领取记录表(CardExchangeRecord)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-06 14:15:07
|
||||
*/
|
||||
public interface CardExchangeRecordMapper extends BaseMapper<CardExchangeRecord> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.fuint.business.marketingActivity.cardExchange.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
|
||||
|
||||
/**
|
||||
* 兑换券领取记录表(CardExchangeRecord)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-06 14:15:07
|
||||
*/
|
||||
public interface CardExchangeRecordService extends IService<CardExchangeRecord> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param cardExchangeRecord
|
||||
* @return
|
||||
*/
|
||||
IPage select(Page page, CardExchangeRecord cardExchangeRecord);
|
||||
|
||||
/**
|
||||
* 分页查询已使用数据
|
||||
* @param page
|
||||
* @param cardExchangeRecord
|
||||
* @return
|
||||
*/
|
||||
IPage selectIsUsed(Page page, CardExchangeRecord cardExchangeRecord);
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.fuint.business.marketingActivity.cardExchange.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
|
||||
/**
|
||||
* 兑换券(CardExchange)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-06 14:14:17
|
||||
*/
|
||||
public interface CardExchangeService extends IService<CardExchange> {
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param cardExchange
|
||||
* @return
|
||||
*/
|
||||
Boolean add(CardExchange cardExchange) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询
|
||||
* @param page
|
||||
* @param cardExchange
|
||||
* @return
|
||||
*/
|
||||
IPage select(Page page, CardExchange cardExchange);
|
||||
}
|
||||
|
@ -0,0 +1,77 @@
|
||||
package com.fuint.business.marketingActivity.cardExchange.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeRecordMapper;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
|
||||
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 兑换券领取记录表(CardExchangeRecord)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-06 14:15:07
|
||||
*/
|
||||
@Service("cardExchangeRecordService")
|
||||
public class CardExchangeRecordServiceImpl extends ServiceImpl<CardExchangeRecordMapper, CardExchangeRecord> implements CardExchangeRecordService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param cardExchangeRecord
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage select(Page page, CardExchangeRecord cardExchangeRecord) {
|
||||
//构建查询条件
|
||||
LambdaQueryWrapper<CardExchangeRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(ObjectUtils.isNotEmpty(cardExchangeRecord.getExchangeName())){
|
||||
queryWrapper.like(CardExchangeRecord::getExchangeName,cardExchangeRecord.getExchangeName());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cardExchangeRecord.getMobile())){
|
||||
queryWrapper.eq(CardExchangeRecord::getMobile,cardExchangeRecord.getMobile());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardExchangeRecord.getStatus())) {
|
||||
queryWrapper.eq(CardExchangeRecord::getStatus,cardExchangeRecord.getStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardExchangeRecord.getTicketCode())) {
|
||||
queryWrapper.eq(CardExchangeRecord::getTicketCode,cardExchangeRecord.getTicketCode());
|
||||
}
|
||||
queryWrapper.orderByDesc(CardExchangeRecord::getCreateTime);
|
||||
return page(page, queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询已使用数据
|
||||
* @param page
|
||||
* @param cardExchangeRecord
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage selectIsUsed(Page page, CardExchangeRecord cardExchangeRecord) {
|
||||
//构建查询条件
|
||||
LambdaQueryWrapper<CardExchangeRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(ObjectUtils.isNotEmpty(cardExchangeRecord.getExchangeName())){
|
||||
queryWrapper.like(CardExchangeRecord::getExchangeName,cardExchangeRecord.getExchangeName());
|
||||
}
|
||||
//会员手机号
|
||||
if (ObjectUtils.isNotEmpty(cardExchangeRecord.getMobile())){
|
||||
queryWrapper.eq(CardExchangeRecord::getMobile,cardExchangeRecord.getMobile());
|
||||
}
|
||||
//员工手机号
|
||||
if (ObjectUtils.isNotEmpty(cardExchangeRecord.getStaffMobile())){
|
||||
queryWrapper.eq(CardExchangeRecord::getStaffMobile,cardExchangeRecord.getStaffMobile());
|
||||
}
|
||||
queryWrapper.eq(CardExchangeRecord::getStatus,"1");
|
||||
if (ObjectUtils.isNotEmpty(cardExchangeRecord.getStartTime()) && ObjectUtils.isNotEmpty(cardExchangeRecord.getEndTime()) ) {
|
||||
queryWrapper.between(CardExchangeRecord::getCancelTime,cardExchangeRecord.getStartTime(),cardExchangeRecord.getEndTime());
|
||||
}
|
||||
queryWrapper.orderByDesc(CardExchangeRecord::getCreateTime);
|
||||
return page(page, queryWrapper);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,81 @@
|
||||
package com.fuint.business.marketingActivity.cardExchange.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeMapper;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
|
||||
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeService;
|
||||
import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.common.util.CryptoUtils;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 兑换券(CardExchange)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-06 14:14:17
|
||||
*/
|
||||
@Service("cardExchangeService")
|
||||
public class CardExchangeServiceImpl extends ServiceImpl<CardExchangeMapper, CardExchange> implements CardExchangeService {
|
||||
|
||||
@Resource
|
||||
private StoreService storeService;
|
||||
/**
|
||||
* 新增数据
|
||||
* @param cardExchange
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean add(CardExchange cardExchange) throws Exception {
|
||||
//获取当前店铺的id和连锁店id
|
||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||
cardExchange.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
cardExchange.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||
}
|
||||
//设置过期时间
|
||||
Integer validity = cardExchange.getValidity();
|
||||
long time = new Date().getTime();
|
||||
long i = (long)validity * 1;
|
||||
cardExchange.setOutTime(new Date(time + i));
|
||||
//二维码链接加密
|
||||
String qr_code_link = "12132";
|
||||
cardExchange.setQrCodeLink(qr_code_link);
|
||||
String secretKey = "sQPoC/1do9BZMkg8I5c09A==";
|
||||
CryptoUtils.encryptSymmetrically(secretKey, null,cardExchange.getQrCodeLink(), CryptoUtils.Algorithm.Encryption.AES_ECB_PKCS5);
|
||||
return save(cardExchange);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件分页查询
|
||||
* @param page
|
||||
* @param cardExchange
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage select(Page page, CardExchange cardExchange) {
|
||||
//构建查询条件
|
||||
LambdaQueryWrapper<CardExchange> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(ObjectUtils.isNotEmpty(cardExchange.getName())){
|
||||
queryWrapper.like(CardExchange::getName,cardExchange.getName());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cardExchange.getType())){
|
||||
queryWrapper.eq(CardExchange::getType,cardExchange.getType());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardExchange.getStatus())) {
|
||||
queryWrapper.eq(CardExchange::getStatus,cardExchange.getStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardExchange.getIsonline())) {
|
||||
queryWrapper.eq(CardExchange::getIsonline,cardExchange.getIsonline());
|
||||
}
|
||||
queryWrapper.orderByDesc(CardExchange::getCreateTime);
|
||||
return page(page, queryWrapper);
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ public class CardFuelDieselController extends BaseController {
|
||||
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getOilType())){
|
||||
queryWrapper.eq(CardFuelDiesel::getOilType,cardFuelDiesel.getOilType());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cardFuelDiesel.getStatus())){
|
||||
queryWrapper.eq(CardFuelDiesel::getStatus,cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
||||
if (ObjectUtils.isNotEmpty(cardFuelDiesel.getActiveStatus())){
|
||||
queryWrapper.eq(CardFuelDiesel::getActiveStatus,cardFuelDiesel.getActiveStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getType())) {
|
||||
queryWrapper.eq(CardFuelDiesel::getType,cardFuelDiesel.getType());
|
||||
|
@ -58,7 +58,7 @@ public class CardGiftController extends BaseController {
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getActivateStatus())) {
|
||||
queryWrapper.eq(CardGift::getActivateStatus,cardGift.getActivateStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getActivateStatus())) {
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getStatus())) {
|
||||
queryWrapper.eq(CardGift::getStatus,cardGift.getStatus());
|
||||
}
|
||||
queryWrapper.orderByDesc(CardGift::getCreateTime);
|
||||
|
@ -31,6 +31,8 @@ public class CardGift extends Model<CardGift> {
|
||||
private Integer storeId;
|
||||
//礼品卡状态 1:在用 2:挂失 3:停用
|
||||
private String status;
|
||||
//兑换功能状态 0:启用 1:禁用
|
||||
private String exchangeStatus;
|
||||
//激活状态
|
||||
private String activateStatus;
|
||||
//生成数量
|
||||
@ -115,6 +117,14 @@ public class CardGift extends Model<CardGift> {
|
||||
this.activateStatus = activateStatus;
|
||||
}
|
||||
|
||||
public String getExchangeStatus() {
|
||||
return exchangeStatus;
|
||||
}
|
||||
|
||||
public void setExchangeStatus(String exchangeStatus) {
|
||||
this.exchangeStatus = exchangeStatus;
|
||||
}
|
||||
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.fuint.business.oilDepotConfiguration.service.OilDepotConfigService;
|
||||
import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -85,6 +86,10 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
|
||||
LambdaQueryWrapper<OilDepotConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OilDepotConfig::getStoreId, storeId);
|
||||
OilDepotConfig oilDepotConfig = oilDepotConfigService.getOne(queryWrapper);
|
||||
//礼品卡兑换功能状态
|
||||
if (ObjectUtils.isNotEmpty(oilDepotConfig) && StringUtils.isNotEmpty(oilDepotConfig.getExchangeStatus())){
|
||||
map.put("exchangeStatus",oilDepotConfig.getExchangeStatus().equals("0") ? 0L : 1L);
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(oilDepotConfig)) {
|
||||
map.put("total_amount", (long) oilDepotConfig.getTotalAmount());
|
||||
//礼品卡剩余额度
|
||||
|
@ -23,6 +23,8 @@ public class OilDepotConfig extends Model<OilDepotConfig> {
|
||||
private Integer storeId;
|
||||
//礼品卡数量总额度
|
||||
private Integer totalAmount;
|
||||
//礼品卡兑换状态
|
||||
private String exchangeStatus;
|
||||
//创建者
|
||||
private String createBy;
|
||||
//创建时间
|
||||
@ -65,6 +67,14 @@ public class OilDepotConfig extends Model<OilDepotConfig> {
|
||||
this.totalAmount = totalAmount;
|
||||
}
|
||||
|
||||
public String getExchangeStatus() {
|
||||
return exchangeStatus;
|
||||
}
|
||||
|
||||
public void setExchangeStatus(String exchangeStatus) {
|
||||
this.exchangeStatus = exchangeStatus;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
@ -0,0 +1,297 @@
|
||||
package com.fuint.common.util;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.Key;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Signature;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.KeySpec;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Base64;
|
||||
import java.util.Base64.Decoder;
|
||||
import java.util.Base64.Encoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 支持AES、DES、RSA加密、数字签名以及生成对称密钥和非对称密钥对
|
||||
*/
|
||||
public class CryptoUtils {
|
||||
|
||||
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
|
||||
private static final Encoder BASE64_ENCODER = Base64.getEncoder();
|
||||
private static final Decoder BASE64_DECODER = Base64.getDecoder();
|
||||
|
||||
private static final Map<Algorithm, KeyFactory> KEY_FACTORY_CACHE = new ConcurrentHashMap<>();
|
||||
private static final Map<Algorithm, Cipher> CIPHER_CACHE = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 生成对称密钥,目前支持的算法有AES、DES
|
||||
* @param algorithm
|
||||
* @return
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public static String generateSymmetricKey(Algorithm algorithm) throws NoSuchAlgorithmException {
|
||||
KeyGenerator generator = KeyGenerator.getInstance(algorithm.getName());
|
||||
generator.init(algorithm.getKeySize());
|
||||
SecretKey secretKey = generator.generateKey();
|
||||
return BASE64_ENCODER.encodeToString(secretKey.getEncoded());
|
||||
}
|
||||
|
||||
/**
|
||||
* 对称加密
|
||||
* @param secretKey 密钥
|
||||
* @param iv 加密向量,只有CBC模式才支持,如果是CBC则必传
|
||||
* @param plainText 明文
|
||||
* @param algorithm 对称加密算法,如AES、DES
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptSymmetrically(String secretKey, String iv, String plainText, Algorithm algorithm) throws Exception {
|
||||
SecretKey key = decodeSymmetricKey(secretKey, algorithm);
|
||||
IvParameterSpec ivParameterSpec = StringUtils.isBlank(iv) ? null : decodeIv(iv);
|
||||
byte[] plainTextInBytes = plainText.getBytes(DEFAULT_CHARSET);
|
||||
byte[] ciphertextInBytes = transform(algorithm, Cipher.ENCRYPT_MODE, key, ivParameterSpec, plainTextInBytes);
|
||||
|
||||
return BASE64_ENCODER.encodeToString(ciphertextInBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对称解密
|
||||
* @param secretKey 密钥
|
||||
* @param iv 加密向量,只有CBC模式才支持,如果是CBC则必传
|
||||
* @param ciphertext 密文
|
||||
* @param algorithm 对称加密算法,如AES、DES
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decryptSymmetrically(String secretKey, String iv, String ciphertext, Algorithm algorithm) throws Exception {
|
||||
SecretKey key = decodeSymmetricKey(secretKey, algorithm);
|
||||
IvParameterSpec ivParameterSpec = StringUtils.isBlank(iv) ? null : decodeIv(iv);
|
||||
byte[] ciphertextInBytes = BASE64_DECODER.decode(ciphertext);
|
||||
byte[] plainTextInBytes = transform(algorithm, Cipher.DECRYPT_MODE, key, ivParameterSpec, ciphertextInBytes);
|
||||
return new String(plainTextInBytes, DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* 非对称加密
|
||||
* @param publicKeyText 公钥
|
||||
* @param plainText 明文
|
||||
* @param algorithm 非对称加密算法
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptAsymmetrically(String publicKeyText, String plainText, Algorithm algorithm) throws Exception {
|
||||
PublicKey publicKey = regeneratePublicKey(publicKeyText, algorithm);
|
||||
byte[] plainTextInBytes = plainText.getBytes(DEFAULT_CHARSET);
|
||||
byte[] ciphertextInBytes = transform(algorithm, Cipher.ENCRYPT_MODE, publicKey, plainTextInBytes);
|
||||
return BASE64_ENCODER.encodeToString(ciphertextInBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 非对称解密
|
||||
* @param privateKeyText 私钥
|
||||
* @param ciphertext 密文
|
||||
* @param algorithm 非对称加密算法
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decryptAsymmetrically(String privateKeyText, String ciphertext, Algorithm algorithm) throws Exception {
|
||||
PrivateKey privateKey = regeneratePrivateKey(privateKeyText, algorithm);
|
||||
byte[] ciphertextInBytes = BASE64_DECODER.decode(ciphertext);
|
||||
byte[] plainTextInBytes = transform(algorithm, Cipher.DECRYPT_MODE, privateKey, ciphertextInBytes);
|
||||
return new String(plainTextInBytes, DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成数字签名
|
||||
* @param privateKeyText 私钥
|
||||
* @param msg 传输的数据
|
||||
* @param encryptionAlgorithm 加密算法,见Algorithm中的加密算法
|
||||
* @param signatureAlgorithm 签名算法,见Algorithm中的签名算法
|
||||
* @return 数字签名
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String doSign(String privateKeyText, String msg, Algorithm encryptionAlgorithm, Algorithm signatureAlgorithm)
|
||||
throws Exception {
|
||||
PrivateKey privateKey = regeneratePrivateKey(privateKeyText, encryptionAlgorithm);
|
||||
// Signature只支持签名算法
|
||||
Signature signature = Signature.getInstance(signatureAlgorithm.getName());
|
||||
signature.initSign(privateKey);
|
||||
signature.update(msg.getBytes(DEFAULT_CHARSET));
|
||||
byte[] signatureInBytes = signature.sign();
|
||||
return BASE64_ENCODER.encodeToString(signatureInBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字签名验证
|
||||
* @param publicKeyText 公钥
|
||||
* @param msg 传输的数据
|
||||
* @param signatureText 数字签名
|
||||
* @param encryptionAlgorithm 加密算法,见Algorithm中的加密算法
|
||||
* @param signatureAlgorithm 签名算法,见Algorithm中的签名算法
|
||||
* @return 校验是否成功
|
||||
* @throws Exception
|
||||
*/
|
||||
public static boolean doVerify(String publicKeyText, String msg, String signatureText, Algorithm encryptionAlgorithm,
|
||||
Algorithm signatureAlgorithm) throws Exception {
|
||||
PublicKey publicKey = regeneratePublicKey(publicKeyText, encryptionAlgorithm);
|
||||
Signature signature = Signature.getInstance(signatureAlgorithm.getName());
|
||||
signature.initVerify(publicKey);
|
||||
signature.update(msg.getBytes(DEFAULT_CHARSET));
|
||||
return signature.verify(BASE64_DECODER.decode(signatureText));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将密钥进行Base64位解码,重新生成SecretKey实例
|
||||
* @param secretKey 密钥
|
||||
* @param algorithm 算法
|
||||
* @return
|
||||
*/
|
||||
private static SecretKey decodeSymmetricKey(String secretKey, Algorithm algorithm) {
|
||||
byte[] key = BASE64_DECODER.decode(secretKey);
|
||||
return new SecretKeySpec(key, algorithm.getName());
|
||||
}
|
||||
|
||||
private static IvParameterSpec decodeIv(String iv) {
|
||||
byte[] ivInBytes = BASE64_DECODER.decode(iv);
|
||||
return new IvParameterSpec(ivInBytes);
|
||||
}
|
||||
|
||||
private static PublicKey regeneratePublicKey(String publicKeyText, Algorithm algorithm)
|
||||
throws NoSuchAlgorithmException, InvalidKeySpecException {
|
||||
byte[] keyInBytes = BASE64_DECODER.decode(publicKeyText);
|
||||
KeyFactory keyFactory = getKeyFactory(algorithm);
|
||||
// 公钥必须使用RSAPublicKeySpec或者X509EncodedKeySpec
|
||||
KeySpec publicKeySpec = new X509EncodedKeySpec(keyInBytes);
|
||||
PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);
|
||||
return publicKey;
|
||||
}
|
||||
|
||||
private static PrivateKey regeneratePrivateKey(String key, Algorithm algorithm) throws Exception {
|
||||
byte[] keyInBytes = BASE64_DECODER.decode(key);
|
||||
KeyFactory keyFactory = getKeyFactory(algorithm);
|
||||
// 私钥必须使用RSAPrivateCrtKeySpec或者PKCS8EncodedKeySpec
|
||||
KeySpec privateKeySpec = new PKCS8EncodedKeySpec(keyInBytes);
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec);
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
private static KeyFactory getKeyFactory(Algorithm algorithm) throws NoSuchAlgorithmException {
|
||||
KeyFactory keyFactory = KEY_FACTORY_CACHE.get(algorithm);
|
||||
if (keyFactory == null) {
|
||||
keyFactory = KeyFactory.getInstance(algorithm.getName());
|
||||
KEY_FACTORY_CACHE.put(algorithm, keyFactory);
|
||||
}
|
||||
|
||||
return keyFactory;
|
||||
}
|
||||
|
||||
private static byte[] transform(Algorithm algorithm, int mode, Key key, byte[] msg) throws Exception {
|
||||
return transform(algorithm, mode, key, null, msg);
|
||||
}
|
||||
|
||||
private static byte[] transform(Algorithm algorithm, int mode, Key key, IvParameterSpec iv, byte[] msg) throws Exception {
|
||||
Cipher cipher = CIPHER_CACHE.get(algorithm);
|
||||
// double check,减少上下文切换
|
||||
if (cipher == null) {
|
||||
synchronized (CryptoUtils.class) {
|
||||
if ((cipher = CIPHER_CACHE.get(algorithm)) == null) {
|
||||
cipher = determineWhichCipherToUse(algorithm);
|
||||
CIPHER_CACHE.put(algorithm, cipher);
|
||||
}
|
||||
cipher.init(mode, key, iv);
|
||||
return cipher.doFinal(msg);
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (CryptoUtils.class) {
|
||||
cipher.init(mode, key, iv);
|
||||
return cipher.doFinal(msg);
|
||||
}
|
||||
}
|
||||
|
||||
private static Cipher determineWhichCipherToUse(Algorithm algorithm) throws NoSuchAlgorithmException, NoSuchPaddingException {
|
||||
Cipher cipher;
|
||||
String transformation = algorithm.getTransformation();
|
||||
// 官方推荐的transformation使用algorithm/mode/padding组合,SunJCE使用ECB作为默认模式,使用PKCS5Padding作为默认填充
|
||||
if (StringUtils.isNotEmpty(transformation)) {
|
||||
cipher = Cipher.getInstance(transformation);
|
||||
} else {
|
||||
cipher = Cipher.getInstance(algorithm.getName());
|
||||
}
|
||||
|
||||
return cipher;
|
||||
}
|
||||
|
||||
/**
|
||||
* 算法分为加密算法和签名算法,更多算法实现见:<br/>
|
||||
* <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#impl">jdk8中的标准算法</a>
|
||||
*/
|
||||
public static class Algorithm {
|
||||
|
||||
public interface Encryption {
|
||||
Algorithm AES_ECB_PKCS5 = new Algorithm("AES", "AES/ECB/PKCS5Padding", 128);
|
||||
Algorithm AES_CBC_PKCS5 = new Algorithm("AES", "AES/CBC/PKCS5Padding", 128);
|
||||
Algorithm DES_ECB_PKCS5 = new Algorithm("DES", "DES/ECB/PKCS5Padding", 56);
|
||||
Algorithm DES_CBC_PKCS5 = new Algorithm("DES", "DES/CBC/PKCS5Padding", 56);
|
||||
Algorithm RSA_ECB_PKCS1 = new Algorithm("RSA", "RSA/ECB/PKCS1Padding", 1024);
|
||||
Algorithm DSA = new Algorithm("DSA", 1024);
|
||||
}
|
||||
|
||||
public interface Signing {
|
||||
Algorithm SHA1WithDSA = new Algorithm("SHA1withDSA", 1024);
|
||||
Algorithm SHA1WithRSA = new Algorithm("SHA1WithRSA", 2048);
|
||||
Algorithm SHA256WithRSA = new Algorithm("SHA256WithRSA", 2048);
|
||||
}
|
||||
|
||||
@Getter
|
||||
private String name;
|
||||
@Getter
|
||||
private String transformation;
|
||||
@Getter
|
||||
private int keySize;
|
||||
|
||||
public Algorithm(String name, int keySize) {
|
||||
this(name, null, keySize);
|
||||
}
|
||||
|
||||
public Algorithm(String name, String transformation, int keySize) {
|
||||
this.name = name;
|
||||
this.transformation = transformation;
|
||||
this.keySize = keySize;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class AsymmetricKeyPair {
|
||||
|
||||
private String publicKey;
|
||||
private String privateKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user