From b7e13419622f56e85e86370464dd32f4fdac6551 Mon Sep 17 00:00:00 2001 From: perry <292303709@qq.com> Date: Sun, 14 May 2023 17:36:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/shop/enums/ErrorCodeConstants.java | 6 +- .../recharge/RechargeGearController.java | 102 ++++++++ .../admin/recharge/vo/RechargeGearBaseVO.java | 29 +++ .../recharge/vo/RechargeGearCreateReqVO.java | 14 ++ .../recharge/vo/RechargeGearExcelVO.java | 34 +++ .../recharge/vo/RechargeGearExportReqVO.java | 15 ++ .../recharge/vo/RechargeGearPageReqVO.java | 17 ++ .../admin/recharge/vo/RechargeGearRespVO.java | 19 ++ .../recharge/vo/RechargeGearUpdateReqVO.java | 18 ++ .../convert/recharge/RechargeGearConvert.java | 34 +++ .../dataobject/recharge/RechargeGearDO.java | 43 ++++ .../mysql/recharge/RechargeGearMapper.java | 32 +++ .../service/recharge/RechargeGearService.java | 70 ++++++ .../recharge/RechargeGearServiceImpl.java | 82 +++++++ .../mapper/recharge/RechargeGearMapper.xml | 12 + .../admin/dept/vo/dept/DeptCreateReqVO.java | 4 + .../service/tenant/TenantServiceImpl.java | 18 ++ .../src/main/resources/application.yaml | 4 + yudao-ui-admin/.env.dev | 2 +- yudao-ui-admin/.env.front | 2 +- yudao-ui-admin/.env.local | 2 +- yudao-ui-admin/.env.prod | 2 +- yudao-ui-admin/.env.stage | 2 +- yudao-ui-admin/.env.static | 2 +- yudao-ui-admin/src/api/shop/rechargeGear.js | 54 +++++ .../src/layout/components/Navbar.vue | 12 +- yudao-ui-admin/src/views/login.vue | 13 +- .../src/views/shop/rechargeGear/index.vue | 217 ++++++++++++++++++ 28 files changed, 837 insertions(+), 24 deletions(-) create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearBaseVO.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearCreateReqVO.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearExcelVO.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearExportReqVO.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearPageReqVO.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearRespVO.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearUpdateReqVO.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/convert/recharge/RechargeGearConvert.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeGearDO.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/recharge/RechargeGearMapper.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeGearMapper.xml create mode 100644 yudao-ui-admin/src/api/shop/rechargeGear.js create mode 100644 yudao-ui-admin/src/views/shop/rechargeGear/index.vue diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/enums/ErrorCodeConstants.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/enums/ErrorCodeConstants.java index c84d5fcf4..78247cec6 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/enums/ErrorCodeConstants.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/enums/ErrorCodeConstants.java @@ -63,9 +63,11 @@ public interface ErrorCodeConstants { ErrorCode GOODS_DOWN_UPDATE = new ErrorCode(1008007008, "请先下架商品,再进行修改"); - ErrorCode GOODS_EXISTS_HUI = new ErrorCode(1008007008, "商品已存在回收站"); + ErrorCode GOODS_EXISTS_HUI = new ErrorCode(1008007009, "商品已存在回收站"); - ErrorCode SUB_STOCK_ERROR = new ErrorCode(1008007008, "更新普通商品库存失败"); + ErrorCode SUB_STOCK_ERROR = new ErrorCode(1008007010, "更新普通商品库存失败"); + + ErrorCode RECHARGE_GEAR_NOT_EXISTS = new ErrorCode(1008007011, "充值档位不存在"); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java new file mode 100644 index 000000000..fdd887f65 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java @@ -0,0 +1,102 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge; + +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.shop.controller.admin.recharge.vo.*; +import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO; +import cn.iocoder.yudao.module.shop.convert.recharge.RechargeGearConvert; +import cn.iocoder.yudao.module.shop.service.recharge.RechargeGearService; + +@Tag(name = "管理后台 - 充值档位") +@RestController +@RequestMapping("/shop/recharge-gear") +@Validated +public class RechargeGearController { + + @Resource + private RechargeGearService rechargeGearService; + + @PostMapping("/create") + @Operation(summary = "创建充值档位") + @PreAuthorize("@ss.hasPermission('shop:recharge-gear:create')") + public CommonResult createRechargeGear(@Valid @RequestBody RechargeGearCreateReqVO createReqVO) { + return success(rechargeGearService.createRechargeGear(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新充值档位") + @PreAuthorize("@ss.hasPermission('shop:recharge-gear:update')") + public CommonResult updateRechargeGear(@Valid @RequestBody RechargeGearUpdateReqVO updateReqVO) { + rechargeGearService.updateRechargeGear(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除充值档位") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('shop:recharge-gear:delete')") + public CommonResult deleteRechargeGear(@RequestParam("id") String id) { + rechargeGearService.deleteRechargeGear(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得充值档位") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('shop:recharge-gear:query')") + public CommonResult getRechargeGear(@RequestParam("id") String id) { + RechargeGearDO rechargeGear = rechargeGearService.getRechargeGear(id); + return success(RechargeGearConvert.INSTANCE.convert(rechargeGear)); + } + + @GetMapping("/list") + @Operation(summary = "获得充值档位列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('shop:recharge-gear:query')") + public CommonResult> getRechargeGearList(@RequestParam("ids") Collection ids) { + List list = rechargeGearService.getRechargeGearList(ids); + return success(RechargeGearConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得充值档位分页") + @PreAuthorize("@ss.hasPermission('shop:recharge-gear:query')") + public CommonResult> getRechargeGearPage(@Valid RechargeGearPageReqVO pageVO) { + PageResult pageResult = rechargeGearService.getRechargeGearPage(pageVO); + return success(RechargeGearConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出充值档位 Excel") + @PreAuthorize("@ss.hasPermission('shop:recharge-gear:export')") + @OperateLog(type = EXPORT) + public void exportRechargeGearExcel(@Valid RechargeGearExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = rechargeGearService.getRechargeGearList(exportReqVO); + // 导出 Excel + List datas = RechargeGearConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "充值档位.xls", "数据", RechargeGearExcelVO.class, datas); + } + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearBaseVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearBaseVO.java new file mode 100644 index 000000000..72e41fd50 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearBaseVO.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import javax.validation.constraints.*; + +/** +* 充值档位 Base VO,提供给添加、修改、详细的子 VO 使用 +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 +*/ +@Data +public class RechargeGearBaseVO { + + @Schema(description = "档位名称", required = true, example = "张三") + @NotNull(message = "档位名称不能为空") + private String name; + + @Schema(description = "档位备注", required = true) + @NotNull(message = "档位备注不能为空") + private String gearRemarks; + + @Schema(description = "档位显示金额", required = true) + @NotNull(message = "档位显示金额不能为空") + private Integer gearAmount; + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearCreateReqVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearCreateReqVO.java new file mode 100644 index 000000000..1897dddfe --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.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 RechargeGearCreateReqVO extends RechargeGearBaseVO { + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearExcelVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearExcelVO.java new file mode 100644 index 000000000..d23dc8669 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearExcelVO.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 充值档位 Excel VO + * + * @author 创盈云 + */ +@Data +public class RechargeGearExcelVO { + + @ExcelProperty("主键") + private String id; + + @ExcelProperty("档位名称") + private String name; + + @ExcelProperty("档位备注") + private String gearRemarks; + + @ExcelProperty("档位显示金额") + private Integer gearAmount; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearExportReqVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearExportReqVO.java new file mode 100644 index 000000000..8e8e051a2 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearExportReqVO.java @@ -0,0 +1,15 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.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,参数和 RechargeGearPageReqVO 是一致的") +@Data +public class RechargeGearExportReqVO { + + @Schema(description = "档位名称", example = "张三") + private String name; + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearPageReqVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearPageReqVO.java new file mode 100644 index 000000000..89cfa1ce2 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearPageReqVO.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.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 RechargeGearPageReqVO extends PageParam { + + @Schema(description = "档位名称", example = "张三") + private String name; + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearRespVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearRespVO.java new file mode 100644 index 000000000..9e4006b8a --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.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 RechargeGearRespVO extends RechargeGearBaseVO { + + @Schema(description = "主键", required = true, example = "3324") + private String id; + + @Schema(description = "创建时间", required = true) + private LocalDateTime createTime; + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearUpdateReqVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearUpdateReqVO.java new file mode 100644 index 000000000..c74733fdf --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeGearUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.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 RechargeGearUpdateReqVO extends RechargeGearBaseVO { + + @Schema(description = "主键", required = true, example = "3324") + @NotNull(message = "主键不能为空") + private String id; + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/convert/recharge/RechargeGearConvert.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/convert/recharge/RechargeGearConvert.java new file mode 100644 index 000000000..53ce4e151 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/convert/recharge/RechargeGearConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.shop.convert.recharge; + +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.shop.controller.admin.recharge.vo.*; +import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO; + +/** + * 充值档位 Convert + * + * @author 创盈云 + */ +@Mapper +public interface RechargeGearConvert { + + RechargeGearConvert INSTANCE = Mappers.getMapper(RechargeGearConvert.class); + + RechargeGearDO convert(RechargeGearCreateReqVO bean); + + RechargeGearDO convert(RechargeGearUpdateReqVO bean); + + RechargeGearRespVO convert(RechargeGearDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeGearDO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeGearDO.java new file mode 100644 index 000000000..de83afb1a --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeGearDO.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.shop.dal.dataobject.recharge; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 充值档位 DO + * + * @author 创盈云 + */ +@TableName("cy_recharge_gear") +@KeySequence("cy_recharge_gear_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class RechargeGearDO extends BaseDO { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private String id; + /** + * 档位名称 + */ + private String name; + /** + * 档位备注 + */ + private String gearRemarks; + /** + * 档位显示金额 + */ + private Integer gearAmount; + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/recharge/RechargeGearMapper.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/recharge/RechargeGearMapper.java new file mode 100644 index 000000000..0aa4f62a2 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/recharge/RechargeGearMapper.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.shop.dal.mysql.recharge; + +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.shop.dal.dataobject.recharge.RechargeGearDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*; + +/** + * 充值档位 Mapper + * + * @author 创盈云 + */ +@Mapper +public interface RechargeGearMapper extends BaseMapperX { + + default PageResult selectPage(RechargeGearPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(RechargeGearDO::getName, reqVO.getName()) + .orderByDesc(RechargeGearDO::getId)); + } + + default List selectList(RechargeGearExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(RechargeGearDO::getName, reqVO.getName()) + .orderByDesc(RechargeGearDO::getId)); + } + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java new file mode 100644 index 000000000..646f1bdf9 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.shop.service.recharge; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*; +import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 充值档位 Service 接口 + * + * @author 创盈云 + */ +public interface RechargeGearService { + + /** + * 创建充值档位 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + String createRechargeGear(@Valid RechargeGearCreateReqVO createReqVO); + + /** + * 更新充值档位 + * + * @param updateReqVO 更新信息 + */ + void updateRechargeGear(@Valid RechargeGearUpdateReqVO updateReqVO); + + /** + * 删除充值档位 + * + * @param id 编号 + */ + void deleteRechargeGear(String id); + + /** + * 获得充值档位 + * + * @param id 编号 + * @return 充值档位 + */ + RechargeGearDO getRechargeGear(String id); + + /** + * 获得充值档位列表 + * + * @param ids 编号 + * @return 充值档位列表 + */ + List getRechargeGearList(Collection ids); + + /** + * 获得充值档位分页 + * + * @param pageReqVO 分页查询 + * @return 充值档位分页 + */ + PageResult getRechargeGearPage(RechargeGearPageReqVO pageReqVO); + + /** + * 获得充值档位列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 充值档位列表 + */ + List getRechargeGearList(RechargeGearExportReqVO exportReqVO); + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java new file mode 100644 index 000000000..2867ba083 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.shop.service.recharge; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*; +import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.shop.convert.recharge.RechargeGearConvert; +import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeGearMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.shop.enums.ErrorCodeConstants.*; + +/** + * 充值档位 Service 实现类 + * + * @author 创盈云 + */ +@Service +@Validated +public class RechargeGearServiceImpl implements RechargeGearService { + + @Resource + private RechargeGearMapper rechargeGearMapper; + + @Override + public String createRechargeGear(RechargeGearCreateReqVO createReqVO) { + // 插入 + RechargeGearDO rechargeGear = RechargeGearConvert.INSTANCE.convert(createReqVO); + rechargeGearMapper.insert(rechargeGear); + // 返回 + return rechargeGear.getId(); + } + + @Override + public void updateRechargeGear(RechargeGearUpdateReqVO updateReqVO) { + // 校验存在 + validateRechargeGearExists(updateReqVO.getId()); + // 更新 + RechargeGearDO updateObj = RechargeGearConvert.INSTANCE.convert(updateReqVO); + rechargeGearMapper.updateById(updateObj); + } + + @Override + public void deleteRechargeGear(String id) { + // 校验存在 + validateRechargeGearExists(id); + // 删除 + rechargeGearMapper.deleteById(id); + } + + private void validateRechargeGearExists(String id) { + if (rechargeGearMapper.selectById(id) == null) { + throw exception(RECHARGE_GEAR_NOT_EXISTS); + } + } + + @Override + public RechargeGearDO getRechargeGear(String id) { + return rechargeGearMapper.selectById(id); + } + + @Override + public List getRechargeGearList(Collection ids) { + return rechargeGearMapper.selectBatchIds(ids); + } + + @Override + public PageResult getRechargeGearPage(RechargeGearPageReqVO pageReqVO) { + return rechargeGearMapper.selectPage(pageReqVO); + } + + @Override + public List getRechargeGearList(RechargeGearExportReqVO exportReqVO) { + return rechargeGearMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeGearMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeGearMapper.xml new file mode 100644 index 000000000..808570d4a --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeGearMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptCreateReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptCreateReqVO.java index 66741f6da..163ad9ab4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptCreateReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptCreateReqVO.java @@ -9,4 +9,8 @@ import lombok.ToString; @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class DeptCreateReqVO extends DeptBaseVO { + /** + * 多租户编号 + */ + private Long tenantId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java index 1664ff6e3..04697bc91 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java @@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.tenant.config.TenantProperties; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; +import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantExportReqVO; @@ -23,6 +24,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO; import cn.iocoder.yudao.module.system.dal.mysql.tenant.TenantMapper; import cn.iocoder.yudao.module.system.enums.permission.RoleCodeEnum; import cn.iocoder.yudao.module.system.enums.permission.RoleTypeEnum; +import cn.iocoder.yudao.module.system.service.dept.DeptService; import cn.iocoder.yudao.module.system.service.permission.MenuService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.RoleService; @@ -73,6 +75,8 @@ public class TenantServiceImpl implements TenantService { private MenuService menuService; @Resource private PermissionService permissionService; + @Resource + private DeptService deptService; @Override public List getTenantIdList() { @@ -113,7 +117,10 @@ public class TenantServiceImpl implements TenantService { Long userId = createUser(roleId, createReqVO); // 修改租户的管理员 tenantMapper.updateById(new TenantDO().setId(tenant.getId()).setContactUserId(userId)); + //创建顶级部门 + createDept(tenant,userId); }); + return tenant.getId(); } @@ -136,6 +143,17 @@ public class TenantServiceImpl implements TenantService { return roleId; } + private Long createDept(TenantDO tenant,Long userId){ + DeptCreateReqVO deptCreateReqVO = new DeptCreateReqVO(); + deptCreateReqVO.setName(tenant.getName()); + deptCreateReqVO.setSort(0); + deptCreateReqVO.setStatus(0); + deptCreateReqVO.setPhone(tenant.getContactMobile()); + deptCreateReqVO.setLeaderUserId(userId); + deptCreateReqVO.setTenantId(tenant.getId()); + Long deptId = deptService.createDept(deptCreateReqVO); + return deptId; + } @Override @Transactional(rollbackFor = Exception.class) public void updateTenant(TenantUpdateReqVO updateReqVO) { diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 7f2714885..5567d8ce1 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -204,6 +204,10 @@ yudao: - eb_store_product_rule - eb_store_product_reply - eb_user_address + - cy_recharge_gear + - cy_phone_record + - cy_recharge_order_info + - cy_refund_fee_record sms-code: # 短信验证码相关的配置项 expire-times: 10m send-frequency: 1m diff --git a/yudao-ui-admin/.env.dev b/yudao-ui-admin/.env.dev index fc2b1cb18..25b797fd3 100644 --- a/yudao-ui-admin/.env.dev +++ b/yudao-ui-admin/.env.dev @@ -4,7 +4,7 @@ ENV = 'development' # 页面标题 VUE_APP_TITLE = 创盈商户管理系统 -# 芋道管理系统/开发环境 +# 创盈管理系统/开发环境 VUE_APP_BASE_API = 'http://localhost:48080' # 路由懒加载 diff --git a/yudao-ui-admin/.env.front b/yudao-ui-admin/.env.front index 343bdb275..d36aa63b6 100644 --- a/yudao-ui-admin/.env.front +++ b/yudao-ui-admin/.env.front @@ -4,7 +4,7 @@ ENV = 'development' # 页面标题 VUE_APP_TITLE = 创盈商户管理系统 -# 芋道管理系统/本地环境 +# 创盈管理系统/本地环境 VUE_APP_BASE_API = 'http://api-dashboard.yudao.iocoder.cn' # 路由懒加载 diff --git a/yudao-ui-admin/.env.local b/yudao-ui-admin/.env.local index 9870183c2..554f0090f 100644 --- a/yudao-ui-admin/.env.local +++ b/yudao-ui-admin/.env.local @@ -4,7 +4,7 @@ ENV = 'development' # 页面标题 VUE_APP_TITLE = 创盈商户管理系统 -# 芋道管理系统/本地环境 +# 创盈管理系统/本地环境 # VUE_APP_BASE_API = '/proxy-api' VUE_APP_BASE_API = 'http://127.0.0.1:48080' diff --git a/yudao-ui-admin/.env.prod b/yudao-ui-admin/.env.prod index 7e939441f..46be158eb 100644 --- a/yudao-ui-admin/.env.prod +++ b/yudao-ui-admin/.env.prod @@ -4,7 +4,7 @@ ENV = 'production' # 页面标题 VUE_APP_TITLE = 创盈商户管理系统 -# 芋道管理系统/生产环境 +# 创盈管理系统/生产环境 VUE_APP_BASE_API = '/prod-api' # 根据服务器或域名修改 diff --git a/yudao-ui-admin/.env.stage b/yudao-ui-admin/.env.stage index 50c208e87..6ceceae5e 100644 --- a/yudao-ui-admin/.env.stage +++ b/yudao-ui-admin/.env.stage @@ -6,7 +6,7 @@ VUE_APP_TITLE = 创盈商户管理系统 # 测试环境配置 ENV = 'staging' -# 芋道管理系统/测试环境 +# 创盈管理系统/测试环境 VUE_APP_BASE_API = 'http://api-dashboard.yudao.iocoder.cn' # 静态资源地址 diff --git a/yudao-ui-admin/.env.static b/yudao-ui-admin/.env.static index b9da152bb..f68030151 100644 --- a/yudao-ui-admin/.env.static +++ b/yudao-ui-admin/.env.static @@ -6,7 +6,7 @@ ENV = 'staging' # 页面标题 VUE_APP_TITLE = 创盈商户管理系统 -# 芋道管理系统/测试环境 +# 创盈管理系统/测试环境 VUE_APP_BASE_API = 'http://127.0.0.1:48080' # 根据服务器或域名修改 diff --git a/yudao-ui-admin/src/api/shop/rechargeGear.js b/yudao-ui-admin/src/api/shop/rechargeGear.js new file mode 100644 index 000000000..5a797b99f --- /dev/null +++ b/yudao-ui-admin/src/api/shop/rechargeGear.js @@ -0,0 +1,54 @@ +import request from '@/utils/request' + +// 创建充值档位 +export function createRechargeGear(data) { + return request({ + url: '/shop/recharge-gear/create', + method: 'post', + data: data + }) +} + +// 更新充值档位 +export function updateRechargeGear(data) { + return request({ + url: '/shop/recharge-gear/update', + method: 'put', + data: data + }) +} + +// 删除充值档位 +export function deleteRechargeGear(id) { + return request({ + url: '/shop/recharge-gear/delete?id=' + id, + method: 'delete' + }) +} + +// 获得充值档位 +export function getRechargeGear(id) { + return request({ + url: '/shop/recharge-gear/get?id=' + id, + method: 'get' + }) +} + +// 获得充值档位分页 +export function getRechargeGearPage(query) { + return request({ + url: '/shop/recharge-gear/page', + method: 'get', + params: query + }) +} + +// 导出充值档位 Excel +export function exportRechargeGearExcel(query) { + return request({ + url: '/shop/recharge-gear/export-excel', + method: 'get', + params: query, + responseType: 'blob' + }) +} diff --git a/yudao-ui-admin/src/layout/components/Navbar.vue b/yudao-ui-admin/src/layout/components/Navbar.vue index 2bec4f399..bbc1d3681 100644 --- a/yudao-ui-admin/src/layout/components/Navbar.vue +++ b/yudao-ui-admin/src/layout/components/Navbar.vue @@ -12,13 +12,13 @@ - - - + + + - - - + + + diff --git a/yudao-ui-admin/src/views/login.vue b/yudao-ui-admin/src/views/login.vue index f2a1625bd..0bf969f29 100644 --- a/yudao-ui-admin/src/views/login.vue +++ b/yudao-ui-admin/src/views/login.vue @@ -1,6 +1,6 @@