From 884b9110c41f6331fd0282f14973ca7b23547cf5 Mon Sep 17 00:00:00 2001 From: XinWei <2718030729@qq.com> Date: Tue, 8 Oct 2024 17:40:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=8D=A1=E7=89=87=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=92=8C=E4=BC=9A=E5=91=98=E6=9D=83=E7=9B=8A=E7=A7=BB?= =?UTF-8?q?=E6=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-admin-vue3/src/api/cardbase/index.ts | 43 +++ yudao-admin-vue3/src/api/cardlog/index.ts | 43 +++ .../src/api/club/clubCard/index.ts | 44 +++ yudao-admin-vue3/src/api/interest/index.ts | 45 +++ .../src/api/pay/wallet/balance/index.ts | 2 +- .../src/api/transferCard/index.ts | 45 +++ yudao-admin-vue3/src/api/transferlog/index.ts | 45 +++ yudao-admin-vue3/src/utils/dict.ts | 4 +- .../src/views/club/clubCard/CardForm.vue | 117 ++++++ .../src/views/club/clubCard/index.vue | 237 ++++++++++++ .../src/views/club/sendCard/CardList.vue | 182 +++++++++ .../src/views/club/sendCard/CardLogForm.vue | 104 +++++ .../src/views/club/sendCard/index.vue | 235 +++++++++++ .../src/views/interest/InterestForm.vue | 117 ++++++ yudao-admin-vue3/src/views/interest/index.vue | 197 ++++++++++ .../memberbenefit/PaidMemberBenefitForm.vue | 33 +- .../mall/promotion/memberbenefit/index.vue | 30 +- .../seckill/config/SeckillConfigForm.vue | 6 +- .../src/views/mall/promotion/user/index.vue | 2 +- .../views/member/cardbase/CardBaseForm.vue | 106 +++++ .../src/views/member/cardbase/index.vue | 220 +++++++++++ .../src/views/transferCard/TransferForm.vue | 124 ++++++ .../src/views/transferCard/index.vue | 289 ++++++++++++++ .../src/views/transferlog/TransferLogForm.vue | 124 ++++++ .../src/views/transferlog/index.vue | 253 ++++++++++++ .../dataobject/brokerage/BrokerageUserDO.java | 4 + .../brokerage/BrokerageUserService.java | 5 + .../brokerage/BrokerageUserServiceImpl.java | 34 ++ .../member/api/clubCard/ClubCardApi.java | 8 + .../member/api/clubCard/vo/ClubCardApiVo.java | 57 +++ .../api/user/dto/MemberUserRespDTO.java | 4 + .../member/enums/ErrorCodeConstants.java | 9 + .../enums/point/MemberPointBizTypeEnum.java | 4 +- .../yudao-module-member-biz/pom.xml | 7 +- .../member/api/clubCard/clubCardApiImpl.java | 28 ++ .../AfterVerificationController.java | 176 +++++++++ .../vo/AfterVerificationPageReqVO.java | 39 ++ .../vo/AfterVerificationRespVO.java | 55 +++ .../vo/AfterVerificationSaveReqVO.java | 33 ++ .../admin/cardbase/CardBaseController.java | 94 +++++ .../admin/cardbase/vo/CardBasePageReqVO.java | 36 ++ .../admin/cardbase/vo/CardBaseRespVO.java | 39 ++ .../admin/cardbase/vo/CardBaseSaveReqVO.java | 25 ++ .../admin/cardlog/CardLogController.java | 97 +++++ .../admin/cardlog/vo/CardLogPageReqVO.java | 42 ++ .../admin/cardlog/vo/CardLogRespVO.java | 47 +++ .../admin/cardlog/vo/CardLogSaveReqVO.java | 31 ++ .../admin/clubCard/ClubCardController.java | 136 +++++++ .../admin/clubCard/vo/ClubCardPageReqVO.java | 45 +++ .../admin/clubCard/vo/ClubCardRespVO.java | 62 +++ .../admin/clubCard/vo/ClubCardSaveReqVO.java | 37 ++ .../admin/interest/InterestController.java | 107 +++++ .../admin/interest/vo/InterestPageReqVO.java | 42 ++ .../admin/interest/vo/InterestRespVO.java | 46 +++ .../admin/interest/vo/InterestSaveReqVO.java | 38 ++ .../PaidMemberBenefitController.java | 2 +- .../vo/PaidMemberBenefitSaveReqVO.java | 3 + .../admin/transfer/TransferController.java | 127 ++++++ .../admin/transfer/vo/TransferPageReqVO.java | 42 ++ .../admin/transfer/vo/TransferRespVO.java | 50 +++ .../admin/transfer/vo/TransferSaveReqVO.java | 31 ++ .../transferlog/TransferLogController.java | 94 +++++ .../transferlog/vo/TransferLogPageReqVO.java | 42 ++ .../transferlog/vo/TransferLogRespVO.java | 50 +++ .../transferlog/vo/TransferLogSaveReqVO.java | 31 ++ .../admin/user/MemberUserController.java | 55 ++- .../admin/user/vo/MemberUserPageReqVO.java | 9 +- .../app/interest/AppInterestController.java | 54 +++ .../app/user/AppMemberUserController.java | 365 +++++++++++++++++- .../vo/AppMemberUserDoVerificationVo.java | 11 + .../app/user/vo/AppMemberUserInfoRespVO.java | 3 + .../AfterVerificationDO.java | 69 ++++ .../dal/dataobject/cardbase/CardBaseDO.java | 46 +++ .../dal/dataobject/cardlog/CardLogDO.java | 57 +++ .../dal/dataobject/clubCard/ClubCardDO.java | 70 ++++ .../dal/dataobject/interest/InterestDO.java | 56 +++ .../dataobject/memberCode/MemberCodeDo.java | 30 ++ .../dal/dataobject/transfer/TransferDO.java | 54 +++ .../dataobject/transferlog/TransferLogDO.java | 54 +++ .../dal/dataobject/user/MemberUserDO.java | 13 +- .../AfterVerificationMapper.java | 29 ++ .../dal/mysql/cardbase/CardBaseMapper.java | 28 ++ .../dal/mysql/cardlog/CardLogMapper.java | 27 ++ .../dal/mysql/clubCard/ClubCardMapper.java | 44 +++ .../dal/mysql/interest/InterestMapper.java | 29 ++ .../mysql/memberCode/MemberCodeMapper.java | 9 + .../mysql/transfer/TransferCardMapper.java | 30 ++ .../mysql/transferlog/TransferLogMapper.java | 30 ++ .../dal/mysql/user/MemberUserMapper.java | 3 +- .../AfterVerificationService.java | 63 +++ .../AfterVerificationServiceImpl.java | 135 +++++++ .../service/cardbase/CardBaseService.java | 56 +++ .../service/cardbase/CardBaseServiceImpl.java | 76 ++++ .../service/cardlog/CardLogService.java | 55 +++ .../service/cardlog/CardLogServiceImpl.java | 72 ++++ .../service/clubCard/ClubCardService.java | 68 ++++ .../service/clubCard/ClubCardServiceImpl.java | 130 +++++++ .../service/interest/InterestService.java | 56 +++ .../service/interest/InterestServiceImpl.java | 91 +++++ .../service/transfer/TransferService.java | 55 +++ .../service/transfer/TransferServiceImpl.java | 71 ++++ .../transferlog/TransferLogService.java | 57 +++ .../transferlog/TransferLogServiceImpl.java | 78 ++++ .../service/user/MemberUserService.java | 1 + .../service/user/MemberUserServiceImpl.java | 20 +- .../module/system/api/dict/DictDataApi.java | 3 + .../api/dict/dto/DictDataSaveReqApiVO.java | 41 ++ .../system/enums/LogRecordConstants.java | 7 +- .../system/api/dict/DictDataApiImpl.java | 6 + .../system/service/dict/DictDataService.java | 2 + .../service/dict/DictDataServiceImpl.java | 14 + 111 files changed, 6807 insertions(+), 31 deletions(-) create mode 100644 yudao-admin-vue3/src/api/cardbase/index.ts create mode 100644 yudao-admin-vue3/src/api/cardlog/index.ts create mode 100644 yudao-admin-vue3/src/api/club/clubCard/index.ts create mode 100644 yudao-admin-vue3/src/api/interest/index.ts create mode 100644 yudao-admin-vue3/src/api/transferCard/index.ts create mode 100644 yudao-admin-vue3/src/api/transferlog/index.ts create mode 100644 yudao-admin-vue3/src/views/club/clubCard/CardForm.vue create mode 100644 yudao-admin-vue3/src/views/club/clubCard/index.vue create mode 100644 yudao-admin-vue3/src/views/club/sendCard/CardList.vue create mode 100644 yudao-admin-vue3/src/views/club/sendCard/CardLogForm.vue create mode 100644 yudao-admin-vue3/src/views/club/sendCard/index.vue create mode 100644 yudao-admin-vue3/src/views/interest/InterestForm.vue create mode 100644 yudao-admin-vue3/src/views/interest/index.vue create mode 100644 yudao-admin-vue3/src/views/member/cardbase/CardBaseForm.vue create mode 100644 yudao-admin-vue3/src/views/member/cardbase/index.vue create mode 100644 yudao-admin-vue3/src/views/transferCard/TransferForm.vue create mode 100644 yudao-admin-vue3/src/views/transferCard/index.vue create mode 100644 yudao-admin-vue3/src/views/transferlog/TransferLogForm.vue create mode 100644 yudao-admin-vue3/src/views/transferlog/index.vue create mode 100644 yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/ClubCardApi.java create mode 100644 yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/vo/ClubCardApiVo.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/clubCard/clubCardApiImpl.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/AfterVerificationController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationPageReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/afterverification/vo/AfterVerificationSaveReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/CardBaseController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBasePageReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBaseRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardbase/vo/CardBaseSaveReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/CardLogController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogPageReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/cardlog/vo/CardLogSaveReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/ClubCardController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardPageReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/clubCard/vo/ClubCardSaveReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/InterestController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestPageReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/interest/vo/InterestSaveReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/TransferController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferPageReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transfer/vo/TransferSaveReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/TransferLogController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogPageReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/transferlog/vo/TransferLogSaveReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/interest/AppInterestController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserDoVerificationVo.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/afterverification/AfterVerificationDO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/cardbase/CardBaseDO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/cardlog/CardLogDO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/clubCard/ClubCardDO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/interest/InterestDO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberCode/MemberCodeDo.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/transfer/TransferDO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/transferlog/TransferLogDO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/afterverification/AfterVerificationMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/cardbase/CardBaseMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/cardlog/CardLogMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/clubCard/ClubCardMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/interest/InterestMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberCode/MemberCodeMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/transfer/TransferCardMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/transferlog/TransferLogMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/afterverification/AfterVerificationService.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/afterverification/AfterVerificationServiceImpl.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardbase/CardBaseService.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardbase/CardBaseServiceImpl.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardlog/CardLogService.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/cardlog/CardLogServiceImpl.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/clubCard/ClubCardService.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/clubCard/ClubCardServiceImpl.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/interest/InterestService.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/interest/InterestServiceImpl.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transfer/TransferService.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transfer/TransferServiceImpl.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transferlog/TransferLogService.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/transferlog/TransferLogServiceImpl.java create mode 100644 yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/dto/DictDataSaveReqApiVO.java 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/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 6004227..98cea3c 100644 --- a/yudao-admin-vue3/src/utils/dict.ts +++ b/yudao-admin-vue3/src/utils/dict.ts @@ -258,5 +258,7 @@ export enum DICT_TYPE { AI_WRITE_LANGUAGE = 'ai_write_language', // AI 写作语言 // ========== 通用模块 ========== - ZERO_OR_ONE = 'zero_or_one' + ZERO_OR_ONE = 'zero_or_one', + IS_ACTIVATE = 'is_activate', + CARD_STATUS = 'card_status' } 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 @@ + + + + + + + + + + + + + + + + {{ dict.label }} + + + + + + 确 定 + 取 消 + + + + \ 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 @@ + + + + + + + + + + + + + + + + + + 搜索 + 重置 + + + + + + + + + + 导出 + + + + + + + + + + + + + + + + {{scope.row.cardSection}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 index 83dd186..cd24106 100644 --- a/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/PaidMemberBenefitForm.vue +++ b/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/PaidMemberBenefitForm.vue @@ -10,8 +10,8 @@ - - + + @@ -26,6 +26,19 @@ /> + + + + {{ dict.name }} + + + + + @@ -39,6 +52,7 @@ \ 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 index d1ef3fa..6fe9b0a 100644 --- a/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/index.vue +++ b/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/index.vue @@ -45,6 +45,16 @@ /> + + + + + + + + + + + + + 确 定 + 取 消 + + + + \ 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/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 d056ba8..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 @@ -55,5 +55,14 @@ public interface ErrorCodeConstants { //========== 用户分组 1-004-012-000 ========== ErrorCode GROUP_NOT_EXISTS = new ErrorCode(1_004_012_000, "用户分组不存在"); ErrorCode GROUP_HAS_USER = new ErrorCode(1_004_012_001, "用户分组下存在用户,无法删除"); + //============================================ + ErrorCode CARD_LOG_NOT_EXISTS = new ErrorCode(1_004_013_000, "发卡记录不存在"); + ErrorCode AFTER_VERIFICATION_NOT_EXISTS = new ErrorCode(1_004_014_000, "核销记录不存在"); + ErrorCode CARD_BASE_NOT_EXISTS = new ErrorCode(1_004_015_000, "会员卡档案不存在"); + ErrorCode INTEREST_NOT_EXISTS = new ErrorCode(1_004_016_000, "权益通知不存在"); + ErrorCode TRANSFER_NOT_EXISTS = new ErrorCode(1_004_017_000, "会员卡划拨不存在"); + ErrorCode TRANSFER_LOG_NOT_EXISTS = new ErrorCode(1_004_018_000, "会员卡划拨记录不存在"); + // ========== ========== + ErrorCode INPUTCODE_NOT_EXISTS = new ErrorCode(1_004_019_000, "进件码不存在"); } 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 index 935b17b..5532cb4 100644 --- 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 @@ -56,7 +56,7 @@ public class PaidMemberBenefitController { return success(true); } @PutMapping("/updateStatus") - @Operation(summary = "更新付费会员权益") + @Operation(summary = "更新付费会员权益状态") @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:update')") public CommonResult updatePaidMemberBenefitStatus(@RequestBody PaidMemberBenefitStatusReqVO req) { paidMemberBenefitService.updatePaidMemberBenefitStatus(req); 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 index c8d49af..8c23de8 100644 --- 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 @@ -31,4 +31,7 @@ public class PaidMemberBenefitSaveReqVO { @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/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 9a4de1e..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')") @@ -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 0882893..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,10 +41,15 @@ public class MemberUserPageReqVO extends PageParam { @Schema(description = "用户分组编号", example = "1") private Long groupId; - @Schema(description = "是否付费会员", example = "1") - private Integer isPaidMember; + @Schema(description = "权益id", example = "1") + private Long noticeInterestId; + + @Schema(description = "是否绑过卡", example = "1") + private Integer activate; + // TODO 芋艿:注册用户类型; + // TODO 芋艿:登录用户类型; } 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/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 bd2ec47..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 @@ -143,7 +143,16 @@ public class MemberUserDO extends TenantBaseDO { private Long groupId; /** - * 是否付费会员(0:不是 1:是) + * 是否绑过卡 */ - private Integer isPaidMember; + private Integer activate; + + /** + * 会员权益id + */ + private Long noticeInterestId; + /** + * 角色id(0:普通用户, 1:工作人员) + */ + private Integer roleId; } 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/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 0fcce12..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,7 +47,8 @@ public interface MemberUserMapper extends BaseMapperX { .betweenIfPresent(MemberUserDO::getCreateTime, reqVO.getCreateTime()) .eqIfPresent(MemberUserDO::getLevelId, reqVO.getLevelId()) .eqIfPresent(MemberUserDO::getGroupId, reqVO.getGroupId()) - .eqIfPresent(MemberUserDO::getIsPaidMember, reqVO.getIsPaidMember()) + .eqIfPresent(MemberUserDO::getNoticeInterestId, reqVO.getNoticeInterestId()) + .eqIfPresent(MemberUserDO::getActivate, reqVO.getActivate()) .apply(StrUtil.isNotEmpty(tagIdSql), tagIdSql) .orderByDesc(MemberUserDO::getId)); } 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/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 5993c20..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 @@ -286,12 +286,6 @@ public class MemberUserServiceImpl implements MemberUserService { // 0 代表无等级:防止UpdateById时,会被过滤掉的问题 levelId = ObjectUtil.defaultIfNull(levelId, 0L); MemberUserDO memberUserDO = new MemberUserDO().setId(id).setLevelId(levelId).setExperience(experience); - // 暂时这样设计:如果等级为0则设置付费会员状态为0,否则则设置为付费会员状态(1) - if (levelId == 0){ - memberUserDO.setIsPaidMember(0); - }else{ - memberUserDO.setIsPaidMember(1); - } memberUserMapper.updateById(memberUserDO); } @@ -320,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-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(); + } + }