diff --git a/sql/mysql/member_poinit_20230809积分四张表结构调整.sql b/sql/mysql/member_poinit_20230809积分四张表结构调整.sql new file mode 100644 index 0000000000..53171ce45a --- /dev/null +++ b/sql/mysql/member_poinit_20230809积分四张表结构调整.sql @@ -0,0 +1,140 @@ +/* + Navicat Premium Data Transfer + + Source Server : docer-master-root(3308) + Source Server Type : MySQL + Source Server Version : 80030 + Source Host : 10.211.55.5:3308 + Source Schema : mall + + Target Server Type : MySQL + Target Server Version : 80030 + File Encoding : 65001 + + Date: 09/08/2023 22:41:36 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for member_point_config +-- ---------------------------- +DROP TABLE IF EXISTS `member_point_config`; +CREATE TABLE `member_point_config` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键', + `trade_deduct_enable` bit(1) DEFAULT NULL COMMENT '1 开启积分抵扣\n0 关闭积分抵扣', + `trade_deduct_unit_price` int DEFAULT NULL COMMENT '积分抵扣(单位:分)', + `trade_deduct_max_price` int DEFAULT NULL COMMENT '积分抵扣最大值', + `trade_give_point` int DEFAULT NULL COMMENT '1元赠送多少分', + `creator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `updater` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '更新人', + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '变更时间', + `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户id', + `deleted` bit(1) DEFAULT b'0' COMMENT '是否被删除 0 未删除 1已删除', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='会员积分配置表'; + +-- ---------------------------- +-- Records of member_point_config +-- ---------------------------- +BEGIN; +INSERT INTO `member_point_config` (`id`, `trade_deduct_enable`, `trade_deduct_unit_price`, `trade_deduct_max_price`, `trade_give_point`, `creator`, `create_time`, `updater`, `update_time`, `tenant_id`, `deleted`) VALUES (5, b'1', 12504, 1234, 1234, '1', '2023-08-09 22:27:42', '1', '2023-08-09 22:32:55', '1', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for member_point_record +-- ---------------------------- +DROP TABLE IF EXISTS `member_point_record`; +CREATE TABLE `member_point_record` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键', + `biz_id` varchar(255) DEFAULT NULL COMMENT '业务编码', + `biz_type` varchar(255) DEFAULT NULL COMMENT '业务类型', + `title` varchar(255) DEFAULT NULL COMMENT '积分标题', + `description` varchar(5000) DEFAULT NULL COMMENT '积分描述', + `point` int DEFAULT NULL COMMENT '积分', + `total_point` int NOT NULL COMMENT '变动后的积分', + `status` int DEFAULT NULL COMMENT '状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款)\n', + `user_id` bigint DEFAULT NULL COMMENT '用户id', + `freezing_time` datetime DEFAULT NULL COMMENT '冻结时间', + `thawing_time` datetime DEFAULT NULL COMMENT '解冻时间', + `create_time` datetime DEFAULT NULL COMMENT '发生时间', + `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户', + `deleted` int DEFAULT '0' COMMENT '是否删除', + `creator` varchar(255) DEFAULT NULL COMMENT '创建用户', + `updater` varchar(255) DEFAULT NULL COMMENT '更新用户', + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `index_userId` (`user_id`), + KEY `index_title` (`title`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户积分记录'; + +-- ---------------------------- +-- Records of member_point_record +-- ---------------------------- +BEGIN; +INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `status`, `user_id`, `freezing_time`, `thawing_time`, `create_time`, `tenant_id`, `deleted`, `creator`, `updater`, `update_time`) VALUES (1, '1', '1', '12', NULL, 212, 12, 1, 247, '2023-06-13 00:00:00', '2023-06-20 00:00:00', '2023-06-10 12:38:48', '1', 1, '1', '1', '2023-08-09 12:30:36'); +INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `status`, `user_id`, `freezing_time`, `thawing_time`, `create_time`, `tenant_id`, `deleted`, `creator`, `updater`, `update_time`) VALUES (2, '12', '1', '这是一个测试', '我是描述', 1212, 12, 2, 247, '2023-06-28 00:00:00', NULL, '2023-06-10 12:42:48', '1', 0, '1', '1', '2023-08-09 12:31:45'); +INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `status`, `user_id`, `freezing_time`, `thawing_time`, `create_time`, `tenant_id`, `deleted`, `creator`, `updater`, `update_time`) VALUES (3, '12', '1', '12', '我是一个描述', 12, 12, 1, 248, '2023-06-27 00:00:00', '2023-06-23 00:00:00', '2023-06-10 20:06:48', '1', 0, '1', '1', '2023-08-09 12:31:41'); +INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `status`, `user_id`, `freezing_time`, `thawing_time`, `create_time`, `tenant_id`, `deleted`, `creator`, `updater`, `update_time`) VALUES (4, '12', '1', '描述2', '我是一个描述', -12, 12, 1, 248, '2023-08-09 11:21:00', '2023-09-13 00:00:00', '2023-06-10 20:06:48', '1', 0, '1', '1', '2023-08-09 12:57:28'); +COMMIT; + +-- ---------------------------- +-- Table structure for member_sign_in_config +-- ---------------------------- +DROP TABLE IF EXISTS `member_sign_in_config`; +CREATE TABLE `member_sign_in_config` ( + `id` int NOT NULL AUTO_INCREMENT COMMENT '规则自增主键', + `day` int DEFAULT NULL COMMENT '签到第x天', + `point` int DEFAULT NULL COMMENT '签到天数对应分数', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '变更时间', + `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户id', + `is_enable` tinyint(1) DEFAULT NULL COMMENT '是否启用 1启用,0未启动', + `deleted` int DEFAULT '0' COMMENT '是否删除', + `creator` varchar(255) DEFAULT NULL COMMENT '创建人', + `updater` varchar(255) DEFAULT NULL COMMENT '变更人', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='积分签到规则'; + +-- ---------------------------- +-- Records of member_sign_in_config +-- ---------------------------- +BEGIN; +INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `is_enable`, `deleted`, `creator`, `updater`) VALUES (1, 4, 10, '2023-06-10 11:34:43', '2023-08-08 15:10:03', '1', 1, 0, '1', '1'); +INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `is_enable`, `deleted`, `creator`, `updater`) VALUES (2, 2, 20, '2023-06-10 11:34:59', '2023-08-08 13:39:54', '1', 1, 1, '1', '1'); +INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `is_enable`, `deleted`, `creator`, `updater`) VALUES (3, 7, 1001, '2023-06-10 17:47:45', '2023-08-08 15:09:55', '1', 0, 0, '1', '1'); +INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `is_enable`, `deleted`, `creator`, `updater`) VALUES (4, 6, 12121, '2023-06-10 17:47:55', '2023-08-08 15:09:47', '1', 0, 0, '1', '1'); +INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `is_enable`, `deleted`, `creator`, `updater`) VALUES (5, 2, 12, '2023-06-10 19:54:52', '2023-08-08 15:10:03', '1', 1, 0, '1', '1'); +COMMIT; + +-- ---------------------------- +-- Table structure for member_sign_in_record +-- ---------------------------- +DROP TABLE IF EXISTS `member_sign_in_record`; +CREATE TABLE `member_sign_in_record` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '签到自增id', + `user_id` bigint DEFAULT NULL COMMENT '签到用户', + `day` int DEFAULT NULL COMMENT '第几天签到', + `point` int DEFAULT NULL COMMENT '签到的分数', + `create_time` datetime DEFAULT NULL COMMENT '签到时间', + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '变更时间', + `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户id', + `deleted` int DEFAULT '0' COMMENT '是否删除', + `creator` varchar(255) DEFAULT NULL COMMENT '创建人', + `updater` varchar(255) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户签到积分'; + +-- ---------------------------- +-- Records of member_sign_in_record +-- ---------------------------- +BEGIN; +INSERT INTO `member_sign_in_record` (`id`, `user_id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (1, 247, 1, 123, '2023-06-10 12:58:18', '2023-08-09 08:51:31', '1', 1, '1', '1'); +INSERT INTO `member_sign_in_record` (`id`, `user_id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (2, 247, 12, 12, '2023-06-10 19:56:39', '2023-08-09 08:51:32', '1', 1, '1', '1'); +INSERT INTO `member_sign_in_record` (`id`, `user_id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (3, 1, 12, 1212, '2023-06-10 20:01:17', '2023-08-09 08:05:07', '1', 1, '1', '1'); +INSERT INTO `member_sign_in_record` (`id`, `user_id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (4, 247, 12, 1212, '2023-06-10 20:01:27', '2023-08-09 08:51:34', '1', 0, '1', '1'); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointRecordController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointRecordController.java index ef207075ca..7745599bfa 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointRecordController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointRecordController.java @@ -2,22 +2,28 @@ package cn.iocoder.yudao.module.member.controller.admin.point; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; +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.point.vo.recrod.MemberPointRecordPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO; -import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO; import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert; import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO; +import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO; import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.List; +import java.util.stream.Collectors; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 用户积分记录") @@ -28,31 +34,34 @@ public class MemberPointRecordController { @Resource private MemberPointRecordService recordService; - - // TODO @xiaqing:积分应该没有更新操作呀?可以删除哈; - @PutMapping("/update") - @Operation(summary = "更新用户积分记录") - @PreAuthorize("@ss.hasPermission('point:record:update')") - public CommonResult updateRecord(@Valid @RequestBody MemberPointRecordUpdateReqVO updateReqVO) { - recordService.updateRecord(updateReqVO); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得用户积分记录") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('point:record:query')") - public CommonResult getRecord(@RequestParam("id") Long id) { - MemberPointRecordDO record = recordService.getRecord(id); - return success(MemberPointRecordConvert.INSTANCE.convert(record)); - } + @Resource + MemberUserApi memberUserApi; @GetMapping("/page") @Operation(summary = "获得用户积分记录分页") @PreAuthorize("@ss.hasPermission('point:record:query')") - public CommonResult> getRecordPage(@Valid MemberPointRecordPageReqVO pageVO) { - PageResult pageResult = recordService.getRecordPage(pageVO); - return success(MemberPointRecordConvert.INSTANCE.convertPage(pageResult)); + public CommonResult > getRecordPage(@Valid MemberPointRecordPageReqVO pageVO) { + //根据用户昵称查询出用户ids + List userIds = null; + if (StringUtils.isNotBlank(pageVO.getNickName())) { + List users = memberUserApi.getUserListByNickname(pageVO.getNickName()); + //如果查询用户结果为空直接返回无需继续查询 + if (CollectionUtils.isEmpty(users)) { + return success(new PageResult <>()); + } + userIds=users.stream().map(user->user.getId()).collect(Collectors.toList()); + pageVO.setUserIds(userIds); + } + + PageResult pageResult = recordService.getRecordPage(pageVO); + //根据查询的userId转换成nickName + List result = pageResult.getList(); + List users = null; + if (!CollectionUtils.isEmpty(result)) { + List ids = result.stream().map(user -> user.getUserId()).collect(Collectors.toList()); + users = memberUserApi.getUsers(ids); + } + return success(MemberPointRecordConvert.INSTANCE.convertPage(pageResult,users)); } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java index 4d7de8d428..1ab1d5a3f7 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java @@ -18,12 +18,12 @@ public class MemberPointConfigBaseVO { private Boolean tradeDeductEnable; @Schema(description = "积分抵扣,单位:分", example = "13506") - private BigDecimal tradeDeductUnitPrice; + private Integer tradeDeductUnitPrice; @Schema(description = "积分抵扣最大值", example = "32428") - private Long tradeDeductMaxPrice; + private Integer tradeDeductMaxPrice; @Schema(description = "1 元赠送多少分") - private Long tradeGivePoint; + private Integer tradeGivePoint; } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordBaseVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordBaseVO.java index 9d0c2604a1..bae11b281d 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordBaseVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordBaseVO.java @@ -24,10 +24,6 @@ public class MemberPointRecordBaseVO { @NotNull(message = "业务类型不能为空") private String bizType; - @Schema(description = "1增加 0扣减", example = "1") - @NotNull(message = "操作类型不能为空") - private String type; - @Schema(description = "积分标题") @NotNull(message = "积分标题不能为空") private String title; @@ -47,10 +43,6 @@ public class MemberPointRecordBaseVO { @NotNull(message = "积分状态不能为空") private Integer status; - @Schema(description = "用户id", example = "31169") - @NotNull(message = "用户ID不能为空") - private Integer userId; - @Schema(description = "冻结时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @NotNull(message = "冻结时间不能为空") diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordCreateReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordCreateReqVO.java deleted file mode 100644 index d0214c2cc1..0000000000 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordCreateReqVO.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod; - -import lombok.*; -import io.swagger.v3.oas.annotations.media.Schema; - -@Schema(description = "管理后台 - 用户积分记录创建 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class MemberPointRecordCreateReqVO extends MemberPointRecordBaseVO { - -} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordExportReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordExportReqVO.java deleted file mode 100644 index 0858bbd4fc..0000000000 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordExportReqVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod; - -import lombok.*; -import io.swagger.v3.oas.annotations.media.Schema; - -@Schema(description = "管理后台 - 用户积分记录 Excel 导出 Request VO,参数和 PointRecordPageReqVO 是一致的") -@Data -public class MemberPointRecordExportReqVO { - - @Schema(description = "业务编码", example = "22706") - private String bizId; - - @Schema(description = "业务类型", example = "1") - private String bizType; - - @Schema(description = "1增加 0扣减", example = "1") - private String type; - - @Schema(description = "积分标题") - private String title; - - @Schema(description = "状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款) ", example = "1") - private Integer status; - -} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java index 7275314cdc..3f24ec5b7c 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java @@ -4,25 +4,28 @@ import lombok.*; import io.swagger.v3.oas.annotations.media.Schema; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.util.List; + @Schema(description = "管理后台 - 用户积分记录分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MemberPointRecordPageReqVO extends PageParam { - @Schema(description = "业务编码", example = "22706") - private String bizId; + @Schema(description = "用户昵称", example = "张三") + private String nickName; + + //用户id集合,用户将nickName查询转换成user_ids查询 + private List userIds; @Schema(description = "业务类型", example = "1") private String bizType; - @Schema(description = "1增加 0扣减", example = "1") - private String type; - @Schema(description = "积分标题") private String title; @Schema(description = "状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款) ", example = "1") private Integer status; + } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java index d48cf6de8b..851fc9396d 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java @@ -16,4 +16,7 @@ public class MemberPointRecordRespVO extends MemberPointRecordBaseVO { @Schema(description = "发生时间") private LocalDateTime createTime; + //昵称 + private String nickName; + } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordUpdateReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordUpdateReqVO.java deleted file mode 100644 index 6da3e76885..0000000000 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordUpdateReqVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; - -import javax.validation.constraints.*; - -@Schema(description = "管理后台 - 用户积分记录更新 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class MemberPointRecordUpdateReqVO extends MemberPointRecordBaseVO { - - @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31457") - @NotNull(message = "自增主键不能为空") - private Long id; - -} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInConfigController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInConfigController.java index ea208b6c6a..361e69506a 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInConfigController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInConfigController.java @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.member.controller.admin.signin; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigCreateReqVO; -import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigRespVO; import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO; import cn.iocoder.yudao.module.member.convert.signin.MemberSignInConfigConvert; @@ -19,6 +18,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.List; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 积分签到规则") @@ -63,12 +64,12 @@ public class MemberSignInConfigController { return success(MemberSignInConfigConvert.INSTANCE.convert(signInConfig)); } - @GetMapping("/page") + @GetMapping("/list") @Operation(summary = "获得积分签到规则分页") @PreAuthorize("@ss.hasPermission('point:sign-in-config:query')") - public CommonResult> getSignInConfigPage(@Valid MemberSignInConfigPageReqVO pageVO) { - PageResult pageResult = memberSignInConfigService.getSignInConfigPage(pageVO); - return success(MemberSignInConfigConvert.INSTANCE.convertPage(pageResult)); + public CommonResult> getSignInConfigPage() { + List pageResult = memberSignInConfigService.getSignInConfigList(); + return success(MemberSignInConfigConvert.INSTANCE.convertList(pageResult)); } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInRecordController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInRecordController.java index fae6ebdab6..5a84389808 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInRecordController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInRecordController.java @@ -2,21 +2,30 @@ package cn.iocoder.yudao.module.member.controller.admin.signin; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; +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.signin.vo.MemberSignInRecordPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordRespVO; import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert; import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO; import cn.iocoder.yudao.module.member.service.signin.MemberSignInRecordService; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.List; +import java.util.stream.Collectors; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 用户签到积分") @@ -27,31 +36,33 @@ public class MemberSignInRecordController { @Resource private MemberSignInRecordService memberSignInRecordService; + @Resource + MemberUserApi memberUserApi; - // TODO @xiaqing:签到是不是不用删除? - @DeleteMapping("/delete") - @Operation(summary = "删除用户签到积分") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('point:sign-in-record:delete')") - public CommonResult deleteSignInRecord(@RequestParam("id") Long id) { - memberSignInRecordService.deleteSignInRecord(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得用户签到积分") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('point:sign-in-record:query')") - public CommonResult getSignInRecord(@RequestParam("id") Long id) { - MemberSignInRecordDO signInRecord = memberSignInRecordService.getSignInRecord(id); - return success(MemberSignInRecordConvert.INSTANCE.convert(signInRecord)); - } @GetMapping("/page") @Operation(summary = "获得用户签到积分分页") @PreAuthorize("@ss.hasPermission('point:sign-in-record:query')") - public CommonResult> getSignInRecordPage(@Valid MemberSignInRecordPageReqVO pageVO) { - PageResult pageResult = memberSignInRecordService.getSignInRecordPage(pageVO); - return success(MemberSignInRecordConvert.INSTANCE.convertPage(pageResult)); + public CommonResult > getSignInRecordPage(@Valid MemberSignInRecordPageReqVO pageVO) { + //请求中如果有nickName,需要根据nickName查询出userId + if(StringUtils.isNotBlank(pageVO.getNickName())){ + List users= memberUserApi.getUserListByNickname(pageVO.getNickName()).stream() + .map(user->user.getId()).collect(Collectors.toList()); + //如果根据昵称查出来的用户为空,则无需继续查找 + if(CollectionUtils.isEmpty(users)){ + return success(new PageResult <>()); + } + pageVO.setUserIds(users); + } + //处理查询结果首先将数据信息查询,然后将userId转换为nickName + PageResult pageResult = memberSignInRecordService.getSignInRecordPage(pageVO); + List result = pageResult.getList(); + //设置获取的用户信息 + List users = null; + if (!CollectionUtils.isEmpty(result)) { + List ids = result.stream().map(user -> user.getUserId()).collect(Collectors.toList()); + users = memberUserApi.getUsers(ids); + } + return success(MemberSignInRecordConvert.INSTANCE.convertPage(pageResult, users)); } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigBaseVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigBaseVO.java index 334d98ad2a..7aa098eeda 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigBaseVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigBaseVO.java @@ -16,4 +16,8 @@ public class MemberSignInConfigBaseVO { @Schema(description = "签到天数对应分数", example = "10") private Integer point; + @Schema(description = "是否启用", example = "1") + private Boolean isEnable; + + } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigPageReqVO.java deleted file mode 100644 index 7ffd3827ad..0000000000 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigPageReqVO.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.iocoder.yudao.module.member.controller.admin.signin.vo; - -import lombok.*; -import io.swagger.v3.oas.annotations.media.Schema; -import cn.iocoder.yudao.framework.common.pojo.PageParam; - -@Schema(description = "管理后台 - 积分签到规则分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class MemberSignInConfigPageReqVO extends PageParam { - - @Schema(description = "签到第x天", example = "7") - private Integer day; - -} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordBaseVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordBaseVO.java index f593d0d35f..c3c51f5bab 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordBaseVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordBaseVO.java @@ -11,7 +11,7 @@ import lombok.Data; public class MemberSignInRecordBaseVO { @Schema(description = "签到用户", example = "6507") - private Integer userId; + private Long userId; @Schema(description = "第几天签到") private Integer day; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordPageReqVO.java index d3808a8317..11dd6d69c7 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordPageReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordPageReqVO.java @@ -8,6 +8,7 @@ import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; +import java.util.List; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -17,8 +18,11 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ToString(callSuper = true) public class MemberSignInRecordPageReqVO extends PageParam { + //用户前台模糊查询 @Schema(description = "签到用户", example = "6507") - private Integer userId; + private String nickName; + + private ListuserIds; @Schema(description = "第几天签到") private Integer day; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordRespVO.java index a5b7844121..a01fa5a22d 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordRespVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordRespVO.java @@ -19,4 +19,7 @@ public class MemberSignInRecordRespVO extends MemberSignInRecordBaseVO { @Schema(description = "签到时间") private LocalDateTime createTime; + //昵称,用于前台展示 + private String nickName; + } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java index d1cdd1d49a..bd0d44281d 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java @@ -2,9 +2,7 @@ package cn.iocoder.yudao.module.member.convert.point; import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigRespVO; import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigSaveReqVO; -import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO; import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; -import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java index 4a771884b3..d83d45e225 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java @@ -1,12 +1,17 @@ package cn.iocoder.yudao.module.member.convert.point; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordCreateReqVO; +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO; -import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO; import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 用户积分记录 Convert @@ -18,12 +23,62 @@ public interface MemberPointRecordConvert { MemberPointRecordConvert INSTANCE = Mappers.getMapper(MemberPointRecordConvert.class); - MemberPointRecordDO convert(MemberPointRecordCreateReqVO bean); + default PageResult convertPage(PageResult page, List users) { + if (page == null) { + return null; + } - MemberPointRecordDO convert(MemberPointRecordUpdateReqVO bean); + PageResult pageResult = new PageResult (); - MemberPointRecordRespVO convert(MemberPointRecordDO bean); + pageResult.setList(memberPointRecordDOListToMemberPointRecordRespVOList(page.getList(), users)); + pageResult.setTotal(page.getTotal()); + + return pageResult; + } + + default List memberPointRecordDOListToMemberPointRecordRespVOList(List list, List users) { + if (list == null) { + return null; + } + Map maps = null; + //是否需要转换用户标志 + boolean userNickFlag = !CollectionUtils.isEmpty(users); + if (userNickFlag) { + maps = users.stream() + .collect(Collectors.toMap(MemberUserRespDTO::getId, MemberUserRespDTO::getNickname, (key1, key2) -> key2)); + } + List list1 = new ArrayList (list.size()); + for (MemberPointRecordDO memberPointRecordDO : list) { + MemberPointRecordRespVO recordRespVO = memberPointRecordDOToMemberPointRecordRespVO(memberPointRecordDO); + recordRespVO.setNickName(maps.get(memberPointRecordDO.getUserId())); + list1.add(recordRespVO); + } + + return list1; + } + + default MemberPointRecordRespVO memberPointRecordDOToMemberPointRecordRespVO(MemberPointRecordDO memberPointRecordDO) { + if (memberPointRecordDO == null) { + return null; + } + + MemberPointRecordRespVO memberPointRecordRespVO = new MemberPointRecordRespVO(); + + memberPointRecordRespVO.setBizId(memberPointRecordDO.getBizId()); + memberPointRecordRespVO.setBizType(memberPointRecordDO.getBizType()); + memberPointRecordRespVO.setType(memberPointRecordDO.getType()); + memberPointRecordRespVO.setTitle(memberPointRecordDO.getTitle()); + memberPointRecordRespVO.setDescription(memberPointRecordDO.getDescription()); + memberPointRecordRespVO.setPoint(memberPointRecordDO.getPoint()); + memberPointRecordRespVO.setTotalPoint(memberPointRecordDO.getTotalPoint()); + memberPointRecordRespVO.setStatus(memberPointRecordDO.getStatus()); + memberPointRecordRespVO.setFreezingTime(memberPointRecordDO.getFreezingTime()); + memberPointRecordRespVO.setThawingTime(memberPointRecordDO.getThawingTime()); + memberPointRecordRespVO.setId(memberPointRecordDO.getId()); + memberPointRecordRespVO.setCreateTime(memberPointRecordDO.getCreateTime()); + + return memberPointRecordRespVO; + } - PageResult convertPage(PageResult page); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/signin/MemberSignInRecordConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/signin/MemberSignInRecordConvert.java index 0af4e6178e..13b24b392a 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/signin/MemberSignInRecordConvert.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/signin/MemberSignInRecordConvert.java @@ -1,12 +1,19 @@ package cn.iocoder.yudao.module.member.convert.signin; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordCreateReqVO; +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordRespVO; -import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordUpdateReqVO; import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; /** * 用户签到积分 Convert @@ -18,12 +25,57 @@ public interface MemberSignInRecordConvert { MemberSignInRecordConvert INSTANCE = Mappers.getMapper(MemberSignInRecordConvert.class); - MemberSignInRecordDO convert(MemberSignInRecordCreateReqVO bean); + default public MemberSignInRecordRespVO convert(MemberSignInRecordDO bean) { + if (bean == null) { + return null; + } - MemberSignInRecordDO convert(MemberSignInRecordUpdateReqVO bean); + MemberSignInRecordRespVO memberSignInRecordRespVO = new MemberSignInRecordRespVO(); - MemberSignInRecordRespVO convert(MemberSignInRecordDO bean); + memberSignInRecordRespVO.setUserId(bean.getUserId()); + memberSignInRecordRespVO.setDay(bean.getDay()); + memberSignInRecordRespVO.setPoint(bean.getPoint()); + memberSignInRecordRespVO.setId(bean.getId()); + memberSignInRecordRespVO.setCreateTime(bean.getCreateTime()); + + return memberSignInRecordRespVO; + } + + default PageResult convertPage(PageResult page, List userRespDTOS) { + if (page == null) { + return null; + } + + PageResult pageResult = new PageResult (); + + pageResult.setList(memberSignInRecordDOListToMemberSignInRecordRespVOList(page.getList(),userRespDTOS)); + pageResult.setTotal(page.getTotal()); + + return pageResult; + } + + default List memberSignInRecordDOListToMemberSignInRecordRespVOList(List list,List userRespDTOS) { + if (list == null) { + return null; + } + Map maps=null; + //是否需要转换用户标志 + boolean userNickFlag = !CollectionUtils.isEmpty(userRespDTOS); + if(userNickFlag){ + maps = userRespDTOS.stream() + .collect(Collectors.toMap(MemberUserRespDTO::getId, MemberUserRespDTO::getNickname, (key1, key2) -> key2)); + } + List list1 = new ArrayList (list.size()); + for (MemberSignInRecordDO memberSignInRecordDO : list) { + MemberSignInRecordRespVO recordRespVO = convert(memberSignInRecordDO); + if(userNickFlag){ + recordRespVO.setNickName(maps.get(recordRespVO.getUserId())); + } + list1.add(recordRespVO); + } + + return list1; + } - PageResult convertPage(PageResult page); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointConfigDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointConfigDO.java index a7d54219f6..94fed9c53b 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointConfigDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointConfigDO.java @@ -27,7 +27,7 @@ public class MemberPointConfigDO extends BaseDO { * 自增主键 */ @TableId - private Integer id; + private Long id; /** * 积分抵扣开关 */ @@ -37,7 +37,7 @@ public class MemberPointConfigDO extends BaseDO { * * 1 积分抵扣多少分 */ - private BigDecimal tradeDeductUnitPrice; + private Integer tradeDeductUnitPrice; /** * 积分抵扣最大值 */ diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java index 895aea458c..40df4d4a61 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java @@ -38,11 +38,6 @@ public class MemberPointRecordDO extends BaseDO { * 枚举 {@link TODO biz_type 对应枚举,然后改成 int 类型哈} */ private String bizType; - /** - * 1增加 0扣减 - */ - // TODO @xiaqing:要不把 type 合并到 point 里?增加 point 是正数,减少 point 是负数? - private String type; /** * 积分标题 */ @@ -52,7 +47,7 @@ public class MemberPointRecordDO extends BaseDO { */ private String description; /** - * 积分 + * 积分 正数表示获得积分 负数表示消耗积分 */ private Integer point; /** @@ -62,13 +57,13 @@ public class MemberPointRecordDO extends BaseDO { /** * 状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款) * - * 枚举 {@link TODO point_status 对应的类} + * 枚举 {@link point_status 对应的类} */ private Integer status; /** * 用户id */ - private Integer userId; + private Long userId; /** * 冻结时间 */ diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInConfigDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInConfigDO.java index 1c7bcd853b..42142e3f38 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInConfigDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInConfigDO.java @@ -34,5 +34,8 @@ public class MemberSignInConfigDO extends BaseDO { * 签到天数对应分数 */ private Integer point; - + /** + * 是否启用 + */ + private Boolean isEnable; } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInRecordDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInRecordDO.java index 8cf89cc434..a959403273 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInRecordDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInRecordDO.java @@ -29,7 +29,7 @@ public class MemberSignInRecordDO extends BaseDO { /** * 签到用户 */ - private Integer userId; + private Long userId; /** * 第几天签到 */ diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java index 095aa37f72..f3d42d0782 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java @@ -17,7 +17,7 @@ public interface MemberPointRecordMapper extends BaseMapperX selectPage(MemberPointRecordPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(MemberPointRecordDO::getBizId, reqVO.getBizId()) + .inIfPresent(MemberPointRecordDO::getUserId,reqVO.getUserIds()) .eqIfPresent(MemberPointRecordDO::getBizType, reqVO.getBizType()) .eqIfPresent(MemberPointRecordDO::getType, reqVO.getType()) .eqIfPresent(MemberPointRecordDO::getTitle, reqVO.getTitle()) diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInConfigMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInConfigMapper.java index 6f14d0d5df..7c8f5974fd 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInConfigMapper.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInConfigMapper.java @@ -1,13 +1,13 @@ package cn.iocoder.yudao.module.member.dal.mysql.signin; -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.signin.vo.MemberSignInConfigPageReqVO; -import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO; import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 积分签到规则 Mapper * @@ -16,18 +16,32 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface MemberSignInConfigMapper extends BaseMapperX { - default PageResult selectPage(MemberSignInConfigPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(MemberSignInConfigDO::getDay, reqVO.getDay()) - .orderByAsc(MemberSignInConfigDO::getDay)); + /** + * 描述 :选择性更新对象属性,如果不为空则更新。 + * Author :xiaqing + * Date :2023-08-08 23:38:48 + */ + default int updateIfPresent(MemberSignInConfigDO updateObj){ + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper <>(); + wrapper.eq(MemberSignInConfigDO::getId, updateObj.getId()) + .set(updateObj.getDay() != null, MemberSignInConfigDO::getDay, updateObj.getDay()) + .set(updateObj.getPoint() != null, MemberSignInConfigDO::getPoint, updateObj.getPoint()) + .set(updateObj.getIsEnable() != null, MemberSignInConfigDO::getIsEnable, updateObj.getIsEnable()); + return update(null,wrapper); } - // - default long selectSameDayNotSelf(MemberSignInConfigUpdateReqVO reqVO){ - return selectCount(new LambdaQueryWrapperX () - .ne(MemberSignInConfigDO::getId, reqVO.getId()) - .eq(MemberSignInConfigDO::getDay,reqVO.getDay()) - ); + default List getList(){ + return selectList(new LambdaQueryWrapperX ().orderByAsc(MemberSignInConfigDO::getDay)); + } + + /** + * 描述 :根据天数查询对应记录 + * Date :2023-08-09 00:07:11 + */ + default MemberSignInConfigDO selectByDay(Integer day){ + return selectOne(new LambdaQueryWrapperX () + .eq(MemberSignInConfigDO::getDay,day)); + } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInRecordMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInRecordMapper.java index 532efa3624..5e1cbb1d29 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInRecordMapper.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInRecordMapper.java @@ -17,7 +17,7 @@ public interface MemberSignInRecordMapper extends BaseMapperX selectPage(MemberSignInRecordPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(MemberSignInRecordDO::getUserId, reqVO.getUserId()) + .inIfPresent(MemberSignInRecordDO::getUserId, reqVO.getUserIds()) .eqIfPresent(MemberSignInRecordDO::getDay, reqVO.getDay()) .betweenIfPresent(MemberSignInRecordDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(MemberSignInRecordDO::getId)); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java index ebec0b579c..0d5731c3b5 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.member.service.point; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigSaveReqVO; import cn.iocoder.yudao.module.member.convert.point.MemberPointConfigConvert; import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; @@ -24,13 +26,15 @@ public class MemberPointConfigServiceImpl implements MemberPointConfigService { @Override public void saveConfig(MemberPointConfigSaveReqVO saveReqVO) { - // TODO @xiaqing:直接 getConfig() 查询,如果不存在,则插入;存在,则进行更新; - long total = pointConfigMapper.selectCount(); + //获取当前记录 + MemberPointConfigDO configDO = getConfig(); MemberPointConfigDO pointConfigDO = MemberPointConfigConvert.INSTANCE.convert(saveReqVO); - //大于0存在记录,则更新,否则插入 - if (total > 0) { + //当前存在记录,则更新,否则插入 + if (configDO != null) { + pointConfigDO.setId(configDO.getId()); pointConfigMapper.updateById(pointConfigDO); } else { + pointConfigDO.setId(null); pointConfigMapper.insert(pointConfigDO); } } @@ -38,8 +42,7 @@ public class MemberPointConfigServiceImpl implements MemberPointConfigService { @Override public MemberPointConfigDO getConfig() { List list = pointConfigMapper.selectList(); - // TODO @xiaqing:可以使用 CollUtil.getFirst() - return list == null ? null : list.get(0); + return CollectionUtils.getFirst(list); } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java index 37ac5ea2de..4c6fb0cb47 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.member.service.point; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO; -import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO; import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO; import javax.validation.Valid; @@ -13,23 +12,6 @@ import javax.validation.Valid; * @author QingX */ public interface MemberPointRecordService { - // TODO @xiaqing:方法和方法之间,是空一行哈; - - /** - * 更新用户积分记录 - * - * @param updateReqVO 更新信息 - */ - void updateRecord(@Valid MemberPointRecordUpdateReqVO updateReqVO); - - - /** - * 获得用户积分记录 - * - * @param id 编号 - * @return 用户积分记录 - */ - MemberPointRecordDO getRecord(Long id); /** * 获得用户积分记录分页 diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java index e1d6757230..c0d5bc8961 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java @@ -2,19 +2,12 @@ package cn.iocoder.yudao.module.member.service.point; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO; -import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO; -import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert; import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO; import cn.iocoder.yudao.module.member.dal.mysql.point.MemberPointRecordMapper; -import cn.iocoder.yudao.module.member.enums.ErrorCodeConstants; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; -import java.util.Collection; -import java.util.List; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; /** @@ -29,26 +22,6 @@ public class MemberPointRecordServiceImpl implements MemberPointRecordService { @Resource private MemberPointRecordMapper recordMapper; - @Override - public void updateRecord(MemberPointRecordUpdateReqVO updateReqVO) { - // 校验存在 - validateRecordExists(updateReqVO.getId()); - // 更新 - MemberPointRecordDO updateObj = MemberPointRecordConvert.INSTANCE.convert(updateReqVO); - recordMapper.updateById(updateObj); - } - - private void validateRecordExists(Long id) { - if (recordMapper.selectById(id) == null) { - throw exception(ErrorCodeConstants.RECORD_NOT_EXISTS); - } - } - - @Override - public MemberPointRecordDO getRecord(Long id) { - return recordMapper.selectById(id); - } - @Override public PageResult getRecordPage(MemberPointRecordPageReqVO pageReqVO) { return recordMapper.selectPage(pageReqVO); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigService.java index f58870507b..f873e52c76 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigService.java @@ -1,12 +1,11 @@ package cn.iocoder.yudao.module.member.service.signin; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigCreateReqVO; -import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO; import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO; import javax.validation.Valid; +import java.util.List; /** * 积分签到规则 Service 接口 @@ -48,9 +47,8 @@ public interface MemberSignInConfigService { /** * 获得积分签到规则分页 * - * @param pageReqVO 分页查询 * @return 积分签到规则分页 */ - PageResult getSignInConfigPage(MemberSignInConfigPageReqVO pageReqVO); + List getSignInConfigList(); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigServiceImpl.java index a1cc2e3219..68085ff16c 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigServiceImpl.java @@ -1,17 +1,20 @@ package cn.iocoder.yudao.module.member.service.signin; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigCreateReqVO; -import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO; import cn.iocoder.yudao.module.member.convert.signin.MemberSignInConfigConvert; import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO; import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInConfigMapper; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; +import java.util.List; + import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.SIGN_IN_CONFIG_EXISTS; import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.SIGN_IN_CONFIG_NOT_EXISTS; @@ -28,30 +31,28 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService @Resource private MemberSignInConfigMapper memberSignInConfigMapper; - // TODO @xiaqing:这种写的逻辑,最好按照 校验 - 更新这样的顺序写;类似这里,37 要放到 34 前面;updateSignInConfig 也是一样的思路 @Override public Integer createSignInConfig(MemberSignInConfigCreateReqVO createReqVO) { + // 判断是否重复插入签到天数 + validateSignInConfigExistsDay(createReqVO.getDay()); + // 插入 MemberSignInConfigDO signInConfig = MemberSignInConfigConvert.INSTANCE.convert(createReqVO); - // 判断是否重复插入签到天数 - validateSignInConfigExistsDay(signInConfig.getDay()); memberSignInConfigMapper.insert(signInConfig); // 返回 return signInConfig.getId(); } - // TODO @xiaqing:这个逻辑的空行要注意;52 到 53 是没必要的空行;而 49 和 50 之间有个空行会好点,可以区分出是 校验 - 更新这样的逻辑间隔 @Override public void updateSignInConfig(MemberSignInConfigUpdateReqVO updateReqVO) { // 校验存在 validateSignInConfigExists(updateReqVO.getId()); //判断是否重复插入签到天数 validateSignInConfigSameDayNotSelf(updateReqVO); - // 判断更新的 + + // 判断更新 MemberSignInConfigDO updateObj = MemberSignInConfigConvert.INSTANCE.convert(updateReqVO); - - - memberSignInConfigMapper.updateById(updateObj); + memberSignInConfigMapper.updateIfPresent(updateObj); } @Override @@ -68,18 +69,18 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService } } - // TODO @xiaqing:这个唯一判断,也可以参考下别的模块哈; //根据签到天数判断是否存在一个相同的天数 private void validateSignInConfigExistsDay(Integer day) { - if (memberSignInConfigMapper.selectCount(MemberSignInConfigDO::getDay,day)>0) { + MemberSignInConfigDO configDO = memberSignInConfigMapper.selectByDay(day); + if (configDO != null) { throw exception(SIGN_IN_CONFIG_EXISTS); } } - // TODO @xiaqing:参考下别的模块,判断唯一,排除自己怎么写的哈; // 更新天数时判断是否有重复的天数,需要去除自己 private void validateSignInConfigSameDayNotSelf(MemberSignInConfigUpdateReqVO reqVO) { - if (memberSignInConfigMapper.selectSameDayNotSelf(reqVO)>0) { + MemberSignInConfigDO configDO = memberSignInConfigMapper.selectByDay(reqVO.getDay()); + if (configDO != null && configDO.getId() != reqVO.getId()) { throw exception(SIGN_IN_CONFIG_EXISTS); } } @@ -90,8 +91,8 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService } @Override - public PageResult getSignInConfigPage(MemberSignInConfigPageReqVO pageReqVO) { - return memberSignInConfigMapper.selectPage(pageReqVO); + public List getSignInConfigList() { + return memberSignInConfigMapper.getList(); } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordService.java index 0faf2c1a9b..8f7d2a0649 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordService.java @@ -11,20 +11,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO */ public interface MemberSignInRecordService { - /** - * 删除用户签到积分 - * - * @param id 编号 - */ - void deleteSignInRecord(Long id); - /** - * 获得用户签到积分 - * - * @param id 编号 - * @return 用户签到积分 - */ - MemberSignInRecordDO getSignInRecord(Long id); /** * 获得用户签到积分分页 @@ -34,4 +21,5 @@ public interface MemberSignInRecordService { */ PageResult getSignInRecordPage(MemberSignInRecordPageReqVO pageReqVO); + } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordServiceImpl.java index 23698b5e87..4bc9bf8ea9 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordServiceImpl.java @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordPageReqVO; import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO; import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInRecordMapper; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -23,25 +24,10 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService @Resource private MemberSignInRecordMapper memberSignInRecordMapper; + @Resource + AdminUserApi adminUserApi; - @Override - public void deleteSignInRecord(Long id) { - // 校验存在 - validateSignInRecordExists(id); - // 删除 - memberSignInRecordMapper.deleteById(id); - } - private void validateSignInRecordExists(Long id) { - if (memberSignInRecordMapper.selectById(id) == null) { - throw exception(SIGN_IN_RECORD_NOT_EXISTS); - } - } - - @Override - public MemberSignInRecordDO getSignInRecord(Long id) { - return memberSignInRecordMapper.selectById(id); - } @Override public PageResult getSignInRecordPage(MemberSignInRecordPageReqVO pageReqVO) { diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 4cddf8065d..2389b1d923 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -51,24 +51,24 @@ spring: # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例 username: root - password: 123456 + password: 1qaz!QAZ # username: sa # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W slave: # 模拟从库,可根据自己需要修改 name: ruoyi-vue-pro - url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例 username: root - password: 123456 + password: 1qaz!QAZ # username: sa # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 redis: - host: 127.0.0.1 # 地址 + host: 10.211.55.5 # 地址 port: 6379 # 端口 database: 0 # 数据库索引 # password: dev # 密码,建议生产环境开启