From 017aea38dafe75d1966c1de11a8b4bee2d4389b8 Mon Sep 17 00:00:00 2001
From: khy <2908249413@qq.com>
Date: Thu, 24 Oct 2024 13:59:45 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E4=BB=98=E8=B4=B9=E4=BC=9A=E5=91=98?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/api/member/memberconfig/index.ts | 21 ++++
.../src/views/member/memberconfig/index.vue | 114 ++++++++++++++++++
.../src/views/member/memberuser/index.vue | 32 ++---
.../member/enums/ErrorCodeConstants.java | 5 +-
.../PaidMemberConfigController.java | 59 +++++++++
.../vo/PaidMemberConfigPageReqVO.java | 28 +++++
.../vo/PaidMemberConfigRespVO.java | 31 +++++
.../vo/PaidMemberConfigSaveReqVO.java | 22 ++++
.../memberconfig/PaidMemberConfigConvert.java | 18 +++
.../memberconfig/PaidMemberConfigDO.java | 39 ++++++
.../memberconfig/PaidMemberConfigMapper.java | 28 +++++
.../memberconfig/PaidMemberConfigService.java | 63 ++++++++++
.../PaidMemberConfigServiceImpl.java | 94 +++++++++++++++
13 files changed, 536 insertions(+), 18 deletions(-)
create mode 100644 yudao-admin-vue3/src/api/member/memberconfig/index.ts
create mode 100644 yudao-admin-vue3/src/views/member/memberconfig/index.vue
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/PaidMemberConfigController.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigPageReqVO.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigRespVO.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigSaveReqVO.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/memberconfig/PaidMemberConfigConvert.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberconfig/PaidMemberConfigDO.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberconfig/PaidMemberConfigMapper.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberconfig/PaidMemberConfigService.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberconfig/PaidMemberConfigServiceImpl.java
diff --git a/yudao-admin-vue3/src/api/member/memberconfig/index.ts b/yudao-admin-vue3/src/api/member/memberconfig/index.ts
new file mode 100644
index 0000000..61f4d42
--- /dev/null
+++ b/yudao-admin-vue3/src/api/member/memberconfig/index.ts
@@ -0,0 +1,21 @@
+import request from '@/config/axios'
+
+// 付费会员配置 VO
+export interface PaidMemberConfigVO {
+ id: number // 编号
+ openPaidMember: boolean // 开启付费会员
+ paidMemberPrice: boolean // 商品付费会员价
+}
+
+// 付费会员配置 API
+export const PaidMemberConfigApi = {
+ // 查询付费会员配置详情
+ getPaidMemberConfig: async () => {
+ return await request.get({ url: `/member/paid-member-config/get` })
+ },
+
+ // 保存付费会员配置
+ savePaidMemberConfig: async (data: PaidMemberConfigVO) => {
+ return await request.put({ url: `/member/paid-member-config/save`, data })
+ }
+}
diff --git a/yudao-admin-vue3/src/views/member/memberconfig/index.vue b/yudao-admin-vue3/src/views/member/memberconfig/index.vue
new file mode 100644
index 0000000..16055ec
--- /dev/null
+++ b/yudao-admin-vue3/src/views/member/memberconfig/index.vue
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 开启
+ 关闭
+
+ 付费会员开关
+
+
+
+ 开启
+ 关闭
+
+ 商品付费会员价是否展示
+
+
+
+
+
+
+
+ 提交
+
+
+
+
+
+
diff --git a/yudao-admin-vue3/src/views/member/memberuser/index.vue b/yudao-admin-vue3/src/views/member/memberuser/index.vue
index 2b95c1f..d6849b1 100644
--- a/yudao-admin-vue3/src/views/member/memberuser/index.vue
+++ b/yudao-admin-vue3/src/views/member/memberuser/index.vue
@@ -9,19 +9,19 @@
label-width="68px"
>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -108,7 +108,7 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { PaidMemberUserApi, PaidMemberUserVO } from '@/api/member/memberuser'
-import * as CardApi from '@/api/member/type'
+import * as CardVoApid from '@/api/member/type'
import PaidMemberUserForm from './PaidMemberUserForm.vue'
/** 付费会员 列表 */
@@ -217,10 +217,10 @@ const handleExport = async () => {
}
}
-const cardlist = ref([])//会员类型下拉列表
+const cardlist = ref([])//会员类型下拉列表
/** 初始化 **/
onMounted(async () => {
await getList()
- cardlist.value = (await CardApi.getcardlist()) as CardApi.cardVO[]
+ cardlist.value = (await CardVoApid.cardApi.getcardlist()) as CardVoApid.cardVO[]
})
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 79655f2..efcd957 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
@@ -69,8 +69,9 @@ public interface ErrorCodeConstants {
ErrorCode MEMBER_USER_NOT_EXISTS = new ErrorCode(1_004_021_000, "会员不存在");
ErrorCode PAID_MEMBER_ORDER_NOT_EXISTS = new ErrorCode(1_004_022_000, "付费会员订单不存在");
ErrorCode PAID_MEMBER_USER_ORDER_NO_NOT_EXISTS = new ErrorCode(1_004_023_000, "生成会员订单号失败,请重新提交");
- ErrorCode PAID_MEMBER_USER_NOT_OPEN = new ErrorCode(1_004_021_000, "会员未开通");
- ErrorCode PAID_MEMBER_USER_PASSED = new ErrorCode(1_004_021_000, "会员已过期");
+ ErrorCode PAID_MEMBER_USER_NOT_OPEN = new ErrorCode(1_004_024_000, "会员未开通");
+ ErrorCode PAID_MEMBER_USER_PASSED = new ErrorCode(1_004_025_000, "会员已过期");
+ ErrorCode PAID_MEMBER_CONFIG_NOT_EXISTS = new ErrorCode(1_004_026_000, "付费会员配置不存在");
}
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/PaidMemberConfigController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/PaidMemberConfigController.java
new file mode 100644
index 0000000..a5dbc18
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/PaidMemberConfigController.java
@@ -0,0 +1,59 @@
+package cn.iocoder.yudao.module.member.controller.admin.memberconfig;
+
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Operation;
+
+import javax.validation.constraints.*;
+import javax.validation.*;
+import javax.servlet.http.*;
+import java.util.*;
+import java.io.IOException;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
+
+import cn.iocoder.yudao.module.member.controller.admin.memberconfig.vo.*;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberconfig.PaidMemberConfigDO;
+import cn.iocoder.yudao.module.member.service.memberconfig.PaidMemberConfigService;
+
+@Tag(name = "管理后台 - 付费会员配置")
+@RestController
+@RequestMapping("/member/paid-member-config")
+@Validated
+public class PaidMemberConfigController {
+
+ @Resource
+ private PaidMemberConfigService paidMemberConfigService;
+
+
+ @PutMapping("/save")
+ @Operation(summary = "保存付费会员配置")
+ @PreAuthorize("@ss.hasPermission('member:paid-member-config:save')")
+ public CommonResult updatePaidMemberConfig(@Valid @RequestBody PaidMemberConfigSaveReqVO saveReqVO) {
+ paidMemberConfigService.saveConfig(saveReqVO);
+ return success(true);
+ }
+
+ @GetMapping("/get")
+ @Operation(summary = "获得付费会员配置")
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
+ @PreAuthorize("@ss.hasPermission('member:paid-member-config:query')")
+ public CommonResult getPaidMemberConfig() {
+ PaidMemberConfigDO paidMemberConfig = paidMemberConfigService.getConfig();
+ return success(BeanUtils.toBean(paidMemberConfig, PaidMemberConfigRespVO.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/memberconfig/vo/PaidMemberConfigPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigPageReqVO.java
new file mode 100644
index 0000000..e6d8996
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigPageReqVO.java
@@ -0,0 +1,28 @@
+package cn.iocoder.yudao.module.member.controller.admin.memberconfig.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 付费会员配置分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class PaidMemberConfigPageReqVO extends PageParam {
+
+ @Schema(description = "开启付费会员")
+ private Boolean openPaidMember;
+
+ @Schema(description = "商品付费会员价", example = "20313")
+ private Boolean paidMemberPrice;
+
+ @Schema(description = "创建时间")
+ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+ private LocalDateTime[] createTime;
+
+}
\ No newline at end of file
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigRespVO.java
new file mode 100644
index 0000000..f55545f
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigRespVO.java
@@ -0,0 +1,31 @@
+package cn.iocoder.yudao.module.member.controller.admin.memberconfig.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - 付费会员配置 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class PaidMemberConfigRespVO {
+
+ @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9256")
+ @ExcelProperty("编号")
+ private Long id;
+
+ @Schema(description = "开启付费会员", requiredMode = Schema.RequiredMode.REQUIRED)
+ @ExcelProperty("开启付费会员")
+ private Boolean openPaidMember;
+
+ @Schema(description = "商品付费会员价", requiredMode = Schema.RequiredMode.REQUIRED, example = "20313")
+ @ExcelProperty("商品付费会员价")
+ private Boolean paidMemberPrice;
+
+ @Schema(description = "创建时间")
+ @ExcelProperty("创建时间")
+ private LocalDateTime createTime;
+
+}
\ No newline at end of file
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigSaveReqVO.java
new file mode 100644
index 0000000..3c8793f
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberconfig/vo/PaidMemberConfigSaveReqVO.java
@@ -0,0 +1,22 @@
+package cn.iocoder.yudao.module.member.controller.admin.memberconfig.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import javax.validation.constraints.*;
+
+@Schema(description = "管理后台 - 付费会员配置新增/修改 Request VO")
+@Data
+public class PaidMemberConfigSaveReqVO {
+
+ @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9256")
+ private Long id;
+
+ @Schema(description = "开启付费会员", requiredMode = Schema.RequiredMode.REQUIRED)
+ @NotNull(message = "开启付费会员不能为空")
+ private Boolean openPaidMember;
+
+ @Schema(description = "商品付费会员价", requiredMode = Schema.RequiredMode.REQUIRED, example = "20313")
+ private Boolean paidMemberPrice;
+
+}
\ No newline at end of file
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/memberconfig/PaidMemberConfigConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/memberconfig/PaidMemberConfigConvert.java
new file mode 100644
index 0000000..3b5b636
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/memberconfig/PaidMemberConfigConvert.java
@@ -0,0 +1,18 @@
+package cn.iocoder.yudao.module.member.convert.memberconfig;
+
+import cn.iocoder.yudao.module.member.controller.admin.memberconfig.vo.PaidMemberConfigSaveReqVO;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberconfig.PaidMemberConfigDO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ * 付费会员配置 Convert
+ *
+ */
+@Mapper
+public interface PaidMemberConfigConvert {
+
+ PaidMemberConfigConvert INSTANCE = Mappers.getMapper(PaidMemberConfigConvert.class);
+
+ PaidMemberConfigDO convert(PaidMemberConfigSaveReqVO bean);
+}
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberconfig/PaidMemberConfigDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberconfig/PaidMemberConfigDO.java
new file mode 100644
index 0000000..42a3d78
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberconfig/PaidMemberConfigDO.java
@@ -0,0 +1,39 @@
+package cn.iocoder.yudao.module.member.dal.dataobject.memberconfig;
+
+import lombok.*;
+import java.util.*;
+import java.time.LocalDateTime;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 付费会员配置 DO
+ *
+ * @author 管理员
+ */
+@TableName("paid_member_config")
+@KeySequence("paid_member_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class PaidMemberConfigDO extends BaseDO {
+
+ /**
+ * 编号
+ */
+ @TableId
+ private Long id;
+ /**
+ * 开启付费会员
+ */
+ private Boolean openPaidMember;
+ /**
+ * 商品付费会员价
+ */
+ private Boolean paidMemberPrice;
+
+}
\ 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/memberconfig/PaidMemberConfigMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberconfig/PaidMemberConfigMapper.java
new file mode 100644
index 0000000..b52e471
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberconfig/PaidMemberConfigMapper.java
@@ -0,0 +1,28 @@
+package cn.iocoder.yudao.module.member.dal.mysql.memberconfig;
+
+import java.util.*;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberconfig.PaidMemberConfigDO;
+import org.apache.ibatis.annotations.Mapper;
+import cn.iocoder.yudao.module.member.controller.admin.memberconfig.vo.*;
+
+/**
+ * 付费会员配置 Mapper
+ *
+ * @author 管理员
+ */
+@Mapper
+public interface PaidMemberConfigMapper extends BaseMapperX {
+
+ default PageResult selectPage(PaidMemberConfigPageReqVO reqVO) {
+ return selectPage(reqVO, new LambdaQueryWrapperX()
+ .eqIfPresent(PaidMemberConfigDO::getOpenPaidMember, reqVO.getOpenPaidMember())
+ .eqIfPresent(PaidMemberConfigDO::getPaidMemberPrice, reqVO.getPaidMemberPrice())
+ .betweenIfPresent(PaidMemberConfigDO::getCreateTime, reqVO.getCreateTime())
+ .orderByDesc(PaidMemberConfigDO::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/service/memberconfig/PaidMemberConfigService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberconfig/PaidMemberConfigService.java
new file mode 100644
index 0000000..a61c43b
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberconfig/PaidMemberConfigService.java
@@ -0,0 +1,63 @@
+package cn.iocoder.yudao.module.member.service.memberconfig;
+
+import java.util.*;
+import javax.validation.*;
+import cn.iocoder.yudao.module.member.controller.admin.memberconfig.vo.*;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberconfig.PaidMemberConfigDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+
+/**
+ * 付费会员配置 Service 接口
+ *
+ * @author 管理员
+ */
+public interface PaidMemberConfigService {
+
+ /**
+ * 创建付费会员配置
+ *
+ * @param createReqVO 创建信息
+ * @return 编号
+ */
+ Long createPaidMemberConfig(@Valid PaidMemberConfigSaveReqVO createReqVO);
+
+ /**
+ * 更新付费会员配置
+ *
+ * @param updateReqVO 更新信息
+ */
+ void updatePaidMemberConfig(@Valid PaidMemberConfigSaveReqVO updateReqVO);
+
+ /**
+ * 删除付费会员配置
+ *
+ * @param id 编号
+ */
+ void deletePaidMemberConfig(Long id);
+
+ /**
+ * 获得付费会员配置
+ *
+ * @param id 编号
+ * @return 付费会员配置
+ */
+ PaidMemberConfigDO getPaidMemberConfig(Long id);
+
+ /**
+ * 获得付费会员配置分页
+ *
+ * @param pageReqVO 分页查询
+ * @return 付费会员配置分页
+ */
+ PageResult getPaidMemberConfigPage(PaidMemberConfigPageReqVO pageReqVO);
+
+ /**
+ * 获得付费会员配置
+ *
+ * @return 会员配置
+ */
+ PaidMemberConfigDO getConfig();
+
+ void saveConfig(PaidMemberConfigSaveReqVO saveReqVO);
+}
\ 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/memberconfig/PaidMemberConfigServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberconfig/PaidMemberConfigServiceImpl.java
new file mode 100644
index 0000000..d55bb2d
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberconfig/PaidMemberConfigServiceImpl.java
@@ -0,0 +1,94 @@
+package cn.iocoder.yudao.module.member.service.memberconfig;
+
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
+import cn.iocoder.yudao.module.member.convert.memberconfig.PaidMemberConfigConvert;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import cn.iocoder.yudao.module.member.controller.admin.memberconfig.vo.*;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberconfig.PaidMemberConfigDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+
+import cn.iocoder.yudao.module.member.dal.mysql.memberconfig.PaidMemberConfigMapper;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
+
+/**
+ * 付费会员配置 Service 实现类
+ *
+ * @author 管理员
+ */
+@Service
+@Validated
+public class PaidMemberConfigServiceImpl implements PaidMemberConfigService {
+
+ @Resource
+ private PaidMemberConfigMapper paidMemberConfigMapper;
+
+ @Override
+ public Long createPaidMemberConfig(PaidMemberConfigSaveReqVO createReqVO) {
+ // 插入
+ PaidMemberConfigDO paidMemberConfig = BeanUtils.toBean(createReqVO, PaidMemberConfigDO.class);
+ paidMemberConfigMapper.insert(paidMemberConfig);
+ // 返回
+ return paidMemberConfig.getId();
+ }
+
+ @Override
+ public void updatePaidMemberConfig(PaidMemberConfigSaveReqVO updateReqVO) {
+ // 校验存在
+ validatePaidMemberConfigExists(updateReqVO.getId());
+ // 更新
+ PaidMemberConfigDO updateObj = BeanUtils.toBean(updateReqVO, PaidMemberConfigDO.class);
+ paidMemberConfigMapper.updateById(updateObj);
+ }
+
+ @Override
+ public void deletePaidMemberConfig(Long id) {
+ // 校验存在
+ validatePaidMemberConfigExists(id);
+ // 删除
+ paidMemberConfigMapper.deleteById(id);
+ }
+
+ private void validatePaidMemberConfigExists(Long id) {
+ if (paidMemberConfigMapper.selectById(id) == null) {
+ throw exception(PAID_MEMBER_CONFIG_NOT_EXISTS);
+ }
+ }
+
+ @Override
+ public PaidMemberConfigDO getPaidMemberConfig(Long id) {
+ return paidMemberConfigMapper.selectById(id);
+ }
+
+ @Override
+ public PageResult getPaidMemberConfigPage(PaidMemberConfigPageReqVO pageReqVO) {
+ return paidMemberConfigMapper.selectPage(pageReqVO);
+ }
+
+ @Override
+ public PaidMemberConfigDO getConfig() {
+ List list = paidMemberConfigMapper.selectList();
+ return CollectionUtils.getFirst(list);
+ }
+
+ @Override
+ public void saveConfig(PaidMemberConfigSaveReqVO saveReqVO) {
+ //存在,则更新
+ PaidMemberConfigDO paidMemberConfigDO = getConfig();
+ if(paidMemberConfigDO != null){
+ paidMemberConfigMapper.updateById(PaidMemberConfigConvert.INSTANCE.convert(saveReqVO).setId(paidMemberConfigDO.getId()));
+ return;
+ }
+ //不存在,则进行插入
+ paidMemberConfigMapper.insert(PaidMemberConfigConvert.INSTANCE.convert(saveReqVO));
+ }
+
+}
\ No newline at end of file
From 1bf166aa0f38a3415abc37e8e8a465837dff0df4 Mon Sep 17 00:00:00 2001
From: khy <2908249413@qq.com>
Date: Thu, 24 Oct 2024 16:30:24 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=9A=E5=91=98=E6=94=AF=E4=BB=98bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/app/user/vo/AppMemberUserInfoRespVO.java | 4 ++++
.../module/member/service/user/MemberUserServiceImpl.java | 2 +-
.../yudao/module/pay/dal/mysql/order/PayOrderMapper.java | 6 ++++++
.../yudao/module/pay/service/order/PayOrderServiceImpl.java | 6 +++++-
4 files changed, 16 insertions(+), 2 deletions(-)
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 7a13f20..ea22be3 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
@@ -4,6 +4,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "用户 APP - 用户个人信息 Response VO")
@Data
@@ -45,6 +48,7 @@ public class AppMemberUserInfoRespVO {
private String cardName;
@Schema(description = "会员名称", requiredMode = Schema.RequiredMode.REQUIRED)
+ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String cardExpirationTime;
@Schema(description = "用户 App - 会员等级")
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 a83ab5b..6400bf8 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
@@ -322,7 +322,7 @@ public class MemberUserServiceImpl implements MemberUserService {
validateMobileUnique(memberUserDO.getId(), memberUserDO.getMobile());
// 更新
- if(memberUserDO.getLevelId() == 5){
+ if(memberUserDO.getLevelId() != null && memberUserDO.getLevelId() == 5){
memberUserDO.setLevelId(Long.parseLong("1"));
}
memberUserMapper.updateById(memberUserDO);
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java
index 95510d5..a3c00ad 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.pay.dal.mysql.order;
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.pay.api.order.dto.PayOrderCreateReqDTO;
import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
@@ -59,4 +60,9 @@ public interface PayOrderMapper extends BaseMapperX {
.lt(PayOrderDO::getExpireTime, expireTime));
}
+ default PayOrderDO selectByAppIdAndMerchantOrderIdAndSubject(Long appId, String merchantOrderId, String subject){
+ return selectOne(PayOrderDO::getAppId, appId,
+ PayOrderDO::getMerchantOrderId, merchantOrderId,
+ PayOrderDO::getSubject,subject);
+ }
}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
index 6a6dbb9..709ea49 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
@@ -120,10 +120,14 @@ public class PayOrderServiceImpl implements PayOrderService {
public Long createOrder(PayOrderCreateReqDTO reqDTO) {
// 校验 App
PayAppDO app = appService.validPayApp(reqDTO.getAppId());
-
// 查询对应的支付交易单是否已经存在。如果是,则直接返回
PayOrderDO order = orderMapper.selectByAppIdAndMerchantOrderId(
reqDTO.getAppId(), reqDTO.getMerchantOrderId());
+ if(reqDTO.getSubject() != null && reqDTO.getSubject().equals("会员支付购卡")){
+ /// 查询对应的会员购卡是否已经存在。如果是,则直接返回(付费会员订单)
+ order = orderMapper.selectByAppIdAndMerchantOrderIdAndSubject(reqDTO.getAppId(),reqDTO.getMerchantOrderId()
+ ,reqDTO.getSubject());
+ }
if (order != null) {
log.warn("[createOrder][appId({}) merchantOrderId({}) 已经存在对应的支付单({})]", order.getAppId(),
order.getMerchantOrderId(), toJsonString(order)); // 理论来说,不会出现这个情况