会员卡片管理和会员权益移植
This commit is contained in:
parent
38fd2ecc6a
commit
884b9110c4
43
yudao-admin-vue3/src/api/cardbase/index.ts
Normal file
43
yudao-admin-vue3/src/api/cardbase/index.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 会员卡档案 VO
|
||||
export interface CardBaseVO {
|
||||
id: number // 档案编号
|
||||
cardNum: string // 卡号
|
||||
scret: string // 卡密
|
||||
parentId: number // 上级id
|
||||
subId: number // 下级id
|
||||
}
|
||||
|
||||
// 会员卡档案 API
|
||||
export const CardBaseApi = {
|
||||
// 查询会员卡档案分页
|
||||
getCardBasePage: async (params: any) => {
|
||||
return await request.get({ url: `/mall/card-base/page`, params })
|
||||
},
|
||||
|
||||
// 查询会员卡档案详情
|
||||
getCardBase: async (id: number) => {
|
||||
return await request.get({ url: `/mall/card-base/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增会员卡档案
|
||||
createCardBase: async (data: CardBaseVO) => {
|
||||
return await request.post({ url: `/mall/card-base/create`, data })
|
||||
},
|
||||
|
||||
// 修改会员卡档案
|
||||
updateCardBase: async (data: CardBaseVO) => {
|
||||
return await request.put({ url: `/mall/card-base/update`, data })
|
||||
},
|
||||
|
||||
// 删除会员卡档案
|
||||
deleteCardBase: async (id: number) => {
|
||||
return await request.delete({ url: `/mall/card-base/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出会员卡档案 Excel
|
||||
exportCardBase: async (params) => {
|
||||
return await request.download({ url: `/mall/card-base/export-excel`, params })
|
||||
},
|
||||
}
|
43
yudao-admin-vue3/src/api/cardlog/index.ts
Normal file
43
yudao-admin-vue3/src/api/cardlog/index.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 发卡记录 VO
|
||||
export interface CardLogVO {
|
||||
id: number // 编号
|
||||
nickName: string // 会员昵称
|
||||
phone: string // 手机号
|
||||
countNumber: number // 数量
|
||||
cardSection: number // 区间
|
||||
}
|
||||
|
||||
// 发卡记录 API
|
||||
export const CardLogApi = {
|
||||
// 查询发卡记录分页
|
||||
getCardLogPage: async (params: any) => {
|
||||
return await request.get({ url: `/send/card-log/page`, params })
|
||||
},
|
||||
|
||||
// 查询发卡记录详情
|
||||
getCardLog: async (id: number) => {
|
||||
return await request.get({ url: `/send/card-log/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增发卡记录
|
||||
createCardLog: async (data: CardLogVO) => {
|
||||
return await request.post({ url: `/send/card-log/create`, data })
|
||||
},
|
||||
|
||||
// 修改发卡记录
|
||||
updateCardLog: async (data: CardLogVO) => {
|
||||
return await request.put({ url: `/send/card-log/update`, data })
|
||||
},
|
||||
|
||||
// 删除发卡记录
|
||||
deleteCardLog: async (id: number) => {
|
||||
return await request.delete({ url: `/send/card-log/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出发卡记录 Excel
|
||||
exportCardLog: async (params) => {
|
||||
return await request.download({ url: `/send/card-log/export-excel`, params })
|
||||
},
|
||||
}
|
44
yudao-admin-vue3/src/api/club/clubCard/index.ts
Normal file
44
yudao-admin-vue3/src/api/club/clubCard/index.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 会员卡 VO
|
||||
export interface CardVO {
|
||||
id: number // 会员卡编号
|
||||
parentId: number // 上级用户id
|
||||
subId: number // 下级用户id
|
||||
cardNumber: string // 会员卡号
|
||||
isActivate: number // 是否已激活(0:未激活 , 1:已激活)
|
||||
activateTime: number // 激活时间
|
||||
}
|
||||
|
||||
// 会员卡 API
|
||||
export const CardApi = {
|
||||
// 查询会员卡分页
|
||||
getCardPage: async (params: any) => {
|
||||
return await request.get({ url: `/club/card/page`, params })
|
||||
},
|
||||
|
||||
// 查询会员卡详情
|
||||
getCard: async (id: number) => {
|
||||
return await request.get({ url: `/club/card/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增会员卡
|
||||
createCard: async (data: CardVO) => {
|
||||
return await request.post({ url: `/club/card/create`, data })
|
||||
},
|
||||
|
||||
// 修改会员卡
|
||||
updateCard: async (data: CardVO) => {
|
||||
return await request.put({ url: `/club/card/update`, data })
|
||||
},
|
||||
|
||||
// 删除会员卡
|
||||
deleteCard: async (id: number) => {
|
||||
return await request.delete({ url: `/club/card/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出会员卡 Excel
|
||||
exportCard: async (params) => {
|
||||
return await request.download({ url: `/club/card/export-excel`, params })
|
||||
},
|
||||
}
|
45
yudao-admin-vue3/src/api/interest/index.ts
Normal file
45
yudao-admin-vue3/src/api/interest/index.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 权益通知 VO
|
||||
export interface InterestVO {
|
||||
id: number // 权益编号
|
||||
title: string // 权益标题
|
||||
goodsName: string // 商品名称
|
||||
desc: string // 权益描述
|
||||
isUsed: string // 权益次数
|
||||
equity: string // 权益内容
|
||||
notice: string // 须知内容
|
||||
}
|
||||
|
||||
// 权益通知 API
|
||||
export const InterestApi = {
|
||||
// 查询权益通知分页
|
||||
getInterestPage: async (params: any) => {
|
||||
return await request.get({ url: `/notice/interest/page`, params })
|
||||
},
|
||||
|
||||
// 查询权益通知详情
|
||||
getInterest: async (id: number) => {
|
||||
return await request.get({ url: `/notice/interest/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增权益通知
|
||||
createInterest: async (data: InterestVO) => {
|
||||
return await request.post({ url: `/notice/interest/create`, data })
|
||||
},
|
||||
|
||||
// 修改权益通知
|
||||
updateInterest: async (data: InterestVO) => {
|
||||
return await request.put({ url: `/notice/interest/update`, data })
|
||||
},
|
||||
|
||||
// 删除权益通知
|
||||
deleteInterest: async (id: number) => {
|
||||
return await request.delete({ url: `/notice/interest/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出权益通知 Excel
|
||||
exportInterest: async (params) => {
|
||||
return await request.download({ url: `/notice/interest/export-excel`, params })
|
||||
},
|
||||
}
|
@ -27,5 +27,5 @@ export const getWalletPage = async (params) => {
|
||||
|
||||
// 修改会员钱包余额
|
||||
export const updateWalletBalance = async (data: any) => {
|
||||
return await request.post({ url: `/pay/wallet/update`, data })
|
||||
return await request.put({ url: `/pay/wallet/update-balance`, data })
|
||||
}
|
||||
|
45
yudao-admin-vue3/src/api/transferCard/index.ts
Normal file
45
yudao-admin-vue3/src/api/transferCard/index.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 会员卡划拨 VO
|
||||
export interface TransferVO {
|
||||
id: number // 编号
|
||||
cardNumber: string // 会员卡号
|
||||
assignorId: number // 合伙人
|
||||
transfereeId: number // 会员
|
||||
assignorPhone: string // 合伙人电话
|
||||
transfereePhone: string // 会员电话
|
||||
status: number // 状态
|
||||
}
|
||||
|
||||
// 会员卡划拨 API
|
||||
export const TransferApi = {
|
||||
// 查询会员卡划拨分页
|
||||
getTransferPage: async (params: any) => {
|
||||
return await request.get({ url: `/card/transfer/page`, params })
|
||||
},
|
||||
|
||||
// 查询会员卡划拨详情
|
||||
getTransfer: async (id: number) => {
|
||||
return await request.get({ url: `/card/transfer/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增会员卡划拨
|
||||
createTransfer: async (data: TransferVO) => {
|
||||
return await request.post({ url: `/card/transfer/create`, data })
|
||||
},
|
||||
|
||||
// 修改会员卡划拨
|
||||
updateTransfer: async (data: TransferVO) => {
|
||||
return await request.put({ url: `/card/transfer/update`, data })
|
||||
},
|
||||
|
||||
// 删除会员卡划拨
|
||||
deleteTransfer: async (id: number) => {
|
||||
return await request.delete({ url: `/card/transfer/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出会员卡划拨 Excel
|
||||
exportTransfer: async (params) => {
|
||||
return await request.download({ url: `/card/transfer/export-excel`, params })
|
||||
}
|
||||
}
|
45
yudao-admin-vue3/src/api/transferlog/index.ts
Normal file
45
yudao-admin-vue3/src/api/transferlog/index.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 会员卡划拨记录 VO
|
||||
export interface TransferLogVO {
|
||||
id: number // 划拨id
|
||||
cardNumber: string // 会员卡号
|
||||
assignorId: number // 发起人
|
||||
transfereeId: number // 划拨人
|
||||
assignorPhone: string // 发起人手机
|
||||
transfereePhone: string // 划拨人手机
|
||||
status: number // 状态
|
||||
}
|
||||
|
||||
// 会员卡划拨记录 API
|
||||
export const TransferLogApi = {
|
||||
// 查询会员卡划拨记录分页
|
||||
getTransferLogPage: async (params: any) => {
|
||||
return await request.get({ url: `/card/transfer-log/page`, params })
|
||||
},
|
||||
|
||||
// 查询会员卡划拨记录详情
|
||||
getTransferLog: async (id: number) => {
|
||||
return await request.get({ url: `/card/transfer-log/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增会员卡划拨记录
|
||||
createTransferLog: async (data: TransferLogVO) => {
|
||||
return await request.post({ url: `/card/transfer-log/create`, data })
|
||||
},
|
||||
|
||||
// 修改会员卡划拨记录
|
||||
updateTransferLog: async (data: TransferLogVO) => {
|
||||
return await request.put({ url: `/card/transfer-log/update`, data })
|
||||
},
|
||||
|
||||
// 删除会员卡划拨记录
|
||||
deleteTransferLog: async (id: number) => {
|
||||
return await request.delete({ url: `/card/transfer-log/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出会员卡划拨记录 Excel
|
||||
exportTransferLog: async (params) => {
|
||||
return await request.download({ url: `/card/transfer-log/export-excel`, params })
|
||||
},
|
||||
}
|
@ -258,5 +258,7 @@ export enum DICT_TYPE {
|
||||
AI_WRITE_LANGUAGE = 'ai_write_language', // AI 写作语言
|
||||
|
||||
// ========== 通用模块 ==========
|
||||
ZERO_OR_ONE = 'zero_or_one'
|
||||
ZERO_OR_ONE = 'zero_or_one',
|
||||
IS_ACTIVATE = 'is_activate',
|
||||
CARD_STATUS = 'card_status'
|
||||
}
|
||||
|
117
yudao-admin-vue3/src/views/club/clubCard/CardForm.vue
Normal file
117
yudao-admin-vue3/src/views/club/clubCard/CardForm.vue
Normal file
@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="合伙人手机号" prop="nickName">
|
||||
<el-input v-model="formData.nickName" placeholder="请输入合伙人手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="会员卡号" prop="cardNumber">
|
||||
<el-input v-model="formData.cardNumber" placeholder="请输入会员卡号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="激活状态" prop="isActivate">
|
||||
<el-radio-group v-model="formData.isActivate">
|
||||
<el-radio
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.IS_ACTIVATE)"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { CardApi, CardVO } from '@/api/club/clubCard'
|
||||
|
||||
/** 会员卡 表单 */
|
||||
defineOptions({ name: 'CardForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
nickName: undefined,
|
||||
phone: undefined,
|
||||
cardNumber: undefined,
|
||||
isActivate: undefined,
|
||||
activateTime: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await CardApi.getCard(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as CardVO
|
||||
if (formType.value === 'create') {
|
||||
await CardApi.createCard(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await CardApi.updateCard(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
nickName: undefined,
|
||||
phone: undefined,
|
||||
cardNumber: undefined,
|
||||
isActivate: undefined,
|
||||
activateTime: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
237
yudao-admin-vue3/src/views/club/clubCard/index.vue
Normal file
237
yudao-admin-vue3/src/views/club/clubCard/index.vue
Normal file
@ -0,0 +1,237 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="合伙人手机号" prop="nickName">
|
||||
<el-input
|
||||
v-model="queryParams.nickName"
|
||||
placeholder="请输入合伙人手机号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="领取人手机号" prop="phone">
|
||||
<el-input
|
||||
v-model="queryParams.phone"
|
||||
placeholder="请输入领取人手机号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员卡号" prop="cardNumber">
|
||||
<el-input
|
||||
v-model="queryParams.cardNumber"
|
||||
placeholder="请输入会员卡号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="激活状态" prop="isActivate">
|
||||
<el-select
|
||||
v-model="queryParams.isActivate"
|
||||
placeholder="请选择激活状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.IS_ACTIVATE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- plain-->
|
||||
<!-- @click="openForm('create')"-->
|
||||
<!-- v-hasPermi="['club:card:create']"-->
|
||||
<!-- >-->
|
||||
<!-- <Icon icon="ep:plus" class="mr-5px" /> 新增-->
|
||||
<!-- </el-button>-->
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['club:card:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="会员卡号" align="center" prop="cardNumber" />
|
||||
<el-table-column label="合伙人姓名" align="center" prop="parentName" />
|
||||
<el-table-column label="合伙人手机" align="center" prop="nickName" />
|
||||
<el-table-column label="领取人手机" align="center" prop="phone" />
|
||||
<el-table-column label="领取人姓名" align="center" prop="subName" />
|
||||
<el-table-column label="激活状态" align="center" prop="isActivate">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.IS_ACTIVATE" :value="scope.row.isActivate" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="领取时间"
|
||||
align="center"
|
||||
prop="activateTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<!-- <el-table-column label="操作" align="center">-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!--<!– <el-button–>-->
|
||||
<!--<!– link–>-->
|
||||
<!--<!– type="primary"–>-->
|
||||
<!--<!– @click="openForm('update', scope.row.id)"–>-->
|
||||
<!--<!– v-hasPermi="['club:card:update']"–>-->
|
||||
<!--<!– >–>-->
|
||||
<!--<!– 编辑–>-->
|
||||
<!--<!– </el-button>–>-->
|
||||
<!-- <el-button-->
|
||||
<!-- link-->
|
||||
<!-- type="danger"-->
|
||||
<!-- @click="handleDelete(scope.row.id)"-->
|
||||
<!-- v-hasPermi="['club:card:delete']"-->
|
||||
<!-- >-->
|
||||
<!-- 删除-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<CardForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { CardApi, CardVO } from '@/api/club/clubCard'
|
||||
import CardForm from './CardForm.vue'
|
||||
|
||||
/** 会员卡 列表 */
|
||||
defineOptions({ name: 'ClubCard' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<CardVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
nickName: undefined,
|
||||
phone: undefined,
|
||||
cardNumber: undefined,
|
||||
parentName: undefined,
|
||||
subName: undefined,
|
||||
isActivate: undefined,
|
||||
activateTime: undefined,
|
||||
createTime: [],
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await CardApi.getCardPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await CardApi.deleteCard(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await CardApi.exportCard(queryParams)
|
||||
console.log(data,'data')
|
||||
download.excel(data, '会员卡.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
182
yudao-admin-vue3/src/views/club/sendCard/CardList.vue
Normal file
182
yudao-admin-vue3/src/views/club/sendCard/CardList.vue
Normal file
@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<Dialog title="会员卡列表" v-model="dialogVisible">
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="会员卡号" align="center" prop="cardNumber" />
|
||||
<!-- <el-table-column label="昵称" align="center" prop="nickName" />-->
|
||||
<!-- <el-table-column label="合伙人" align="center" prop="nickName" />-->
|
||||
<el-table-column label="领取人" align="center" prop="phone" />
|
||||
<el-table-column label="激活状态" align="center" prop="isActivate">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.IS_ACTIVATE" :value="scope.row.isActivate" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="领取时间"
|
||||
align="center"
|
||||
prop="activateTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<!-- <el-button-->
|
||||
<!-- link-->
|
||||
<!-- type="primary"-->
|
||||
<!-- @click="openForm('update', scope.row.id)"-->
|
||||
<!-- v-hasPermi="['club:card:update']"-->
|
||||
<!-- >-->
|
||||
<!-- 编辑-->
|
||||
<!-- </el-button>-->
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['club:card:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
<!-- <template #footer>-->
|
||||
<!-- <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>-->
|
||||
<!-- <el-button @click="dialogVisible = false">取 消</el-button>-->
|
||||
<!-- </template>-->
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { CardLogApi, CardLogVO } from '@/api/cardlog'
|
||||
import {CardApi, CardVO} from "@/api/club/clubCard";
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
|
||||
/** 发卡记录 表单 */
|
||||
defineOptions({ name: 'CardLogForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const list = ref<CardVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
nickName: undefined,
|
||||
phone: undefined,
|
||||
countNumber: undefined,
|
||||
})
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
nickName: undefined,
|
||||
phone: undefined,
|
||||
cardNumber: undefined,
|
||||
isActivate: undefined,
|
||||
activateTime: undefined,
|
||||
createTime: [],
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await CardApi.getCardPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 会员卡删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
let st = await CardApi.deleteCard(id)
|
||||
// message.success(t('common.delSuccess'))
|
||||
if (st){
|
||||
message.success(t('common.delSuccess'))
|
||||
}else {
|
||||
message.error("删除失败,状态不是未激活")
|
||||
}
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const openCardList = async (phone: String) => {
|
||||
dialogVisible.value = true
|
||||
// dialogTitle.value = t('action.' + type)
|
||||
// formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
formLoading.value = true
|
||||
try {
|
||||
// formData.value = await CardLogApi.getCardLog(id)
|
||||
queryParams.nickName = phone
|
||||
const data = await CardApi.getCardPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
defineExpose({ openCardList }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as CardLogVO
|
||||
if (formType.value === 'create') {
|
||||
await CardLogApi.createCardLog(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await CardLogApi.updateCardLog(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
nickName: undefined,
|
||||
phone: undefined,
|
||||
cardNumber: undefined,
|
||||
isActivate: undefined,
|
||||
activateTime: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
104
yudao-admin-vue3/src/views/club/sendCard/CardLogForm.vue
Normal file
104
yudao-admin-vue3/src/views/club/sendCard/CardLogForm.vue
Normal file
@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="会员昵称" prop="nickName">
|
||||
<el-input v-model="formData.nickName" placeholder="请输入会员昵称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="countNumber">
|
||||
<el-input v-model="formData.countNumber" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="卡号区间" prop="cardSection">
|
||||
<el-input v-model="formData.cardSection" placeholder="请输入卡号区间" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { CardLogApi, CardLogVO } from '@/api/cardlog'
|
||||
|
||||
/** 发卡记录 表单 */
|
||||
defineOptions({ name: 'CardLogForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
nickName: undefined,
|
||||
phone: undefined,
|
||||
countNumber: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await CardLogApi.getCardLog(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as CardLogVO
|
||||
if (formType.value === 'create') {
|
||||
await CardLogApi.createCardLog(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await CardLogApi.updateCardLog(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
nickName: undefined,
|
||||
phone: undefined,
|
||||
countNumber: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
235
yudao-admin-vue3/src/views/club/sendCard/index.vue
Normal file
235
yudao-admin-vue3/src/views/club/sendCard/index.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="合伙人昵称" prop="nickName">
|
||||
<el-input
|
||||
v-model="queryParams.nickName"
|
||||
placeholder="请输入合伙人昵称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input
|
||||
v-model="queryParams.phone"
|
||||
placeholder="请输入手机号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="countNumber">
|
||||
<el-input
|
||||
v-model="queryParams.countNumber"
|
||||
placeholder="请输入数量"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发卡时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- plain-->
|
||||
<!-- @click="openForm('create')"-->
|
||||
<!-- v-hasPermi="['send:card-log:create']"-->
|
||||
<!-- >-->
|
||||
<!-- <Icon icon="ep:plus" class="mr-5px" /> 新增-->
|
||||
<!-- </el-button>-->
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['send:card-log:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="合伙人昵称" align="center" prop="nickName" />
|
||||
<el-table-column label="手机号" align="center" prop="phone" />
|
||||
<el-table-column label="数量" align="center" prop="countNumber" />
|
||||
<!-- <el-table-column label="卡号区间" align="center" prop="cardSection" @click="toCards" />-->
|
||||
<el-table-column prop="cardSection" label="卡号区间" >
|
||||
<template #default="scope">
|
||||
<div @click="toCards(scope.row.phone)">{{scope.row.cardSection}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="发卡时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<!-- <el-table-column label="操作" align="center">-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- <el-button-->
|
||||
<!-- link-->
|
||||
<!-- type="primary"-->
|
||||
<!-- @click="openForm('update', scope.row.id)"-->
|
||||
<!-- v-hasPermi="['send:card-log:update']"-->
|
||||
<!-- >-->
|
||||
<!-- 编辑-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- link-->
|
||||
<!-- type="danger"-->
|
||||
<!-- @click="handleDelete(scope.row.id)"-->
|
||||
<!-- v-hasPermi="['send:card-log:delete']"-->
|
||||
<!-- >-->
|
||||
<!-- 删除-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<CardLogForm ref="formRef" @success="getList" />
|
||||
<CardList ref="cardListFormRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { CardLogApi, CardLogVO } from '@/api/cardlog'
|
||||
import { CardApi, CardVO } from '@/api/club/clubCard'
|
||||
import CardLogForm from './CardLogForm.vue'
|
||||
import CardList from './CardList.vue'
|
||||
|
||||
/** 发卡记录 列表 */
|
||||
defineOptions({ name: 'CardLog' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<CardLogVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
nickName: undefined,
|
||||
phone: undefined,
|
||||
countNumber: undefined,
|
||||
cardSection: undefined,
|
||||
createTime: [],
|
||||
})
|
||||
const queryParamsByCardList = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
nickName: undefined,
|
||||
phone: undefined,
|
||||
cardNumber: undefined,
|
||||
isActivate: undefined,
|
||||
createTime: [],
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await CardLogApi.getCardLogPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await CardLogApi.deleteCardLog(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 会员卡列表 */
|
||||
const cardListFormRef = ref()
|
||||
const toCards = async (phone: String) => {
|
||||
cardListFormRef.value.openCardList(phone)
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await CardLogApi.exportCardLog(queryParams)
|
||||
download.excel(data, '发卡记录.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
117
yudao-admin-vue3/src/views/interest/InterestForm.vue
Normal file
117
yudao-admin-vue3/src/views/interest/InterestForm.vue
Normal file
@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="权益标题" prop="title">
|
||||
<el-input v-model="formData.title" placeholder="请输入权益标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="权益次数" prop="title">
|
||||
<el-input v-model="formData.isUsed" placeholder="请输入权益次数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称" prop="goodsName">
|
||||
<el-input v-model="formData.goodsName" placeholder="请输入商品名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="权益描述" prop="description">
|
||||
<Editor v-model="formData.description" height="150px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="权益内容" prop="equity">
|
||||
<Editor v-model="formData.equity" height="150px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="须知内容" prop="notice">
|
||||
<Editor v-model="formData.notice" height="150px" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { InterestApi, InterestVO } from '@/api/interest'
|
||||
|
||||
/** 权益通知 表单 */
|
||||
defineOptions({ name: 'InterestForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
title: undefined,
|
||||
goodsName: undefined,
|
||||
description: undefined,
|
||||
isUsed: undefined,
|
||||
equity: undefined,
|
||||
notice: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await InterestApi.getInterest(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as InterestVO
|
||||
if (formType.value === 'create') {
|
||||
console.log(data,'data')
|
||||
await InterestApi.createInterest(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await InterestApi.updateInterest(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
title: undefined,
|
||||
goodsName: undefined,
|
||||
description: undefined,
|
||||
isUsed: undefined,
|
||||
equity: undefined,
|
||||
notice: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
197
yudao-admin-vue3/src/views/interest/index.vue
Normal file
197
yudao-admin-vue3/src/views/interest/index.vue
Normal file
@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="权益标题" prop="title">
|
||||
<el-input
|
||||
v-model="queryParams.title"
|
||||
placeholder="请输入权益标题"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['notice:interest:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['notice:interest:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="权益编号" align="center" prop="id" />
|
||||
<el-table-column label="权益标题" align="center" prop="title" />
|
||||
<el-table-column label="权益描述" align="center" prop="description" />
|
||||
<el-table-column label="权益内容" align="center" prop="equity" />
|
||||
<el-table-column label="须知内容" align="center" prop="notice" />
|
||||
<el-table-column label="权益次数" align="center" prop="isUsed" />
|
||||
<el-table-column label="商品名称" align="center" prop="goodsName" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['notice:interest:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['notice:interest:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<InterestForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { InterestApi, InterestVO } from '@/api/interest'
|
||||
import InterestForm from './InterestForm.vue'
|
||||
|
||||
/** 权益通知 列表 */
|
||||
defineOptions({ name: 'Interest' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<InterestVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
createTime: [],
|
||||
title: undefined,
|
||||
goodsName: undefined,
|
||||
description: undefined,
|
||||
equity: undefined,
|
||||
isUsed: undefined,
|
||||
notice: undefined,
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await InterestApi.getInterestPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await InterestApi.deleteInterest(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await InterestApi.exportInterest(queryParams)
|
||||
download.excel(data, '权益通知.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
@ -10,8 +10,8 @@
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图标地址" prop="iconUrl">
|
||||
<el-input v-model="formData.iconUrl" placeholder="请输入图标地址" />
|
||||
<el-form-item label="图标" prop="iconUrl">
|
||||
<UploadImg v-model="formData.iconUrl" :limit="1" :is-show-tip="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="intro">
|
||||
<el-input v-model="formData.intro" placeholder="请输入描述" />
|
||||
@ -26,6 +26,19 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员等级" prop="levelIdList">
|
||||
<el-checkbox-group v-model="formData.levelIdList">
|
||||
<el-checkbox
|
||||
v-for="dict in memberLevelList"
|
||||
:key="dict.id"
|
||||
:label="dict.id"
|
||||
>
|
||||
{{ dict.name }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="formData.sort" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
@ -39,6 +52,7 @@
|
||||
<script setup lang="ts">
|
||||
import { PaidMemberBenefitApi, PaidMemberBenefitVO } from '@/api/mall/promotion/memberbenefit'
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import * as LevelApi from '@/api/member/level'
|
||||
/** 付费会员权益 表单 */
|
||||
defineOptions({ name: 'PaidMemberBenefitForm' })
|
||||
|
||||
@ -56,6 +70,7 @@ const formData = ref({
|
||||
intro: undefined,
|
||||
status: undefined,
|
||||
sort: undefined,
|
||||
levelIdList: []
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
@ -64,6 +79,7 @@ const formRules = reactive({
|
||||
sort: [{ required: true, message: '排序不能为空', trigger: 'blur' }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const memberLevelList = ref() // 等级列表
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
@ -83,6 +99,15 @@ const open = async (type: string, id?: number) => {
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/**查询等级列表 */
|
||||
const getMemberLevelList = async () => {
|
||||
const queryLevelParams = reactive({
|
||||
status: 0
|
||||
})
|
||||
const resultData = await LevelApi.getLevelList(queryLevelParams)
|
||||
memberLevelList.value = resultData
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
@ -119,4 +144,8 @@ const resetForm = () => {
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getMemberLevelList()
|
||||
})
|
||||
</script>
|
@ -45,6 +45,16 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员等级" prop="levelId">
|
||||
<el-select v-model="queryParams.levelId" class="!w-240px" placeholder="请选择" clearable>
|
||||
<el-option
|
||||
v-for="dict in memberLevelList"
|
||||
:key="dict.id"
|
||||
:label="dict.name"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="排序" prop="sort">
|
||||
<el-input
|
||||
v-model="queryParams.sort"
|
||||
@ -94,7 +104,11 @@
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label=" 编号" align="center" prop="id" />
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
<el-table-column label="图标地址" align="center" prop="iconUrl" />
|
||||
<el-table-column align="center" label="图标" prop="avatar" width="80px">
|
||||
<template #default="scope">
|
||||
<img :src="scope.row.iconUrl" style="width: 40px" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="描述" align="center" prop="intro" />
|
||||
<el-table-column align="center" label="状态" min-width="80">
|
||||
<template #default="{ row }">
|
||||
@ -158,6 +172,7 @@ import { PaidMemberBenefitApi, PaidMemberBenefitVO } from '@/api/mall/promotion/
|
||||
import PaidMemberBenefitForm from './PaidMemberBenefitForm.vue'
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { ProductSpuStatusEnum } from '@/utils/constants'
|
||||
import * as LevelApi from '@/api/member/level'
|
||||
/** 付费会员权益 列表 */
|
||||
defineOptions({ name: 'PaidMemberBenefit' })
|
||||
|
||||
@ -176,7 +191,9 @@ const queryParams = reactive({
|
||||
status: undefined,
|
||||
sort: undefined,
|
||||
createTime: [],
|
||||
levelId: undefined
|
||||
})
|
||||
const memberLevelList = ref() // 等级列表
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
/** 查询列表 */
|
||||
@ -185,13 +202,21 @@ const getList = async () => {
|
||||
try {
|
||||
const data = await PaidMemberBenefitApi.getPaidMemberBenefitPage(queryParams)
|
||||
list.value = data.list
|
||||
console.table(list.value)
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**查询等级列表 */
|
||||
const getMemberLevelList = async () => {
|
||||
const queryLevelParams = reactive({
|
||||
status: 0
|
||||
})
|
||||
const resultData = await LevelApi.getLevelList(queryLevelParams)
|
||||
memberLevelList.value = resultData
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
@ -240,6 +265,7 @@ const handleExport = async () => {
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getMemberLevelList()
|
||||
getList()
|
||||
})
|
||||
/** 更新显示/隐藏状态 */
|
||||
|
@ -13,14 +13,16 @@
|
||||
<el-form-item label="开始时间点" prop="startTime">
|
||||
<el-time-picker
|
||||
v-model="formData.startTime"
|
||||
value-format="HH:mm:ss"
|
||||
value-format="HH:mm"
|
||||
format="HH:mm"
|
||||
placeholder="选择开始时间点"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间点" prop="endTime">
|
||||
<el-time-picker
|
||||
v-model="formData.endTime"
|
||||
value-format="HH:mm:ss"
|
||||
value-format="HH:mm"
|
||||
format="HH:mm"
|
||||
placeholder="选择结束时间点"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
@ -233,7 +233,7 @@ const queryParams = reactive({
|
||||
tagIds: [],
|
||||
levelId: null,
|
||||
groupId: null,
|
||||
isPaidMember: 1
|
||||
activate: 1
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const updateLevelFormRef = ref() // 修改会员等级表单
|
||||
|
106
yudao-admin-vue3/src/views/member/cardbase/CardBaseForm.vue
Normal file
106
yudao-admin-vue3/src/views/member/cardbase/CardBaseForm.vue
Normal file
@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="卡号" prop="cardNum">
|
||||
<el-input v-model="formData.cardNum" placeholder="请输入卡号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="卡密" prop="scret">
|
||||
<el-input v-model="formData.scret" placeholder="请输入卡密" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="上级id" prop="parentId">-->
|
||||
<!-- <el-input v-model="formData.parentId" placeholder="请输入上级id" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="下级id" prop="subId">-->
|
||||
<!-- <el-input v-model="formData.subId" placeholder="请输入下级id" />-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { CardBaseApi, CardBaseVO } from '@/api/cardbase'
|
||||
|
||||
/** 会员卡档案 表单 */
|
||||
defineOptions({ name: 'CardBaseForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
cardNum: undefined,
|
||||
scret: undefined,
|
||||
parentId: undefined,
|
||||
subId: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await CardBaseApi.getCardBase(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as CardBaseVO
|
||||
if (formType.value === 'create') {
|
||||
await CardBaseApi.createCardBase(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await CardBaseApi.updateCardBase(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
cardNum: undefined,
|
||||
scret: undefined,
|
||||
parentId: undefined,
|
||||
subId: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
220
yudao-admin-vue3/src/views/member/cardbase/index.vue
Normal file
220
yudao-admin-vue3/src/views/member/cardbase/index.vue
Normal file
@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="卡号" prop="cardNum">
|
||||
<el-input
|
||||
v-model="queryParams.cardNum"
|
||||
placeholder="请输入卡号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="卡密" prop="scret">
|
||||
<el-input
|
||||
v-model="queryParams.scret"
|
||||
placeholder="请输入卡密"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="上级id" prop="parentId">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.parentId"-->
|
||||
<!-- placeholder="请输入上级id"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter="handleQuery"-->
|
||||
<!-- class="!w-240px"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="下级id" prop="subId">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.subId"-->
|
||||
<!-- placeholder="请输入下级id"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter="handleQuery"-->
|
||||
<!-- class="!w-240px"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['mall:card-base:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['mall:card-base:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="会员卡号" align="center" prop="cardNum" />
|
||||
<el-table-column label="卡密" align="center" prop="scret" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<!-- <el-table-column label="上级id" align="center" prop="parentId" />-->
|
||||
<!-- <el-table-column label="下级id" align="center" prop="subId" />-->
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['mall:card-base:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['mall:card-base:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<CardBaseForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { CardBaseApi, CardBaseVO } from '@/api/cardbase'
|
||||
import CardBaseForm from './CardBaseForm.vue'
|
||||
|
||||
/** 会员卡档案 列表 */
|
||||
defineOptions({ name: 'CardBase' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<CardBaseVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
cardNum: undefined,
|
||||
scret: undefined,
|
||||
createTime: [],
|
||||
parentId: undefined,
|
||||
subId: undefined,
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await CardBaseApi.getCardBasePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await CardBaseApi.deleteCardBase(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await CardBaseApi.exportCardBase(queryParams)
|
||||
download.excel(data, '会员卡档案.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
124
yudao-admin-vue3/src/views/transferCard/TransferForm.vue
Normal file
124
yudao-admin-vue3/src/views/transferCard/TransferForm.vue
Normal file
@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="会员卡号" prop="cardNumber">
|
||||
<el-input v-model="formData.cardNumber" placeholder="请输入会员卡号" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="合伙人" prop="assignorId">-->
|
||||
<!-- <el-input v-model="formData.assignorId" placeholder="请输入合伙人" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="会员" prop="transfereeId">-->
|
||||
<!-- <el-input v-model="formData.transfereeId" placeholder="请输入会员" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="合伙人电话" prop="assignorPhone">
|
||||
<el-input v-model="formData.assignorPhone" placeholder="请输入合伙人电话" />
|
||||
</el-form-item>
|
||||
<el-form-item label="会员电话" prop="transfereePhone">
|
||||
<el-input v-model="formData.transfereePhone" placeholder="请输入会员电话" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="formData.status" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.CARD_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { TransferApi, TransferVO } from '@/api/transferCard'
|
||||
|
||||
/** 会员卡划拨 表单 */
|
||||
defineOptions({ name: 'TransferForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
cardNumber: undefined,
|
||||
assignorId: undefined,
|
||||
transfereeId: undefined,
|
||||
assignorPhone: undefined,
|
||||
transfereePhone: undefined,
|
||||
status: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await TransferApi.getTransfer(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as TransferVO
|
||||
if (formType.value === 'create') {
|
||||
await TransferApi.createTransfer(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await TransferApi.updateTransfer(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
cardNumber: undefined,
|
||||
assignorId: undefined,
|
||||
transfereeId: undefined,
|
||||
assignorPhone: undefined,
|
||||
transfereePhone: undefined,
|
||||
status: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
289
yudao-admin-vue3/src/views/transferCard/index.vue
Normal file
289
yudao-admin-vue3/src/views/transferCard/index.vue
Normal file
@ -0,0 +1,289 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员卡号" prop="cardNumber">
|
||||
<el-input
|
||||
v-model="queryParams.cardNumber"
|
||||
placeholder="请输入会员卡号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="合伙人" prop="assignorId">
|
||||
<el-input
|
||||
v-model="queryParams.assignorId"
|
||||
placeholder="请输入合伙人"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员" prop="transfereeId">
|
||||
<el-input
|
||||
v-model="queryParams.transfereeId"
|
||||
placeholder="请输入会员"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="合伙人电话" prop="assignorPhone">
|
||||
<el-input
|
||||
v-model="queryParams.assignorPhone"
|
||||
placeholder="请输入合伙人电话"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员电话" prop="transfereePhone">
|
||||
<el-input
|
||||
v-model="queryParams.transfereePhone"
|
||||
placeholder="请输入会员电话"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.CARD_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['card:transfer:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['card:transfer:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<!-- <el-table-column label="编号" align="center" prop="id" />-->
|
||||
<el-table-column label="会员卡号" align="center" prop="cardNumber" />
|
||||
<!-- <el-table-column label="合伙人" align="center" prop="assignorId" />-->
|
||||
<!-- <el-table-column label="会员" align="center" prop="transfereeId" />-->
|
||||
<el-table-column label="合伙人电话" align="center" prop="assignorPhone" />
|
||||
<el-table-column label="会员电话" align="center" prop="transfereePhone" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.CARD_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope" >
|
||||
<div v-if="scope.row.status == 0">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="handlePass(scope.row)"
|
||||
v-hasPermi="['card:transfer:delete']"
|
||||
>
|
||||
通过
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['card:transfer:delete']"
|
||||
>
|
||||
驳回
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<TransferForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { TransferApi, TransferVO } from '@/api/transferCard'
|
||||
import TransferForm from './TransferForm.vue'
|
||||
|
||||
/** 会员卡划拨 列表 */
|
||||
defineOptions({ name: 'Transfer' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<TransferVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
createTime: [],
|
||||
cardNumber: undefined,
|
||||
assignorId: undefined,
|
||||
transfereeId: undefined,
|
||||
assignorPhone: undefined,
|
||||
transfereePhone: undefined,
|
||||
status: undefined
|
||||
})
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
cardNumber: undefined,
|
||||
assignorId: undefined,
|
||||
transfereeId: undefined,
|
||||
assignorPhone: undefined,
|
||||
transfereePhone: undefined,
|
||||
status: undefined
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await TransferApi.getTransferPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 审核驳回按钮操作 */
|
||||
const handleDelete = async (list: any) => {
|
||||
try {
|
||||
// 审核驳回的二次确认
|
||||
await message.delConfirm('确定驳回该请求吗','审核确认')
|
||||
// 请求驳回
|
||||
const data = formData.value as unknown as TransferVO
|
||||
data.cardNumber = list.cardNumber;
|
||||
data.transfereeId = list.transfereeId;
|
||||
data.transfereePhone = list.transfereePhone;
|
||||
data.status = -1;
|
||||
data.id = list.id;
|
||||
await TransferApi.updateTransfer(data)
|
||||
message.success(t('common.examineReject'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 审核通过按钮操作 */
|
||||
const handlePass = async (list: any) => {
|
||||
try {
|
||||
// 审核通过的二次确认
|
||||
await message.delConfirm('确定通过该审核吗?','审核确认')
|
||||
// 审核通过
|
||||
const data = formData.value as unknown as TransferVO
|
||||
data.cardNumber = list.cardNumber;
|
||||
data.transfereeId = list.transfereeId;
|
||||
data.transfereePhone = list.transfereePhone;
|
||||
data.status = 1;
|
||||
data.id = list.id;
|
||||
await TransferApi.updateTransfer(data)
|
||||
message.success(t('common.examinePass'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await TransferApi.exportTransfer(queryParams)
|
||||
download.excel(data, '会员卡划拨.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
124
yudao-admin-vue3/src/views/transferlog/TransferLogForm.vue
Normal file
124
yudao-admin-vue3/src/views/transferlog/TransferLogForm.vue
Normal file
@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="会员卡号" prop="cardNumber">
|
||||
<el-input v-model="formData.cardNumber" placeholder="请输入会员卡号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发起人" prop="assignorId">
|
||||
<el-input v-model="formData.assignorId" placeholder="请输入发起人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="划拨人" prop="transfereeId">
|
||||
<el-input v-model="formData.transfereeId" placeholder="请输入划拨人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发起人手机" prop="assignorPhone">
|
||||
<el-input v-model="formData.assignorPhone" placeholder="请输入发起人手机" />
|
||||
</el-form-item>
|
||||
<el-form-item label="划拨人手机" prop="transfereePhone">
|
||||
<el-input v-model="formData.transfereePhone" placeholder="请输入划拨人手机" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="formData.status" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.CARD_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { TransferLogApi, TransferLogVO } from '@/api/transferlog'
|
||||
|
||||
/** 会员卡划拨记录 表单 */
|
||||
defineOptions({ name: 'TransferLogForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
cardNumber: undefined,
|
||||
assignorId: undefined,
|
||||
transfereeId: undefined,
|
||||
assignorPhone: undefined,
|
||||
transfereePhone: undefined,
|
||||
status: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await TransferLogApi.getTransferLog(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as TransferLogVO
|
||||
if (formType.value === 'create') {
|
||||
await TransferLogApi.createTransferLog(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await TransferLogApi.updateTransferLog(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
cardNumber: undefined,
|
||||
assignorId: undefined,
|
||||
transfereeId: undefined,
|
||||
assignorPhone: undefined,
|
||||
transfereePhone: undefined,
|
||||
status: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
253
yudao-admin-vue3/src/views/transferlog/index.vue
Normal file
253
yudao-admin-vue3/src/views/transferlog/index.vue
Normal file
@ -0,0 +1,253 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员卡号" prop="cardNumber">
|
||||
<el-input
|
||||
v-model="queryParams.cardNumber"
|
||||
placeholder="请输入会员卡号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发起人" prop="assignorId">
|
||||
<el-input
|
||||
v-model="queryParams.assignorId"
|
||||
placeholder="请输入发起人"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="划拨人" prop="transfereeId">
|
||||
<el-input
|
||||
v-model="queryParams.transfereeId"
|
||||
placeholder="请输入划拨人"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发起人手机" prop="assignorPhone">
|
||||
<el-input
|
||||
v-model="queryParams.assignorPhone"
|
||||
placeholder="请输入发起人手机"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="划拨人手机" prop="transfereePhone">
|
||||
<el-input
|
||||
v-model="queryParams.transfereePhone"
|
||||
placeholder="请输入划拨人手机"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.CARD_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['card:transfer-log:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['card:transfer-log:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<!-- <el-table-column label="划拨id" align="center" prop="id" />-->
|
||||
<el-table-column label="会员卡号" align="center" prop="cardNumber" />
|
||||
<el-table-column label="发起人" align="center" prop="assignorId" />
|
||||
<el-table-column label="划拨人" align="center" prop="transfereeId" />
|
||||
<el-table-column label="发起人手机" align="center" prop="assignorPhone" />
|
||||
<el-table-column label="划拨人手机" align="center" prop="transfereePhone" />
|
||||
<!-- <el-table-column label="状态" align="center" prop="status">-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- <dict-tag :type="DICT_TYPE.CARD_STATUS" :value="scope.row.status" />-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['card:transfer-log:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['card:transfer-log:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<TransferLogForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { TransferLogApi, TransferLogVO } from '@/api/transferlog'
|
||||
import TransferLogForm from './TransferLogForm.vue'
|
||||
|
||||
/** 会员卡划拨记录 列表 */
|
||||
defineOptions({ name: 'TransferLog' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<TransferLogVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
createTime: [],
|
||||
cardNumber: undefined,
|
||||
assignorId: undefined,
|
||||
transfereeId: undefined,
|
||||
assignorPhone: undefined,
|
||||
transfereePhone: undefined,
|
||||
status: undefined,
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await TransferLogApi.getTransferLogPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await TransferLogApi.deleteTransferLog(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await TransferLogApi.exportTransferLog(queryParams)
|
||||
download.excel(data, '会员卡划拨记录.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
@ -59,4 +59,8 @@ public class BrokerageUserDO extends BaseDO {
|
||||
* 冻结佣金
|
||||
*/
|
||||
private Integer frozenPrice;
|
||||
/**
|
||||
* 二级绑定
|
||||
*/
|
||||
private Long bindSecondUserId;
|
||||
}
|
||||
|
@ -143,4 +143,9 @@ public interface BrokerageUserService {
|
||||
*/
|
||||
PageResult<AppBrokerageUserChildSummaryRespVO> getBrokerageUserChildSummaryPage(AppBrokerageUserChildSummaryPageReqVO pageReqVO, Long userId);
|
||||
|
||||
boolean createBrokerageUser(@NotNull Long userId, Long bindUserId);
|
||||
|
||||
void updateBrokerageByUserId(Long id, Long bindUserId);
|
||||
|
||||
void updateBrokerageBySecondUserId(Long id, Long secondBindUserId);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageEnabledConditionEn
|
||||
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.service.config.TradeConfigService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -264,6 +265,39 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
|
||||
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createBrokerageUser(Long userId, Long bindUserId) {
|
||||
BrokerageUserDO brokerageUserDO = new BrokerageUserDO();
|
||||
brokerageUserDO.setId(userId);
|
||||
brokerageUserDO.setBindUserId(bindUserId);
|
||||
brokerageUserDO.setBindUserTime(LocalDateTime.now());
|
||||
brokerageUserDO.setBrokerageEnabled(true);
|
||||
brokerageUserDO.setDeleted(false);
|
||||
brokerageUserDO.setBindUserTime(LocalDateTime.now());
|
||||
brokerageUserMapper.insert(brokerageUserDO);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBrokerageByUserId(Long id, Long bindUserId) {
|
||||
// 校验存在
|
||||
BrokerageUserDO brokerageUser = validateBrokerageUserExists(id);
|
||||
brokerageUser.setBindUserId(bindUserId);
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("id",brokerageUser.getId());
|
||||
brokerageUserMapper.update(brokerageUser,queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBrokerageBySecondUserId(Long id, Long secondBindUserId) {
|
||||
// 校验存在
|
||||
BrokerageUserDO brokerageUser = validateBrokerageUserExists(id);
|
||||
brokerageUser.setBindSecondUserId(secondBindUserId);
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("id",brokerageUser.getId());
|
||||
brokerageUserMapper.update(brokerageUser,queryWrapper);
|
||||
}
|
||||
|
||||
private boolean isUserCanBind(BrokerageUserDO user) {
|
||||
// 校验分销功能是否启用
|
||||
TradeConfigDO tradeConfig = tradeConfigService.getTradeConfig();
|
||||
|
@ -0,0 +1,8 @@
|
||||
package cn.iocoder.yudao.module.member.api.clubCard;
|
||||
|
||||
import cn.iocoder.yudao.module.member.api.clubCard.vo.ClubCardApiVo;
|
||||
|
||||
public interface ClubCardApi {
|
||||
ClubCardApiVo getCard(Integer id);
|
||||
ClubCardApiVo getCardBySubId(Integer subId);
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.member.api.clubCard.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 会员卡 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Data
|
||||
public class ClubCardApiVo {
|
||||
|
||||
/**
|
||||
* 会员卡编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 上级用户id
|
||||
*/
|
||||
private Integer parentId;
|
||||
/**
|
||||
* 下级用户id
|
||||
*/
|
||||
private Integer subId;
|
||||
/**
|
||||
* 会员卡号
|
||||
*/
|
||||
private String cardNumber;
|
||||
/**
|
||||
* 是否已激活(0:未激活 , 1:已激活)
|
||||
*
|
||||
*/
|
||||
private Integer isActivate;
|
||||
|
||||
/**
|
||||
* 昵称(后面改用成了合伙人手机号)
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号(会员的)
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 激活时间
|
||||
*/
|
||||
private LocalDateTime activateTime;
|
||||
|
||||
/**
|
||||
* 卡密
|
||||
*/
|
||||
private String scret;
|
||||
|
||||
}
|
@ -17,6 +17,10 @@ public class MemberUserRespDTO {
|
||||
* 用户ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 真实名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
|
@ -55,5 +55,14 @@ public interface ErrorCodeConstants {
|
||||
//========== 用户分组 1-004-012-000 ==========
|
||||
ErrorCode GROUP_NOT_EXISTS = new ErrorCode(1_004_012_000, "用户分组不存在");
|
||||
ErrorCode GROUP_HAS_USER = new ErrorCode(1_004_012_001, "用户分组下存在用户,无法删除");
|
||||
//============================================
|
||||
ErrorCode CARD_LOG_NOT_EXISTS = new ErrorCode(1_004_013_000, "发卡记录不存在");
|
||||
ErrorCode AFTER_VERIFICATION_NOT_EXISTS = new ErrorCode(1_004_014_000, "核销记录不存在");
|
||||
ErrorCode CARD_BASE_NOT_EXISTS = new ErrorCode(1_004_015_000, "会员卡档案不存在");
|
||||
ErrorCode INTEREST_NOT_EXISTS = new ErrorCode(1_004_016_000, "权益通知不存在");
|
||||
ErrorCode TRANSFER_NOT_EXISTS = new ErrorCode(1_004_017_000, "会员卡划拨不存在");
|
||||
ErrorCode TRANSFER_LOG_NOT_EXISTS = new ErrorCode(1_004_018_000, "会员卡划拨记录不存在");
|
||||
|
||||
// ========== ==========
|
||||
ErrorCode INPUTCODE_NOT_EXISTS = new ErrorCode(1_004_019_000, "进件码不存在");
|
||||
}
|
||||
|
@ -18,7 +18,9 @@ public enum MemberPointBizTypeEnum implements IntArrayValuable {
|
||||
|
||||
SIGN(1, "签到", "签到获得 {} 积分", true),
|
||||
ADMIN(2, "管理员修改", "管理员修改 {} 积分", true),
|
||||
|
||||
JOIN_AS_A_PARTNER(33,"加入合伙人","加入合伙人获得 {} 积分",true),
|
||||
BIND_MEMBERSHIP_CARD(34,"绑定会员卡","绑定会员卡获得 {} 积分",true),
|
||||
MEMBERSHIP_LEVEL_PROMOTION(35,"等级提升","等级提升获得 {} 积分",true),
|
||||
ORDER_USE(11, "订单积分抵扣", "下单使用 {} 积分", false), // 下单时,扣减积分
|
||||
ORDER_USE_CANCEL(12, "订单积分抵扣(整单取消)", "订单取消,退还 {} 积分", true), // ORDER_USE 的取消
|
||||
ORDER_USE_CANCEL_ITEM(13, "订单积分抵扣(单个退款)", "订单退款,退还 {} 积分", true), // ORDER_USE 的取消
|
||||
|
@ -90,7 +90,12 @@
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-trade-biz</artifactId>
|
||||
<scope>compile</scope>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.member.api.clubCard;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.api.clubCard.vo.ClubCardApiVo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.clubCard.ClubCardDO;
|
||||
import cn.iocoder.yudao.module.member.service.clubCard.ClubCardService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
public class clubCardApiImpl implements ClubCardApi{
|
||||
@Resource
|
||||
private ClubCardService cardService;
|
||||
@Override
|
||||
public ClubCardApiVo getCard(Integer id) {
|
||||
ClubCardDO card = cardService.getCard(id);
|
||||
return BeanUtils.toBean(card, ClubCardApiVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClubCardApiVo getCardBySubId(Integer subId) {
|
||||
ClubCardDO cardBySubId = cardService.getCardBySubId(subId);
|
||||
return BeanUtils.toBean(cardBySubId, ClubCardApiVo.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,176 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.afterverification;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.afterverification.vo.AfterVerificationPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.afterverification.vo.AfterVerificationRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.afterverification.vo.AfterVerificationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.afterverification.AfterVerificationDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.afterverification.AfterVerificationMapper;
|
||||
import cn.iocoder.yudao.module.member.service.afterverification.AfterVerificationService;
|
||||
import cn.iocoder.yudao.module.member.service.interest.InterestService;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 核销记录")
|
||||
@RestController
|
||||
@RequestMapping("/cancel/after-verification")
|
||||
@Validated
|
||||
public class AfterVerificationController {
|
||||
|
||||
@Resource
|
||||
private AfterVerificationService afterVerificationService;
|
||||
|
||||
@Resource
|
||||
private InterestService interestService;
|
||||
|
||||
@Resource
|
||||
private MemberUserService memberUserService;
|
||||
|
||||
@Resource
|
||||
private MemberUserApi memberUserApi;
|
||||
|
||||
@Resource
|
||||
private AfterVerificationMapper afterVerificationMapper;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建核销记录")
|
||||
@PreAuthorize("@ss.hasPermission('cancel:after-verification:create')")
|
||||
public CommonResult<Long> createAfterVerification(@Valid @RequestBody AfterVerificationSaveReqVO createReqVO) {
|
||||
return success(afterVerificationService.createAfterVerification(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新核销记录")
|
||||
@PreAuthorize("@ss.hasPermission('cancel:after-verification:update')")
|
||||
public CommonResult<Boolean> updateAfterVerification(@Valid @RequestBody AfterVerificationSaveReqVO updateReqVO) {
|
||||
afterVerificationService.updateAfterVerification(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除核销记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('cancel:after-verification:delete')")
|
||||
public CommonResult<Boolean> deleteAfterVerification(@RequestParam("id") Long id) {
|
||||
afterVerificationService.deleteAfterVerification(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得核销记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('cancel:after-verification:query')")
|
||||
public CommonResult<AfterVerificationRespVO> getAfterVerification(@RequestParam("id") Long id) {
|
||||
AfterVerificationDO afterVerification = afterVerificationService.getAfterVerification(id);
|
||||
return success(BeanUtils.toBean(afterVerification, AfterVerificationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得核销记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('cancel:after-verification:query')")
|
||||
public CommonResult<PageResult<AfterVerificationRespVO>> getAfterVerificationPage(@Valid AfterVerificationPageReqVO pageReqVO) {
|
||||
PageResult<AfterVerificationDO> pageResult = afterVerificationService.getAfterVerificationPage(pageReqVO);
|
||||
PageResult<AfterVerificationRespVO> result = BeanUtils.toBean(pageResult, AfterVerificationRespVO.class);
|
||||
ArrayList<Long> list = new ArrayList<>();
|
||||
for (AfterVerificationRespVO respVO : result.getList()) {
|
||||
list.add(respVO.getMemberUserId());
|
||||
}
|
||||
Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(list);
|
||||
for (AfterVerificationRespVO respVO : result.getList()) {
|
||||
if (userMap.get(respVO.getMemberUserId()) != null){
|
||||
respVO.setName(userMap.get(respVO.getMemberUserId()).getName());
|
||||
}
|
||||
}
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出核销记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('cancel:after-verification:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportAfterVerificationExcel(@Valid AfterVerificationPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<AfterVerificationDO> list = afterVerificationService.getAfterVerificationPage(pageReqVO).getList();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
List<AfterVerificationRespVO> voList = BeanUtils.toBean(list, AfterVerificationRespVO.class);
|
||||
ArrayList<Long> arrayList = new ArrayList<>();
|
||||
for (AfterVerificationRespVO respVO : voList) {
|
||||
respVO.setCreateTimeToString(respVO.getCreateTime().format(formatter));
|
||||
arrayList.add(respVO.getMemberUserId());
|
||||
}
|
||||
Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(arrayList);
|
||||
for (AfterVerificationRespVO respVO : voList) {
|
||||
if (userMap.get(respVO.getMemberUserId()) != null){
|
||||
respVO.setName(userMap.get(respVO.getMemberUserId()).getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "核销记录.xls", "数据", AfterVerificationRespVO.class,
|
||||
voList);
|
||||
}
|
||||
|
||||
// @GetMapping("/test")
|
||||
// public void test(AfterVerificationPageReqVO pageReqVO){
|
||||
// pageReqVO.setPageNo(1);
|
||||
// pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
// List<AfterVerificationDO> list = afterVerificationService.getAfterVerificationPage(pageReqVO).getList();
|
||||
// Collections.reverse(list);
|
||||
// ArrayList<String> arrayList = new ArrayList<>();
|
||||
// for (AfterVerificationDO verificationDO : list) {
|
||||
// MemberUserDO user = memberUserService.getUser(verificationDO.getMemberUserId());
|
||||
// if (user != null){
|
||||
// long count = arrayList.stream()
|
||||
// .filter(s -> s.equals(verificationDO.getCardNumber()))
|
||||
// .count();
|
||||
// verificationDO.setSurplusCounts(interestService.getInterest(user.getNoticeInterestId()).getIsUsed().longValue() - count - 1);
|
||||
// arrayList.add(verificationDO.getCardNumber());
|
||||
// }
|
||||
// }
|
||||
// afterVerificationMapper.updateBatch(list);
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/test1")
|
||||
// public void test1(){
|
||||
// List<String> list = new ArrayList<>();
|
||||
// list.add("commercial");
|
||||
// list.add("commer");
|
||||
// list.add("commer");
|
||||
// list.add("commerce");
|
||||
// list.add("commer");
|
||||
//
|
||||
// // 统计包含 "commer" 的字符串的数量
|
||||
// long count = list.stream()
|
||||
// .filter(s -> s.equals("commer"))
|
||||
// .count();
|
||||
//
|
||||
// System.out.println("Number of strings containing 'commer': " + count);
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.afterverification.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 核销记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AfterVerificationPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "核销时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "会员id", example = "25415")
|
||||
private Long memberUserId;
|
||||
|
||||
@Schema(description = "商品名称", example = "芋艿")
|
||||
private String goodsName;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "昵称", example = "王五")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String phone;
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.afterverification.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 核销记录 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AfterVerificationRespVO {
|
||||
|
||||
@Schema(description = "核销编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "16608")
|
||||
// @ExcelProperty("核销编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
@ExcelProperty("会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "昵称", example = "王五")
|
||||
@ExcelProperty("昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "姓名", example = "王五")
|
||||
@ExcelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
@ExcelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "商品名称", example = "芋艿")
|
||||
@ExcelProperty("商品名称")
|
||||
private String goodsName;
|
||||
|
||||
@Schema(description = "会员id", example = "25415")
|
||||
// @ExcelProperty("会员id")
|
||||
private Long memberUserId;
|
||||
|
||||
@Schema(description = "核销时间")
|
||||
// @ExcelProperty("核销时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "核销时间")
|
||||
@ExcelProperty("核销时间")
|
||||
private String createTimeToString;
|
||||
|
||||
@Schema(description = "核销时间")
|
||||
@ExcelProperty("剩余核销次数")
|
||||
private Long surplusCounts;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.afterverification.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 核销记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class AfterVerificationSaveReqVO {
|
||||
|
||||
// @Schema(description = "核销编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "16608")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "会员id", example = "25415")
|
||||
private Long memberUserId;
|
||||
|
||||
@Schema(description = "商品名称", example = "芋艿")
|
||||
private String goodsName;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "会员昵称", example = "王五")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "剩余次数")
|
||||
private Long surplusCounts;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.cardbase;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardbase.vo.CardBasePageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardbase.vo.CardBaseRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardbase.vo.CardBaseSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.cardbase.CardBaseDO;
|
||||
import cn.iocoder.yudao.module.member.service.cardbase.CardBaseService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 会员卡档案")
|
||||
@RestController
|
||||
@RequestMapping("/mall/card-base")
|
||||
@Validated
|
||||
public class CardBaseController {
|
||||
|
||||
@Resource
|
||||
private CardBaseService cardBaseService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建会员卡档案")
|
||||
@PreAuthorize("@ss.hasPermission('mall:card-base:create')")
|
||||
public CommonResult<Long> createCardBase(@Valid @RequestBody CardBaseSaveReqVO createReqVO) {
|
||||
return success(cardBaseService.createCardBase(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新会员卡档案")
|
||||
@PreAuthorize("@ss.hasPermission('mall:card-base:update')")
|
||||
public CommonResult<Boolean> updateCardBase(@Valid @RequestBody CardBaseSaveReqVO updateReqVO) {
|
||||
cardBaseService.updateCardBase(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除会员卡档案")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('mall:card-base:delete')")
|
||||
public CommonResult<Boolean> deleteCardBase(@RequestParam("id") Long id) {
|
||||
cardBaseService.deleteCardBase(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员卡档案")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mall:card-base:query')")
|
||||
public CommonResult<CardBaseRespVO> getCardBase(@RequestParam("id") Long id) {
|
||||
CardBaseDO cardBase = cardBaseService.getCardBase(id);
|
||||
return success(BeanUtils.toBean(cardBase, CardBaseRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得会员卡档案分页")
|
||||
@PreAuthorize("@ss.hasPermission('mall:card-base:query')")
|
||||
public CommonResult<PageResult<CardBaseRespVO>> getCardBasePage(@Valid CardBasePageReqVO pageReqVO) {
|
||||
PageResult<CardBaseDO> pageResult = cardBaseService.getCardBasePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CardBaseRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出会员卡档案 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('mall:card-base:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportCardBaseExcel(@Valid CardBasePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<CardBaseDO> list = cardBaseService.getCardBasePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "会员卡档案.xls", "数据", CardBaseRespVO.class,
|
||||
BeanUtils.toBean(list, CardBaseRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.cardbase.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡档案分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CardBasePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "卡号")
|
||||
private String cardNum;
|
||||
|
||||
@Schema(description = "卡密")
|
||||
private String scret;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "上级id", example = "15709")
|
||||
private Integer parentId;
|
||||
|
||||
@Schema(description = "下级id", example = "2163")
|
||||
private Integer subId;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.cardbase.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡档案 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CardBaseRespVO {
|
||||
|
||||
@Schema(description = "档案编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28190")
|
||||
@ExcelProperty("档案编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "卡号")
|
||||
@ExcelProperty("卡号")
|
||||
private String cardNum;
|
||||
|
||||
@Schema(description = "卡密")
|
||||
@ExcelProperty("卡密")
|
||||
private String scret;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "上级id", example = "15709")
|
||||
@ExcelProperty("上级id")
|
||||
private Integer parentId;
|
||||
|
||||
@Schema(description = "下级id", example = "2163")
|
||||
@ExcelProperty("下级id")
|
||||
private Integer subId;
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.cardbase.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡档案新增/修改 Request VO")
|
||||
@Data
|
||||
public class CardBaseSaveReqVO {
|
||||
|
||||
@Schema(description = "档案编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28190")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "卡号")
|
||||
private String cardNum;
|
||||
|
||||
@Schema(description = "卡密")
|
||||
private String scret;
|
||||
|
||||
@Schema(description = "上级id", example = "15709")
|
||||
private Integer parentId;
|
||||
|
||||
@Schema(description = "下级id", example = "2163")
|
||||
private Integer subId;
|
||||
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.cardlog;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardlog.vo.CardLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardlog.vo.CardLogRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardlog.vo.CardLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.cardlog.CardLogDO;
|
||||
import cn.iocoder.yudao.module.member.service.cardlog.CardLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 发卡记录")
|
||||
@RestController
|
||||
@RequestMapping("/send/card-log")
|
||||
@Validated
|
||||
public class CardLogController {
|
||||
|
||||
@Resource
|
||||
private CardLogService cardLogService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建发卡记录")
|
||||
@PreAuthorize("@ss.hasPermission('send:card-log:create')")
|
||||
public CommonResult<Integer> createCardLog(@Valid @RequestBody CardLogSaveReqVO createReqVO) {
|
||||
return success(cardLogService.createCardLog(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新发卡记录")
|
||||
@PreAuthorize("@ss.hasPermission('send:card-log:update')")
|
||||
public CommonResult<Boolean> updateCardLog(@Valid @RequestBody CardLogSaveReqVO updateReqVO) {
|
||||
cardLogService.updateCardLog(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除发卡记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('send:card-log:delete')")
|
||||
public CommonResult<Boolean> deleteCardLog(@RequestParam("id") Integer id) {
|
||||
cardLogService.deleteCardLog(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得发卡记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('send:card-log:query')")
|
||||
public CommonResult<CardLogRespVO> getCardLog(@RequestParam("id") Integer id) {
|
||||
CardLogDO cardLog = cardLogService.getCardLog(id);
|
||||
return success(BeanUtils.toBean(cardLog, CardLogRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得发卡记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('send:card-log:query')")
|
||||
public CommonResult<PageResult<CardLogRespVO>> getCardLogPage(@Valid CardLogPageReqVO pageReqVO) {
|
||||
PageResult<CardLogDO> pageResult = cardLogService.getCardLogPage(pageReqVO);
|
||||
System.out.println("--------------------------");
|
||||
System.out.println(pageResult);
|
||||
System.out.println("--------------------------");
|
||||
return success(BeanUtils.toBean(pageResult, CardLogRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出发卡记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('send:card-log:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportCardLogExcel(@Valid CardLogPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<CardLogDO> list = cardLogService.getCardLogPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "发卡记录.xls", "数据", CardLogRespVO.class,
|
||||
BeanUtils.toBean(list, CardLogRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.cardlog.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 发卡记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CardLogPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "会员昵称", example = "芋艿")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer countNumber;
|
||||
|
||||
@Schema(description = "发卡时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "起始卡号")
|
||||
private String starNumber;
|
||||
|
||||
@Schema(description = "结束卡号")
|
||||
private String endNumber;
|
||||
|
||||
@Schema(description = "卡号区间")
|
||||
private String cardSection;
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.cardlog.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 发卡记录 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CardLogRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9984")
|
||||
@ExcelProperty("编号")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "会员昵称", example = "芋艿")
|
||||
@ExcelProperty("会员昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
@ExcelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "数量")
|
||||
@ExcelProperty("数量")
|
||||
private Integer countNumber;
|
||||
|
||||
@Schema(description = "发卡时间")
|
||||
@ExcelProperty("发卡时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "起始卡号")
|
||||
@ExcelProperty("起始卡号")
|
||||
private String starNumber;
|
||||
|
||||
@Schema(description = "结束卡号")
|
||||
@ExcelProperty("结束卡号")
|
||||
private String endNumber;
|
||||
|
||||
@Schema(description = "卡号区间")
|
||||
@ExcelProperty("卡号区间")
|
||||
private String cardSection;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.cardlog.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 发卡记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class CardLogSaveReqVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9984")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "会员昵称", example = "芋艿")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer countNumber;
|
||||
|
||||
@Schema(description = "起始卡号")
|
||||
private String starNumber;
|
||||
|
||||
@Schema(description = "结束卡号")
|
||||
private String endNumber;
|
||||
|
||||
@Schema(description = "卡号区间")
|
||||
private String cardSection;
|
||||
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.clubCard;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.clubCard.ClubCardDO;
|
||||
import cn.iocoder.yudao.module.member.service.clubCard.ClubCardService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 会员卡")
|
||||
@RestController
|
||||
@RequestMapping("/club/card")
|
||||
@Validated
|
||||
public class ClubCardController {
|
||||
|
||||
@Resource
|
||||
private ClubCardService cardService;
|
||||
@Resource
|
||||
private MemberUserApi memberUserApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建会员卡")
|
||||
@PreAuthorize("@ss.hasPermission('club:card:create')")
|
||||
public CommonResult<Integer> createCard(@Valid @RequestBody ClubCardSaveReqVO createReqVO) {
|
||||
return success(cardService.createCard(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新会员卡")
|
||||
@PreAuthorize("@ss.hasPermission('club:card:update')")
|
||||
public CommonResult<Boolean> updateCard(@Valid @RequestBody ClubCardSaveReqVO updateReqVO) {
|
||||
cardService.updateCard(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除会员卡")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('club:card:delete')")
|
||||
public CommonResult<Boolean> deleteCard(@RequestParam("id") Integer id) {
|
||||
ClubCardDO card = cardService.getCard(id);
|
||||
if (card.getIsActivate() == 0){
|
||||
cardService.deleteCard(id);
|
||||
return success(true);
|
||||
}else {
|
||||
return success(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员卡")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('club:card:query')")
|
||||
public CommonResult<ClubCardRespVO> getCard(@RequestParam("id") Integer id) {
|
||||
ClubCardDO card = cardService.getCard(id);
|
||||
return success(BeanUtils.toBean(card, ClubCardRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得会员卡分页")
|
||||
@PreAuthorize("@ss.hasPermission('club:card:query')")
|
||||
public CommonResult<PageResult<ClubCardRespVO>> getCardPage(@Valid ClubCardPageReqVO pageReqVO) {
|
||||
PageResult<ClubCardDO> pageResult = cardService.getCardPage(pageReqVO);
|
||||
PageResult<ClubCardRespVO> clubCardRespVOPageResult = BeanUtils.toBean(pageResult, ClubCardRespVO.class);
|
||||
for (ClubCardRespVO respVO : clubCardRespVOPageResult.getList()) {
|
||||
MemberUserRespDTO user = memberUserApi.getUser(respVO.getParentId().longValue());
|
||||
if (respVO.getSubId() != null){
|
||||
MemberUserRespDTO dto = memberUserApi.getUser(respVO.getSubId().longValue());
|
||||
respVO.setSubName(dto.getName());
|
||||
}
|
||||
respVO.setParentName(user.getName());
|
||||
}
|
||||
return success(clubCardRespVOPageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出会员卡 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('club:card:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportCardExcel(@Valid ClubCardPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ClubCardDO> list = cardService.getCardPage(pageReqVO).getList();
|
||||
ArrayList<Long> parIds = new ArrayList<>();
|
||||
ArrayList<Long> subIds = new ArrayList<>();
|
||||
for (ClubCardDO cardDO : list) {
|
||||
if (cardDO.getParentId() != null){
|
||||
parIds.add(cardDO.getParentId().longValue());
|
||||
}
|
||||
if (cardDO.getSubId() != null){
|
||||
subIds.add(cardDO.getSubId().longValue());
|
||||
}
|
||||
}
|
||||
List<ClubCardRespVO> voList = BeanUtils.toBean(list, ClubCardRespVO.class);
|
||||
Map<Long, MemberUserRespDTO> parMap = memberUserApi.getUserMap(parIds);
|
||||
Map<Long, MemberUserRespDTO> subMap = memberUserApi.getUserMap(subIds);
|
||||
for (ClubCardRespVO vo : voList) {
|
||||
if (vo.getParentId() != null && parMap != null){
|
||||
vo.setParentName(parMap.get(vo.getParentId().longValue()).getName());
|
||||
}
|
||||
if (vo.getSubId() != null && subMap != null){
|
||||
vo.setSubName(subMap.get(vo.getSubId().longValue()).getName());
|
||||
}
|
||||
}
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "会员卡.xls", "数据", ClubCardRespVO.class,
|
||||
voList);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.clubCard.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ClubCardPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "上级用户id", example = "31810")
|
||||
private Integer parentId;
|
||||
|
||||
@Schema(description = "下级用户id", example = "18337")
|
||||
private Integer subId;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "是否已激活(0:未激活 , 1:已激活)")
|
||||
private Integer isActivate;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "激活时间")
|
||||
private LocalDateTime activateTime;
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.clubCard.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ClubCardRespVO {
|
||||
|
||||
@Schema(description = "会员卡编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27892")
|
||||
@ExcelProperty("会员卡编号")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "上级用户id", example = "31810")
|
||||
@ExcelProperty("上级用户id")
|
||||
private Integer parentId;
|
||||
|
||||
@Schema(description = "下级用户id", example = "18337")
|
||||
@ExcelProperty("下级用户id")
|
||||
private Integer subId;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
@ExcelProperty("会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "是否已激活")
|
||||
@ExcelProperty(value = "是否已激活", converter = DictConvert.class)
|
||||
@DictFormat("is_activate") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer isActivate;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "合伙人手机")
|
||||
@ExcelProperty("合伙人手机")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
@ExcelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "合伙人姓名")
|
||||
@ExcelProperty("合伙人姓名")
|
||||
private String parentName;
|
||||
|
||||
@Schema(description = "领取人姓名")
|
||||
@ExcelProperty("领取人姓名")
|
||||
private String subName;
|
||||
|
||||
@Schema(description = "激活时间")
|
||||
@ExcelProperty("激活时间")
|
||||
private LocalDateTime activateTime;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.clubCard.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡新增/修改 Request VO")
|
||||
@Data
|
||||
public class ClubCardSaveReqVO {
|
||||
|
||||
@Schema(description = "会员卡编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27892")
|
||||
private Integer id;
|
||||
|
||||
// @Schema(description = "上级用户id", example = "31810")
|
||||
// private Integer parentId;
|
||||
//
|
||||
// @Schema(description = "下级用户id", example = "18337")
|
||||
// private Integer subId;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "是否已激活(0:未激活 , 1:已激活)")
|
||||
private Integer isActivate;
|
||||
|
||||
@Schema(description = "卡密")
|
||||
private String secret;
|
||||
|
||||
@Schema(description = "会员权益id")
|
||||
private Long noticeInterestId;
|
||||
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.interest;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.interest.InterestDO;
|
||||
import cn.iocoder.yudao.module.member.service.interest.InterestService;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataSaveReqApiVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 权益通知")
|
||||
@RestController
|
||||
@RequestMapping("/notice/interest")
|
||||
@Validated
|
||||
public class InterestController {
|
||||
|
||||
@Resource
|
||||
private InterestService interestService;
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建权益通知")
|
||||
@PreAuthorize("@ss.hasPermission('notice:interest:create')")
|
||||
public CommonResult<Long> createInterest(@Valid @RequestBody InterestSaveReqVO createReqVO) {
|
||||
Long interest = interestService.createInterest(createReqVO);
|
||||
DictDataSaveReqApiVO apiVO = new DictDataSaveReqApiVO();
|
||||
apiVO.setLabel(createReqVO.getTitle());
|
||||
apiVO.setDictType("member_meal");
|
||||
apiVO.setSort(1);
|
||||
apiVO.setValue(interest.toString());
|
||||
apiVO.setStatus(0);
|
||||
apiVO.setColorType("default");
|
||||
dictDataApi.createDictDataApi(apiVO);
|
||||
return success(interest);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新权益通知")
|
||||
@PreAuthorize("@ss.hasPermission('notice:interest:update')")
|
||||
public CommonResult<Boolean> updateInterest(@Valid @RequestBody InterestSaveReqVO updateReqVO) {
|
||||
interestService.updateInterest(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除权益通知")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('notice:interest:delete')")
|
||||
public CommonResult<Boolean> deleteInterest(@RequestParam("id") Long id) {
|
||||
interestService.deleteInterest(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得权益通知")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('notice:interest:query')")
|
||||
public CommonResult<InterestRespVO> getInterest(@RequestParam("id") Long id) {
|
||||
InterestDO interest = interestService.getInterest(id);
|
||||
return success(BeanUtils.toBean(interest, InterestRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得权益通知分页")
|
||||
@PreAuthorize("@ss.hasPermission('notice:interest:query')")
|
||||
public CommonResult<PageResult<InterestRespVO>> getInterestPage(@Valid InterestPageReqVO pageReqVO) {
|
||||
PageResult<InterestDO> pageResult = interestService.getInterestPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, InterestRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出权益通知 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('notice:interest:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportInterestExcel(@Valid InterestPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<InterestDO> list = interestService.getInterestPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "权益通知.xls", "数据", InterestRespVO.class,
|
||||
BeanUtils.toBean(list, InterestRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.interest.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 权益通知分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InterestPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "权益标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "权益描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "权益内容")
|
||||
private String equity;
|
||||
|
||||
@Schema(description = "须知内容")
|
||||
private String notice;
|
||||
|
||||
@Schema(description = "权益次数")
|
||||
private Integer isUsed;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.interest.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 权益通知 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class InterestRespVO {
|
||||
|
||||
@Schema(description = "权益编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12188")
|
||||
@ExcelProperty("权益编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "权益标题")
|
||||
@ExcelProperty("权益标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "权益描述")
|
||||
@ExcelProperty("权益描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "权益内容")
|
||||
@ExcelProperty("权益内容")
|
||||
private String equity;
|
||||
|
||||
@Schema(description = "须知内容")
|
||||
@ExcelProperty("须知内容")
|
||||
private String notice;
|
||||
|
||||
@Schema(description = "权益次数")
|
||||
private Integer isUsed;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.interest.vo;
|
||||
|
||||
import com.mzt.logapi.starter.annotation.DiffLogField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 权益通知新增/修改 Request VO")
|
||||
@Data
|
||||
public class InterestSaveReqVO {
|
||||
|
||||
@Schema(description = "权益编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12188")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "权益标题")
|
||||
@DiffLogField(name = "权益标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "权益描述")
|
||||
@DiffLogField(name = "权益描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "权益内容")
|
||||
@DiffLogField(name = "权益内容")
|
||||
private String equity;
|
||||
|
||||
@Schema(description = "须知内容")
|
||||
@DiffLogField(name = "须知内容")
|
||||
private String notice;
|
||||
|
||||
@Schema(description = "权益次数")
|
||||
@DiffLogField(name = "权益次数")
|
||||
private Integer isUsed;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
@DiffLogField(name = "商品名称")
|
||||
private String goodsName;
|
||||
|
||||
}
|
@ -56,7 +56,7 @@ public class PaidMemberBenefitController {
|
||||
return success(true);
|
||||
}
|
||||
@PutMapping("/updateStatus")
|
||||
@Operation(summary = "更新付费会员权益")
|
||||
@Operation(summary = "更新付费会员权益状态")
|
||||
@PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:update')")
|
||||
public CommonResult<Boolean> updatePaidMemberBenefitStatus(@RequestBody PaidMemberBenefitStatusReqVO req) {
|
||||
paidMemberBenefitService.updatePaidMemberBenefitStatus(req);
|
||||
|
@ -31,4 +31,7 @@ public class PaidMemberBenefitSaveReqVO {
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "等级Id列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "等级Id不能为空")
|
||||
private List<Long> levelIdList;
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.transfer;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transfer.vo.TransferPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transfer.vo.TransferRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transfer.vo.TransferSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.clubCard.ClubCardDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.transfer.TransferDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.service.clubCard.ClubCardService;
|
||||
import cn.iocoder.yudao.module.member.service.transfer.TransferService;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 会员卡划拨")
|
||||
@RestController
|
||||
@RequestMapping("/card/transfer")
|
||||
@Validated
|
||||
public class TransferController {
|
||||
|
||||
@Resource
|
||||
private TransferService transferService;
|
||||
@Resource
|
||||
private ClubCardService cardService;
|
||||
@Resource
|
||||
private MemberUserService userService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建会员卡划拨")
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer:create')")
|
||||
public CommonResult<Long> createTransfer(@Valid @RequestBody TransferSaveReqVO createReqVO) {
|
||||
return success(transferService.createTransfer(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过或者驳回会员卡划拨")
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer:update')")
|
||||
public CommonResult<Boolean> updateTransfer(@Valid @RequestBody TransferSaveReqVO updateReqVO) {
|
||||
if (updateReqVO.getStatus() == 1){
|
||||
MemberUserDO userByMobile = userService.getUserByMobile(updateReqVO.getTransfereePhone());
|
||||
if (userByMobile == null){
|
||||
return success(false);
|
||||
}
|
||||
ArrayList<ClubCardDO> list = new ArrayList<>();
|
||||
String str = updateReqVO.getCardNumber();
|
||||
//划拨卡号数组
|
||||
String[] array = str.split(",");
|
||||
for (String element : array) {
|
||||
ClubCardDO clubCardDO = cardService.getCardByCardNumber(element);
|
||||
if (clubCardDO != null){
|
||||
clubCardDO.setNickName(updateReqVO.getTransfereePhone());
|
||||
clubCardDO.setParentId(userByMobile.getId().intValue());
|
||||
clubCardDO.setUpdateTime(LocalDateTime.now());
|
||||
clubCardDO.setIsActivate(0);
|
||||
list.add(clubCardDO);
|
||||
}else {
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
cardService.updateCards(list);
|
||||
}
|
||||
transferService.updateTransfer(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除会员卡划拨")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer:delete')")
|
||||
public CommonResult<Boolean> deleteTransfer(@RequestParam("id") Long id) {
|
||||
transferService.deleteTransfer(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员卡划拨")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer:query')")
|
||||
public CommonResult<TransferRespVO> getTransfer(@RequestParam("id") Long id) {
|
||||
TransferDO transfer = transferService.getTransfer(id);
|
||||
return success(BeanUtils.toBean(transfer, TransferRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得会员卡划拨分页")
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer:query')")
|
||||
public CommonResult<PageResult<TransferRespVO>> getTransferPage(@Valid TransferPageReqVO pageReqVO) {
|
||||
PageResult<TransferDO> pageResult = transferService.getTransferPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, TransferRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出会员卡划拨 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportTransferExcel(@Valid TransferPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<TransferDO> list = transferService.getTransferPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "会员卡划拨.xls", "数据", TransferRespVO.class,
|
||||
BeanUtils.toBean(list, TransferRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.transfer.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡划拨分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TransferPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "合伙人", example = "23016")
|
||||
private Long assignorId;
|
||||
|
||||
@Schema(description = "会员", example = "24204")
|
||||
private Long transfereeId;
|
||||
|
||||
@Schema(description = "合伙人电话")
|
||||
private String assignorPhone;
|
||||
|
||||
@Schema(description = "会员电话")
|
||||
private String transfereePhone;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.transfer.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡划拨 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class TransferRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8595")
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
@ExcelProperty("会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "合伙人", example = "23016")
|
||||
@ExcelProperty("合伙人")
|
||||
private Long assignorId;
|
||||
|
||||
@Schema(description = "会员", example = "24204")
|
||||
@ExcelProperty("会员")
|
||||
private Long transfereeId;
|
||||
|
||||
@Schema(description = "合伙人电话")
|
||||
@ExcelProperty("合伙人电话")
|
||||
private String assignorPhone;
|
||||
|
||||
@Schema(description = "会员电话")
|
||||
@ExcelProperty("会员电话")
|
||||
private String transfereePhone;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
@ExcelProperty(value = "状态", converter = DictConvert.class)
|
||||
@DictFormat("card_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.transfer.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡划拨新增/修改 Request VO")
|
||||
@Data
|
||||
public class TransferSaveReqVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8595")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "合伙人", example = "23016")
|
||||
private Long assignorId;
|
||||
|
||||
@Schema(description = "会员", example = "24204")
|
||||
private Long transfereeId;
|
||||
|
||||
@Schema(description = "合伙人电话")
|
||||
private String assignorPhone;
|
||||
|
||||
@Schema(description = "会员电话")
|
||||
private String transfereePhone;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.transferlog;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transferlog.vo.TransferLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transferlog.vo.TransferLogRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transferlog.vo.TransferLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.transferlog.TransferLogDO;
|
||||
import cn.iocoder.yudao.module.member.service.transferlog.TransferLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 会员卡划拨记录")
|
||||
@RestController
|
||||
@RequestMapping("/card/transfer-log")
|
||||
@Validated
|
||||
public class TransferLogController {
|
||||
|
||||
@Resource
|
||||
private TransferLogService transferLogService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建会员卡划拨记录")
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer-log:create')")
|
||||
public CommonResult<Long> createTransferLog(@Valid @RequestBody TransferLogSaveReqVO createReqVO) {
|
||||
return success(transferLogService.createTransferLog(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新会员卡划拨记录")
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer-log:update')")
|
||||
public CommonResult<Boolean> updateTransferLog(@Valid @RequestBody TransferLogSaveReqVO updateReqVO) {
|
||||
transferLogService.updateTransferLog(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除会员卡划拨记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer-log:delete')")
|
||||
public CommonResult<Boolean> deleteTransferLog(@RequestParam("id") Long id) {
|
||||
transferLogService.deleteTransferLog(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员卡划拨记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer-log:query')")
|
||||
public CommonResult<TransferLogRespVO> getTransferLog(@RequestParam("id") Long id) {
|
||||
TransferLogDO transferLog = transferLogService.getTransferLog(id);
|
||||
return success(BeanUtils.toBean(transferLog, TransferLogRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得会员卡划拨记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer-log:query')")
|
||||
public CommonResult<PageResult<TransferLogRespVO>> getTransferLogPage(@Valid TransferLogPageReqVO pageReqVO) {
|
||||
PageResult<TransferLogDO> pageResult = transferLogService.getTransferLogPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, TransferLogRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出会员卡划拨记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('card:transfer-log:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportTransferLogExcel(@Valid TransferLogPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<TransferLogDO> list = transferLogService.getTransferLogPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "会员卡划拨记录.xls", "数据", TransferLogRespVO.class,
|
||||
BeanUtils.toBean(list, TransferLogRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.transferlog.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡划拨记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TransferLogPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "发起人", example = "10999")
|
||||
private Long assignorId;
|
||||
|
||||
@Schema(description = "划拨人", example = "25483")
|
||||
private Long transfereeId;
|
||||
|
||||
@Schema(description = "发起人手机")
|
||||
private String assignorPhone;
|
||||
|
||||
@Schema(description = "划拨人手机")
|
||||
private String transfereePhone;
|
||||
|
||||
@Schema(description = "状态", example = "2")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.transferlog.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡划拨记录 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class TransferLogRespVO {
|
||||
|
||||
@Schema(description = "划拨id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29512")
|
||||
@ExcelProperty("划拨id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
@ExcelProperty("会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "发起人", example = "10999")
|
||||
@ExcelProperty("发起人")
|
||||
private Long assignorId;
|
||||
|
||||
@Schema(description = "划拨人", example = "25483")
|
||||
@ExcelProperty("划拨人")
|
||||
private Long transfereeId;
|
||||
|
||||
@Schema(description = "发起人手机")
|
||||
@ExcelProperty("发起人手机")
|
||||
private String assignorPhone;
|
||||
|
||||
@Schema(description = "划拨人手机")
|
||||
@ExcelProperty("划拨人手机")
|
||||
private String transfereePhone;
|
||||
|
||||
@Schema(description = "状态", example = "2")
|
||||
@ExcelProperty(value = "状态", converter = DictConvert.class)
|
||||
@DictFormat("card_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.transferlog.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 会员卡划拨记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class TransferLogSaveReqVO {
|
||||
|
||||
@Schema(description = "划拨id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29512")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "会员卡号")
|
||||
private String cardNumber;
|
||||
|
||||
@Schema(description = "发起人", example = "10999")
|
||||
private Long assignorId;
|
||||
|
||||
@Schema(description = "划拨人", example = "25483")
|
||||
private Long transfereeId;
|
||||
|
||||
@Schema(description = "发起人手机")
|
||||
private String assignorPhone;
|
||||
|
||||
@Schema(description = "划拨人手机")
|
||||
private String transfereePhone;
|
||||
|
||||
@Schema(description = "状态", example = "2")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -1,15 +1,25 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.afterverification.vo.AfterVerificationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.*;
|
||||
import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.clubCard.ClubCardDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.group.MemberGroupDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.memberCode.MemberCodeDo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.tag.MemberTagDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.memberCode.MemberCodeMapper;
|
||||
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||
import cn.iocoder.yudao.module.member.service.clubCard.ClubCardService;
|
||||
import cn.iocoder.yudao.module.member.service.group.MemberGroupService;
|
||||
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
||||
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
||||
@ -24,14 +34,14 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
|
||||
@ -54,7 +64,10 @@ public class MemberUserController {
|
||||
private MemberPointRecordService memberPointRecordService;
|
||||
@Resource
|
||||
private PayWalletApi payWalletApi;
|
||||
|
||||
@Resource
|
||||
private ClubCardService cardService;
|
||||
@Resource
|
||||
private MemberCodeMapper memberCodeMapper;
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新会员用户")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:update')")
|
||||
@ -125,5 +138,35 @@ public class MemberUserController {
|
||||
}
|
||||
return success(convertPage);
|
||||
}
|
||||
|
||||
@GetMapping("/verificationCode")
|
||||
@Operation(summary = "核销码")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:code')")
|
||||
public CommonResult<String> verificationCode(@RequestParam("id") Long id){
|
||||
MemberUserDO user = memberUserService.getUser(id);
|
||||
if (user.getActivate() == 0){
|
||||
return success("error");
|
||||
}
|
||||
AfterVerificationSaveReqVO appMemberUserVerificationCodeVo = new AfterVerificationSaveReqVO();
|
||||
appMemberUserVerificationCodeVo.setMemberUserId(id);
|
||||
appMemberUserVerificationCodeVo.setId(System.currentTimeMillis());
|
||||
ClubCardDO cardBySubId = cardService.getCardBySubId(id.intValue());
|
||||
appMemberUserVerificationCodeVo.setCardNumber(cardBySubId.getCardNumber());
|
||||
String encodedString = Base64.getEncoder().encodeToString(appMemberUserVerificationCodeVo.toString().getBytes());
|
||||
// String key = "verificationCode_" + id;
|
||||
// redisTemplate.delete(key);
|
||||
// // 将数据添加到 Redis
|
||||
// redisTemplate.opsForValue().set(key,encodedString);
|
||||
// // 设置数据的过期时间为10秒
|
||||
//// redisTemplate.expire(key, 60*60*24, TimeUnit.SECONDS);
|
||||
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// System.out.println("获取核销码:"+encodedString+" 当前时间"+now.format(formatter));
|
||||
String uuid = IdUtil.fastSimpleUUID();
|
||||
MemberCodeDo memberCodeDo = new MemberCodeDo();
|
||||
memberCodeDo.setRealCode(encodedString);
|
||||
memberCodeDo.setGetCodeType(1);
|
||||
memberCodeDo.setModelCode(uuid);
|
||||
memberCodeMapper.insert(memberCodeDo);
|
||||
return success(uuid);
|
||||
}
|
||||
}
|
||||
|
@ -41,10 +41,15 @@ public class MemberUserPageReqVO extends PageParam {
|
||||
@Schema(description = "用户分组编号", example = "1")
|
||||
private Long groupId;
|
||||
|
||||
@Schema(description = "是否付费会员", example = "1")
|
||||
private Integer isPaidMember;
|
||||
@Schema(description = "权益id", example = "1")
|
||||
private Long noticeInterestId;
|
||||
|
||||
@Schema(description = "是否绑过卡", example = "1")
|
||||
private Integer activate;
|
||||
|
||||
// TODO 芋艿:注册用户类型;
|
||||
|
||||
|
||||
// TODO 芋艿:登录用户类型;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.interest;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestRespVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.interest.InterestDO;
|
||||
import cn.iocoder.yudao.module.member.service.interest.InterestService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "APP - 权益通知")
|
||||
@RestController
|
||||
@RequestMapping("/notice/interest")
|
||||
@Validated
|
||||
public class AppInterestController {
|
||||
|
||||
@Resource
|
||||
private InterestService interestService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得权益通知分页")
|
||||
@PreAuthenticated
|
||||
public CommonResult<List<InterestRespVO>> getInterestPage(@Valid InterestPageReqVO pageReqVO) {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
PageResult<InterestDO> pageResult = interestService.getInterestPage(pageReqVO);
|
||||
PageResult<InterestRespVO> interestRespVOPageResult = BeanUtils.toBean(pageResult, InterestRespVO.class);
|
||||
return success(interestRespVOPageResult.getList());
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得权益通知")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthenticated
|
||||
public CommonResult<InterestRespVO> getInterest(@RequestParam("id") Long id) {
|
||||
InterestDO interest = interestService.getInterest(id);
|
||||
return success(BeanUtils.toBean(interest, InterestRespVO.class));
|
||||
}
|
||||
}
|
@ -1,13 +1,39 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.user;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.afterverification.vo.AfterVerificationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transfer.vo.TransferSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.*;
|
||||
import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.afterverification.AfterVerificationDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.cardbase.CardBaseDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.clubCard.ClubCardDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.interest.InterestDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.memberCode.MemberCodeDo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.transferlog.TransferLogDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.memberCode.MemberCodeMapper;
|
||||
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||
import cn.iocoder.yudao.module.member.service.afterverification.AfterVerificationService;
|
||||
import cn.iocoder.yudao.module.member.service.cardbase.CardBaseService;
|
||||
import cn.iocoder.yudao.module.member.service.clubCard.ClubCardService;
|
||||
import cn.iocoder.yudao.module.member.service.interest.InterestService;
|
||||
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
||||
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
||||
import cn.iocoder.yudao.module.member.service.transfer.TransferService;
|
||||
import cn.iocoder.yudao.module.member.service.transferlog.TransferLogService;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
||||
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -17,6 +43,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@ -31,7 +60,24 @@ public class AppMemberUserController {
|
||||
private MemberUserService userService;
|
||||
@Resource
|
||||
private MemberLevelService levelService;
|
||||
|
||||
@Resource
|
||||
private ClubCardService cardService;
|
||||
@Resource
|
||||
private CardBaseService cardBaseService;
|
||||
@Resource
|
||||
private BrokerageUserService brokerageUserService;
|
||||
@Resource
|
||||
private TransferService transferService;
|
||||
@Resource
|
||||
private TransferLogService transferLogService;
|
||||
@Resource
|
||||
private AfterVerificationService afterVerificationService;
|
||||
@Resource
|
||||
private InterestService interestService;
|
||||
@Resource
|
||||
private MemberPointRecordService pointRecordService;
|
||||
@Resource
|
||||
private MemberCodeMapper memberCodeMapper;
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得基本信息")
|
||||
@PreAuthenticated
|
||||
@ -79,6 +125,323 @@ public class AppMemberUserController {
|
||||
userService.resetUserPassword(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
@PostMapping("/activate")
|
||||
@Operation(summary = "激活会员")
|
||||
@PreAuthenticated
|
||||
public CommonResult<String> activateCard(@RequestBody ClubCardSaveReqVO createReqVO) {
|
||||
String s = createReqVO.getCardNumber().toUpperCase();
|
||||
createReqVO.setCardNumber(s);
|
||||
// System.out.println("--------------------------- "+s);
|
||||
// System.out.println("-------------------------- "+createReqVO);
|
||||
ClubCardDO cardByCardNumber = cardService.getCardByCardNumber(createReqVO.getCardNumber());
|
||||
// System.out.println("=================");
|
||||
// System.out.println(cardByCardNumber);
|
||||
// System.out.println("=================0");
|
||||
if (cardByCardNumber == null){
|
||||
if(cardBaseService.getCardBaseByCardNumber("NO:"+createReqVO.getCardNumber()) != null){
|
||||
return success("该卡号未申领");
|
||||
}
|
||||
return success("非法卡号!请输入正确的卡号");
|
||||
}
|
||||
if (cardByCardNumber.getIsActivate() == 2){
|
||||
return success("绑定失败,该卡号正在审核中");
|
||||
}
|
||||
if (cardByCardNumber.getIsActivate() == 0){
|
||||
CardBaseDO cardBaseByCardNumber = cardBaseService.getCardBaseByCardNumber("NO:"+createReqVO.getCardNumber());
|
||||
if (cardBaseByCardNumber.getScret().equals(createReqVO.getSecret())){
|
||||
MemberUserDO user = userService.getUser(getLoginUserId());
|
||||
cardByCardNumber.setPhone(user.getMobile());
|
||||
cardByCardNumber.setSubId(Integer.parseInt(getLoginUserId().toString()));
|
||||
cardByCardNumber.setActivateTime(LocalDateTime.now());
|
||||
cardService.updateCardByIsActivate(cardByCardNumber);
|
||||
//查询是否已绑定
|
||||
BrokerageUserDO brokerageUser = brokerageUserService.getBrokerageUser(getLoginUserId());
|
||||
if (brokerageUser == null){
|
||||
//未绑定直接绑定
|
||||
brokerageUserService.createBrokerageUser(getLoginUserId(),Long.parseLong(cardByCardNumber.getParentId().toString()));
|
||||
}else {
|
||||
if (brokerageUser.getBindUserId() == null){
|
||||
//已绑定,但上级为空
|
||||
brokerageUserService.updateBrokerageByUserId(getLoginUserId(),cardByCardNumber.getParentId().longValue());
|
||||
}else {
|
||||
//已绑定,但上级不为空
|
||||
brokerageUserService.updateBrokerageBySecondUserId(getLoginUserId(),cardByCardNumber.getParentId().longValue());
|
||||
}
|
||||
}
|
||||
if (cardByCardNumber.getParentId().longValue() != getLoginUserId()){
|
||||
pointRecordService.createPointRecord(user.getId(),299, MemberPointBizTypeEnum.BIND_MEMBERSHIP_CARD,"661");
|
||||
}
|
||||
user.setActivate(1);
|
||||
if (user.getPoint() != null || cardByCardNumber.getParentId().longValue() != getLoginUserId()){
|
||||
user.setPoint(user.getPoint()+299);
|
||||
}
|
||||
user.setNoticeInterestId(createReqVO.getNoticeInterestId());
|
||||
user.setName(createReqVO.getNickName());
|
||||
userService.updateUserDo(user);
|
||||
return success("绑定成功");
|
||||
}else {
|
||||
return success("绑定失败!卡密错误");
|
||||
}
|
||||
}else {
|
||||
return success("绑定失败!该会员卡已被绑定");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/getWxCard")
|
||||
@Operation(summary = "获得会员卡")
|
||||
@PreAuthenticated
|
||||
public CommonResult<ClubCardRespVO> getWxCard(@RequestParam("id") Integer id) {
|
||||
ClubCardDO card = cardService.getCard(id);
|
||||
return success(BeanUtils.toBean(card, ClubCardRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getAfterVerificationList")
|
||||
@Operation(summary = "核销记录")
|
||||
@PreAuthenticated
|
||||
public CommonResult<List<AfterVerificationDO>> getAfterVerificationList(){
|
||||
return success(afterVerificationService.getAfterVerificationList(getLoginUserId()));
|
||||
}
|
||||
|
||||
@GetMapping("/verificationCode")
|
||||
@Operation(summary = "核销码")
|
||||
@PreAuthenticated
|
||||
public CommonResult<String> verificationCode(AfterVerificationSaveReqVO appMemberUserVerificationCodeVo){
|
||||
appMemberUserVerificationCodeVo.setMemberUserId(getLoginUserId());
|
||||
appMemberUserVerificationCodeVo.setId(System.currentTimeMillis());
|
||||
ClubCardDO cardBySubId = cardService.getCardBySubId(getLoginUserId().intValue());
|
||||
appMemberUserVerificationCodeVo.setCardNumber(cardBySubId.getCardNumber());
|
||||
String encodedString = Base64.getEncoder().encodeToString(appMemberUserVerificationCodeVo.toString().getBytes());
|
||||
// String key = "verificationCode_" + getLoginUserId();
|
||||
// redisTemplate.delete(key);
|
||||
// // 将数据添加到 Redis
|
||||
// redisTemplate.opsForValue().set(key,encodedString);
|
||||
// // 设置数据的过期时间为10秒
|
||||
//// redisTemplate.expire(key, 60*60*24, TimeUnit.SECONDS);
|
||||
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// System.out.println("获取核销码:"+encodedString+" 当前时间"+now.format(formatter));
|
||||
|
||||
// =========================================================================================
|
||||
String uuid = IdUtil.fastSimpleUUID();
|
||||
MemberCodeDo memberCodeDo = new MemberCodeDo();
|
||||
memberCodeDo.setRealCode(encodedString);
|
||||
memberCodeDo.setGetCodeType(0);
|
||||
memberCodeDo.setModelCode(uuid);
|
||||
memberCodeMapper.insert(memberCodeDo);
|
||||
|
||||
return success(uuid);
|
||||
}
|
||||
|
||||
@PostMapping("/doVerification")
|
||||
@Operation(summary = "核销操作")
|
||||
@PreAuthenticated
|
||||
public CommonResult<String> doVerificationCode(@RequestBody AppMemberUserDoVerificationVo appMemberUserVerificationVo){
|
||||
MemberUserDO serviceUser = userService.getUser(getLoginUserId());
|
||||
if (serviceUser.getRoleId() != 1 && serviceUser.getRoleId() != 2){
|
||||
return success("非法人员禁止核销");
|
||||
}
|
||||
MemberCodeDo memberModel = memberCodeMapper.selectOne("model_code", appMemberUserVerificationVo.getCode());
|
||||
if (memberModel == null){
|
||||
return success("核销码已过期");
|
||||
}
|
||||
// 解码Base64编码的字符串
|
||||
byte[] decodedBytes = Base64.getDecoder().decode(memberModel.getRealCode());
|
||||
String decodedString = new String(decodedBytes);
|
||||
// 将字符串转换回对象
|
||||
// 使用字符串分割方法将字符串分割为属性值数组
|
||||
String[] parts = decodedString.replaceAll("\\s", "").replaceAll("\\)", "").split("\\(")[1].split(",");
|
||||
// 创建 AfterVerificationSaveReqVO 对象
|
||||
AfterVerificationSaveReqVO verificationCodeVo = new AfterVerificationSaveReqVO();
|
||||
for (String part : parts) {
|
||||
String[] keyValue = part.split("=");
|
||||
String key = keyValue[0];
|
||||
String value = keyValue.length > 1 ? keyValue[1] : null;
|
||||
switch (key) {
|
||||
case "id":
|
||||
verificationCodeVo.setId(Long.parseLong("1"));
|
||||
break;
|
||||
case "memberUserId":
|
||||
verificationCodeVo.setMemberUserId(Long.parseLong(value));
|
||||
break;
|
||||
case "goodsName":
|
||||
verificationCodeVo.setGoodsName("鲜鸡蛋20个");
|
||||
break;
|
||||
case "cardNumber":
|
||||
verificationCodeVo.setCardNumber(value);
|
||||
break;
|
||||
case "nickName":
|
||||
verificationCodeVo.setNickName(value);
|
||||
break;
|
||||
case "phone":
|
||||
verificationCodeVo.setPhone(value);
|
||||
break;
|
||||
default:
|
||||
// 如果出现了未知的属性,可以选择忽略或者进行其他处理
|
||||
break;
|
||||
}
|
||||
}
|
||||
//查询会员信息
|
||||
MemberUserDO user = userService.getUser(verificationCodeVo.getMemberUserId());
|
||||
verificationCodeVo.setPhone(user.getMobile());
|
||||
verificationCodeVo.setNickName(user.getNickname());
|
||||
InterestDO interest = interestService.getInterest(user.getNoticeInterestId());
|
||||
if (interest != null){
|
||||
verificationCodeVo.setGoodsName(interest.getGoodsName());
|
||||
}
|
||||
// String key = "verificationCode_" + verificationCodeVo.getMemberUserId();
|
||||
// String encodedStrings = redisTemplate.opsForValue().get(key);
|
||||
// if (encodedStrings == null || "".equals(encodedStrings) || !appMemberUserVerificationVo.getCode().equals(encodedStrings)) {
|
||||
// // 如果集合为空,则表示没有找到相应的验证码数据
|
||||
// return success("核销码已过期");
|
||||
// }
|
||||
//查询核销对应用户的核销列表用于计数
|
||||
List<AfterVerificationDO> list = afterVerificationService.getAfterVerificationList(verificationCodeVo.getMemberUserId());
|
||||
InterestDO countNum = interestService.getInterest(user.getNoticeInterestId());
|
||||
if (countNum.getIsUsed() - list.size() > 0){
|
||||
if (serviceUser.getRoleId() == 1){
|
||||
//查询当月是否已经核销过
|
||||
List<AfterVerificationDO> afterVerificationListByDate = afterVerificationService.getAfterVerificationListByDate(verificationCodeVo.getMemberUserId());
|
||||
if (afterVerificationListByDate.size() == 0){
|
||||
//插入核销记录
|
||||
appMemberUserVerificationVo.setMemberUserId(getLoginUserId());
|
||||
verificationCodeVo.setSurplusCounts(countNum.getIsUsed().longValue() - afterVerificationService.getCountByUserId(verificationCodeVo.getMemberUserId()) - 1);
|
||||
afterVerificationService.createAfterVerificationByGun(verificationCodeVo,appMemberUserVerificationVo);
|
||||
// redisTemplate.delete(key);
|
||||
return success("核销成功");
|
||||
}else {
|
||||
return success("核销失败,本月权益已领取");
|
||||
}
|
||||
}
|
||||
if (serviceUser.getRoleId() == 2){
|
||||
//插入核销记录
|
||||
appMemberUserVerificationVo.setMemberUserId(getLoginUserId());
|
||||
verificationCodeVo.setSurplusCounts(countNum.getIsUsed().longValue() - afterVerificationService.getCountByUserId(verificationCodeVo.getMemberUserId()) - 1);
|
||||
afterVerificationService.createAfterVerificationByGun(verificationCodeVo,appMemberUserVerificationVo);
|
||||
// redisTemplate.delete(key);
|
||||
return success("核销成功");
|
||||
}
|
||||
return success("服务器繁忙,请及时联系管理员");
|
||||
}else {
|
||||
return success("核销失败,您的核销次数已用完");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/MemberUserIndexCard")
|
||||
@Operation(summary = "会员卡详情")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Map<String,Object>> MemberUserIndexCard(){
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
ClubCardDO cardBySubId = cardService.getCardBySubId(Integer.parseInt(getLoginUserId().toString()));
|
||||
MemberUserDO user = userService.getUser(getLoginUserId());
|
||||
// System.out.println("--------------------------");
|
||||
// System.out.println(user);
|
||||
// System.out.println(getLoginUserId());
|
||||
// System.out.println("--------------------------");
|
||||
if (cardBySubId == null){
|
||||
map.put("isActivate",false);
|
||||
map.put("cardNumber",null);
|
||||
map.put("count",null);
|
||||
}else {
|
||||
map.put("isActivate",true);
|
||||
map.put("cardNumber",cardBySubId.getCardNumber());
|
||||
List<AfterVerificationDO> list = afterVerificationService.getAfterVerificationList(getLoginUserId());
|
||||
if (user.getNoticeInterestId() != null){
|
||||
InterestDO countNum = interestService.getInterest(user.getNoticeInterestId());
|
||||
if (countNum != null){
|
||||
map.put("count",countNum.getIsUsed() - list.size());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (user.getRoleId() == 1 || user.getRoleId() == 2){
|
||||
map.put("isJob",true);
|
||||
}
|
||||
if (user.getRoleId() == 0 || user.getRoleId() == null){
|
||||
map.put("isJob",false);
|
||||
}
|
||||
if (user.getLevelId() != null && user.getLevelId() != 1){
|
||||
map.put("total",cardService.getCardPageByMemberCount(getLoginUserId()));
|
||||
}
|
||||
// System.out.println("========================");
|
||||
// System.out.println(map);
|
||||
// System.out.println("========================");
|
||||
return success(map);
|
||||
}
|
||||
|
||||
@GetMapping("/getInterest")
|
||||
@Operation(summary = "获取权益")
|
||||
@PreAuthenticated
|
||||
public CommonResult<InterestRespVO> getInterest() {
|
||||
MemberUserDO user = userService.getUser(getLoginUserId());
|
||||
if (user.getNoticeInterestId() != null){
|
||||
InterestDO interest = interestService.getInterest(user.getNoticeInterestId());
|
||||
return success(BeanUtils.toBean(interest, InterestRespVO.class));
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/getClubCardByMember")
|
||||
@Operation(summary = "合伙人卡片展示")
|
||||
@PreAuthenticated
|
||||
public CommonResult<PageResult<ClubCardDO>> getClubCardDOByMember(@Valid ClubCardPageReqVO pageReqVO) {
|
||||
pageReqVO.setParentId(Integer.parseInt(getLoginUserId()+""));
|
||||
PageResult<ClubCardDO> cardPageByMember = cardService.getCardPageByMember(pageReqVO);
|
||||
for (ClubCardDO clubCardDO : cardPageByMember.getList()) {
|
||||
clubCardDO.setScret(cardBaseService.getCardBaseByCardNumber("NO:"+clubCardDO.getCardNumber()).getScret());
|
||||
}
|
||||
return success(cardPageByMember);
|
||||
}
|
||||
|
||||
@PostMapping("/transferCard")
|
||||
@Operation(summary = "合伙人卡片划拨")
|
||||
@PreAuthenticated
|
||||
public CommonResult<String> transferCard(@RequestBody TransferSaveReqVO createReqVO) {
|
||||
createReqVO.setAssignorId(getLoginUserId());
|
||||
if (createReqVO.getCardNumber() == null || createReqVO.getCardNumber().equals("")){
|
||||
return success("请先勾选要划拨的卡号");
|
||||
}
|
||||
MemberUserDO user = userService.getUser(getLoginUserId());
|
||||
if (user != null){
|
||||
createReqVO.setAssignorPhone(userService.getUser(getLoginUserId()).getMobile());
|
||||
}else {
|
||||
return success("数据异常请联系管理员排查");
|
||||
}
|
||||
if (user.getMobile().equals(createReqVO.getTransfereePhone())){
|
||||
return success("划拨失败,禁止划拨给自己");
|
||||
}
|
||||
MemberUserDO userByMobile = userService.getUserByMobile(createReqVO.getTransfereePhone());
|
||||
if (userByMobile != null){
|
||||
createReqVO.setTransfereeId(userService.getUserByMobile(createReqVO.getTransfereePhone()).getId());
|
||||
}else {
|
||||
return success("划拨失败,请填写正确的合伙人手机号");
|
||||
}
|
||||
if (userByMobile.getLevelId() == 1 || userByMobile.getLevelId() == 5 ){
|
||||
return success("划拨失败,划拨人不是合伙人");
|
||||
}
|
||||
ArrayList<TransferLogDO> list = new ArrayList<>();
|
||||
ArrayList<ClubCardDO> clubCardList = new ArrayList<>();
|
||||
TransferLogDO transferLogSaveReqVO = new TransferLogDO();
|
||||
String str = createReqVO.getCardNumber();
|
||||
//划拨卡号数组
|
||||
String[] array = str.split(",");
|
||||
for (String s : array) {
|
||||
transferLogSaveReqVO.setAssignorId(createReqVO.getAssignorId());
|
||||
transferLogSaveReqVO.setAssignorPhone(user.getMobile());
|
||||
transferLogSaveReqVO.setCardNumber(s);
|
||||
transferLogSaveReqVO.setStatus(0);
|
||||
transferLogSaveReqVO.setTransfereePhone(createReqVO.getTransfereePhone());
|
||||
transferLogSaveReqVO.setTransfereeId(userByMobile.getId());
|
||||
list.add(transferLogSaveReqVO);
|
||||
ClubCardDO cardByCardNumber = cardService.getCardByCardNumber(s);
|
||||
cardByCardNumber.setIsActivate(2);
|
||||
cardByCardNumber.setUpdateTime(LocalDateTime.now());
|
||||
clubCardList.add(cardByCardNumber);
|
||||
}
|
||||
cardService.updateCards(clubCardList);
|
||||
transferLogService.createTransferLogs(list);
|
||||
transferService.createTransfer(createReqVO);
|
||||
return success("划拨成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.user.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppMemberUserDoVerificationVo {
|
||||
private Long memberUserId;//核销员id
|
||||
private String nickName;//核销员昵称
|
||||
private String phone;//核销员手机号
|
||||
private String code;//核销码
|
||||
}
|
@ -35,6 +35,9 @@ public class AppMemberUserInfoRespVO {
|
||||
@Schema(description = "用户等级")
|
||||
private Level level;
|
||||
|
||||
@Schema(description = "是否绑过卡")
|
||||
private Integer activate;
|
||||
|
||||
@Schema(description = "是否成为推广员", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean brokerageEnabled;
|
||||
|
||||
|
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.afterverification;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 核销记录 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("cancel_after_verification")
|
||||
@KeySequence("cancel_after_verification_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AfterVerificationDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 核销编号
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
private Long memberUserId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String goodsName;
|
||||
/**
|
||||
* 会员卡号
|
||||
*/
|
||||
private String cardNumber;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickName;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 核销员姓名
|
||||
*/
|
||||
private String verificationName;
|
||||
/**
|
||||
* 核销员id
|
||||
*/
|
||||
private Long verificationId;
|
||||
|
||||
/**
|
||||
* 核销员手机号
|
||||
*/
|
||||
private String verificationPhone;
|
||||
|
||||
/**
|
||||
* 剩余次数
|
||||
*/
|
||||
private Long surplusCounts;
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.cardbase;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 会员卡档案 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("mall_card_base")
|
||||
@KeySequence("mall_card_base_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CardBaseDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 档案编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 卡号
|
||||
*/
|
||||
private String cardNum;
|
||||
/**
|
||||
* 卡密
|
||||
*/
|
||||
private String scret;
|
||||
/**
|
||||
* 上级id
|
||||
*/
|
||||
private Integer parentId;
|
||||
/**
|
||||
* 下级id
|
||||
*/
|
||||
private Integer subId;
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.cardlog;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 发卡记录 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("send_card_log")
|
||||
@KeySequence("send_card_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CardLogDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Integer id;
|
||||
/**
|
||||
* 会员昵称
|
||||
*/
|
||||
private String nickName;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer countNumber;
|
||||
|
||||
/**
|
||||
* 起始卡号
|
||||
*/
|
||||
private String starNumber;
|
||||
|
||||
/**
|
||||
*结束卡号
|
||||
*/
|
||||
private String endNumber;
|
||||
|
||||
/**
|
||||
*卡号区间
|
||||
*/
|
||||
private String cardSection;
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.clubCard;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 会员卡 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("club_card")
|
||||
@KeySequence("club_card_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ClubCardDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 会员卡编号
|
||||
*/
|
||||
@TableId
|
||||
private Integer id;
|
||||
/**
|
||||
* 上级用户id
|
||||
*/
|
||||
private Integer parentId;
|
||||
/**
|
||||
* 下级用户id
|
||||
*/
|
||||
private Integer subId;
|
||||
/**
|
||||
* 会员卡号
|
||||
*/
|
||||
private String cardNumber;
|
||||
/**
|
||||
* 是否已激活(0:未激活 , 1:已激活)
|
||||
*
|
||||
* 枚举 {@link TODO is_activate 对应的类}
|
||||
*/
|
||||
private Integer isActivate;
|
||||
|
||||
/**
|
||||
* 昵称(后面改用成了合伙人手机号)
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号(会员的)
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 激活时间
|
||||
*/
|
||||
private LocalDateTime activateTime;
|
||||
|
||||
/**
|
||||
* 卡密
|
||||
*/
|
||||
private String scret;
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.interest;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 权益通知 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("notice_interest")
|
||||
@KeySequence("notice_interest_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InterestDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 权益编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 权益标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 权益描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 权益内容
|
||||
*/
|
||||
private String equity;
|
||||
/**
|
||||
* 须知内容
|
||||
*/
|
||||
private String notice;
|
||||
|
||||
/**
|
||||
* 权益次数
|
||||
*/
|
||||
private Integer isUsed;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String goodsName;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.memberCode;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 会员核销码 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName(value = "member_code", autoResultMap = true)
|
||||
@KeySequence("member_code_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MemberCodeDo extends BaseDO {
|
||||
@TableId
|
||||
private Long id;
|
||||
private String realCode;
|
||||
private String modelCode;
|
||||
/**
|
||||
* 获取二维码类型(0:小程序端 1:pc后台)
|
||||
*/
|
||||
private Integer getCodeType;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.transfer;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 会员卡划拨 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("card_transfer")
|
||||
@KeySequence("card_transfer_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TransferDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 会员卡号
|
||||
*/
|
||||
private String cardNumber;
|
||||
/**
|
||||
* 合伙人
|
||||
*/
|
||||
private Long assignorId;
|
||||
/**
|
||||
* 会员
|
||||
*/
|
||||
private Long transfereeId;
|
||||
/**
|
||||
* 合伙人电话
|
||||
*/
|
||||
private String assignorPhone;
|
||||
/**
|
||||
* 会员电话
|
||||
*/
|
||||
private String transfereePhone;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.transferlog;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 会员卡划拨记录 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("card_transfer_log")
|
||||
@KeySequence("card_transfer_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TransferLogDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 划拨id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 会员卡号
|
||||
*/
|
||||
private String cardNumber;
|
||||
/**
|
||||
* 发起人
|
||||
*/
|
||||
private Long assignorId;
|
||||
/**
|
||||
* 划拨人
|
||||
*/
|
||||
private Long transfereeId;
|
||||
/**
|
||||
* 发起人手机
|
||||
*/
|
||||
private String assignorPhone;
|
||||
/**
|
||||
* 划拨人手机
|
||||
*/
|
||||
private String transfereePhone;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -143,7 +143,16 @@ public class MemberUserDO extends TenantBaseDO {
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 是否付费会员(0:不是 1:是)
|
||||
* 是否绑过卡
|
||||
*/
|
||||
private Integer isPaidMember;
|
||||
private Integer activate;
|
||||
|
||||
/**
|
||||
* 会员权益id
|
||||
*/
|
||||
private Long noticeInterestId;
|
||||
/**
|
||||
* 角色id(0:普通用户, 1:工作人员)
|
||||
*/
|
||||
private Integer roleId;
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.afterverification;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.afterverification.vo.AfterVerificationPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.afterverification.AfterVerificationDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 核销记录 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface AfterVerificationMapper extends BaseMapperX<AfterVerificationDO> {
|
||||
|
||||
default PageResult<AfterVerificationDO> selectPage(AfterVerificationPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AfterVerificationDO>()
|
||||
.betweenIfPresent(AfterVerificationDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(AfterVerificationDO::getMemberUserId, reqVO.getMemberUserId())
|
||||
.likeIfPresent(AfterVerificationDO::getGoodsName, reqVO.getGoodsName())
|
||||
.eqIfPresent(AfterVerificationDO::getCardNumber, reqVO.getCardNumber())
|
||||
.likeIfPresent(AfterVerificationDO::getNickName, reqVO.getNickName())
|
||||
.eqIfPresent(AfterVerificationDO::getPhone, reqVO.getPhone())
|
||||
.orderByDesc(AfterVerificationDO::getCreateTime));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.cardbase;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardbase.vo.CardBasePageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.cardbase.CardBaseDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 会员卡档案 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface CardBaseMapper extends BaseMapperX<CardBaseDO> {
|
||||
|
||||
default PageResult<CardBaseDO> selectPage(CardBasePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CardBaseDO>()
|
||||
.eqIfPresent(CardBaseDO::getCardNum, reqVO.getCardNum())
|
||||
.eqIfPresent(CardBaseDO::getScret, reqVO.getScret())
|
||||
.betweenIfPresent(CardBaseDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(CardBaseDO::getParentId, reqVO.getParentId())
|
||||
.eqIfPresent(CardBaseDO::getSubId, reqVO.getSubId())
|
||||
.orderByAsc(CardBaseDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.cardlog;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardlog.vo.CardLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.cardlog.CardLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 发卡记录 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface CardLogMapper extends BaseMapperX<CardLogDO> {
|
||||
|
||||
default PageResult<CardLogDO> selectPage(CardLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CardLogDO>()
|
||||
.likeIfPresent(CardLogDO::getNickName, reqVO.getNickName())
|
||||
.eqIfPresent(CardLogDO::getPhone, reqVO.getPhone())
|
||||
.eqIfPresent(CardLogDO::getCountNumber, reqVO.getCountNumber())
|
||||
.betweenIfPresent(CardLogDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(CardLogDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.clubCard;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.clubCard.ClubCardDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 会员卡 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface ClubCardMapper extends BaseMapperX<ClubCardDO> {
|
||||
|
||||
default PageResult<ClubCardDO> selectPage(ClubCardPageReqVO reqVO) {
|
||||
LambdaQueryWrapperX<ClubCardDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||
if (reqVO.getIsActivate() == null) {
|
||||
wrapperX.orderByDesc(ClubCardDO::getId); //
|
||||
} else if (reqVO.getIsActivate() == 1) {
|
||||
wrapperX.orderByDesc(ClubCardDO::getActivateTime); // 如果 isActivate 等于 1,则按照 activateTime 倒序排序
|
||||
}else if (reqVO.getIsActivate() == 2){
|
||||
wrapperX.orderByDesc(ClubCardDO::getUpdateTime);
|
||||
}else {
|
||||
wrapperX.orderByDesc(ClubCardDO::getId); // 其他情况按照 id 倒序排序
|
||||
}
|
||||
PageResult<ClubCardDO> page = selectPage(reqVO, wrapperX
|
||||
.eqIfPresent(ClubCardDO::getParentId, reqVO.getParentId())
|
||||
.eqIfPresent(ClubCardDO::getSubId, reqVO.getSubId())
|
||||
.eqIfPresent(ClubCardDO::getCardNumber, reqVO.getCardNumber())
|
||||
.eqIfPresent(ClubCardDO::getIsActivate, reqVO.getIsActivate())
|
||||
.eqIfPresent(ClubCardDO::getNickName, reqVO.getNickName())
|
||||
.eqIfPresent(ClubCardDO::getPhone, reqVO.getPhone())
|
||||
.eqIfPresent(ClubCardDO::getActivateTime, reqVO.getActivateTime())
|
||||
.betweenIfPresent(ClubCardDO::getCreateTime, reqVO.getCreateTime()));
|
||||
// .orderByDesc(ClubCardDO::getActivateTime));
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.interest;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.interest.InterestDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 权益通知 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface InterestMapper extends BaseMapperX<InterestDO> {
|
||||
|
||||
default PageResult<InterestDO> selectPage(InterestPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InterestDO>()
|
||||
.betweenIfPresent(InterestDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(InterestDO::getTitle, reqVO.getTitle())
|
||||
.eqIfPresent(InterestDO::getDescription, reqVO.getDescription())
|
||||
.eqIfPresent(InterestDO::getEquity, reqVO.getEquity())
|
||||
.eqIfPresent(InterestDO::getNotice, reqVO.getNotice())
|
||||
.eqIfPresent(InterestDO::getGoodsName, reqVO.getGoodsName())
|
||||
.orderByAsc(InterestDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.memberCode;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.memberCode.MemberCodeDo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MemberCodeMapper extends BaseMapperX<MemberCodeDo> {
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.transfer;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transfer.vo.TransferPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.transfer.TransferDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 会员卡划拨 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface TransferCardMapper extends BaseMapperX<TransferDO> {
|
||||
|
||||
default PageResult<TransferDO> selectPage(TransferPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TransferDO>()
|
||||
.betweenIfPresent(TransferDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(TransferDO::getCardNumber, reqVO.getCardNumber())
|
||||
.eqIfPresent(TransferDO::getAssignorId, reqVO.getAssignorId())
|
||||
.eqIfPresent(TransferDO::getTransfereeId, reqVO.getTransfereeId())
|
||||
.eqIfPresent(TransferDO::getAssignorPhone, reqVO.getAssignorPhone())
|
||||
.eqIfPresent(TransferDO::getTransfereePhone, reqVO.getTransfereePhone())
|
||||
.eqIfPresent(TransferDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(TransferDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.transferlog;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transferlog.vo.TransferLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.transferlog.TransferLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 会员卡划拨记录 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface TransferLogMapper extends BaseMapperX<TransferLogDO> {
|
||||
|
||||
default PageResult<TransferLogDO> selectPage(TransferLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TransferLogDO>()
|
||||
.betweenIfPresent(TransferLogDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(TransferLogDO::getCardNumber, reqVO.getCardNumber())
|
||||
.eqIfPresent(TransferLogDO::getAssignorId, reqVO.getAssignorId())
|
||||
.eqIfPresent(TransferLogDO::getTransfereeId, reqVO.getTransfereeId())
|
||||
.eqIfPresent(TransferLogDO::getAssignorPhone, reqVO.getAssignorPhone())
|
||||
.eqIfPresent(TransferLogDO::getTransfereePhone, reqVO.getTransfereePhone())
|
||||
.eqIfPresent(TransferLogDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(TransferLogDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -47,7 +47,8 @@ public interface MemberUserMapper extends BaseMapperX<MemberUserDO> {
|
||||
.betweenIfPresent(MemberUserDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(MemberUserDO::getLevelId, reqVO.getLevelId())
|
||||
.eqIfPresent(MemberUserDO::getGroupId, reqVO.getGroupId())
|
||||
.eqIfPresent(MemberUserDO::getIsPaidMember, reqVO.getIsPaidMember())
|
||||
.eqIfPresent(MemberUserDO::getNoticeInterestId, reqVO.getNoticeInterestId())
|
||||
.eqIfPresent(MemberUserDO::getActivate, reqVO.getActivate())
|
||||
.apply(StrUtil.isNotEmpty(tagIdSql), tagIdSql)
|
||||
.orderByDesc(MemberUserDO::getId));
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.member.service.afterverification;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.afterverification.vo.AfterVerificationPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.afterverification.vo.AfterVerificationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppMemberUserDoVerificationVo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.afterverification.AfterVerificationDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 核销记录 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface AfterVerificationService {
|
||||
|
||||
/**
|
||||
* 创建核销记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createAfterVerification(@Valid AfterVerificationSaveReqVO createReqVO);
|
||||
Long createAfterVerificationByGun(@Valid AfterVerificationSaveReqVO createReqVO, AppMemberUserDoVerificationVo appMemberUserDoVerificationVo);
|
||||
|
||||
/**
|
||||
* 更新核销记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAfterVerification(@Valid AfterVerificationSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除核销记录
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteAfterVerification(Long id);
|
||||
|
||||
/**
|
||||
* 获得核销记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 核销记录
|
||||
*/
|
||||
AfterVerificationDO getAfterVerification(Long id);
|
||||
|
||||
/**
|
||||
* 获得核销记录分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 核销记录分页
|
||||
*/
|
||||
PageResult<AfterVerificationDO> getAfterVerificationPage(AfterVerificationPageReqVO pageReqVO);
|
||||
List<AfterVerificationDO> getAfterVerificationList(Long id);
|
||||
Integer getCountByUserId(Long id);
|
||||
Long getCountByCardNumber(String cardNumber);
|
||||
|
||||
List<AfterVerificationDO> getAfterVerificationListByDate(Long id);
|
||||
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package cn.iocoder.yudao.module.member.service.afterverification;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.afterverification.vo.AfterVerificationPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.afterverification.vo.AfterVerificationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppMemberUserDoVerificationVo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.afterverification.AfterVerificationDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.afterverification.AfterVerificationMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.AFTER_VERIFICATION_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 核销记录 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AfterVerificationServiceImpl implements AfterVerificationService {
|
||||
|
||||
@Resource
|
||||
private AfterVerificationMapper afterVerificationMapper;
|
||||
|
||||
@Override
|
||||
public Long createAfterVerification(AfterVerificationSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AfterVerificationDO afterVerification = BeanUtils.toBean(createReqVO, AfterVerificationDO.class);
|
||||
afterVerificationMapper.insert(afterVerification);
|
||||
// 返回
|
||||
return afterVerification.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long createAfterVerificationByGun(AfterVerificationSaveReqVO createReqVO, AppMemberUserDoVerificationVo appMemberUserDoVerificationVo) {
|
||||
// 插入
|
||||
AfterVerificationDO afterVerification = BeanUtils.toBean(createReqVO, AfterVerificationDO.class);
|
||||
afterVerification.setId(Long.parseLong(RandomStringUtils.randomNumeric(10)));
|
||||
afterVerification.setVerificationId(appMemberUserDoVerificationVo.getMemberUserId());
|
||||
afterVerification.setVerificationName(appMemberUserDoVerificationVo.getNickName());
|
||||
afterVerification.setVerificationPhone(appMemberUserDoVerificationVo.getPhone());
|
||||
afterVerification.setDeleted(false);
|
||||
// System.out.println("---------------------do");
|
||||
// System.out.println(afterVerification.getId());
|
||||
// System.out.println(afterVerification);
|
||||
// System.out.println("---------------------do");
|
||||
afterVerificationMapper.insert(afterVerification);
|
||||
// 返回
|
||||
return afterVerification.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAfterVerification(AfterVerificationSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateAfterVerificationExists(updateReqVO.getId());
|
||||
// 更新
|
||||
AfterVerificationDO updateObj = BeanUtils.toBean(updateReqVO, AfterVerificationDO.class);
|
||||
afterVerificationMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAfterVerification(Long id) {
|
||||
// 校验存在
|
||||
validateAfterVerificationExists(id);
|
||||
// 删除
|
||||
afterVerificationMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateAfterVerificationExists(Long id) {
|
||||
if (afterVerificationMapper.selectById(id) == null) {
|
||||
throw exception(AFTER_VERIFICATION_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AfterVerificationDO getAfterVerification(Long id) {
|
||||
return afterVerificationMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AfterVerificationDO> getAfterVerificationPage(AfterVerificationPageReqVO pageReqVO) {
|
||||
return afterVerificationMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AfterVerificationDO> getAfterVerificationList(Long id) {
|
||||
return afterVerificationMapper.selectList("member_user_id",id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCountByUserId(Long id) {
|
||||
|
||||
return afterVerificationMapper.selectCount("member_user_id",id).intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getCountByCardNumber(String cardNumber) {
|
||||
return afterVerificationMapper.selectCount("card_number",cardNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AfterVerificationDO> getAfterVerificationListByDate(Long id) {
|
||||
QueryWrapper<AfterVerificationDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("member_user_id", id);
|
||||
// 获取当前月份的第一天和最后一天
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0); // 0时
|
||||
calendar.set(Calendar.MINUTE, 0); // 0分
|
||||
calendar.set(Calendar.SECOND, 0); // 0秒
|
||||
Date firstDayOfMonth = calendar.getTime();
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 23); // 23时
|
||||
calendar.set(Calendar.MINUTE, 59); // 59分
|
||||
calendar.set(Calendar.SECOND, 59); // 59秒
|
||||
Date lastDayOfMonth = calendar.getTime();
|
||||
|
||||
// 使用between方法过滤出当前月份的数据
|
||||
queryWrapper.between("create_time", firstDayOfMonth, lastDayOfMonth);
|
||||
return afterVerificationMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.member.service.cardbase;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardbase.vo.CardBasePageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardbase.vo.CardBaseSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.cardbase.CardBaseDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 会员卡档案 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface CardBaseService {
|
||||
|
||||
/**
|
||||
* 创建会员卡档案
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createCardBase(@Valid CardBaseSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新会员卡档案
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateCardBase(@Valid CardBaseSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除会员卡档案
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteCardBase(Long id);
|
||||
|
||||
/**
|
||||
* 获得会员卡档案
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 会员卡档案
|
||||
*/
|
||||
CardBaseDO getCardBase(Long id);
|
||||
CardBaseDO getCardBaseByCardNumber(String cardNumber);
|
||||
|
||||
/**
|
||||
* 获得会员卡档案分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 会员卡档案分页
|
||||
*/
|
||||
PageResult<CardBaseDO> getCardBasePage(CardBasePageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package cn.iocoder.yudao.module.member.service.cardbase;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardbase.vo.CardBasePageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardbase.vo.CardBaseSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.cardbase.CardBaseDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.cardbase.CardBaseMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.CARD_BASE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 会员卡档案 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class CardBaseServiceImpl implements CardBaseService {
|
||||
|
||||
@Resource
|
||||
private CardBaseMapper cardBaseMapper;
|
||||
|
||||
@Override
|
||||
public Long createCardBase(CardBaseSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
CardBaseDO cardBase = BeanUtils.toBean(createReqVO, CardBaseDO.class);
|
||||
cardBaseMapper.insert(cardBase);
|
||||
// 返回
|
||||
return cardBase.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCardBase(CardBaseSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateCardBaseExists(updateReqVO.getId());
|
||||
// 更新
|
||||
CardBaseDO updateObj = BeanUtils.toBean(updateReqVO, CardBaseDO.class);
|
||||
cardBaseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCardBase(Long id) {
|
||||
// 校验存在
|
||||
validateCardBaseExists(id);
|
||||
// 删除
|
||||
cardBaseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateCardBaseExists(Long id) {
|
||||
if (cardBaseMapper.selectById(id) == null) {
|
||||
throw exception(CARD_BASE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardBaseDO getCardBase(Long id) {
|
||||
return cardBaseMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardBaseDO getCardBaseByCardNumber(String cardNumber) {
|
||||
return cardBaseMapper.selectOne("card_num",cardNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CardBaseDO> getCardBasePage(CardBasePageReqVO pageReqVO) {
|
||||
return cardBaseMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.member.service.cardlog;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardlog.vo.CardLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardlog.vo.CardLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.cardlog.CardLogDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 发卡记录 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface CardLogService {
|
||||
|
||||
/**
|
||||
* 创建发卡记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createCardLog(@Valid CardLogSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新发卡记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateCardLog(@Valid CardLogSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除发卡记录
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteCardLog(Integer id);
|
||||
|
||||
/**
|
||||
* 获得发卡记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 发卡记录
|
||||
*/
|
||||
CardLogDO getCardLog(Integer id);
|
||||
|
||||
/**
|
||||
* 获得发卡记录分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 发卡记录分页
|
||||
*/
|
||||
PageResult<CardLogDO> getCardLogPage(CardLogPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.member.service.cardlog;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardlog.vo.CardLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.cardlog.vo.CardLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.cardlog.CardLogDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.cardlog.CardLogMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.CARD_LOG_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 发卡记录 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class CardLogServiceImpl implements CardLogService {
|
||||
|
||||
@Resource
|
||||
private CardLogMapper cardLogMapper;
|
||||
|
||||
@Override
|
||||
public Integer createCardLog(CardLogSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
CardLogDO cardLog = BeanUtils.toBean(createReqVO, CardLogDO.class);
|
||||
cardLog.setDeleted(false);
|
||||
cardLogMapper.insert(cardLog);
|
||||
// 返回
|
||||
return cardLog.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCardLog(CardLogSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateCardLogExists(updateReqVO.getId());
|
||||
// 更新
|
||||
CardLogDO updateObj = BeanUtils.toBean(updateReqVO, CardLogDO.class);
|
||||
cardLogMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCardLog(Integer id) {
|
||||
// 校验存在
|
||||
validateCardLogExists(id);
|
||||
// 删除
|
||||
cardLogMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateCardLogExists(Integer id) {
|
||||
if (cardLogMapper.selectById(id) == null) {
|
||||
throw exception(CARD_LOG_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardLogDO getCardLog(Integer id) {
|
||||
return cardLogMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CardLogDO> getCardLogPage(CardLogPageReqVO pageReqVO) {
|
||||
return cardLogMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.member.service.clubCard;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.clubCard.ClubCardDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员卡 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface ClubCardService {
|
||||
|
||||
/**
|
||||
* 创建会员卡
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createCard(@Valid ClubCardSaveReqVO createReqVO);
|
||||
|
||||
Integer createCard(List<ClubCardDO> cardList);
|
||||
|
||||
Integer activateAndBind(@Valid ClubCardSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新会员卡
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateCard(@Valid ClubCardSaveReqVO updateReqVO);
|
||||
void updateCards(ArrayList<ClubCardDO> list);
|
||||
void updateCardByIsActivate(ClubCardDO cardDO);
|
||||
|
||||
/**
|
||||
* 删除会员卡
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteCard(Integer id);
|
||||
|
||||
/**
|
||||
* 获得会员卡
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 会员卡
|
||||
*/
|
||||
ClubCardDO getCard(Integer id);
|
||||
ClubCardDO getCardByCardNumber(String cardNumber);
|
||||
ClubCardDO getCardBySubId(Integer subId);
|
||||
ClubCardDO getCardByParentId(Integer parentId);
|
||||
|
||||
/**
|
||||
* 获得会员卡分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 会员卡分页
|
||||
*/
|
||||
PageResult<ClubCardDO> getCardPage(ClubCardPageReqVO pageReqVO);
|
||||
PageResult<ClubCardDO> getCardPageByMember(ClubCardPageReqVO pageReqVO);
|
||||
Long getCardPageByMemberCount(Long id);
|
||||
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package cn.iocoder.yudao.module.member.service.clubCard;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.clubCard.vo.ClubCardSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.clubCard.ClubCardDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.clubCard.ClubCardMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.CARD_LOG_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 会员卡 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ClubCardServiceImpl implements ClubCardService {
|
||||
|
||||
@Resource
|
||||
private ClubCardMapper cardMapper;
|
||||
|
||||
@Override
|
||||
public Integer createCard(ClubCardSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ClubCardDO card = BeanUtils.toBean(createReqVO, ClubCardDO.class);
|
||||
card.setDeleted(false);
|
||||
cardMapper.insert(card);
|
||||
// 返回
|
||||
return card.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer createCard(List<ClubCardDO> cardList) {
|
||||
// 插入
|
||||
cardMapper.insertBatch(cardList);
|
||||
// 返回
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer activateAndBind(ClubCardSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ClubCardDO card = BeanUtils.toBean(createReqVO, ClubCardDO.class);
|
||||
card.setDeleted(false);
|
||||
cardMapper.insert(card);
|
||||
// 返回
|
||||
return card.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCard(ClubCardSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateCardExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ClubCardDO updateObj = BeanUtils.toBean(updateReqVO, ClubCardDO.class);
|
||||
cardMapper.updateById(updateObj);
|
||||
}
|
||||
@Override
|
||||
public void updateCards(ArrayList<ClubCardDO> list) {
|
||||
// 更新
|
||||
cardMapper.updateBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCardByIsActivate(ClubCardDO cardDO) {
|
||||
// 校验存在
|
||||
validateCardExists(cardDO.getId());
|
||||
// 更新
|
||||
cardDO.setIsActivate(1);
|
||||
cardMapper.updateById(cardDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCard(Integer id) {
|
||||
// 校验存在
|
||||
validateCardExists(id);
|
||||
// 删除
|
||||
cardMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateCardExists(Integer id) {
|
||||
if (cardMapper.selectById(id) == null) {
|
||||
throw exception(CARD_LOG_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClubCardDO getCard(Integer id) {
|
||||
return cardMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClubCardDO getCardByCardNumber(String cardNumber) {
|
||||
return cardMapper.selectOne("card_number",cardNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClubCardDO getCardBySubId(Integer subId) {
|
||||
return cardMapper.selectOne("sub_id",subId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClubCardDO getCardByParentId(Integer parentId) {
|
||||
return cardMapper.selectOne("parent_id",parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ClubCardDO> getCardPage(ClubCardPageReqVO pageReqVO) {
|
||||
return cardMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ClubCardDO> getCardPageByMember(ClubCardPageReqVO pageReqVO) {
|
||||
return cardMapper.selectPage(pageReqVO);
|
||||
}
|
||||
@Override
|
||||
public Long getCardPageByMemberCount(Long id) {
|
||||
return cardMapper.selectCount("parent_id",id);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.member.service.interest;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.interest.InterestDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 权益通知 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface InterestService {
|
||||
|
||||
/**
|
||||
* 创建权益通知
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createInterest(@Valid InterestSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新权益通知
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateInterest(@Valid InterestSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除权益通知
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteInterest(Long id);
|
||||
|
||||
/**
|
||||
* 获得权益通知
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 权益通知
|
||||
*/
|
||||
InterestDO getInterest(Long id);
|
||||
InterestDO getInterestByUsed();
|
||||
|
||||
/**
|
||||
* 获得权益通知分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 权益通知分页
|
||||
*/
|
||||
PageResult<InterestDO> getInterestPage(InterestPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package cn.iocoder.yudao.module.member.service.interest;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.interest.vo.InterestSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.interest.InterestDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.interest.InterestMapper;
|
||||
import com.mzt.logapi.context.LogRecordContext;
|
||||
import com.mzt.logapi.service.impl.DiffParseFunction;
|
||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.INTEREST_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.system.enums.LogRecordConstants.*;
|
||||
|
||||
|
||||
/**
|
||||
* 权益通知 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class InterestServiceImpl implements InterestService {
|
||||
|
||||
@Resource
|
||||
private InterestMapper interestMapper;
|
||||
|
||||
@Override
|
||||
@LogRecord(type = NOTICE_INTEREST_TYPE, subType = NOTICE_INTEREST_CREATE_SUB_TYPE, bizNo = "{{interest.id}}",
|
||||
success = NOTICE_INTEREST_CREATE_SUCCESS)
|
||||
public Long createInterest(InterestSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
InterestDO interest = BeanUtils.toBean(createReqVO, InterestDO.class);
|
||||
interest.setDeleted(false);
|
||||
interestMapper.insert(interest);
|
||||
LogRecordContext.putVariable("interest",interest);
|
||||
// 返回
|
||||
return interest.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@LogRecord(type = NOTICE_INTEREST_TYPE, subType = NOTICE_INTEREST_UPDATE_SUB_TYPE, bizNo = "{{interest.id}}",
|
||||
success = NOTICE_INTEREST_UPDATE_SUCCESS)
|
||||
public void updateInterest(InterestSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateInterestExists(updateReqVO.getId());
|
||||
InterestDO oldInterest = interestMapper.selectOne("id", updateReqVO.getId());
|
||||
// 更新
|
||||
InterestDO updateObj = BeanUtils.toBean(updateReqVO, InterestDO.class);
|
||||
interestMapper.updateById(updateObj);
|
||||
|
||||
LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT,BeanUtils.toBean(oldInterest,InterestSaveReqVO.class));
|
||||
LogRecordContext.putVariable("interest", oldInterest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteInterest(Long id) {
|
||||
// 校验存在
|
||||
validateInterestExists(id);
|
||||
// 删除
|
||||
interestMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateInterestExists(Long id) {
|
||||
if (interestMapper.selectById(id) == null) {
|
||||
throw exception(INTEREST_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterestDO getInterest(Long id) {
|
||||
return interestMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterestDO getInterestByUsed() {
|
||||
return interestMapper.selectOne("is_used", 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InterestDO> getInterestPage(InterestPageReqVO pageReqVO) {
|
||||
return interestMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.member.service.transfer;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transfer.vo.TransferPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.transfer.vo.TransferSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.transfer.TransferDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 会员卡划拨 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface TransferService {
|
||||
|
||||
/**
|
||||
* 创建会员卡划拨
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createTransfer(@Valid TransferSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新会员卡划拨
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateTransfer(@Valid TransferSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除会员卡划拨
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteTransfer(Long id);
|
||||
|
||||
/**
|
||||
* 获得会员卡划拨
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 会员卡划拨
|
||||
*/
|
||||
TransferDO getTransfer(Long id);
|
||||
|
||||
/**
|
||||
* 获得会员卡划拨分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 会员卡划拨分页
|
||||
*/
|
||||
PageResult<TransferDO> getTransferPage(TransferPageReqVO pageReqVO);
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user