From fd072b7d6ee0001826033fdaa367814c5313f2d7 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 17 Jun 2023 18:33:17 +0800 Subject: [PATCH] =?UTF-8?q?code=20review=EF=BC=9A=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../point/MemberPointConfigController.java | 45 ++++++++ .../vo/config/MemberPointConfigBaseVO.java | 27 +++++ .../vo/config/MemberPointConfigRespVO.java | 13 +++ .../vo/config/MemberPointConfigSaveReqVO.java | 13 +++ .../admin/point/vo/recrod/package-info.java | 1 + .../point/MemberPointConfigConvert.java | 20 ++++ .../dataobject/point/MemberPointConfigDO.java | 35 +++--- .../mysql/point/MemberPointConfigMapper.java | 14 +++ .../point/MemberPointConfigService.java | 29 +++++ .../point/MemberPointConfigServiceImpl.java | 33 ++++++ .../pointconfig/PointConfigController.java | 102 ------------------ .../pointconfig/vo/PointConfigBaseVO.java | 30 ------ .../vo/PointConfigCreateReqVO.java | 14 --- .../pointconfig/vo/PointConfigExcelVO.java | 45 -------- .../vo/PointConfigExportReqVO.java | 15 --- .../pointconfig/vo/PointConfigPageReqVO.java | 17 --- .../pointconfig/vo/PointConfigRespVO.java | 22 ---- .../vo/PointConfigUpdateReqVO.java | 18 ---- .../pointconfig/PointConfigConvert.java | 34 ------ .../mysql/pointconfig/PointConfigMapper.java | 32 ------ .../pointconfig/PointConfigService.java | 70 ------------ .../pointconfig/PointConfigServiceImpl.java | 92 ---------------- .../mapper/pointconfig/PointConfigMapper.xml | 12 --- .../mapper/pointrecord/PointRecordMapper.xml | 12 --- .../signinconfig/SignInConfigMapper.xml | 12 --- .../signinrecord/SignInRecordMapper.xml | 12 --- 26 files changed, 212 insertions(+), 557 deletions(-) create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointConfigController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigSaveReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/package-info.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java rename yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/pointconfig/PointConfigDO.java => yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointConfigDO.java (53%) create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointConfigMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigService.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/PointConfigController.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigBaseVO.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigCreateReqVO.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExcelVO.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExportReqVO.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigPageReqVO.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigRespVO.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigUpdateReqVO.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/pointconfig/PointConfigConvert.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/pointconfig/PointConfigMapper.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigService.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigServiceImpl.java delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointconfig/PointConfigMapper.xml delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointrecord/PointRecordMapper.xml delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinconfig/SignInConfigMapper.xml delete mode 100644 yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinrecord/SignInRecordMapper.xml diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointConfigController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointConfigController.java new file mode 100644 index 000000000..f0e6d0ee2 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointConfigController.java @@ -0,0 +1,45 @@ +package cn.iocoder.yudao.module.member.controller.admin.point; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +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.convert.point.MemberPointConfigConvert; +import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; +import cn.iocoder.yudao.module.member.service.point.MemberPointConfigService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 会员积分设置") +@RestController +@RequestMapping("/point/config") +@Validated +public class MemberPointConfigController { + + @Resource + private MemberPointConfigService memberPointConfigService; + + @PutMapping("/update") + @Operation(summary = "保存会员积分配置") + @PreAuthorize("@ss.hasPermission('member:point-config:save')") + public CommonResult updateConfig(@Valid @RequestBody MemberPointConfigSaveReqVO saveReqVO) { + memberPointConfigService.saveConfig(saveReqVO); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得会员积分配置") + @PreAuthorize("@ss.hasPermission('member:point-config:query')") + public CommonResult getConfig() { + MemberPointConfigDO config = memberPointConfigService.getConfig(); + return success(MemberPointConfigConvert.INSTANCE.convert(config)); + } + +} 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 new file mode 100644 index 000000000..46ad58321 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.member.controller.admin.point.vo.config; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 会员积分配置 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class MemberPointConfigBaseVO { + + @Schema(description = "积分抵扣开关", required = true, example = "true") + private Boolean tradeDeductEnable; + + @Schema(description = "积分抵扣,单位:分", example = "13506") + private BigDecimal tradeDeductUnitPrice; + + @Schema(description = "积分抵扣最大值", example = "32428") + private Long tradeDeductMaxPrice; + + @Schema(description = "1 元赠送多少分") + private Long tradeGivePoint; + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigRespVO.java new file mode 100644 index 000000000..36ace83e7 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigRespVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.member.controller.admin.point.vo.config; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 会员积分配置 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class MemberPointConfigRespVO extends MemberPointConfigBaseVO { +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigSaveReqVO.java new file mode 100644 index 000000000..729ab74b6 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigSaveReqVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.member.controller.admin.point.vo.config; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 会员积分配置保存 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class MemberPointConfigSaveReqVO extends MemberPointConfigBaseVO { +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/package-info.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/package-info.java new file mode 100644 index 000000000..284e2178b --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod; 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 new file mode 100644 index 000000000..cf49d2951 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java @@ -0,0 +1,20 @@ +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.dal.dataobject.point.MemberPointConfigDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 会员积分配置 Convert + * + * @author QingX + */ +@Mapper +public interface MemberPointConfigConvert { + + MemberPointConfigConvert INSTANCE = Mappers.getMapper(MemberPointConfigConvert.class); + + MemberPointConfigRespVO convert(MemberPointConfigDO bean); + +} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/pointconfig/PointConfigDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointConfigDO.java similarity index 53% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/pointconfig/PointConfigDO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointConfigDO.java index ee30a27d1..a7d54219f 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/pointconfig/PointConfigDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointConfigDO.java @@ -1,15 +1,15 @@ -package cn.iocoder.yudao.module.point.dal.dataobject.pointconfig; +package cn.iocoder.yudao.module.member.dal.dataobject.point; -import lombok.*; -import java.util.*; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +import java.math.BigDecimal; /** - * 积分设置 DO + * 会员积分配置 DO * * @author QingX */ @@ -21,7 +21,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; @Builder @NoArgsConstructor @AllArgsConstructor -public class PointConfigDO extends BaseDO { +public class MemberPointConfigDO extends BaseDO { /** * 自增主键 @@ -29,23 +29,22 @@ public class PointConfigDO extends BaseDO { @TableId private Integer id; /** - * 1 开启积分抵扣 -0 关闭积分抵扣 - * - * 枚举 {@link TODO infra_boolean_string 对应的类} + * 积分抵扣开关 */ - private Integer tradeDeductEnable; + private Boolean tradeDeductEnable; /** - * 积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元) + * 积分抵扣,单位:分 + * + * 1 积分抵扣多少分 */ private BigDecimal tradeDeductUnitPrice; /** * 积分抵扣最大值 */ - private Long tradeDeductMaxPrice; + private Integer tradeDeductMaxPrice; /** - * 1元赠送多少分 + * 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/dal/mysql/point/MemberPointConfigMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointConfigMapper.java new file mode 100644 index 000000000..e099c1714 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointConfigMapper.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.member.dal.mysql.point; + +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 积分设置 Mapper + * + * @author QingX + */ +@Mapper +public interface MemberPointConfigMapper extends BaseMapperX { +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigService.java new file mode 100644 index 000000000..4becacd36 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigService.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.member.service.point; + +import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigSaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; + +import javax.validation.Valid; + +/** + * 会员积分配置 Service 接口 + * + * @author QingX + */ +public interface MemberPointConfigService { + + /** + * 保存会员积分配置 + * + * @param saveReqVO 更新信息 + */ + void saveConfig(@Valid MemberPointConfigSaveReqVO saveReqVO); + + /** + * 获得会员积分配置 + * + * @return 积分配置 + */ + MemberPointConfigDO getConfig(); + +} 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 new file mode 100644 index 000000000..181537d55 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.member.service.point; + +import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigSaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; +import cn.iocoder.yudao.module.member.dal.mysql.point.MemberPointConfigMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; + +/** + * 会员积分配置 Service 实现类 + * + * @author QingX + */ +@Service +@Validated +public class MemberPointConfigServiceImpl implements MemberPointConfigService { + + @Resource + private MemberPointConfigMapper memberPointConfigMapper; + + @Override + public void saveConfig(MemberPointConfigSaveReqVO saveReqVO) { + // TODO qingx:配置存在,则 update;不存在则 insert + } + + @Override + public MemberPointConfigDO getConfig() { + // TODO qingx:直接查询到一条; + return null; + } +} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/PointConfigController.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/PointConfigController.java deleted file mode 100644 index 137d03050..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/PointConfigController.java +++ /dev/null @@ -1,102 +0,0 @@ -package cn.iocoder.yudao.module.point.controller.admin.pointconfig; - -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.PageResult; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; - -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; - -import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*; -import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO; -import cn.iocoder.yudao.module.point.convert.pointconfig.PointConfigConvert; -import cn.iocoder.yudao.module.point.service.pointconfig.PointConfigService; - -@Tag(name = "管理后台 - 积分设置") -@RestController -@RequestMapping("/point/config") -@Validated -public class PointConfigController { - - @Resource - private PointConfigService configService; - - @PostMapping("/create") - @Operation(summary = "创建积分设置") - @PreAuthorize("@ss.hasPermission('point:config:create')") - public CommonResult createConfig(@Valid @RequestBody PointConfigCreateReqVO createReqVO) { - return success(configService.createConfig(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新积分设置") - @PreAuthorize("@ss.hasPermission('point:config:update')") - public CommonResult updateConfig(@Valid @RequestBody PointConfigUpdateReqVO updateReqVO) { - configService.updateConfig(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除积分设置") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('point:config:delete')") - public CommonResult deleteConfig(@RequestParam("id") Integer id) { - configService.deleteConfig(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得积分设置") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('point:config:query')") - public CommonResult getConfig(@RequestParam("id") Integer id) { - PointConfigDO config = configService.getConfig(id); - return success(PointConfigConvert.INSTANCE.convert(config)); - } - - @GetMapping("/list") - @Operation(summary = "获得积分设置列表") - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") - @PreAuthorize("@ss.hasPermission('point:config:query')") - public CommonResult> getConfigList(@RequestParam("ids") Collection ids) { - List list = configService.getConfigList(ids); - return success(PointConfigConvert.INSTANCE.convertList(list)); - } - - @GetMapping("/page") - @Operation(summary = "获得积分设置分页") - @PreAuthorize("@ss.hasPermission('point:config:query')") - public CommonResult> getConfigPage(@Valid PointConfigPageReqVO pageVO) { - PageResult pageResult = configService.getConfigPage(pageVO); - return success(PointConfigConvert.INSTANCE.convertPage(pageResult)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出积分设置 Excel") - @PreAuthorize("@ss.hasPermission('point:config:export')") - @OperateLog(type = EXPORT) - public void exportConfigExcel(@Valid PointConfigExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { - List list = configService.getConfigList(exportReqVO); - // 导出 Excel - List datas = PointConfigConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "积分设置.xls", "数据", PointConfigExcelVO.class, datas); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigBaseVO.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigBaseVO.java deleted file mode 100644 index d1e900cc2..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigBaseVO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import javax.validation.constraints.*; - -/** - * 积分设置 Base VO,提供给添加、修改、详细的子 VO 使用 - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 - */ -@Data -public class PointConfigBaseVO { - - @Schema(description = "1 开启积分抵扣 0 关闭积分抵扣", example = "1") - private Integer tradeDeductEnable; - - @Schema(description = "积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元)", example = "13506") - private BigDecimal tradeDeductUnitPrice; - - @Schema(description = "积分抵扣最大值", example = "32428") - private Long tradeDeductMaxPrice; - - @Schema(description = "1元赠送多少分") - private Long tradeGivePoint; - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigCreateReqVO.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigCreateReqVO.java deleted file mode 100644 index 4284f5e34..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigCreateReqVO.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import javax.validation.constraints.*; - -@Schema(description = "管理后台 - 积分设置创建 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class PointConfigCreateReqVO extends PointConfigBaseVO { - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExcelVO.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExcelVO.java deleted file mode 100644 index 0d01c7a5c..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExcelVO.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.time.LocalDateTime; - -import com.alibaba.excel.annotation.ExcelProperty; -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; - - -/** - * 积分设置 Excel VO - * - * @author QingX - */ -@Data -public class PointConfigExcelVO { - - @ExcelProperty("自增主键") - private Integer id; - - @ExcelProperty(value = "1 开启积分抵扣 0 关闭积分抵扣", converter = DictConvert.class) - @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 - private Integer tradeDeductEnable; - - @ExcelProperty("积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元)") - private BigDecimal tradeDeductUnitPrice; - - @ExcelProperty("积分抵扣最大值") - private Long tradeDeductMaxPrice; - - @ExcelProperty("1元赠送多少分") - private Long tradeGivePoint; - - @ExcelProperty("创建时间") - private LocalDateTime createTime; - - @ExcelProperty("变更时间") - private LocalDateTime updateTime; - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExportReqVO.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExportReqVO.java deleted file mode 100644 index bcc712d29..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExportReqVO.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; - -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; -import cn.iocoder.yudao.framework.common.pojo.PageParam; - -@Schema(description = "管理后台 - 积分设置 Excel 导出 Request VO,参数和 PointConfigPageReqVO 是一致的") -@Data -public class PointConfigExportReqVO { - - @Schema(description = "1 开启积分抵扣 0 关闭积分抵扣", example = "1") - private Integer tradeDeductEnable; - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigPageReqVO.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigPageReqVO.java deleted file mode 100644 index cc994837c..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigPageReqVO.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; - -import lombok.*; -import java.util.*; -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 PointConfigPageReqVO extends PageParam { - - @Schema(description = "1 开启积分抵扣 0 关闭积分抵扣", example = "1") - private Integer tradeDeductEnable; - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigRespVO.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigRespVO.java deleted file mode 100644 index a8efe57b4..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigRespVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.time.LocalDateTime; - -@Schema(description = "管理后台 - 积分设置 Response VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class PointConfigRespVO extends PointConfigBaseVO { - - @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20937") - private Integer id; - - @Schema(description = "创建时间") - private LocalDateTime createTime; - - @Schema(description = "变更时间") - private LocalDateTime updateTime; - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigUpdateReqVO.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigUpdateReqVO.java deleted file mode 100644 index 9b50f259d..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigUpdateReqVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; - -@Schema(description = "管理后台 - 积分设置更新 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class PointConfigUpdateReqVO extends PointConfigBaseVO { - - @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20937") - @NotNull(message = "自增主键不能为空") - private Integer id; - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/pointconfig/PointConfigConvert.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/pointconfig/PointConfigConvert.java deleted file mode 100644 index 56b96cf75..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/pointconfig/PointConfigConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.point.convert.pointconfig; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*; -import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO; - -/** - * 积分设置 Convert - * - * @author QingX - */ -@Mapper -public interface PointConfigConvert { - - PointConfigConvert INSTANCE = Mappers.getMapper(PointConfigConvert.class); - - PointConfigDO convert(PointConfigCreateReqVO bean); - - PointConfigDO convert(PointConfigUpdateReqVO bean); - - PointConfigRespVO convert(PointConfigDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/pointconfig/PointConfigMapper.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/pointconfig/PointConfigMapper.java deleted file mode 100644 index 5d11f9b5b..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/pointconfig/PointConfigMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.yudao.module.point.dal.mysql.pointconfig; - -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.point.dal.dataobject.pointconfig.PointConfigDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*; - -/** - * 积分设置 Mapper - * - * @author QingX - */ -@Mapper -public interface PointConfigMapper extends BaseMapperX { - - default PageResult selectPage(PointConfigPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(PointConfigDO::getTradeDeductEnable, reqVO.getTradeDeductEnable()) - .orderByDesc(PointConfigDO::getId)); - } - - default List selectList(PointConfigExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .eqIfPresent(PointConfigDO::getTradeDeductEnable, reqVO.getTradeDeductEnable()) - .orderByDesc(PointConfigDO::getId)); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigService.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigService.java deleted file mode 100644 index d579b7b9d..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigService.java +++ /dev/null @@ -1,70 +0,0 @@ -package cn.iocoder.yudao.module.point.service.pointconfig; - -import java.util.*; -import javax.validation.*; -import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*; -import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -/** - * 积分设置 Service 接口 - * - * @author QingX - */ -public interface PointConfigService { - - /** - * 创建积分设置 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Integer createConfig(@Valid PointConfigCreateReqVO createReqVO); - - /** - * 更新积分设置 - * - * @param updateReqVO 更新信息 - */ - void updateConfig(@Valid PointConfigUpdateReqVO updateReqVO); - - /** - * 删除积分设置 - * - * @param id 编号 - */ - void deleteConfig(Integer id); - - /** - * 获得积分设置 - * - * @param id 编号 - * @return 积分设置 - */ - PointConfigDO getConfig(Integer id); - - /** - * 获得积分设置列表 - * - * @param ids 编号 - * @return 积分设置列表 - */ - List getConfigList(Collection ids); - - /** - * 获得积分设置分页 - * - * @param pageReqVO 分页查询 - * @return 积分设置分页 - */ - PageResult getConfigPage(PointConfigPageReqVO pageReqVO); - - /** - * 获得积分设置列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 积分设置列表 - */ - List getConfigList(PointConfigExportReqVO exportReqVO); - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigServiceImpl.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigServiceImpl.java deleted file mode 100644 index 5cc8185d8..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigServiceImpl.java +++ /dev/null @@ -1,92 +0,0 @@ -package cn.iocoder.yudao.module.point.service.pointconfig; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; - -import java.util.*; -import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*; -import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import cn.iocoder.yudao.module.point.convert.pointconfig.PointConfigConvert; -import cn.iocoder.yudao.module.point.dal.mysql.pointconfig.PointConfigMapper; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*; - -/** - * 积分设置 Service 实现类 - * - * @author QingX - */ -@Service -@Validated -public class PointConfigServiceImpl implements PointConfigService { - - @Autowired - private PointConfigMapper configMapper; - - @Override - public Integer createConfig(PointConfigCreateReqVO createReqVO) { - // 插入 - PointConfigDO config = PointConfigConvert.INSTANCE.convert(createReqVO); - //每个租户只允许存在一条记录 - validateConfigExistsOne(); - - configMapper.insert(config); - // 返回 - return config.getId(); - } - - @Override - public void updateConfig(PointConfigUpdateReqVO updateReqVO) { - // 校验存在 - validateConfigExists(updateReqVO.getId()); - // 更新 - PointConfigDO updateObj = PointConfigConvert.INSTANCE.convert(updateReqVO); - configMapper.updateById(updateObj); - } - - @Override - public void deleteConfig(Integer id) { - // 校验存在 - validateConfigExists(id); - // 删除 - configMapper.deleteById(id); - } - - private void validateConfigExists(Integer id) { - if (configMapper.selectById(id) == null) { - throw exception(CONFIG_NOT_EXISTS); - } - } - - private void validateConfigExistsOne() { - if (configMapper.selectCount() > 0) { - throw exception(CONFIG_EXISTS); - } - } - - @Override - public PointConfigDO getConfig(Integer id) { - return configMapper.selectById(id); - } - - @Override - public List getConfigList(Collection ids) { - return configMapper.selectBatchIds(ids); - } - - @Override - public PageResult getConfigPage(PointConfigPageReqVO pageReqVO) { - return configMapper.selectPage(pageReqVO); - } - - @Override - public List getConfigList(PointConfigExportReqVO exportReqVO) { - return configMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointconfig/PointConfigMapper.xml b/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointconfig/PointConfigMapper.xml deleted file mode 100644 index 963afd6c8..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointconfig/PointConfigMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointrecord/PointRecordMapper.xml b/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointrecord/PointRecordMapper.xml deleted file mode 100644 index cc09cce4b..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointrecord/PointRecordMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinconfig/SignInConfigMapper.xml b/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinconfig/SignInConfigMapper.xml deleted file mode 100644 index 2e665c01a..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinconfig/SignInConfigMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinrecord/SignInRecordMapper.xml b/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinrecord/SignInRecordMapper.xml deleted file mode 100644 index bd9d58976..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinrecord/SignInRecordMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - -