Commit fd072b7d6ee0001826033fdaa367814c5313f2d7
1 parent
798e322f
code review:会员积分配置
Showing
26 changed files
with
211 additions
and
556 deletions
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointConfigController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.member.controller.admin.point; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigRespVO; | |
| 5 | +import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.member.convert.point.MemberPointConfigConvert; | |
| 7 | +import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; | |
| 8 | +import cn.iocoder.yudao.module.member.service.point.MemberPointConfigService; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 11 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 12 | +import org.springframework.validation.annotation.Validated; | |
| 13 | +import org.springframework.web.bind.annotation.*; | |
| 14 | + | |
| 15 | +import javax.annotation.Resource; | |
| 16 | +import javax.validation.Valid; | |
| 17 | + | |
| 18 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 19 | + | |
| 20 | +@Tag(name = "管理后台 - 会员积分设置") | |
| 21 | +@RestController | |
| 22 | +@RequestMapping("/point/config") | |
| 23 | +@Validated | |
| 24 | +public class MemberPointConfigController { | |
| 25 | + | |
| 26 | + @Resource | |
| 27 | + private MemberPointConfigService memberPointConfigService; | |
| 28 | + | |
| 29 | + @PutMapping("/update") | |
| 30 | + @Operation(summary = "保存会员积分配置") | |
| 31 | + @PreAuthorize("@ss.hasPermission('member:point-config:save')") | |
| 32 | + public CommonResult<Boolean> updateConfig(@Valid @RequestBody MemberPointConfigSaveReqVO saveReqVO) { | |
| 33 | + memberPointConfigService.saveConfig(saveReqVO); | |
| 34 | + return success(true); | |
| 35 | + } | |
| 36 | + | |
| 37 | + @GetMapping("/get") | |
| 38 | + @Operation(summary = "获得会员积分配置") | |
| 39 | + @PreAuthorize("@ss.hasPermission('member:point-config:query')") | |
| 40 | + public CommonResult<MemberPointConfigRespVO> getConfig() { | |
| 41 | + MemberPointConfigDO config = memberPointConfigService.getConfig(); | |
| 42 | + return success(MemberPointConfigConvert.INSTANCE.convert(config)); | |
| 43 | + } | |
| 44 | + | |
| 45 | +} | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.member.controller.admin.point.vo.config; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.math.BigDecimal; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 会员积分配置 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 10 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 11 | + */ | |
| 12 | +@Data | |
| 13 | +public class MemberPointConfigBaseVO { | |
| 14 | + | |
| 15 | + @Schema(description = "积分抵扣开关", required = true, example = "true") | |
| 16 | + private Boolean tradeDeductEnable; | |
| 17 | + | |
| 18 | + @Schema(description = "积分抵扣,单位:分", example = "13506") | |
| 19 | + private BigDecimal tradeDeductUnitPrice; | |
| 20 | + | |
| 21 | + @Schema(description = "积分抵扣最大值", example = "32428") | |
| 22 | + private Long tradeDeductMaxPrice; | |
| 23 | + | |
| 24 | + @Schema(description = "1 元赠送多少分") | |
| 25 | + private Long tradeGivePoint; | |
| 26 | + | |
| 27 | +} | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.member.controller.admin.point.vo.config; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 会员积分配置 Response VO") | |
| 9 | +@Data | |
| 10 | +@EqualsAndHashCode(callSuper = true) | |
| 11 | +@ToString(callSuper = true) | |
| 12 | +public class MemberPointConfigRespVO extends MemberPointConfigBaseVO { | |
| 13 | +} | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.member.controller.admin.point.vo.config; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 会员积分配置保存 Request VO") | |
| 9 | +@Data | |
| 10 | +@EqualsAndHashCode(callSuper = true) | |
| 11 | +@ToString(callSuper = true) | |
| 12 | +public class MemberPointConfigSaveReqVO extends MemberPointConfigBaseVO { | |
| 13 | +} | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/package-info.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod; | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.member.convert.point; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigRespVO; | |
| 4 | +import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; | |
| 5 | +import org.mapstruct.Mapper; | |
| 6 | +import org.mapstruct.factory.Mappers; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 会员积分配置 Convert | |
| 10 | + * | |
| 11 | + * @author QingX | |
| 12 | + */ | |
| 13 | +@Mapper | |
| 14 | +public interface MemberPointConfigConvert { | |
| 15 | + | |
| 16 | + MemberPointConfigConvert INSTANCE = Mappers.getMapper(MemberPointConfigConvert.class); | |
| 17 | + | |
| 18 | + MemberPointConfigRespVO convert(MemberPointConfigDO bean); | |
| 19 | + | |
| 20 | +} | ... | ... |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/pointconfig/PointConfigDO.java renamed to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointConfigDO.java
| 1 | -package cn.iocoder.yudao.module.point.dal.dataobject.pointconfig; | |
| 1 | +package cn.iocoder.yudao.module.member.dal.dataobject.point; | |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 3 | 7 | import lombok.*; |
| 4 | -import java.util.*; | |
| 8 | + | |
| 5 | 9 | import java.math.BigDecimal; |
| 6 | -import java.time.LocalDateTime; | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import com.baomidou.mybatisplus.annotation.*; | |
| 9 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * 积分设置 DO | |
| 12 | + * 会员积分配置 DO | |
| 13 | 13 | * |
| 14 | 14 | * @author QingX |
| 15 | 15 | */ |
| ... | ... | @@ -21,7 +21,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 21 | 21 | @Builder |
| 22 | 22 | @NoArgsConstructor |
| 23 | 23 | @AllArgsConstructor |
| 24 | -public class PointConfigDO extends BaseDO { | |
| 24 | +public class MemberPointConfigDO extends BaseDO { | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * 自增主键 |
| ... | ... | @@ -29,23 +29,22 @@ public class PointConfigDO extends BaseDO { |
| 29 | 29 | @TableId |
| 30 | 30 | private Integer id; |
| 31 | 31 | /** |
| 32 | - * 1 开启积分抵扣 | |
| 33 | -0 关闭积分抵扣 | |
| 34 | - * | |
| 35 | - * 枚举 {@link TODO infra_boolean_string 对应的类} | |
| 32 | + * 积分抵扣开关 | |
| 36 | 33 | */ |
| 37 | - private Integer tradeDeductEnable; | |
| 34 | + private Boolean tradeDeductEnable; | |
| 38 | 35 | /** |
| 39 | - * 积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元) | |
| 36 | + * 积分抵扣,单位:分 | |
| 37 | + * | |
| 38 | + * 1 积分抵扣多少分 | |
| 40 | 39 | */ |
| 41 | 40 | private BigDecimal tradeDeductUnitPrice; |
| 42 | 41 | /** |
| 43 | 42 | * 积分抵扣最大值 |
| 44 | 43 | */ |
| 45 | - private Long tradeDeductMaxPrice; | |
| 44 | + private Integer tradeDeductMaxPrice; | |
| 46 | 45 | /** |
| 47 | - * 1元赠送多少分 | |
| 46 | + * 1 元赠送多少分 | |
| 48 | 47 | */ |
| 49 | - private Long tradeGivePoint; | |
| 48 | + private Integer tradeGivePoint; | |
| 50 | 49 | |
| 51 | 50 | } | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointConfigMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.member.dal.mysql.point; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 4 | +import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; | |
| 5 | +import org.apache.ibatis.annotations.Mapper; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 积分设置 Mapper | |
| 9 | + * | |
| 10 | + * @author QingX | |
| 11 | + */ | |
| 12 | +@Mapper | |
| 13 | +public interface MemberPointConfigMapper extends BaseMapperX<MemberPointConfigDO> { | |
| 14 | +} | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.member.service.point; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigSaveReqVO; | |
| 4 | +import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; | |
| 5 | + | |
| 6 | +import javax.validation.Valid; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 会员积分配置 Service 接口 | |
| 10 | + * | |
| 11 | + * @author QingX | |
| 12 | + */ | |
| 13 | +public interface MemberPointConfigService { | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 保存会员积分配置 | |
| 17 | + * | |
| 18 | + * @param saveReqVO 更新信息 | |
| 19 | + */ | |
| 20 | + void saveConfig(@Valid MemberPointConfigSaveReqVO saveReqVO); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 获得会员积分配置 | |
| 24 | + * | |
| 25 | + * @return 积分配置 | |
| 26 | + */ | |
| 27 | + MemberPointConfigDO getConfig(); | |
| 28 | + | |
| 29 | +} | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.member.service.point; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigSaveReqVO; | |
| 4 | +import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO; | |
| 5 | +import cn.iocoder.yudao.module.member.dal.mysql.point.MemberPointConfigMapper; | |
| 6 | +import org.springframework.stereotype.Service; | |
| 7 | +import org.springframework.validation.annotation.Validated; | |
| 8 | + | |
| 9 | +import javax.annotation.Resource; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 会员积分配置 Service 实现类 | |
| 13 | + * | |
| 14 | + * @author QingX | |
| 15 | + */ | |
| 16 | +@Service | |
| 17 | +@Validated | |
| 18 | +public class MemberPointConfigServiceImpl implements MemberPointConfigService { | |
| 19 | + | |
| 20 | + @Resource | |
| 21 | + private MemberPointConfigMapper memberPointConfigMapper; | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public void saveConfig(MemberPointConfigSaveReqVO saveReqVO) { | |
| 25 | + // TODO qingx:配置存在,则 update;不存在则 insert | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public MemberPointConfigDO getConfig() { | |
| 30 | + // TODO qingx:直接查询到一条; | |
| 31 | + return null; | |
| 32 | + } | |
| 33 | +} | ... | ... |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/PointConfigController.java deleted
| 1 | -package cn.iocoder.yudao.module.point.controller.admin.pointconfig; | |
| 2 | - | |
| 3 | -import org.springframework.web.bind.annotation.*; | |
| 4 | -import javax.annotation.Resource; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | -import io.swagger.v3.oas.annotations.Operation; | |
| 10 | - | |
| 11 | -import javax.validation.constraints.*; | |
| 12 | -import javax.validation.*; | |
| 13 | -import javax.servlet.http.*; | |
| 14 | -import java.util.*; | |
| 15 | -import java.io.IOException; | |
| 16 | - | |
| 17 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 18 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 19 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | - | |
| 21 | -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 22 | - | |
| 23 | -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 24 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; | |
| 25 | - | |
| 26 | -import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*; | |
| 27 | -import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO; | |
| 28 | -import cn.iocoder.yudao.module.point.convert.pointconfig.PointConfigConvert; | |
| 29 | -import cn.iocoder.yudao.module.point.service.pointconfig.PointConfigService; | |
| 30 | - | |
| 31 | -@Tag(name = "管理后台 - 积分设置") | |
| 32 | -@RestController | |
| 33 | -@RequestMapping("/point/config") | |
| 34 | -@Validated | |
| 35 | -public class PointConfigController { | |
| 36 | - | |
| 37 | - @Resource | |
| 38 | - private PointConfigService configService; | |
| 39 | - | |
| 40 | - @PostMapping("/create") | |
| 41 | - @Operation(summary = "创建积分设置") | |
| 42 | - @PreAuthorize("@ss.hasPermission('point:config:create')") | |
| 43 | - public CommonResult<Integer> createConfig(@Valid @RequestBody PointConfigCreateReqVO createReqVO) { | |
| 44 | - return success(configService.createConfig(createReqVO)); | |
| 45 | - } | |
| 46 | - | |
| 47 | - @PutMapping("/update") | |
| 48 | - @Operation(summary = "更新积分设置") | |
| 49 | - @PreAuthorize("@ss.hasPermission('point:config:update')") | |
| 50 | - public CommonResult<Boolean> updateConfig(@Valid @RequestBody PointConfigUpdateReqVO updateReqVO) { | |
| 51 | - configService.updateConfig(updateReqVO); | |
| 52 | - return success(true); | |
| 53 | - } | |
| 54 | - | |
| 55 | - @DeleteMapping("/delete") | |
| 56 | - @Operation(summary = "删除积分设置") | |
| 57 | - @Parameter(name = "id", description = "编号", required = true) | |
| 58 | - @PreAuthorize("@ss.hasPermission('point:config:delete')") | |
| 59 | - public CommonResult<Boolean> deleteConfig(@RequestParam("id") Integer id) { | |
| 60 | - configService.deleteConfig(id); | |
| 61 | - return success(true); | |
| 62 | - } | |
| 63 | - | |
| 64 | - @GetMapping("/get") | |
| 65 | - @Operation(summary = "获得积分设置") | |
| 66 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 67 | - @PreAuthorize("@ss.hasPermission('point:config:query')") | |
| 68 | - public CommonResult<PointConfigRespVO> getConfig(@RequestParam("id") Integer id) { | |
| 69 | - PointConfigDO config = configService.getConfig(id); | |
| 70 | - return success(PointConfigConvert.INSTANCE.convert(config)); | |
| 71 | - } | |
| 72 | - | |
| 73 | - @GetMapping("/list") | |
| 74 | - @Operation(summary = "获得积分设置列表") | |
| 75 | - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") | |
| 76 | - @PreAuthorize("@ss.hasPermission('point:config:query')") | |
| 77 | - public CommonResult<List<PointConfigRespVO>> getConfigList(@RequestParam("ids") Collection<Integer> ids) { | |
| 78 | - List<PointConfigDO> list = configService.getConfigList(ids); | |
| 79 | - return success(PointConfigConvert.INSTANCE.convertList(list)); | |
| 80 | - } | |
| 81 | - | |
| 82 | - @GetMapping("/page") | |
| 83 | - @Operation(summary = "获得积分设置分页") | |
| 84 | - @PreAuthorize("@ss.hasPermission('point:config:query')") | |
| 85 | - public CommonResult<PageResult<PointConfigRespVO>> getConfigPage(@Valid PointConfigPageReqVO pageVO) { | |
| 86 | - PageResult<PointConfigDO> pageResult = configService.getConfigPage(pageVO); | |
| 87 | - return success(PointConfigConvert.INSTANCE.convertPage(pageResult)); | |
| 88 | - } | |
| 89 | - | |
| 90 | - @GetMapping("/export-excel") | |
| 91 | - @Operation(summary = "导出积分设置 Excel") | |
| 92 | - @PreAuthorize("@ss.hasPermission('point:config:export')") | |
| 93 | - @OperateLog(type = EXPORT) | |
| 94 | - public void exportConfigExcel(@Valid PointConfigExportReqVO exportReqVO, | |
| 95 | - HttpServletResponse response) throws IOException { | |
| 96 | - List<PointConfigDO> list = configService.getConfigList(exportReqVO); | |
| 97 | - // 导出 Excel | |
| 98 | - List<PointConfigExcelVO> datas = PointConfigConvert.INSTANCE.convertList02(list); | |
| 99 | - ExcelUtils.write(response, "积分设置.xls", "数据", PointConfigExcelVO.class, datas); | |
| 100 | - } | |
| 101 | - | |
| 102 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigBaseVO.java deleted
| 1 | -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import java.math.BigDecimal; | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import java.time.LocalDateTime; | |
| 9 | -import javax.validation.constraints.*; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 积分设置 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 13 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 14 | - */ | |
| 15 | -@Data | |
| 16 | -public class PointConfigBaseVO { | |
| 17 | - | |
| 18 | - @Schema(description = "1 开启积分抵扣 0 关闭积分抵扣", example = "1") | |
| 19 | - private Integer tradeDeductEnable; | |
| 20 | - | |
| 21 | - @Schema(description = "积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元)", example = "13506") | |
| 22 | - private BigDecimal tradeDeductUnitPrice; | |
| 23 | - | |
| 24 | - @Schema(description = "积分抵扣最大值", example = "32428") | |
| 25 | - private Long tradeDeductMaxPrice; | |
| 26 | - | |
| 27 | - @Schema(description = "1元赠送多少分") | |
| 28 | - private Long tradeGivePoint; | |
| 29 | - | |
| 30 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 积分设置创建 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class PointConfigCreateReqVO extends PointConfigBaseVO { | |
| 13 | - | |
| 14 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import java.math.BigDecimal; | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import java.time.LocalDateTime; | |
| 9 | - | |
| 10 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 11 | -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 12 | -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 13 | - | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * 积分设置 Excel VO | |
| 17 | - * | |
| 18 | - * @author QingX | |
| 19 | - */ | |
| 20 | -@Data | |
| 21 | -public class PointConfigExcelVO { | |
| 22 | - | |
| 23 | - @ExcelProperty("自增主键") | |
| 24 | - private Integer id; | |
| 25 | - | |
| 26 | - @ExcelProperty(value = "1 开启积分抵扣 0 关闭积分抵扣", converter = DictConvert.class) | |
| 27 | - @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | |
| 28 | - private Integer tradeDeductEnable; | |
| 29 | - | |
| 30 | - @ExcelProperty("积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元)") | |
| 31 | - private BigDecimal tradeDeductUnitPrice; | |
| 32 | - | |
| 33 | - @ExcelProperty("积分抵扣最大值") | |
| 34 | - private Long tradeDeductMaxPrice; | |
| 35 | - | |
| 36 | - @ExcelProperty("1元赠送多少分") | |
| 37 | - private Long tradeGivePoint; | |
| 38 | - | |
| 39 | - @ExcelProperty("创建时间") | |
| 40 | - private LocalDateTime createTime; | |
| 41 | - | |
| 42 | - @ExcelProperty("变更时间") | |
| 43 | - private LocalDateTime updateTime; | |
| 44 | - | |
| 45 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 积分设置 Excel 导出 Request VO,参数和 PointConfigPageReqVO 是一致的") | |
| 9 | -@Data | |
| 10 | -public class PointConfigExportReqVO { | |
| 11 | - | |
| 12 | - @Schema(description = "1 开启积分抵扣 0 关闭积分抵扣", example = "1") | |
| 13 | - private Integer tradeDeductEnable; | |
| 14 | - | |
| 15 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigPageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 积分设置分页 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class PointConfigPageReqVO extends PageParam { | |
| 13 | - | |
| 14 | - @Schema(description = "1 开启积分抵扣 0 关闭积分抵扣", example = "1") | |
| 15 | - private Integer tradeDeductEnable; | |
| 16 | - | |
| 17 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.time.LocalDateTime; | |
| 6 | - | |
| 7 | -@Schema(description = "管理后台 - 积分设置 Response VO") | |
| 8 | -@Data | |
| 9 | -@EqualsAndHashCode(callSuper = true) | |
| 10 | -@ToString(callSuper = true) | |
| 11 | -public class PointConfigRespVO extends PointConfigBaseVO { | |
| 12 | - | |
| 13 | - @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20937") | |
| 14 | - private Integer id; | |
| 15 | - | |
| 16 | - @Schema(description = "创建时间") | |
| 17 | - private LocalDateTime createTime; | |
| 18 | - | |
| 19 | - @Schema(description = "变更时间") | |
| 20 | - private LocalDateTime updateTime; | |
| 21 | - | |
| 22 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - 积分设置更新 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class PointConfigUpdateReqVO extends PointConfigBaseVO { | |
| 13 | - | |
| 14 | - @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20937") | |
| 15 | - @NotNull(message = "自增主键不能为空") | |
| 16 | - private Integer id; | |
| 17 | - | |
| 18 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/pointconfig/PointConfigConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.point.convert.pointconfig; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | - | |
| 7 | -import org.mapstruct.Mapper; | |
| 8 | -import org.mapstruct.factory.Mappers; | |
| 9 | -import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 积分设置 Convert | |
| 14 | - * | |
| 15 | - * @author QingX | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface PointConfigConvert { | |
| 19 | - | |
| 20 | - PointConfigConvert INSTANCE = Mappers.getMapper(PointConfigConvert.class); | |
| 21 | - | |
| 22 | - PointConfigDO convert(PointConfigCreateReqVO bean); | |
| 23 | - | |
| 24 | - PointConfigDO convert(PointConfigUpdateReqVO bean); | |
| 25 | - | |
| 26 | - PointConfigRespVO convert(PointConfigDO bean); | |
| 27 | - | |
| 28 | - List<PointConfigRespVO> convertList(List<PointConfigDO> list); | |
| 29 | - | |
| 30 | - PageResult<PointConfigRespVO> convertPage(PageResult<PointConfigDO> page); | |
| 31 | - | |
| 32 | - List<PointConfigExcelVO> convertList02(List<PointConfigDO> list); | |
| 33 | - | |
| 34 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/pointconfig/PointConfigMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.point.dal.mysql.pointconfig; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | -import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 积分设置 Mapper | |
| 14 | - * | |
| 15 | - * @author QingX | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface PointConfigMapper extends BaseMapperX<PointConfigDO> { | |
| 19 | - | |
| 20 | - default PageResult<PointConfigDO> selectPage(PointConfigPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<PointConfigDO>() | |
| 22 | - .eqIfPresent(PointConfigDO::getTradeDeductEnable, reqVO.getTradeDeductEnable()) | |
| 23 | - .orderByDesc(PointConfigDO::getId)); | |
| 24 | - } | |
| 25 | - | |
| 26 | - default List<PointConfigDO> selectList(PointConfigExportReqVO reqVO) { | |
| 27 | - return selectList(new LambdaQueryWrapperX<PointConfigDO>() | |
| 28 | - .eqIfPresent(PointConfigDO::getTradeDeductEnable, reqVO.getTradeDeductEnable()) | |
| 29 | - .orderByDesc(PointConfigDO::getId)); | |
| 30 | - } | |
| 31 | - | |
| 32 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigService.java deleted
| 1 | -package cn.iocoder.yudao.module.point.service.pointconfig; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | -import javax.validation.*; | |
| 5 | -import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*; | |
| 6 | -import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO; | |
| 7 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 积分设置 Service 接口 | |
| 11 | - * | |
| 12 | - * @author QingX | |
| 13 | - */ | |
| 14 | -public interface PointConfigService { | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * 创建积分设置 | |
| 18 | - * | |
| 19 | - * @param createReqVO 创建信息 | |
| 20 | - * @return 编号 | |
| 21 | - */ | |
| 22 | - Integer createConfig(@Valid PointConfigCreateReqVO createReqVO); | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 更新积分设置 | |
| 26 | - * | |
| 27 | - * @param updateReqVO 更新信息 | |
| 28 | - */ | |
| 29 | - void updateConfig(@Valid PointConfigUpdateReqVO updateReqVO); | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 删除积分设置 | |
| 33 | - * | |
| 34 | - * @param id 编号 | |
| 35 | - */ | |
| 36 | - void deleteConfig(Integer id); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 获得积分设置 | |
| 40 | - * | |
| 41 | - * @param id 编号 | |
| 42 | - * @return 积分设置 | |
| 43 | - */ | |
| 44 | - PointConfigDO getConfig(Integer id); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 获得积分设置列表 | |
| 48 | - * | |
| 49 | - * @param ids 编号 | |
| 50 | - * @return 积分设置列表 | |
| 51 | - */ | |
| 52 | - List<PointConfigDO> getConfigList(Collection<Integer> ids); | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * 获得积分设置分页 | |
| 56 | - * | |
| 57 | - * @param pageReqVO 分页查询 | |
| 58 | - * @return 积分设置分页 | |
| 59 | - */ | |
| 60 | - PageResult<PointConfigDO> getConfigPage(PointConfigPageReqVO pageReqVO); | |
| 61 | - | |
| 62 | - /** | |
| 63 | - * 获得积分设置列表, 用于 Excel 导出 | |
| 64 | - * | |
| 65 | - * @param exportReqVO 查询条件 | |
| 66 | - * @return 积分设置列表 | |
| 67 | - */ | |
| 68 | - List<PointConfigDO> getConfigList(PointConfigExportReqVO exportReqVO); | |
| 69 | - | |
| 70 | -} |
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.point.service.pointconfig; | |
| 2 | - | |
| 3 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 4 | -import org.springframework.stereotype.Service; | |
| 5 | -import javax.annotation.Resource; | |
| 6 | -import org.springframework.validation.annotation.Validated; | |
| 7 | - | |
| 8 | -import java.util.*; | |
| 9 | -import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO; | |
| 11 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 12 | - | |
| 13 | -import cn.iocoder.yudao.module.point.convert.pointconfig.PointConfigConvert; | |
| 14 | -import cn.iocoder.yudao.module.point.dal.mysql.pointconfig.PointConfigMapper; | |
| 15 | - | |
| 16 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 17 | -import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*; | |
| 18 | - | |
| 19 | -/** | |
| 20 | - * 积分设置 Service 实现类 | |
| 21 | - * | |
| 22 | - * @author QingX | |
| 23 | - */ | |
| 24 | -@Service | |
| 25 | -@Validated | |
| 26 | -public class PointConfigServiceImpl implements PointConfigService { | |
| 27 | - | |
| 28 | - @Autowired | |
| 29 | - private PointConfigMapper configMapper; | |
| 30 | - | |
| 31 | - @Override | |
| 32 | - public Integer createConfig(PointConfigCreateReqVO createReqVO) { | |
| 33 | - // 插入 | |
| 34 | - PointConfigDO config = PointConfigConvert.INSTANCE.convert(createReqVO); | |
| 35 | - //每个租户只允许存在一条记录 | |
| 36 | - validateConfigExistsOne(); | |
| 37 | - | |
| 38 | - configMapper.insert(config); | |
| 39 | - // 返回 | |
| 40 | - return config.getId(); | |
| 41 | - } | |
| 42 | - | |
| 43 | - @Override | |
| 44 | - public void updateConfig(PointConfigUpdateReqVO updateReqVO) { | |
| 45 | - // 校验存在 | |
| 46 | - validateConfigExists(updateReqVO.getId()); | |
| 47 | - // 更新 | |
| 48 | - PointConfigDO updateObj = PointConfigConvert.INSTANCE.convert(updateReqVO); | |
| 49 | - configMapper.updateById(updateObj); | |
| 50 | - } | |
| 51 | - | |
| 52 | - @Override | |
| 53 | - public void deleteConfig(Integer id) { | |
| 54 | - // 校验存在 | |
| 55 | - validateConfigExists(id); | |
| 56 | - // 删除 | |
| 57 | - configMapper.deleteById(id); | |
| 58 | - } | |
| 59 | - | |
| 60 | - private void validateConfigExists(Integer id) { | |
| 61 | - if (configMapper.selectById(id) == null) { | |
| 62 | - throw exception(CONFIG_NOT_EXISTS); | |
| 63 | - } | |
| 64 | - } | |
| 65 | - | |
| 66 | - private void validateConfigExistsOne() { | |
| 67 | - if (configMapper.selectCount() > 0) { | |
| 68 | - throw exception(CONFIG_EXISTS); | |
| 69 | - } | |
| 70 | - } | |
| 71 | - | |
| 72 | - @Override | |
| 73 | - public PointConfigDO getConfig(Integer id) { | |
| 74 | - return configMapper.selectById(id); | |
| 75 | - } | |
| 76 | - | |
| 77 | - @Override | |
| 78 | - public List<PointConfigDO> getConfigList(Collection<Integer> ids) { | |
| 79 | - return configMapper.selectBatchIds(ids); | |
| 80 | - } | |
| 81 | - | |
| 82 | - @Override | |
| 83 | - public PageResult<PointConfigDO> getConfigPage(PointConfigPageReqVO pageReqVO) { | |
| 84 | - return configMapper.selectPage(pageReqVO); | |
| 85 | - } | |
| 86 | - | |
| 87 | - @Override | |
| 88 | - public List<PointConfigDO> getConfigList(PointConfigExportReqVO exportReqVO) { | |
| 89 | - return configMapper.selectList(exportReqVO); | |
| 90 | - } | |
| 91 | - | |
| 92 | -} |
yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointconfig/PointConfigMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | -<mapper namespace="cn.iocoder.yudao.module.point.dal.mysql.pointconfig.PointConfigMapper"> | |
| 4 | - | |
| 5 | - <!-- | |
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | - --> | |
| 11 | - | |
| 12 | -</mapper> |
yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointrecord/PointRecordMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | -<mapper namespace="cn.iocoder.yudao.module.point.dal.mysql.pointrecord.PointRecordMapper"> | |
| 4 | - | |
| 5 | - <!-- | |
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | - --> | |
| 11 | - | |
| 12 | -</mapper> |
yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinconfig/SignInConfigMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | -<mapper namespace="cn.iocoder.yudao.module.point.dal.mysql.signinconfig.SignInConfigMapper"> | |
| 4 | - | |
| 5 | - <!-- | |
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | - --> | |
| 11 | - | |
| 12 | -</mapper> |
yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinrecord/SignInRecordMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | -<mapper namespace="cn.iocoder.yudao.module.point.dal.mysql.signinrecord.SignInRecordMapper"> | |
| 4 | - | |
| 5 | - <!-- | |
| 6 | - 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | - 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | - 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | - 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | - --> | |
| 11 | - | |
| 12 | -</mapper> |