diff --git a/.drone.yml b/.drone.yml index bb56727..3aaa5be 100644 --- a/.drone.yml +++ b/.drone.yml @@ -24,7 +24,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行 port: 22 # 远程连接端口 - command_timeout: 5m # 远程执行命令超时时间 + command_timeout: 10m # 远程执行命令超时时间 script: - cd /root/allLikeMall @@ -60,7 +60,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行 port: 22 # 远程连接端口 - command_timeout: 5m # 远程执行命令超时时间 + command_timeout: 10m # 远程执行命令超时时间 script: # - ls diff --git a/yudao-admin-vue3/src/api/cardbase/index.ts b/yudao-admin-vue3/src/api/cardbase/index.ts new file mode 100644 index 0000000..6d099bb --- /dev/null +++ b/yudao-admin-vue3/src/api/cardbase/index.ts @@ -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 }) + }, +} \ No newline at end of file diff --git a/yudao-admin-vue3/src/api/cardlog/index.ts b/yudao-admin-vue3/src/api/cardlog/index.ts new file mode 100644 index 0000000..6a055a9 --- /dev/null +++ b/yudao-admin-vue3/src/api/cardlog/index.ts @@ -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 }) + }, +} diff --git a/yudao-admin-vue3/src/api/club/clubCard/index.ts b/yudao-admin-vue3/src/api/club/clubCard/index.ts new file mode 100644 index 0000000..068d686 --- /dev/null +++ b/yudao-admin-vue3/src/api/club/clubCard/index.ts @@ -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 }) + }, +} diff --git a/yudao-admin-vue3/src/api/interest/index.ts b/yudao-admin-vue3/src/api/interest/index.ts new file mode 100644 index 0000000..07bc3b0 --- /dev/null +++ b/yudao-admin-vue3/src/api/interest/index.ts @@ -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 }) + }, +} diff --git a/yudao-admin-vue3/src/api/mall/promotion/memberbenefit/index.ts b/yudao-admin-vue3/src/api/mall/promotion/memberbenefit/index.ts new file mode 100644 index 0000000..bb3be5e --- /dev/null +++ b/yudao-admin-vue3/src/api/mall/promotion/memberbenefit/index.ts @@ -0,0 +1,48 @@ +import request from '@/config/axios' + +// 付费会员权益 VO +export interface PaidMemberBenefitVO { + id: number // 编号 + name: string // 名称 + iconUrl: string // 图标地址 + intro: string // 描述 + status: boolean // 状态:(默认)0隐藏 1显示 + sort: number // 排序 +} + +// 付费会员权益 API +export const PaidMemberBenefitApi = { + // 查询付费会员权益分页 + getPaidMemberBenefitPage: async (params: any) => { + return await request.get({ url: `/paidmemberbenefit/paid-member-benefit/page`, params }) + }, + + // 查询付费会员权益详情 + getPaidMemberBenefit: async (id: number) => { + return await request.get({ url: `/paidmemberbenefit/paid-member-benefit/get?id=` + id }) + }, + + // 新增付费会员权益 + createPaidMemberBenefit: async (data: PaidMemberBenefitVO) => { + return await request.post({ url: `/paidmemberbenefit/paid-member-benefit/create`, data }) + }, + + // 修改付费会员权益 + updatePaidMemberBenefit: async (data: PaidMemberBenefitVO) => { + return await request.put({ url: `/paidmemberbenefit/paid-member-benefit/update`, data }) + }, + // 修改会员权益状态 + updatePaidMemberBenefitStatus: async (data: any) => { + return await request.put({ url: `/paidmemberbenefit/paid-member-benefit/updateStatus`, data}) + }, + + // 删除付费会员权益 + deletePaidMemberBenefit: async (id: number) => { + return await request.delete({ url: `/paidmemberbenefit/paid-member-benefit/delete?id=` + id }) + }, + + // 导出付费会员权益 Excel + exportPaidMemberBenefit: async (params) => { + return await request.download({ url: `/paidmemberbenefit/paid-member-benefit/export-excel`, params }) + }, +} diff --git a/yudao-admin-vue3/src/api/pay/wallet/balance/index.ts b/yudao-admin-vue3/src/api/pay/wallet/balance/index.ts index a3ba07f..0ec3277 100644 --- a/yudao-admin-vue3/src/api/pay/wallet/balance/index.ts +++ b/yudao-admin-vue3/src/api/pay/wallet/balance/index.ts @@ -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 }) } diff --git a/yudao-admin-vue3/src/api/transferCard/index.ts b/yudao-admin-vue3/src/api/transferCard/index.ts new file mode 100644 index 0000000..00fcb1c --- /dev/null +++ b/yudao-admin-vue3/src/api/transferCard/index.ts @@ -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 }) + } +} \ No newline at end of file diff --git a/yudao-admin-vue3/src/api/transferlog/index.ts b/yudao-admin-vue3/src/api/transferlog/index.ts new file mode 100644 index 0000000..eaff57f --- /dev/null +++ b/yudao-admin-vue3/src/api/transferlog/index.ts @@ -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 }) + }, +} \ No newline at end of file diff --git a/yudao-admin-vue3/src/utils/dict.ts b/yudao-admin-vue3/src/utils/dict.ts index ca4e4ac..98cea3c 100644 --- a/yudao-admin-vue3/src/utils/dict.ts +++ b/yudao-admin-vue3/src/utils/dict.ts @@ -227,6 +227,7 @@ export enum DICT_TYPE { PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status', // 砍价记录的状态 PROMOTION_COMBINATION_RECORD_STATUS = 'promotion_combination_record_status', // 拼团记录的状态 PROMOTION_BANNER_POSITION = 'promotion_banner_position', // banner 定位 + MEMBER_BENEFIT_STATUS = 'member_benefit_status', // 会员权益状态 // ========== CRM - 客户管理模块 ========== CRM_AUDIT_STATUS = 'crm_audit_status', // CRM 审批状态 @@ -257,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' } diff --git a/yudao-admin-vue3/src/views/club/clubCard/CardForm.vue b/yudao-admin-vue3/src/views/club/clubCard/CardForm.vue new file mode 100644 index 0000000..99b3e9d --- /dev/null +++ b/yudao-admin-vue3/src/views/club/clubCard/CardForm.vue @@ -0,0 +1,117 @@ + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/club/clubCard/index.vue b/yudao-admin-vue3/src/views/club/clubCard/index.vue new file mode 100644 index 0000000..4a818aa --- /dev/null +++ b/yudao-admin-vue3/src/views/club/clubCard/index.vue @@ -0,0 +1,237 @@ + + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/club/sendCard/CardList.vue b/yudao-admin-vue3/src/views/club/sendCard/CardList.vue new file mode 100644 index 0000000..9e17fa2 --- /dev/null +++ b/yudao-admin-vue3/src/views/club/sendCard/CardList.vue @@ -0,0 +1,182 @@ + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/club/sendCard/CardLogForm.vue b/yudao-admin-vue3/src/views/club/sendCard/CardLogForm.vue new file mode 100644 index 0000000..b45531a --- /dev/null +++ b/yudao-admin-vue3/src/views/club/sendCard/CardLogForm.vue @@ -0,0 +1,104 @@ + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/club/sendCard/index.vue b/yudao-admin-vue3/src/views/club/sendCard/index.vue new file mode 100644 index 0000000..1de7e07 --- /dev/null +++ b/yudao-admin-vue3/src/views/club/sendCard/index.vue @@ -0,0 +1,235 @@ + + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/interest/InterestForm.vue b/yudao-admin-vue3/src/views/interest/InterestForm.vue new file mode 100644 index 0000000..bde3eb9 --- /dev/null +++ b/yudao-admin-vue3/src/views/interest/InterestForm.vue @@ -0,0 +1,117 @@ + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/interest/index.vue b/yudao-admin-vue3/src/views/interest/index.vue new file mode 100644 index 0000000..2e21b3e --- /dev/null +++ b/yudao-admin-vue3/src/views/interest/index.vue @@ -0,0 +1,197 @@ + + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/PaidMemberBenefitForm.vue b/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/PaidMemberBenefitForm.vue new file mode 100644 index 0000000..cd24106 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/PaidMemberBenefitForm.vue @@ -0,0 +1,151 @@ + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/index.vue b/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/index.vue new file mode 100644 index 0000000..6fe9b0a --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/index.vue @@ -0,0 +1,289 @@ + + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue b/yudao-admin-vue3/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue index d596ec1..ff3fb39 100644 --- a/yudao-admin-vue3/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue +++ b/yudao-admin-vue3/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue @@ -1,117 +1,135 @@ \ No newline at end of file +/** 重置表单 */ +const resetForm = () => { + formData.value = { + id: undefined, + name: undefined, + startTime: undefined, + endTime: undefined, + sliderPicUrls: [], + status: CommonStatusEnum.ENABLE + } + formRef.value?.resetFields() +} + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/UserBalanceUpdateForm.vue b/yudao-admin-vue3/src/views/mall/promotion/user/UserBalanceUpdateForm.vue new file mode 100644 index 0000000..372ff7a --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/UserBalanceUpdateForm.vue @@ -0,0 +1,134 @@ + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/UserForm.vue b/yudao-admin-vue3/src/views/mall/promotion/user/UserForm.vue new file mode 100644 index 0000000..0da4ef6 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/UserForm.vue @@ -0,0 +1,179 @@ + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/UserLevelUpdateForm.vue b/yudao-admin-vue3/src/views/mall/promotion/user/UserLevelUpdateForm.vue new file mode 100644 index 0000000..e583f4a --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/UserLevelUpdateForm.vue @@ -0,0 +1,101 @@ + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/UserPointUpdateForm.vue b/yudao-admin-vue3/src/views/mall/promotion/user/UserPointUpdateForm.vue new file mode 100644 index 0000000..967ebe0 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/UserPointUpdateForm.vue @@ -0,0 +1,128 @@ + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/components/balance-list.vue b/yudao-admin-vue3/src/views/mall/promotion/user/components/balance-list.vue new file mode 100644 index 0000000..3e9d178 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/components/balance-list.vue @@ -0,0 +1,14 @@ + + + + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserAccountInfo.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserAccountInfo.vue new file mode 100644 index 0000000..56a6ab6 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserAccountInfo.vue @@ -0,0 +1,87 @@ + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserAddressList.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserAddressList.vue new file mode 100644 index 0000000..a37caba --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserAddressList.vue @@ -0,0 +1,54 @@ + + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserBasicInfo.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserBasicInfo.vue new file mode 100644 index 0000000..d07b1b2 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserBasicInfo.vue @@ -0,0 +1,85 @@ + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserBrokerageList.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserBrokerageList.vue new file mode 100644 index 0000000..db88787 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserBrokerageList.vue @@ -0,0 +1,125 @@ + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserCouponList.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserCouponList.vue new file mode 100644 index 0000000..2279b8a --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserCouponList.vue @@ -0,0 +1,190 @@ + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserExperienceRecordList.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserExperienceRecordList.vue new file mode 100644 index 0000000..64414ad --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserExperienceRecordList.vue @@ -0,0 +1,158 @@ + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserFavoriteList.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserFavoriteList.vue new file mode 100644 index 0000000..afab9a0 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserFavoriteList.vue @@ -0,0 +1,96 @@ + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserOrderList.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserOrderList.vue new file mode 100644 index 0000000..bae0bf0 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserOrderList.vue @@ -0,0 +1,279 @@ + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserPointList.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserPointList.vue new file mode 100644 index 0000000..9754b29 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserPointList.vue @@ -0,0 +1,152 @@ + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserSignList.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserSignList.vue new file mode 100644 index 0000000..c897274 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/UserSignList.vue @@ -0,0 +1,135 @@ + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/detail/index.vue b/yudao-admin-vue3/src/views/mall/promotion/user/detail/index.vue new file mode 100644 index 0000000..6237cca --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/detail/index.vue @@ -0,0 +1,135 @@ + + + diff --git a/yudao-admin-vue3/src/views/mall/promotion/user/index.vue b/yudao-admin-vue3/src/views/mall/promotion/user/index.vue new file mode 100644 index 0000000..4cfe943 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/user/index.vue @@ -0,0 +1,319 @@ + + diff --git a/yudao-admin-vue3/src/views/member/cardbase/CardBaseForm.vue b/yudao-admin-vue3/src/views/member/cardbase/CardBaseForm.vue new file mode 100644 index 0000000..1fcc950 --- /dev/null +++ b/yudao-admin-vue3/src/views/member/cardbase/CardBaseForm.vue @@ -0,0 +1,106 @@ + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/member/cardbase/index.vue b/yudao-admin-vue3/src/views/member/cardbase/index.vue new file mode 100644 index 0000000..22565d5 --- /dev/null +++ b/yudao-admin-vue3/src/views/member/cardbase/index.vue @@ -0,0 +1,220 @@ + + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/member/user/UserBalanceUpdateForm.vue b/yudao-admin-vue3/src/views/member/user/UserBalanceUpdateForm.vue index 372ff7a..36137cf 100644 --- a/yudao-admin-vue3/src/views/member/user/UserBalanceUpdateForm.vue +++ b/yudao-admin-vue3/src/views/member/user/UserBalanceUpdateForm.vue @@ -1,20 +1,20 @@ - diff --git a/yudao-admin-vue3/src/views/transferCard/TransferForm.vue b/yudao-admin-vue3/src/views/transferCard/TransferForm.vue new file mode 100644 index 0000000..f780fd9 --- /dev/null +++ b/yudao-admin-vue3/src/views/transferCard/TransferForm.vue @@ -0,0 +1,124 @@ + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/transferCard/index.vue b/yudao-admin-vue3/src/views/transferCard/index.vue new file mode 100644 index 0000000..b00474d --- /dev/null +++ b/yudao-admin-vue3/src/views/transferCard/index.vue @@ -0,0 +1,289 @@ + + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/transferlog/TransferLogForm.vue b/yudao-admin-vue3/src/views/transferlog/TransferLogForm.vue new file mode 100644 index 0000000..a9c5935 --- /dev/null +++ b/yudao-admin-vue3/src/views/transferlog/TransferLogForm.vue @@ -0,0 +1,124 @@ + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/transferlog/index.vue b/yudao-admin-vue3/src/views/transferlog/index.vue new file mode 100644 index 0000000..5113f83 --- /dev/null +++ b/yudao-admin-vue3/src/views/transferlog/index.vue @@ -0,0 +1,253 @@ + + + \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageUserDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageUserDO.java index 8d73858..bbc95d0 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageUserDO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageUserDO.java @@ -59,4 +59,8 @@ public class BrokerageUserDO extends BaseDO { * 冻结佣金 */ private Integer frozenPrice; + /** + * 二级绑定 + */ + private Long bindSecondUserId; } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserService.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserService.java index 1a67f04..5811752 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserService.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserService.java @@ -143,4 +143,9 @@ public interface BrokerageUserService { */ PageResult getBrokerageUserChildSummaryPage(AppBrokerageUserChildSummaryPageReqVO pageReqVO, Long userId); + boolean createBrokerageUser(@NotNull Long userId, Long bindUserId); + + void updateBrokerageByUserId(Long id, Long bindUserId); + + void updateBrokerageBySecondUserId(Long id, Long secondBindUserId); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java index 7fb82ee..7e90dad 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java @@ -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(); diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/ClubCardApi.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/ClubCardApi.java new file mode 100644 index 0000000..1219d41 --- /dev/null +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/ClubCardApi.java @@ -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); +} diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/vo/ClubCardApiVo.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/vo/ClubCardApiVo.java new file mode 100644 index 0000000..04e5bcb --- /dev/null +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/vo/ClubCardApiVo.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/dto/MemberUserRespDTO.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/dto/MemberUserRespDTO.java index 50548f9..8327f63 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/dto/MemberUserRespDTO.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/dto/MemberUserRespDTO.java @@ -17,6 +17,10 @@ public class MemberUserRespDTO { * 用户ID */ private Long id; + /** + * 真实名字 + */ + private String name; /** * 用户昵称 */ diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java index ee970a5..534860b 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java @@ -50,9 +50,19 @@ public interface ErrorCodeConstants { ErrorCode LEVEL_HAS_USER = new ErrorCode(1_004_011_005, "用户等级下存在用户,无法删除"); ErrorCode EXPERIENCE_BIZ_NOT_SUPPORT = new ErrorCode(1_004_011_201, "用户经验业务类型不支持"); - + ErrorCode PAID_MEMBER_BENEFIT_NOT_EXISTS = new ErrorCode(1_004_011_202, "付费会员权益不存在"); + ErrorCode PAID_MEMBER_BENEFIT_LEVEL_RELATION_NOT_EXISTS = new ErrorCode(1_004_011_202, "会员权益和等级关系不存在"); //========== 用户分组 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, "进件码不存在"); } diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/point/MemberPointBizTypeEnum.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/point/MemberPointBizTypeEnum.java index ef491f4..7511768 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/point/MemberPointBizTypeEnum.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/point/MemberPointBizTypeEnum.java @@ -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 的取消 diff --git a/yudao-module-member/yudao-module-member-biz/pom.xml b/yudao-module-member/yudao-module-member-biz/pom.xml index 33b5e5b..056df64 100644 --- a/yudao-module-member/yudao-module-member-biz/pom.xml +++ b/yudao-module-member/yudao-module-member-biz/pom.xml @@ -90,7 +90,12 @@ cn.iocoder.boot yudao-spring-boot-starter-biz-ip - + + cn.iocoder.boot + yudao-module-trade-biz + compile + ${revision} + diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/clubCardApiImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/clubCardApiImpl.java new file mode 100644 index 0000000..3c1943e --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/clubCardApiImpl.java @@ -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); + } +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/AfterVerificationController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/AfterVerificationController.java new file mode 100644 index 0000000..805c59b --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/AfterVerificationController.java @@ -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 createAfterVerification(@Valid @RequestBody AfterVerificationSaveReqVO createReqVO) { + return success(afterVerificationService.createAfterVerification(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新核销记录") + @PreAuthorize("@ss.hasPermission('cancel:after-verification:update')") + public CommonResult 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 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 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> getAfterVerificationPage(@Valid AfterVerificationPageReqVO pageReqVO) { + PageResult pageResult = afterVerificationService.getAfterVerificationPage(pageReqVO); + PageResult result = BeanUtils.toBean(pageResult, AfterVerificationRespVO.class); + ArrayList list = new ArrayList<>(); + for (AfterVerificationRespVO respVO : result.getList()) { + list.add(respVO.getMemberUserId()); + } + Map 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 list = afterVerificationService.getAfterVerificationPage(pageReqVO).getList(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + List voList = BeanUtils.toBean(list, AfterVerificationRespVO.class); + ArrayList arrayList = new ArrayList<>(); + for (AfterVerificationRespVO respVO : voList) { + respVO.setCreateTimeToString(respVO.getCreateTime().format(formatter)); + arrayList.add(respVO.getMemberUserId()); + } + Map 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 list = afterVerificationService.getAfterVerificationPage(pageReqVO).getList(); +// Collections.reverse(list); +// ArrayList 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 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); +// } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationPageReqVO.java new file mode 100644 index 0000000..39b0250 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationPageReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationRespVO.java new file mode 100644 index 0000000..fe95788 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationRespVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationSaveReqVO.java new file mode 100644 index 0000000..42756c9 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationSaveReqVO.java @@ -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; + + + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/CardBaseController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/CardBaseController.java new file mode 100644 index 0000000..fd0ec6a --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/CardBaseController.java @@ -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 createCardBase(@Valid @RequestBody CardBaseSaveReqVO createReqVO) { + return success(cardBaseService.createCardBase(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新会员卡档案") + @PreAuthorize("@ss.hasPermission('mall:card-base:update')") + public CommonResult 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 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 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> getCardBasePage(@Valid CardBasePageReqVO pageReqVO) { + PageResult 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 list = cardBaseService.getCardBasePage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "会员卡档案.xls", "数据", CardBaseRespVO.class, + BeanUtils.toBean(list, CardBaseRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBasePageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBasePageReqVO.java new file mode 100644 index 0000000..7419a55 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBasePageReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBaseRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBaseRespVO.java new file mode 100644 index 0000000..12d00c1 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBaseRespVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBaseSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBaseSaveReqVO.java new file mode 100644 index 0000000..448dfc9 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBaseSaveReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/CardLogController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/CardLogController.java new file mode 100644 index 0000000..c1c1202 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/CardLogController.java @@ -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 createCardLog(@Valid @RequestBody CardLogSaveReqVO createReqVO) { + return success(cardLogService.createCardLog(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新发卡记录") + @PreAuthorize("@ss.hasPermission('send:card-log:update')") + public CommonResult 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 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 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> getCardLogPage(@Valid CardLogPageReqVO pageReqVO) { + PageResult 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 list = cardLogService.getCardLogPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "发卡记录.xls", "数据", CardLogRespVO.class, + BeanUtils.toBean(list, CardLogRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogPageReqVO.java new file mode 100644 index 0000000..558ff73 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogPageReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogRespVO.java new file mode 100644 index 0000000..022dba9 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogRespVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogSaveReqVO.java new file mode 100644 index 0000000..748798a --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogSaveReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/ClubCardController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/ClubCardController.java new file mode 100644 index 0000000..448ded7 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/ClubCardController.java @@ -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 createCard(@Valid @RequestBody ClubCardSaveReqVO createReqVO) { + return success(cardService.createCard(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新会员卡") + @PreAuthorize("@ss.hasPermission('club:card:update')") + public CommonResult 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 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 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> getCardPage(@Valid ClubCardPageReqVO pageReqVO) { + PageResult pageResult = cardService.getCardPage(pageReqVO); + PageResult 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 list = cardService.getCardPage(pageReqVO).getList(); + ArrayList parIds = new ArrayList<>(); + ArrayList 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 voList = BeanUtils.toBean(list, ClubCardRespVO.class); + Map parMap = memberUserApi.getUserMap(parIds); + Map 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); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardPageReqVO.java new file mode 100644 index 0000000..a5513ea --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardPageReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardRespVO.java new file mode 100644 index 0000000..2969784 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardRespVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardSaveReqVO.java new file mode 100644 index 0000000..ca15474 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardSaveReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/InterestController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/InterestController.java new file mode 100644 index 0000000..d2a6af4 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/InterestController.java @@ -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 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 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 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 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> getInterestPage(@Valid InterestPageReqVO pageReqVO) { + PageResult 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 list = interestService.getInterestPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "权益通知.xls", "数据", InterestRespVO.class, + BeanUtils.toBean(list, InterestRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestPageReqVO.java new file mode 100644 index 0000000..57402e0 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestPageReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestRespVO.java new file mode 100644 index 0000000..938a1f6 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestRespVO.java @@ -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; + + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestSaveReqVO.java new file mode 100644 index 0000000..c3f2a62 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestSaveReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/PaidMemberBenefitController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/PaidMemberBenefitController.java new file mode 100644 index 0000000..5532cb4 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/PaidMemberBenefitController.java @@ -0,0 +1,105 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit; + +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitRespVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitStatusReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO; +import cn.iocoder.yudao.module.member.service.memberbenefit.PaidMemberBenefitService; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + + +@Tag(name = "管理后台 - 付费会员权益") +@RestController +@RequestMapping("/paidmemberbenefit/paid-member-benefit") +@Validated +public class PaidMemberBenefitController { + + @Resource + private PaidMemberBenefitService paidMemberBenefitService; + + @PostMapping("/create") + @Operation(summary = "创建付费会员权益") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:create')") + public CommonResult createPaidMemberBenefit(@Valid @RequestBody PaidMemberBenefitSaveReqVO createReqVO) { + return success(paidMemberBenefitService.createPaidMemberBenefit(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新付费会员权益") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:update')") + public CommonResult updatePaidMemberBenefit(@Valid @RequestBody PaidMemberBenefitSaveReqVO updateReqVO) { + paidMemberBenefitService.updatePaidMemberBenefit(updateReqVO); + return success(true); + } + @PutMapping("/updateStatus") + @Operation(summary = "更新付费会员权益状态") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:update')") + public CommonResult updatePaidMemberBenefitStatus(@RequestBody PaidMemberBenefitStatusReqVO req) { + paidMemberBenefitService.updatePaidMemberBenefitStatus(req); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除付费会员权益") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:delete')") + public CommonResult deletePaidMemberBenefit(@RequestParam("id") Long id) { + paidMemberBenefitService.deletePaidMemberBenefit(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得付费会员权益") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:query')") + public CommonResult getPaidMemberBenefit(@RequestParam("id") Long id) { + PaidMemberBenefitDO paidMemberBenefit = paidMemberBenefitService.getPaidMemberBenefit(id); + return success(BeanUtils.toBean(paidMemberBenefit, PaidMemberBenefitRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得付费会员权益分页") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:query')") + public CommonResult> getPaidMemberBenefitPage(@Valid PaidMemberBenefitPageReqVO pageReqVO) { + PageResult pageResult = paidMemberBenefitService.getPaidMemberBenefitPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, PaidMemberBenefitRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出付费会员权益 Excel") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportPaidMemberBenefitExcel(@Valid PaidMemberBenefitPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = paidMemberBenefitService.getPaidMemberBenefitPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "付费会员权益.xls", "数据", PaidMemberBenefitRespVO.class, + BeanUtils.toBean(list, PaidMemberBenefitRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationPageReqVO.java new file mode 100644 index 0000000..7de9dd0 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationPageReqVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +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 MemberBenefitLevelRelationPageReqVO extends PageParam { + + @Schema(description = "会员等级编号", example = "234") + private Long memberLevelId; + + @Schema(description = "会员权益编号", example = "8416") + private Long memberBenefitId; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationRespVO.java new file mode 100644 index 0000000..00f1594 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationRespVO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 会员权益和等级关系 Response VO") +@Data +@ExcelIgnoreUnannotated +public class MemberBenefitLevelRelationRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30308") + @ExcelProperty("编号") + private Long id; + + @Schema(description = "会员等级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "234") + @ExcelProperty("会员等级编号") + private Long memberLevelId; + + @Schema(description = "会员权益编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8416") + @ExcelProperty("会员权益编号") + private Long memberBenefitId; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationSaveReqVO.java new file mode 100644 index 0000000..7fd7446 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationSaveReqVO.java @@ -0,0 +1,23 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 会员权益和等级关系新增/修改 Request VO") +@Data +public class MemberBenefitLevelRelationSaveReqVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30308") + private Long id; + + @Schema(description = "会员等级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "234") + @NotNull(message = "会员等级编号不能为空") + private Long memberLevelId; + + @Schema(description = "会员权益编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8416") + @NotNull(message = "会员权益编号不能为空") + private Long memberBenefitId; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitPageReqVO.java new file mode 100644 index 0000000..77a673b --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitPageReqVO.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +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 PaidMemberBenefitPageReqVO extends PageParam { + + @Schema(description = "名称", example = "王五") + private String name; + + @Schema(description = "图标地址", example = "https://www.iocoder.cn") + private String iconUrl; + + @Schema(description = "描述") + private String intro; + + @Schema(description = "状态:(默认)0隐藏 1显示", example = "1") + private Integer status; + + @Schema(description = "排序") + private Integer sort; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitRespVO.java new file mode 100644 index 0000000..77162a2 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitRespVO.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 付费会员权益 Response VO") +@Data +@ExcelIgnoreUnannotated +public class PaidMemberBenefitRespVO { + + @Schema(description = " 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29131") + @ExcelProperty(" 编号") + private Long id; + + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @ExcelProperty("名称") + private String name; + + @Schema(description = "图标地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") + @ExcelProperty("图标地址") + private String iconUrl; + + @Schema(description = "描述") + @ExcelProperty("描述") + private String intro; + + @Schema(description = "状态:(默认)0隐藏 1显示", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("状态:(默认)0隐藏 1显示") + private Integer status; + + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("排序") + private Integer sort; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitSaveReqVO.java new file mode 100644 index 0000000..8c23de8 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitSaveReqVO.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 付费会员权益新增/修改 Request VO") +@Data +public class PaidMemberBenefitSaveReqVO { + + @Schema(description = " 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29131") + private Long id; + + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotEmpty(message = "名称不能为空") + private String name; + + @Schema(description = "图标地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") + @NotEmpty(message = "图标地址不能为空") + private String iconUrl; + + @Schema(description = "描述") + private String intro; + + @Schema(description = "状态:(默认)0隐藏 1显示", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态:(默认)0隐藏 1显示不能为空") + private Integer status; + + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "排序不能为空") + private Integer sort; + + @Schema(description = "等级Id列表", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "等级Id不能为空") + private List levelIdList; +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitStatusReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitStatusReqVO.java new file mode 100644 index 0000000..8250593 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitStatusReqVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + + +@Schema(description = "管理后台 - 付费会员权益新增/修改 Request VO") +@Data +public class PaidMemberBenefitStatusReqVO { + @Schema(description = " 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29131") + private Long id; + + @Schema(description = "状态:(默认)0隐藏 1显示", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态:(默认)0隐藏 1显示不能为空") + private Integer status; +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/TransferController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/TransferController.java new file mode 100644 index 0000000..73ffd0a --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/TransferController.java @@ -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 createTransfer(@Valid @RequestBody TransferSaveReqVO createReqVO) { + return success(transferService.createTransfer(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "通过或者驳回会员卡划拨") + @PreAuthorize("@ss.hasPermission('card:transfer:update')") + public CommonResult updateTransfer(@Valid @RequestBody TransferSaveReqVO updateReqVO) { + if (updateReqVO.getStatus() == 1){ + MemberUserDO userByMobile = userService.getUserByMobile(updateReqVO.getTransfereePhone()); + if (userByMobile == null){ + return success(false); + } + ArrayList 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 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 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> getTransferPage(@Valid TransferPageReqVO pageReqVO) { + PageResult 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 list = transferService.getTransferPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "会员卡划拨.xls", "数据", TransferRespVO.class, + BeanUtils.toBean(list, TransferRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferPageReqVO.java new file mode 100644 index 0000000..83130e5 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferPageReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferRespVO.java new file mode 100644 index 0000000..e24ebba --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferRespVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferSaveReqVO.java new file mode 100644 index 0000000..029a0a5 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferSaveReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/TransferLogController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/TransferLogController.java new file mode 100644 index 0000000..52d409a --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/TransferLogController.java @@ -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 createTransferLog(@Valid @RequestBody TransferLogSaveReqVO createReqVO) { + return success(transferLogService.createTransferLog(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新会员卡划拨记录") + @PreAuthorize("@ss.hasPermission('card:transfer-log:update')") + public CommonResult 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 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 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> getTransferLogPage(@Valid TransferLogPageReqVO pageReqVO) { + PageResult 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 list = transferLogService.getTransferLogPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "会员卡划拨记录.xls", "数据", TransferLogRespVO.class, + BeanUtils.toBean(list, TransferLogRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogPageReqVO.java new file mode 100644 index 0000000..d19763e --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogPageReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogRespVO.java new file mode 100644 index 0000000..1d74aba --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogRespVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogSaveReqVO.java new file mode 100644 index 0000000..372c98f --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogSaveReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/MemberUserController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/MemberUserController.java index ae75442..f91cf41 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/MemberUserController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/MemberUserController.java @@ -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')") @@ -84,7 +97,7 @@ public class MemberUserController { @Operation(summary = "更新会员用户余额") @PreAuthorize("@ss.hasPermission('member:user:update-balance')") public CommonResult updateUserBalance(@Valid @RequestBody Long id) { - // todo @jason:增加一个【修改余额】 + // 这个功能加在了pay模块里 return success(true); } @@ -125,5 +138,35 @@ public class MemberUserController { } return success(convertPage); } - + @GetMapping("/verificationCode") + @Operation(summary = "核销码") + @PreAuthorize("@ss.hasPermission('member:user:code')") + public CommonResult 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); + } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/vo/MemberUserPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/vo/MemberUserPageReqVO.java index abb9428..2cece01 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/vo/MemberUserPageReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/user/vo/MemberUserPageReqVO.java @@ -41,8 +41,15 @@ public class MemberUserPageReqVO extends PageParam { @Schema(description = "用户分组编号", example = "1") private Long groupId; + @Schema(description = "权益id", example = "1") + private Long noticeInterestId; + + @Schema(description = "是否绑过卡", example = "1") + private Integer activate; + // TODO 芋艿:注册用户类型; + // TODO 芋艿:登录用户类型; } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/interest/AppInterestController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/interest/AppInterestController.java new file mode 100644 index 0000000..cef1da7 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/interest/AppInterestController.java @@ -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> getInterestPage(@Valid InterestPageReqVO pageReqVO) { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + PageResult pageResult = interestService.getInterestPage(pageReqVO); + PageResult 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 getInterest(@RequestParam("id") Long id) { + InterestDO interest = interestService.getInterest(id); + return success(BeanUtils.toBean(interest, InterestRespVO.class)); + } +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java index 3a268e8..d1eb7dd 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java @@ -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 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 getWxCard(@RequestParam("id") Integer id) { + ClubCardDO card = cardService.getCard(id); + return success(BeanUtils.toBean(card, ClubCardRespVO.class)); + } + + @GetMapping("/getAfterVerificationList") + @Operation(summary = "核销记录") + @PreAuthenticated + public CommonResult> getAfterVerificationList(){ + return success(afterVerificationService.getAfterVerificationList(getLoginUserId())); + } + + @GetMapping("/verificationCode") + @Operation(summary = "核销码") + @PreAuthenticated + public CommonResult 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 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 list = afterVerificationService.getAfterVerificationList(verificationCodeVo.getMemberUserId()); + InterestDO countNum = interestService.getInterest(user.getNoticeInterestId()); + if (countNum.getIsUsed() - list.size() > 0){ + if (serviceUser.getRoleId() == 1){ + //查询当月是否已经核销过 + List 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> MemberUserIndexCard(){ + Map 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 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 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> getClubCardDOByMember(@Valid ClubCardPageReqVO pageReqVO) { + pageReqVO.setParentId(Integer.parseInt(getLoginUserId()+"")); + PageResult 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 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 list = new ArrayList<>(); + ArrayList 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("划拨成功"); + } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserDoVerificationVo.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserDoVerificationVo.java new file mode 100644 index 0000000..53b91ac --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserDoVerificationVo.java @@ -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;//核销码 +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java index 72e4fa3..cac56a4 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java @@ -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; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/afterverification/AfterVerificationDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/afterverification/AfterVerificationDO.java new file mode 100644 index 0000000..d3994ac --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/afterverification/AfterVerificationDO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/cardbase/CardBaseDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/cardbase/CardBaseDO.java new file mode 100644 index 0000000..df72f9a --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/cardbase/CardBaseDO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/cardlog/CardLogDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/cardlog/CardLogDO.java new file mode 100644 index 0000000..9093e6e --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/cardlog/CardLogDO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/clubCard/ClubCardDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/clubCard/ClubCardDO.java new file mode 100644 index 0000000..c29e5ca --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/clubCard/ClubCardDO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/interest/InterestDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/interest/InterestDO.java new file mode 100644 index 0000000..73e6ef6 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/interest/InterestDO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberCode/MemberCodeDo.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberCode/MemberCodeDo.java new file mode 100644 index 0000000..0d4909e --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberCode/MemberCodeDo.java @@ -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; +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefit/PaidMemberBenefitDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefit/PaidMemberBenefitDO.java new file mode 100644 index 0000000..a303d70 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefit/PaidMemberBenefitDO.java @@ -0,0 +1,51 @@ +package cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 付费会员权益 DO + * + * @author 管理员 + */ +@TableName("paid_member_benefit") +@KeySequence("paid_member_benefit_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PaidMemberBenefitDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + /** + * 名称 + */ + private String name; + /** + * 图标地址 + */ + private String iconUrl; + /** + * 描述 + */ + private String intro; + /** + * 状态:(默认)0隐藏 1显示 + */ + private Integer status; + /** + * 排序 + */ + private Integer sort; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefitlevelrelation/MemberBenefitLevelRelationDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefitlevelrelation/MemberBenefitLevelRelationDO.java new file mode 100644 index 0000000..a170794 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefitlevelrelation/MemberBenefitLevelRelationDO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 会员权益和等级关系 DO + * + * @author 管理员 + */ +@TableName("paid_member_benefit_level_relation") +@KeySequence("paid_member_benefit_level_relation_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MemberBenefitLevelRelationDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + /** + * 会员等级编号 + */ + private Long memberLevelId; + /** + * 会员权益编号 + */ + private Long memberBenefitId; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/transfer/TransferDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/transfer/TransferDO.java new file mode 100644 index 0000000..45e9a7c --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/transfer/TransferDO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/transferlog/TransferLogDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/transferlog/TransferLogDO.java new file mode 100644 index 0000000..3418dbf --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/transferlog/TransferLogDO.java @@ -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; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/user/MemberUserDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/user/MemberUserDO.java index 97ddc19..0d0dde0 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/user/MemberUserDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/user/MemberUserDO.java @@ -142,4 +142,17 @@ public class MemberUserDO extends TenantBaseDO { */ private Long groupId; + /** + * 是否绑过卡 + */ + private Integer activate; + + /** + * 会员权益id + */ + private Long noticeInterestId; + /** + * 角色id(0:普通用户, 1:工作人员) + */ + private Integer roleId; } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/afterverification/AfterVerificationMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/afterverification/AfterVerificationMapper.java new file mode 100644 index 0000000..1dd68c6 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/afterverification/AfterVerificationMapper.java @@ -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 { + + default PageResult selectPage(AfterVerificationPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/cardbase/CardBaseMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/cardbase/CardBaseMapper.java new file mode 100644 index 0000000..cd9111c --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/cardbase/CardBaseMapper.java @@ -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 { + + default PageResult selectPage(CardBasePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/cardlog/CardLogMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/cardlog/CardLogMapper.java new file mode 100644 index 0000000..4b62656 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/cardlog/CardLogMapper.java @@ -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 { + + default PageResult selectPage(CardLogPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(CardLogDO::getNickName, reqVO.getNickName()) + .eqIfPresent(CardLogDO::getPhone, reqVO.getPhone()) + .eqIfPresent(CardLogDO::getCountNumber, reqVO.getCountNumber()) + .betweenIfPresent(CardLogDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(CardLogDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/clubCard/ClubCardMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/clubCard/ClubCardMapper.java new file mode 100644 index 0000000..d24dc68 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/clubCard/ClubCardMapper.java @@ -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 { + + default PageResult selectPage(ClubCardPageReqVO reqVO) { + LambdaQueryWrapperX 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 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; + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/interest/InterestMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/interest/InterestMapper.java new file mode 100644 index 0000000..600fec5 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/interest/InterestMapper.java @@ -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 { + + default PageResult selectPage(InterestPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberCode/MemberCodeMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberCode/MemberCodeMapper.java new file mode 100644 index 0000000..b2911eb --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberCode/MemberCodeMapper.java @@ -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 { +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefit/PaidMemberBenefitMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefit/PaidMemberBenefitMapper.java new file mode 100644 index 0000000..50a0fe7 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefit/PaidMemberBenefitMapper.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.member.dal.mysql.memberbenefit; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 付费会员权益 Mapper + * + * @author 管理员 + */ +@Mapper +public interface PaidMemberBenefitMapper extends BaseMapperX { + + default PageResult selectPage(PaidMemberBenefitPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(PaidMemberBenefitDO::getName, reqVO.getName()) + .eqIfPresent(PaidMemberBenefitDO::getIconUrl, reqVO.getIconUrl()) + .eqIfPresent(PaidMemberBenefitDO::getIntro, reqVO.getIntro()) + .eqIfPresent(PaidMemberBenefitDO::getStatus, reqVO.getStatus()) + .eqIfPresent(PaidMemberBenefitDO::getSort, reqVO.getSort()) + .betweenIfPresent(PaidMemberBenefitDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PaidMemberBenefitDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefitlevelrelation/MemberBenefitLevelRelationMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefitlevelrelation/MemberBenefitLevelRelationMapper.java new file mode 100644 index 0000000..73521ff --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefitlevelrelation/MemberBenefitLevelRelationMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.member.dal.mysql.memberbenefitlevelrelation; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationPageReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation.MemberBenefitLevelRelationDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 会员权益和等级关系 Mapper + * + * @author 管理员 + */ +@Mapper +public interface MemberBenefitLevelRelationMapper extends BaseMapperX { + + default PageResult selectPage(MemberBenefitLevelRelationPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(MemberBenefitLevelRelationDO::getMemberLevelId, reqVO.getMemberLevelId()) + .eqIfPresent(MemberBenefitLevelRelationDO::getMemberBenefitId, reqVO.getMemberBenefitId()) + .betweenIfPresent(MemberBenefitLevelRelationDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(MemberBenefitLevelRelationDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/transfer/TransferCardMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/transfer/TransferCardMapper.java new file mode 100644 index 0000000..6bd958c --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/transfer/TransferCardMapper.java @@ -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 { + + default PageResult selectPage(TransferPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/transferlog/TransferLogMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/transferlog/TransferLogMapper.java new file mode 100644 index 0000000..f30cc0c --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/transferlog/TransferLogMapper.java @@ -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 { + + default PageResult selectPage(TransferLogPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/user/MemberUserMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/user/MemberUserMapper.java index 3f87102..ac0698e 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/user/MemberUserMapper.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/user/MemberUserMapper.java @@ -47,6 +47,8 @@ public interface MemberUserMapper extends BaseMapperX { .betweenIfPresent(MemberUserDO::getCreateTime, reqVO.getCreateTime()) .eqIfPresent(MemberUserDO::getLevelId, reqVO.getLevelId()) .eqIfPresent(MemberUserDO::getGroupId, reqVO.getGroupId()) + .eqIfPresent(MemberUserDO::getNoticeInterestId, reqVO.getNoticeInterestId()) + .eqIfPresent(MemberUserDO::getActivate, reqVO.getActivate()) .apply(StrUtil.isNotEmpty(tagIdSql), tagIdSql) .orderByDesc(MemberUserDO::getId)); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/afterverification/AfterVerificationService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/afterverification/AfterVerificationService.java new file mode 100644 index 0000000..ca05262 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/afterverification/AfterVerificationService.java @@ -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 getAfterVerificationPage(AfterVerificationPageReqVO pageReqVO); + List getAfterVerificationList(Long id); + Integer getCountByUserId(Long id); + Long getCountByCardNumber(String cardNumber); + + List getAfterVerificationListByDate(Long id); + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/afterverification/AfterVerificationServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/afterverification/AfterVerificationServiceImpl.java new file mode 100644 index 0000000..17a6962 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/afterverification/AfterVerificationServiceImpl.java @@ -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 getAfterVerificationPage(AfterVerificationPageReqVO pageReqVO) { + return afterVerificationMapper.selectPage(pageReqVO); + } + + @Override + public List 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 getAfterVerificationListByDate(Long id) { + QueryWrapper 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); + } + +} + diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardbase/CardBaseService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardbase/CardBaseService.java new file mode 100644 index 0000000..ceaa00f --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardbase/CardBaseService.java @@ -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 getCardBasePage(CardBasePageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardbase/CardBaseServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardbase/CardBaseServiceImpl.java new file mode 100644 index 0000000..7e615aa --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardbase/CardBaseServiceImpl.java @@ -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 getCardBasePage(CardBasePageReqVO pageReqVO) { + return cardBaseMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardlog/CardLogService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardlog/CardLogService.java new file mode 100644 index 0000000..fe6da78 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardlog/CardLogService.java @@ -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 getCardLogPage(CardLogPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardlog/CardLogServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardlog/CardLogServiceImpl.java new file mode 100644 index 0000000..db8cf55 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardlog/CardLogServiceImpl.java @@ -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 getCardLogPage(CardLogPageReqVO pageReqVO) { + return cardLogMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/clubCard/ClubCardService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/clubCard/ClubCardService.java new file mode 100644 index 0000000..4451afa --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/clubCard/ClubCardService.java @@ -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 cardList); + + Integer activateAndBind(@Valid ClubCardSaveReqVO createReqVO); + + /** + * 更新会员卡 + * + * @param updateReqVO 更新信息 + */ + void updateCard(@Valid ClubCardSaveReqVO updateReqVO); + void updateCards(ArrayList 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 getCardPage(ClubCardPageReqVO pageReqVO); + PageResult getCardPageByMember(ClubCardPageReqVO pageReqVO); + Long getCardPageByMemberCount(Long id); + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/clubCard/ClubCardServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/clubCard/ClubCardServiceImpl.java new file mode 100644 index 0000000..1a78f3b --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/clubCard/ClubCardServiceImpl.java @@ -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 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 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 getCardPage(ClubCardPageReqVO pageReqVO) { + return cardMapper.selectPage(pageReqVO); + } + + @Override + public PageResult getCardPageByMember(ClubCardPageReqVO pageReqVO) { + return cardMapper.selectPage(pageReqVO); + } + @Override + public Long getCardPageByMemberCount(Long id) { + return cardMapper.selectCount("parent_id",id); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/interest/InterestService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/interest/InterestService.java new file mode 100644 index 0000000..d6925c7 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/interest/InterestService.java @@ -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 getInterestPage(InterestPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/interest/InterestServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/interest/InterestServiceImpl.java new file mode 100644 index 0000000..0d845a6 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/interest/InterestServiceImpl.java @@ -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 getInterestPage(InterestPageReqVO pageReqVO) { + return interestMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitService.java new file mode 100644 index 0000000..2efa755 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitService.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.member.service.memberbenefit; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitStatusReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO; + +/** + * 付费会员权益 Service 接口 + * + * @author 管理员 + */ +public interface PaidMemberBenefitService { + + /** + * 创建付费会员权益 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPaidMemberBenefit(@Valid PaidMemberBenefitSaveReqVO createReqVO); + + /** + * 更新付费会员权益 + * + * @param updateReqVO 更新信息 + */ + void updatePaidMemberBenefit(@Valid PaidMemberBenefitSaveReqVO updateReqVO); + + /** + * 删除付费会员权益 + * + * @param id 编号 + */ + void deletePaidMemberBenefit(Long id); + + /** + * 获得付费会员权益 + * + * @param id 编号 + * @return 付费会员权益 + */ + PaidMemberBenefitDO getPaidMemberBenefit(Long id); + + /** + * 获得付费会员权益分页 + * + * @param pageReqVO 分页查询 + * @return 付费会员权益分页 + */ + PageResult getPaidMemberBenefitPage(PaidMemberBenefitPageReqVO pageReqVO); + + /** + * 更新付费会员状态 + * @return void + */ + void updatePaidMemberBenefitStatus(PaidMemberBenefitStatusReqVO req); +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitServiceImpl.java new file mode 100644 index 0000000..bf16cc2 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitServiceImpl.java @@ -0,0 +1,85 @@ +package cn.iocoder.yudao.module.member.service.memberbenefit; + +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitStatusReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO; +import cn.iocoder.yudao.module.member.dal.mysql.memberbenefit.PaidMemberBenefitMapper; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.PAID_MEMBER_BENEFIT_NOT_EXISTS; + +/** + * 付费会员权益 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class PaidMemberBenefitServiceImpl implements PaidMemberBenefitService { + + @Resource + private PaidMemberBenefitMapper paidMemberBenefitMapper; + + @Override + public Long createPaidMemberBenefit(PaidMemberBenefitSaveReqVO createReqVO) { + // 插入 + PaidMemberBenefitDO paidMemberBenefit = BeanUtils.toBean(createReqVO, PaidMemberBenefitDO.class); + paidMemberBenefitMapper.insert(paidMemberBenefit); + // 返回 + return paidMemberBenefit.getId(); + } + + @Override + public void updatePaidMemberBenefit(PaidMemberBenefitSaveReqVO updateReqVO) { + // 校验存在 + validatePaidMemberBenefitExists(updateReqVO.getId()); + // 更新 + PaidMemberBenefitDO updateObj = BeanUtils.toBean(updateReqVO, PaidMemberBenefitDO.class); + paidMemberBenefitMapper.updateById(updateObj); + } + + @Override + public void deletePaidMemberBenefit(Long id) { + // 校验存在 + validatePaidMemberBenefitExists(id); + // 删除 + paidMemberBenefitMapper.deleteById(id); + } + + private void validatePaidMemberBenefitExists(Long id) { + if (paidMemberBenefitMapper.selectById(id) == null) { + throw exception(PAID_MEMBER_BENEFIT_NOT_EXISTS); + } + } + + @Override + public PaidMemberBenefitDO getPaidMemberBenefit(Long id) { + return paidMemberBenefitMapper.selectById(id); + } + + @Override + public PageResult getPaidMemberBenefitPage(PaidMemberBenefitPageReqVO pageReqVO) { + return paidMemberBenefitMapper.selectPage(pageReqVO); + } + + @Override + public void updatePaidMemberBenefitStatus(PaidMemberBenefitStatusReqVO req) { + // 校验存在 + validatePaidMemberBenefitExists(req.getId()); + // 更新状态 + paidMemberBenefitMapper.updateById(new PaidMemberBenefitDO().setId(req.getId()).setStatus(req.getStatus())); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationService.java new file mode 100644 index 0000000..8c0961c --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.member.service.memberbenefitlevelrelation; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationSaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation.MemberBenefitLevelRelationDO; + +/** + * 会员权益和等级关系 Service 接口 + * + * @author 管理员 + */ +public interface MemberBenefitLevelRelationService { + + /** + * 创建会员权益和等级关系 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createMemberBenefitLevelRelation(@Valid MemberBenefitLevelRelationSaveReqVO createReqVO); + + /** + * 更新会员权益和等级关系 + * + * @param updateReqVO 更新信息 + */ + void updateMemberBenefitLevelRelation(@Valid MemberBenefitLevelRelationSaveReqVO updateReqVO); + + /** + * 删除会员权益和等级关系 + * + * @param id 编号 + */ + void deleteMemberBenefitLevelRelation(Long id); + + /** + * 获得会员权益和等级关系 + * + * @param id 编号 + * @return 会员权益和等级关系 + */ + MemberBenefitLevelRelationDO getMemberBenefitLevelRelation(Long id); + + /** + * 获得会员权益和等级关系分页 + * + * @param pageReqVO 分页查询 + * @return 会员权益和等级关系分页 + */ + PageResult getMemberBenefitLevelRelationPage(MemberBenefitLevelRelationPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationServiceImpl.java new file mode 100644 index 0000000..9724384 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationServiceImpl.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.member.service.memberbenefitlevelrelation; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationSaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation.MemberBenefitLevelRelationDO; +import cn.iocoder.yudao.module.member.dal.mysql.memberbenefitlevelrelation.MemberBenefitLevelRelationMapper; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.PAID_MEMBER_BENEFIT_LEVEL_RELATION_NOT_EXISTS; + +/** + * 会员权益和等级关系 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class MemberBenefitLevelRelationServiceImpl implements MemberBenefitLevelRelationService { + @Resource + private MemberBenefitLevelRelationMapper memberBenefitLevelRelationMapper; + + @Override + public Long createMemberBenefitLevelRelation(MemberBenefitLevelRelationSaveReqVO createReqVO) { + // 插入 + MemberBenefitLevelRelationDO memberBenefitLevelRelation = BeanUtils.toBean(createReqVO, MemberBenefitLevelRelationDO.class); + memberBenefitLevelRelationMapper.insert(memberBenefitLevelRelation); + // 返回 + return memberBenefitLevelRelation.getId(); + } + + @Override + public void updateMemberBenefitLevelRelation(MemberBenefitLevelRelationSaveReqVO updateReqVO) { + // 校验存在 + validateMemberBenefitLevelRelationExists(updateReqVO.getId()); + // 更新 + MemberBenefitLevelRelationDO updateObj = BeanUtils.toBean(updateReqVO, MemberBenefitLevelRelationDO.class); + memberBenefitLevelRelationMapper.updateById(updateObj); + } + + @Override + public void deleteMemberBenefitLevelRelation(Long id) { + // 校验存在 + validateMemberBenefitLevelRelationExists(id); + // 删除 + memberBenefitLevelRelationMapper.deleteById(id); + } + + private void validateMemberBenefitLevelRelationExists(Long id) { + if (memberBenefitLevelRelationMapper.selectById(id) == null) { + throw exception(PAID_MEMBER_BENEFIT_LEVEL_RELATION_NOT_EXISTS); + } + } + + @Override + public MemberBenefitLevelRelationDO getMemberBenefitLevelRelation(Long id) { + return memberBenefitLevelRelationMapper.selectById(id); + } + + @Override + public PageResult getMemberBenefitLevelRelationPage(MemberBenefitLevelRelationPageReqVO pageReqVO) { + return memberBenefitLevelRelationMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transfer/TransferService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transfer/TransferService.java new file mode 100644 index 0000000..c685937 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transfer/TransferService.java @@ -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 getTransferPage(TransferPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transfer/TransferServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transfer/TransferServiceImpl.java new file mode 100644 index 0000000..08bcedc --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transfer/TransferServiceImpl.java @@ -0,0 +1,71 @@ +package cn.iocoder.yudao.module.member.service.transfer; + +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.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 cn.iocoder.yudao.module.member.dal.mysql.transfer.TransferCardMapper; +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.TRANSFER_NOT_EXISTS; + +/** + * 会员卡划拨 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class TransferServiceImpl implements TransferService { + + @Resource + private TransferCardMapper transferMapper; + + @Override + public Long createTransfer(TransferSaveReqVO createReqVO) { + // 插入 + TransferDO transfer = BeanUtils.toBean(createReqVO, TransferDO.class); + transferMapper.insert(transfer); + // 返回 + return transfer.getId(); + } + + @Override + public void updateTransfer(TransferSaveReqVO updateReqVO) { + // 校验存在 + validateTransferExists(updateReqVO.getId()); + // 更新 + TransferDO updateObj = BeanUtils.toBean(updateReqVO, TransferDO.class); + transferMapper.updateById(updateObj); + } + + @Override + public void deleteTransfer(Long id) { + // 校验存在 + validateTransferExists(id); + // 删除 + transferMapper.deleteById(id); + } + + private void validateTransferExists(Long id) { + if (transferMapper.selectById(id) == null) { + throw exception(TRANSFER_NOT_EXISTS); + } + } + + @Override + public TransferDO getTransfer(Long id) { + return transferMapper.selectById(id); + } + + @Override + public PageResult getTransferPage(TransferPageReqVO pageReqVO) { + return transferMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transferlog/TransferLogService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transferlog/TransferLogService.java new file mode 100644 index 0000000..1f36059 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transferlog/TransferLogService.java @@ -0,0 +1,57 @@ +package cn.iocoder.yudao.module.member.service.transferlog; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.member.controller.admin.transferlog.vo.TransferLogPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.transferlog.vo.TransferLogSaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.transferlog.TransferLogDO; + +import javax.validation.Valid; +import java.util.ArrayList; + +/** + * 会员卡划拨记录 Service 接口 + * + * @author 管理员 + */ +public interface TransferLogService { + + /** + * 创建会员卡划拨记录 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createTransferLog(@Valid TransferLogSaveReqVO createReqVO); + void createTransferLogs(ArrayList list); + + /** + * 更新会员卡划拨记录 + * + * @param updateReqVO 更新信息 + */ + void updateTransferLog(@Valid TransferLogSaveReqVO updateReqVO); + + /** + * 删除会员卡划拨记录 + * + * @param id 编号 + */ + void deleteTransferLog(Long id); + + /** + * 获得会员卡划拨记录 + * + * @param id 编号 + * @return 会员卡划拨记录 + */ + TransferLogDO getTransferLog(Long id); + + /** + * 获得会员卡划拨记录分页 + * + * @param pageReqVO 分页查询 + * @return 会员卡划拨记录分页 + */ + PageResult getTransferLogPage(TransferLogPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transferlog/TransferLogServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transferlog/TransferLogServiceImpl.java new file mode 100644 index 0000000..dafdffd --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transferlog/TransferLogServiceImpl.java @@ -0,0 +1,78 @@ +package cn.iocoder.yudao.module.member.service.transferlog; + +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.transferlog.vo.TransferLogPageReqVO; +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.dal.mysql.transferlog.TransferLogMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.ArrayList; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.TRANSFER_LOG_NOT_EXISTS; + +/** + * 会员卡划拨记录 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class TransferLogServiceImpl implements TransferLogService { + + @Resource + private TransferLogMapper transferLogMapper; + + @Override + public Long createTransferLog(TransferLogSaveReqVO createReqVO) { + // 插入 + TransferLogDO transferLog = BeanUtils.toBean(createReqVO, TransferLogDO.class); + transferLogMapper.insert(transferLog); + // 返回 + return transferLog.getId(); + } + + @Override + public void createTransferLogs(ArrayList list) { + // 插入 + transferLogMapper.insertBatch(list); + } + + @Override + public void updateTransferLog(TransferLogSaveReqVO updateReqVO) { + // 校验存在 + validateTransferLogExists(updateReqVO.getId()); + // 更新 + TransferLogDO updateObj = BeanUtils.toBean(updateReqVO, TransferLogDO.class); + transferLogMapper.updateById(updateObj); + } + + @Override + public void deleteTransferLog(Long id) { + // 校验存在 + validateTransferLogExists(id); + // 删除 + transferLogMapper.deleteById(id); + } + + private void validateTransferLogExists(Long id) { + if (transferLogMapper.selectById(id) == null) { + throw exception(TRANSFER_LOG_NOT_EXISTS); + } + } + + @Override + public TransferLogDO getTransferLog(Long id) { + return transferLogMapper.selectById(id); + } + + @Override + public PageResult getTransferLogPage(TransferLogPageReqVO pageReqVO) { + return transferLogMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java index fb2e9cd..d8e6dd9 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java @@ -187,4 +187,5 @@ public interface MemberUserService { */ boolean updateUserPoint(Long userId, Integer point); + void updateUserDo(MemberUserDO user); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java index 2a67aee..a83ab5b 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java @@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserUpdateReqVO; import cn.iocoder.yudao.module.member.controller.app.user.vo.*; @@ -284,10 +285,8 @@ public class MemberUserServiceImpl implements MemberUserService { public void updateUserLevel(Long id, Long levelId, Integer experience) { // 0 代表无等级:防止UpdateById时,会被过滤掉的问题 levelId = ObjectUtil.defaultIfNull(levelId, 0L); - memberUserMapper.updateById(new MemberUserDO() - .setId(id) - .setLevelId(levelId).setExperience(experience) - ); + MemberUserDO memberUserDO = new MemberUserDO().setId(id).setLevelId(levelId).setExperience(experience); + memberUserMapper.updateById(memberUserDO); } @Override @@ -315,4 +314,18 @@ public class MemberUserServiceImpl implements MemberUserService { return true; } + @Override + public void updateUserDo(MemberUserDO memberUserDO) { + // 校验存在 + validateUserExists(memberUserDO.getId()); + // 校验手机唯一 + validateMobileUnique(memberUserDO.getId(), memberUserDO.getMobile()); + + // 更新 + if(memberUserDO.getLevelId() == 5){ + memberUserDO.setLevelId(Long.parseLong("1")); + } + memberUserMapper.updateById(memberUserDO); + } + } diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/wallet/PayWalletBizTypeEnum.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/wallet/PayWalletBizTypeEnum.java index a8937fb..61e7f8d 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/wallet/PayWalletBizTypeEnum.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/wallet/PayWalletBizTypeEnum.java @@ -19,8 +19,8 @@ public enum PayWalletBizTypeEnum implements IntArrayValuable { RECHARGE_REFUND(2, "充值退款"), PAYMENT(3, "支付"), PAYMENT_REFUND(4, "支付退款"), - ADMIN_MODIFY(5, "管理员修改"); - +// ADMIN_MODIFY(5, "管理员修改"); + UPDATE_BALANCE(5, "更新余额"); // TODO 后续增加 /** diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java index cf08e42..f3d8ed0 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java @@ -2,12 +2,10 @@ package cn.iocoder.yudao.module.pay.controller.admin.wallet; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserBalanceVo; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.*; import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; +import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -20,7 +18,9 @@ import javax.annotation.Resource; import javax.validation.Valid; import static cn.iocoder.yudao.framework.common.enums.UserTypeEnum.MEMBER; +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.WALLET_NOT_FOUND; @Tag(name = "管理后台 - 用户钱包") @RestController @@ -40,11 +40,27 @@ public class PayWalletController { return success(PayWalletConvert.INSTANCE.convert02(wallet)); } - @PostMapping("/update") - @PreAuthorize("@ss.hasPermission('pay:wallet:update')") - @Operation(summary = "修改用户钱包余额(后台操作)") - public CommonResult updateWallet(@Valid @RequestBody PayWalletUserBalanceVo reqVo){ - payWalletService.updateWallet(reqVo); +// @PostMapping("/update") +// @PreAuthorize("@ss.hasPermission('pay:wallet:update')") +// @Operation(summary = "修改用户钱包余额(后台操作)") +// public CommonResult updateWallet(@Valid @RequestBody PayWalletUserBalanceVo reqVo){ +// payWalletService.updateWallet(reqVo); +// return success(true); +// } + @PutMapping("/update-balance") + @Operation(summary = "更新会员用户余额") + @PreAuthorize("@ss.hasPermission('pay:wallet:update-balance')") + public CommonResult updateWalletBalance(@Valid @RequestBody PayWalletUpdateBalanceReqVO updateReqVO) { + // 获得用户钱包 + PayWalletDO wallet = payWalletService.getOrCreateWallet(updateReqVO.getUserId(), MEMBER.getValue()); + if (wallet == null) { + log.error("[updateWalletBalance],updateReqVO({}) 用户钱包不存在.", updateReqVO); + throw exception(WALLET_NOT_FOUND); + } + + // 更新钱包余额 + payWalletService.addWalletBalance(wallet.getId(), String.valueOf(updateReqVO.getUserId()), + PayWalletBizTypeEnum.UPDATE_BALANCE, updateReqVO.getBalance()); return success(true); } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUpdateBalanceReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUpdateBalanceReqVO.java new file mode 100644 index 0000000..3fb7eae --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUpdateBalanceReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 修改钱包余额 Request VO") +@Data +public class PayWalletUpdateBalanceReqVO { + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23788") + @NotNull(message = "用户编号不能为空") + private Long userId; + + @Schema(description = "变动余额,正数为增加,负数为减少", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") + @NotNull(message = "变动余额不能为空") + private Integer balance; + +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/RedisKeyConstants.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/RedisKeyConstants.java index 30081c6..7f7aefa 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/RedisKeyConstants.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/RedisKeyConstants.java @@ -15,7 +15,14 @@ public interface RedisKeyConstants { * 过期时间:不固定 */ String PAY_NOTIFY_LOCK = "pay_notify:lock:%d"; - + /** + * 支付钱包的分布式锁 + * + * KEY 格式:pay_wallet:lock:%d + * VALUE 数据格式:HASH // RLock.class:Redisson 的 Lock 锁,使用 Hash 数据结构 + * 过期时间:不固定 + */ + String PAY_WALLET_LOCK = "pay_wallet:lock:%d"; /** * 支付序号的缓存 * diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/wallet/PayWalletLockRedisDAO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/wallet/PayWalletLockRedisDAO.java new file mode 100644 index 0000000..dda2f64 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/wallet/PayWalletLockRedisDAO.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.pay.dal.redis.wallet; + +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; +import org.springframework.stereotype.Repository; + +import javax.annotation.Resource; +import java.util.concurrent.Callable; +import java.util.concurrent.TimeUnit; + +import static cn.iocoder.yudao.module.pay.dal.redis.RedisKeyConstants.PAY_WALLET_LOCK; + + +/** + * 支付钱包的锁 Redis DAO + * + * @author 芋道源码 + */ +@Repository +public class PayWalletLockRedisDAO { + + @Resource + private RedissonClient redissonClient; + + public V lock(Long id, Long timeoutMillis, Callable callable) throws Exception { + String lockKey = formatKey(id); + RLock lock = redissonClient.getLock(lockKey); + try { + lock.lock(timeoutMillis, TimeUnit.MILLISECONDS); + // 执行逻辑 + return callable.call(); + } catch (Exception e) { + throw e; + } finally { + lock.unlock(); + } + } + + private static String formatKey(Long id) { + return String.format(PAY_WALLET_LOCK, id); + } + +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java index db5b784..89b27af 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java @@ -98,10 +98,10 @@ public interface PayWalletService { */ void unfreezePrice(Long id, Integer price); - /** - * 修改钱包余额(后台操作) - * @param reqVo - * @return void - */ - void updateWallet(PayWalletUserBalanceVo reqVo); +// /** +// * 修改钱包余额(后台操作) +// * @param reqVo +// * @return void +// */ +// void updateWallet(PayWalletUserBalanceVo reqVo); } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java index 1a011fb..c33a887 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; import cn.hutool.core.lang.Assert; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserBalanceVo; @@ -10,10 +11,12 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletMapper; +import cn.iocoder.yudao.module.pay.dal.redis.wallet.PayWalletLockRedisDAO; import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -36,7 +39,10 @@ import static cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum.PAYM @Service @Slf4j public class PayWalletServiceImpl implements PayWalletService { - + /** + * 通知超时时间,单位:毫秒 + */ + public static final long UPDATE_TIMEOUT_MILLIS = 120 * DateUtils.SECOND_MILLIS; @Resource private PayWalletMapper walletMapper; @@ -50,6 +56,9 @@ public class PayWalletServiceImpl implements PayWalletService { @Lazy // 延迟加载,避免循环依赖 private PayRefundService refundService; + @Resource + private PayWalletLockRedisDAO lockRedisDAO; + @Override public PayWalletDO getOrCreateWallet(Long userId, Integer userType) { PayWalletDO wallet = walletMapper.selectByUserIdAndType(userId, userType); @@ -161,35 +170,44 @@ public class PayWalletServiceImpl implements PayWalletService { } @Override + @Transactional(rollbackFor = Exception.class) + @SneakyThrows public PayWalletTransactionDO addWalletBalance(Long walletId, String bizId, PayWalletBizTypeEnum bizType, Integer price) { - // 1.1 获取钱包 + // 1. 获取钱包 PayWalletDO payWallet = getWallet(walletId); if (payWallet == null) { - log.error("[addWalletBalance],用户钱包({})不存在.", walletId); + log.error("[addWalletBalance][用户钱包({})不存在]", walletId); throw exception(WALLET_NOT_FOUND); } - // 1.2 更新钱包金额 - switch (bizType) { - case PAYMENT_REFUND: { // 退款更新 - walletMapper.updateWhenConsumptionRefund(payWallet.getId(), price); - break; - } - case RECHARGE: { // 充值更新 - walletMapper.updateWhenRecharge(payWallet.getId(), price); - break; - } - default: { - // TODO 其它类型待实现 - throw new UnsupportedOperationException("待实现"); - } - } - // 2. 生成钱包流水 - WalletTransactionCreateReqBO transactionCreateReqBO = new WalletTransactionCreateReqBO() - .setWalletId(payWallet.getId()).setPrice(price).setBalance(payWallet.getBalance() + price) - .setBizId(bizId).setBizType(bizType.getType()).setTitle(bizType.getDescription()); - return walletTransactionService.createWalletTransaction(transactionCreateReqBO); + // 2. 加锁,更新钱包余额(目的:避免钱包流水的并发更新时,余额变化不连贯) + return lockRedisDAO.lock(walletId, UPDATE_TIMEOUT_MILLIS, () -> { + // 2. 更新钱包金额 + switch (bizType) { + case PAYMENT_REFUND: { // 退款更新 + walletMapper.updateWhenConsumptionRefund(payWallet.getId(), price); + break; + } + case RECHARGE: { // 充值更新 + walletMapper.updateWhenRecharge(payWallet.getId(), price); + break; + } + case UPDATE_BALANCE: // 更新余额 + walletMapper.updateWhenRecharge(payWallet.getId(), price); + break; + default: { + // TODO 其它类型待实现 + throw new UnsupportedOperationException("待实现"); + } + } + + // 3. 生成钱包流水 + WalletTransactionCreateReqBO transactionCreateReqBO = new WalletTransactionCreateReqBO() + .setWalletId(payWallet.getId()).setPrice(price).setBalance(payWallet.getBalance() + price) + .setBizId(bizId).setBizType(bizType.getType()).setTitle(bizType.getDescription()); + return walletTransactionService.createWalletTransaction(transactionCreateReqBO); + }); } @Override @@ -208,37 +226,37 @@ public class PayWalletServiceImpl implements PayWalletService { } } - @Override - public void updateWallet(PayWalletUserBalanceVo reqVo) { - // 如果 - if (reqVo.getBalance().compareTo(BigDecimal.ZERO) == 0) { - return; - } - // 把单位从元转为分 - BigDecimal change = new BigDecimal("100"); - // 查出对应钱包信息 - PayWalletDO walletDO = walletMapper.selectById(reqVo.getId()); - if (reqVo.getBalance().compareTo(new BigDecimal("21474836.47")) > 0) { - throw exception(WALLET_RECHARGE_RANGE_EXCEPTION); - } - // 总共改变的金额 - long changeBalance = (reqVo.getBalance().multiply(change)).longValue(); - // 总余额 - long totalBalance = walletDO.getBalance() + changeBalance; - // 总充值 - long totalRecharge = walletDO.getTotalRecharge() + changeBalance; - if (totalBalance > 2147483647 || totalRecharge > 2147483647 || totalBalance < 0 || totalRecharge < 0) { - throw exception(WALLET_RECHARGE_RANGE_EXCEPTION); - } - walletDO.setBalance((int) totalBalance); - walletDO.setTotalRecharge((int) totalRecharge); - walletMapper.updateById(walletDO); - String title = "后台操作给用户" + (totalBalance > 0 ? "增加" : "减少") + "余额" + Math.abs(changeBalance)/100.0 + "元"; - WalletTransactionCreateReqBO transactionCreateReqBO = new WalletTransactionCreateReqBO() - .setWalletId(reqVo.getId()).setPrice((int) changeBalance).setBalance((int) totalBalance) - .setBizType(PayWalletBizTypeEnum.ADMIN_MODIFY.getType()).setBizId("0").setTitle(title); - walletTransactionService.createWalletTransaction(transactionCreateReqBO); - - } +// @Override +// public void updateWallet(PayWalletUserBalanceVo reqVo) { +// // 如果 +// if (reqVo.getBalance().compareTo(BigDecimal.ZERO) == 0) { +// return; +// } +// // 把单位从元转为分 +// BigDecimal change = new BigDecimal("100"); +// // 查出对应钱包信息 +// PayWalletDO walletDO = walletMapper.selectById(reqVo.getId()); +// if (reqVo.getBalance().compareTo(new BigDecimal("21474836.47")) > 0) { +// throw exception(WALLET_RECHARGE_RANGE_EXCEPTION); +// } +// // 总共改变的金额 +// long changeBalance = (reqVo.getBalance().multiply(change)).longValue(); +// // 总余额 +// long totalBalance = walletDO.getBalance() + changeBalance; +// // 总充值 +// long totalRecharge = walletDO.getTotalRecharge() + changeBalance; +// if (totalBalance > 2147483647 || totalRecharge > 2147483647 || totalBalance < 0 || totalRecharge < 0) { +// throw exception(WALLET_RECHARGE_RANGE_EXCEPTION); +// } +// walletDO.setBalance((int) totalBalance); +// walletDO.setTotalRecharge((int) totalRecharge); +// walletMapper.updateById(walletDO); +// String title = "后台操作给用户" + (totalBalance > 0 ? "增加" : "减少") + "余额" + Math.abs(changeBalance)/100.0 + "元"; +// WalletTransactionCreateReqBO transactionCreateReqBO = new WalletTransactionCreateReqBO() +// .setWalletId(reqVo.getId()).setPrice((int) changeBalance).setBalance((int) totalBalance) +// .setBizType(PayWalletBizTypeEnum.ADMIN_MODIFY.getType()).setBizId("0").setTitle(title); +// walletTransactionService.createWalletTransaction(transactionCreateReqBO); +// +// } } diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/reservation/LitemallReservationServiceImpl.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/reservation/LitemallReservationServiceImpl.java index 7d4958f..0e7e09d 100644 --- a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/reservation/LitemallReservationServiceImpl.java +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/reservation/LitemallReservationServiceImpl.java @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.srbscribe.service.reservation; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; -import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationPageReqVO; import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationSaveReqVO; import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.ServiceTimeVO; @@ -18,7 +17,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; - +import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java index b75684d..1fb923e 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.api.dict; import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataSaveReqApiVO; import java.util.Collection; import java.util.List; @@ -78,4 +79,6 @@ public interface DictDataApi { return convertList(list, DictDataRespDTO::getLabel); } + Long createDictDataApi(DictDataSaveReqApiVO createReqVO); + } diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/dto/DictDataSaveReqApiVO.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/dto/DictDataSaveReqApiVO.java new file mode 100644 index 0000000..4e1f7f4 --- /dev/null +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/dto/DictDataSaveReqApiVO.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.system.api.dict.dto; + +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.validation.InEnum; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Data +public class DictDataSaveReqApiVO { + + private Long id; + + @NotNull(message = "显示顺序不能为空") + private Integer sort; + + @NotBlank(message = "字典标签不能为空") + @Size(max = 100, message = "字典标签长度不能超过100个字符") + private String label; + + @NotBlank(message = "字典键值不能为空") + @Size(max = 100, message = "字典键值长度不能超过100个字符") + private String value; + + @NotBlank(message = "字典类型不能为空") + @Size(max = 100, message = "字典类型长度不能超过100个字符") + private String dictType; + + @NotNull(message = "状态不能为空") + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") + private Integer status; + + private String colorType; + + private String cssClass; + + private String remark; + +} diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/LogRecordConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/LogRecordConstants.java index 4ee3840..993437a 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/LogRecordConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/LogRecordConstants.java @@ -29,5 +29,10 @@ public interface LogRecordConstants { String SYSTEM_ROLE_UPDATE_SUCCESS = "更新了角色【{{#role.name}}】: {_DIFF{#updateReqVO}}"; String SYSTEM_ROLE_DELETE_SUB_TYPE = "删除角色"; String SYSTEM_ROLE_DELETE_SUCCESS = "删除了角色【{{#role.name}}】"; - + // ======================= 会员权益 =======================notice_interest + String NOTICE_INTEREST_TYPE = "会员权益"; + String NOTICE_INTEREST_CREATE_SUB_TYPE = "创建会员权益【{{#interest.title}}】"; + String NOTICE_INTEREST_CREATE_SUCCESS = "创建会员权益"; + String NOTICE_INTEREST_UPDATE_SUB_TYPE = "更新会员权益"; + String NOTICE_INTEREST_UPDATE_SUCCESS = "更新了会员权益【{{#interest.title}}】: {_DIFF{#updateReqVO}}"; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java index aecaf80..460cbe6 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.api.dict; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataSaveReqApiVO; import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO; import cn.iocoder.yudao.module.system.service.dict.DictDataService; import org.springframework.stereotype.Service; @@ -44,4 +45,9 @@ public class DictDataApiImpl implements DictDataApi { return BeanUtils.toBean(list, DictDataRespDTO.class); } + @Override + public Long createDictDataApi(DictDataSaveReqApiVO createReqVO) { + return dictDataService.createDictDataApi(createReqVO); + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java index fc2498f..9a046a7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.system.service.dict; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataSaveReqApiVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataSaveReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO; @@ -107,4 +108,5 @@ public interface DictDataService { */ List getDictDataListByDictType(String dictType); + Long createDictDataApi(DictDataSaveReqApiVO createReqVO); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java index e9f215d..fba950f 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataSaveReqApiVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataSaveReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO; @@ -176,4 +177,17 @@ public class DictDataServiceImpl implements DictDataService { return list; } + @Override + public Long createDictDataApi(DictDataSaveReqApiVO createReqVO) { + // 校验字典类型有效 + validateDictTypeExists(createReqVO.getDictType()); + // 校验字典数据的值的唯一性 + validateDictDataValueUnique(null, createReqVO.getDictType(), createReqVO.getValue()); + + // 插入字典类型 + DictDataDO dictData = BeanUtils.toBean(createReqVO, DictDataDO.class); + dictDataMapper.insert(dictData); + return dictData.getId(); + } + }