Commit e61ecb63dd103ab9ebcb352b5b35882a51a3c1e6
1 parent
8b671117
🔧 简化 sms 模块的 VO
Showing
32 changed files
with
207 additions
and
664 deletions
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java
| ... | ... | @@ -85,7 +85,7 @@ public class RoleController { |
| 85 | 85 | return success(BeanUtils.toBean(pageResult, RoleRespVO.class)); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - @GetMapping("/list-all-simple") | |
| 88 | + @GetMapping({"/list-all-simple", "/simple-list"}) | |
| 89 | 89 | @Operation(summary = "获取角色精简信息列表", description = "只包含被开启的角色,主要用于前端的下拉选项") |
| 90 | 90 | public CommonResult<List<RoleSimpleRespVO>> getSimpleRoleList() { |
| 91 | 91 | List<RoleDO> list = roleService.getRoleListByStatus(singleton(CommonStatusEnum.ENABLE.getStatus())); | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsChannelController.java
| 1 | 1 | package cn.iocoder.yudao.module.system.controller.admin.sms; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.*; | |
| 4 | -import cn.iocoder.yudao.module.system.convert.sms.SmsChannelConvert; | |
| 5 | -import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; | |
| 6 | -import cn.iocoder.yudao.module.system.service.sms.SmsChannelService; | |
| 7 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 8 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 10 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelRespVO; | |
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSaveReqVO; | |
| 9 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSimpleRespVO; | |
| 10 | +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; | |
| 11 | +import cn.iocoder.yudao.module.system.service.sms.SmsChannelService; | |
| 11 | 12 | import io.swagger.v3.oas.annotations.Operation; |
| 13 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 14 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 12 | 15 | import org.springframework.security.access.prepost.PreAuthorize; |
| 13 | 16 | import org.springframework.web.bind.annotation.*; |
| 14 | 17 | |
| ... | ... | @@ -30,14 +33,14 @@ public class SmsChannelController { |
| 30 | 33 | @PostMapping("/create") |
| 31 | 34 | @Operation(summary = "创建短信渠道") |
| 32 | 35 | @PreAuthorize("@ss.hasPermission('system:sms-channel:create')") |
| 33 | - public CommonResult<Long> createSmsChannel(@Valid @RequestBody SmsChannelCreateReqVO createReqVO) { | |
| 36 | + public CommonResult<Long> createSmsChannel(@Valid @RequestBody SmsChannelSaveReqVO createReqVO) { | |
| 34 | 37 | return success(smsChannelService.createSmsChannel(createReqVO)); |
| 35 | 38 | } |
| 36 | 39 | |
| 37 | 40 | @PutMapping("/update") |
| 38 | 41 | @Operation(summary = "更新短信渠道") |
| 39 | 42 | @PreAuthorize("@ss.hasPermission('system:sms-channel:update')") |
| 40 | - public CommonResult<Boolean> updateSmsChannel(@Valid @RequestBody SmsChannelUpdateReqVO updateReqVO) { | |
| 43 | + public CommonResult<Boolean> updateSmsChannel(@Valid @RequestBody SmsChannelSaveReqVO updateReqVO) { | |
| 41 | 44 | smsChannelService.updateSmsChannel(updateReqVO); |
| 42 | 45 | return success(true); |
| 43 | 46 | } |
| ... | ... | @@ -56,8 +59,8 @@ public class SmsChannelController { |
| 56 | 59 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 57 | 60 | @PreAuthorize("@ss.hasPermission('system:sms-channel:query')") |
| 58 | 61 | public CommonResult<SmsChannelRespVO> getSmsChannel(@RequestParam("id") Long id) { |
| 59 | - SmsChannelDO smsChannel = smsChannelService.getSmsChannel(id); | |
| 60 | - return success(SmsChannelConvert.INSTANCE.convert(smsChannel)); | |
| 62 | + SmsChannelDO channel = smsChannelService.getSmsChannel(id); | |
| 63 | + return success(BeanUtils.toBean(channel, SmsChannelRespVO.class)); | |
| 61 | 64 | } |
| 62 | 65 | |
| 63 | 66 | @GetMapping("/page") |
| ... | ... | @@ -65,16 +68,15 @@ public class SmsChannelController { |
| 65 | 68 | @PreAuthorize("@ss.hasPermission('system:sms-channel:query')") |
| 66 | 69 | public CommonResult<PageResult<SmsChannelRespVO>> getSmsChannelPage(@Valid SmsChannelPageReqVO pageVO) { |
| 67 | 70 | PageResult<SmsChannelDO> pageResult = smsChannelService.getSmsChannelPage(pageVO); |
| 68 | - return success(SmsChannelConvert.INSTANCE.convertPage(pageResult)); | |
| 71 | + return success(BeanUtils.toBean(pageResult, SmsChannelRespVO.class)); | |
| 69 | 72 | } |
| 70 | 73 | |
| 71 | - @GetMapping("/list-all-simple") | |
| 74 | + @GetMapping({"/list-all-simple", "/simple-list"}) | |
| 72 | 75 | @Operation(summary = "获得短信渠道精简列表", description = "包含被禁用的短信渠道") |
| 73 | 76 | public CommonResult<List<SmsChannelSimpleRespVO>> getSimpleSmsChannelList() { |
| 74 | 77 | List<SmsChannelDO> list = smsChannelService.getSmsChannelList(); |
| 75 | - // 排序后,返回给前端 | |
| 76 | 78 | list.sort(Comparator.comparing(SmsChannelDO::getId)); |
| 77 | - return success(SmsChannelConvert.INSTANCE.convertList03(list)); | |
| 79 | + return success(BeanUtils.toBean(list, SmsChannelSimpleRespVO.class)); | |
| 78 | 80 | } |
| 79 | 81 | |
| 80 | 82 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsLogController.java
| 1 | 1 | package cn.iocoder.yudao.module.system.controller.admin.sms; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExcelVO; | |
| 4 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO; | |
| 5 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogRespVO; | |
| 7 | -import cn.iocoder.yudao.module.system.convert.sms.SmsLogConvert; | |
| 8 | -import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsLogDO; | |
| 9 | -import cn.iocoder.yudao.module.system.service.sms.SmsLogService; | |
| 10 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 11 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 12 | 7 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 13 | 8 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 14 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 9 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; | |
| 10 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogRespVO; | |
| 11 | +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsLogDO; | |
| 12 | +import cn.iocoder.yudao.module.system.service.sms.SmsLogService; | |
| 15 | 13 | import io.swagger.v3.oas.annotations.Operation; |
| 14 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 16 | 15 | import org.springframework.security.access.prepost.PreAuthorize; |
| 17 | 16 | import org.springframework.validation.annotation.Validated; |
| 18 | 17 | import org.springframework.web.bind.annotation.GetMapping; |
| ... | ... | @@ -40,21 +39,22 @@ public class SmsLogController { |
| 40 | 39 | @GetMapping("/page") |
| 41 | 40 | @Operation(summary = "获得短信日志分页") |
| 42 | 41 | @PreAuthorize("@ss.hasPermission('system:sms-log:query')") |
| 43 | - public CommonResult<PageResult<SmsLogRespVO>> getSmsLogPage(@Valid SmsLogPageReqVO pageVO) { | |
| 44 | - PageResult<SmsLogDO> pageResult = smsLogService.getSmsLogPage(pageVO); | |
| 45 | - return success(SmsLogConvert.INSTANCE.convertPage(pageResult)); | |
| 42 | + public CommonResult<PageResult<SmsLogRespVO>> getSmsLogPage(@Valid SmsLogPageReqVO pageReqVO) { | |
| 43 | + PageResult<SmsLogDO> pageResult = smsLogService.getSmsLogPage(pageReqVO); | |
| 44 | + return success(BeanUtils.toBean(pageResult, SmsLogRespVO.class)); | |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | @GetMapping("/export-excel") |
| 49 | 48 | @Operation(summary = "导出短信日志 Excel") |
| 50 | 49 | @PreAuthorize("@ss.hasPermission('system:sms-log:export')") |
| 51 | 50 | @OperateLog(type = EXPORT) |
| 52 | - public void exportSmsLogExcel(@Valid SmsLogExportReqVO exportReqVO, | |
| 51 | + public void exportSmsLogExcel(@Valid SmsLogPageReqVO exportReqVO, | |
| 53 | 52 | HttpServletResponse response) throws IOException { |
| 54 | - List<SmsLogDO> list = smsLogService.getSmsLogList(exportReqVO); | |
| 53 | + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 54 | + List<SmsLogDO> list = smsLogService.getSmsLogPage(exportReqVO).getList(); | |
| 55 | 55 | // 导出 Excel |
| 56 | - List<SmsLogExcelVO> datas = SmsLogConvert.INSTANCE.convertList02(list); | |
| 57 | - ExcelUtils.write(response, "短信日志.xls", "数据", SmsLogExcelVO.class, datas); | |
| 56 | + ExcelUtils.write(response, "短信日志.xls", "数据", SmsLogRespVO.class, | |
| 57 | + BeanUtils.toBean(list, SmsLogRespVO.class)); | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsTemplateController.java
| 1 | 1 | package cn.iocoder.yudao.module.system.controller.admin.sms; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 3 | 5 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.*; |
| 4 | -import cn.iocoder.yudao.module.system.convert.sms.SmsTemplateConvert; | |
| 5 | 6 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; |
| 6 | 7 | import cn.iocoder.yudao.module.system.service.sms.SmsTemplateService; |
| 7 | 8 | import cn.iocoder.yudao.module.system.service.sms.SmsSendService; |
| ... | ... | @@ -37,14 +38,14 @@ public class SmsTemplateController { |
| 37 | 38 | @PostMapping("/create") |
| 38 | 39 | @Operation(summary = "创建短信模板") |
| 39 | 40 | @PreAuthorize("@ss.hasPermission('system:sms-template:create')") |
| 40 | - public CommonResult<Long> createSmsTemplate(@Valid @RequestBody SmsTemplateCreateReqVO createReqVO) { | |
| 41 | + public CommonResult<Long> createSmsTemplate(@Valid @RequestBody SmsTemplateSaveReqVO createReqVO) { | |
| 41 | 42 | return success(smsTemplateService.createSmsTemplate(createReqVO)); |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | @PutMapping("/update") |
| 45 | 46 | @Operation(summary = "更新短信模板") |
| 46 | 47 | @PreAuthorize("@ss.hasPermission('system:sms-template:update')") |
| 47 | - public CommonResult<Boolean> updateSmsTemplate(@Valid @RequestBody SmsTemplateUpdateReqVO updateReqVO) { | |
| 48 | + public CommonResult<Boolean> updateSmsTemplate(@Valid @RequestBody SmsTemplateSaveReqVO updateReqVO) { | |
| 48 | 49 | smsTemplateService.updateSmsTemplate(updateReqVO); |
| 49 | 50 | return success(true); |
| 50 | 51 | } |
| ... | ... | @@ -63,8 +64,8 @@ public class SmsTemplateController { |
| 63 | 64 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 64 | 65 | @PreAuthorize("@ss.hasPermission('system:sms-template:query')") |
| 65 | 66 | public CommonResult<SmsTemplateRespVO> getSmsTemplate(@RequestParam("id") Long id) { |
| 66 | - SmsTemplateDO smsTemplate = smsTemplateService.getSmsTemplate(id); | |
| 67 | - return success(SmsTemplateConvert.INSTANCE.convert(smsTemplate)); | |
| 67 | + SmsTemplateDO template = smsTemplateService.getSmsTemplate(id); | |
| 68 | + return success(BeanUtils.toBean(template, SmsTemplateRespVO.class)); | |
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | @GetMapping("/page") |
| ... | ... | @@ -72,19 +73,20 @@ public class SmsTemplateController { |
| 72 | 73 | @PreAuthorize("@ss.hasPermission('system:sms-template:query')") |
| 73 | 74 | public CommonResult<PageResult<SmsTemplateRespVO>> getSmsTemplatePage(@Valid SmsTemplatePageReqVO pageVO) { |
| 74 | 75 | PageResult<SmsTemplateDO> pageResult = smsTemplateService.getSmsTemplatePage(pageVO); |
| 75 | - return success(SmsTemplateConvert.INSTANCE.convertPage(pageResult)); | |
| 76 | + return success(BeanUtils.toBean(pageResult, SmsTemplateRespVO.class)); | |
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | @GetMapping("/export-excel") |
| 79 | 80 | @Operation(summary = "导出短信模板 Excel") |
| 80 | 81 | @PreAuthorize("@ss.hasPermission('system:sms-template:export')") |
| 81 | 82 | @OperateLog(type = EXPORT) |
| 82 | - public void exportSmsTemplateExcel(@Valid SmsTemplateExportReqVO exportReqVO, | |
| 83 | + public void exportSmsTemplateExcel(@Valid SmsTemplatePageReqVO exportReqVO, | |
| 83 | 84 | HttpServletResponse response) throws IOException { |
| 84 | - List<SmsTemplateDO> list = smsTemplateService.getSmsTemplateList(exportReqVO); | |
| 85 | + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 86 | + List<SmsTemplateDO> list = smsTemplateService.getSmsTemplatePage(exportReqVO).getList(); | |
| 85 | 87 | // 导出 Excel |
| 86 | - List<SmsTemplateExcelVO> datas = SmsTemplateConvert.INSTANCE.convertList02(list); | |
| 87 | - ExcelUtils.write(response, "短信模板.xls", "数据", SmsTemplateExcelVO.class, datas); | |
| 88 | + ExcelUtils.write(response, "短信模板.xls", "数据", SmsTemplateRespVO.class, | |
| 89 | + BeanUtils.toBean(list, SmsTemplateRespVO.class)); | |
| 88 | 90 | } |
| 89 | 91 | |
| 90 | 92 | @PostMapping("/send-sms") | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/channel/SmsChannelCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | -import lombok.ToString; | |
| 7 | - | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 9 | - | |
| 10 | -@Schema(description = "管理后台 - 短信渠道创建 Request VO") | |
| 11 | -@Data | |
| 12 | -@EqualsAndHashCode(callSuper = true) | |
| 13 | -@ToString(callSuper = true) | |
| 14 | -public class SmsChannelCreateReqVO extends SmsChannelBaseVO { | |
| 15 | - | |
| 16 | - @Schema(description = "渠道编码,参见 SmsChannelEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "YUN_PIAN") | |
| 17 | - @NotNull(message = "渠道编码不能为空") | |
| 18 | - private String code; | |
| 19 | - | |
| 20 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/channel/SmsChannelRespVO.java
| ... | ... | @@ -2,23 +2,43 @@ package cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel; |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.Data; |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | -import lombok.ToString; | |
| 5 | +import org.hibernate.validator.constraints.URL; | |
| 7 | 6 | |
| 7 | +import javax.validation.constraints.NotNull; | |
| 8 | 8 | import java.time.LocalDateTime; |
| 9 | 9 | |
| 10 | 10 | @Schema(description = "管理后台 - 短信渠道 Response VO") |
| 11 | 11 | @Data |
| 12 | -@EqualsAndHashCode(callSuper = true) | |
| 13 | -@ToString(callSuper = true) | |
| 14 | -public class SmsChannelRespVO extends SmsChannelBaseVO { | |
| 12 | +public class SmsChannelRespVO { | |
| 15 | 13 | |
| 16 | 14 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 17 | 15 | private Long id; |
| 18 | 16 | |
| 17 | + @Schema(description = "短信签名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") | |
| 18 | + @NotNull(message = "短信签名不能为空") | |
| 19 | + private String signature; | |
| 20 | + | |
| 19 | 21 | @Schema(description = "渠道编码,参见 SmsChannelEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "YUN_PIAN") |
| 20 | 22 | private String code; |
| 21 | 23 | |
| 24 | + @Schema(description = "启用状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 25 | + @NotNull(message = "启用状态不能为空") | |
| 26 | + private Integer status; | |
| 27 | + | |
| 28 | + @Schema(description = "备注", example = "好吃!") | |
| 29 | + private String remark; | |
| 30 | + | |
| 31 | + @Schema(description = "短信 API 的账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao") | |
| 32 | + @NotNull(message = "短信 API 的账号不能为空") | |
| 33 | + private String apiKey; | |
| 34 | + | |
| 35 | + @Schema(description = "短信 API 的密钥", example = "yuanma") | |
| 36 | + private String apiSecret; | |
| 37 | + | |
| 38 | + @Schema(description = "短信发送回调 URL", example = "https://www.iocoder.cn") | |
| 39 | + @URL(message = "回调 URL 格式不正确") | |
| 40 | + private String callbackUrl; | |
| 41 | + | |
| 22 | 42 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 23 | 43 | private LocalDateTime createTime; |
| 24 | 44 | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/channel/SmsChannelBaseVO.java renamed to yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/channel/SmsChannelSaveReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel; |
| 2 | + | |
| 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 3 | 4 | import lombok.Data; |
| 4 | 5 | import org.hibernate.validator.constraints.URL; |
| 5 | 6 | |
| 6 | 7 | import javax.validation.constraints.NotNull; |
| 7 | 8 | |
| 8 | -/** | |
| 9 | -* 短信渠道 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 10 | -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 11 | -*/ | |
| 9 | +@Schema(description = "管理后台 - 短信渠道创建/修改 Request VO") | |
| 12 | 10 | @Data |
| 13 | -public class SmsChannelBaseVO { | |
| 11 | +public class SmsChannelSaveReqVO { | |
| 12 | + | |
| 13 | + @Schema(description = "编号", example = "1024") | |
| 14 | + private Long id; | |
| 14 | 15 | |
| 15 | 16 | @Schema(description = "短信签名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") |
| 16 | 17 | @NotNull(message = "短信签名不能为空") |
| 17 | 18 | private String signature; |
| 18 | 19 | |
| 20 | + @Schema(description = "渠道编码,参见 SmsChannelEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "YUN_PIAN") | |
| 21 | + @NotNull(message = "渠道编码不能为空") | |
| 22 | + private String code; | |
| 23 | + | |
| 19 | 24 | @Schema(description = "启用状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 20 | 25 | @NotNull(message = "启用状态不能为空") |
| 21 | 26 | private Integer status; | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/channel/SmsChannelSimpleRespVO.java
| ... | ... | @@ -3,18 +3,14 @@ package cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel; |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | |
| 6 | -import javax.validation.constraints.NotNull; | |
| 7 | - | |
| 8 | 6 | @Schema(description = "管理后台 - 短信渠道精简 Response VO") |
| 9 | 7 | @Data |
| 10 | 8 | public class SmsChannelSimpleRespVO { |
| 11 | 9 | |
| 12 | 10 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 13 | - @NotNull(message = "编号不能为空") | |
| 14 | 11 | private Long id; |
| 15 | 12 | |
| 16 | 13 | @Schema(description = "短信签名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") |
| 17 | - @NotNull(message = "短信签名不能为空") | |
| 18 | 14 | private String signature; |
| 19 | 15 | |
| 20 | 16 | @Schema(description = "渠道编码,参见 SmsChannelEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "YUN_PIAN") | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/channel/SmsChannelUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | -import lombok.ToString; | |
| 7 | - | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 9 | - | |
| 10 | -@Schema(description = "管理后台 - 短信渠道更新 Request VO") | |
| 11 | -@Data | |
| 12 | -@EqualsAndHashCode(callSuper = true) | |
| 13 | -@ToString(callSuper = true) | |
| 14 | -public class SmsChannelUpdateReqVO extends SmsChannelBaseVO { | |
| 15 | - | |
| 16 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 17 | - @NotNull(message = "编号不能为空") | |
| 18 | - private Long id; | |
| 19 | - | |
| 20 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.system.controller.admin.sms.vo.log; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 4 | -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 5 | -import cn.iocoder.yudao.framework.excel.core.convert.JsonConvert; | |
| 6 | -import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | |
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 8 | -import lombok.Data; | |
| 9 | - | |
| 10 | -import java.time.LocalDateTime; | |
| 11 | -import java.util.Map; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 短信日志 Excel VO | |
| 15 | - * | |
| 16 | - * @author 芋道源码 | |
| 17 | - */ | |
| 18 | -@Data | |
| 19 | -public class SmsLogExcelVO { | |
| 20 | - | |
| 21 | - @ExcelProperty("编号") | |
| 22 | - private Long id; | |
| 23 | - | |
| 24 | - @ExcelProperty("短信渠道编号") | |
| 25 | - private Long channelId; | |
| 26 | - | |
| 27 | - @ExcelProperty("短信渠道编码") | |
| 28 | - private String channelCode; | |
| 29 | - | |
| 30 | - @ExcelProperty("模板编号") | |
| 31 | - private Long templateId; | |
| 32 | - | |
| 33 | - @ExcelProperty("模板编码") | |
| 34 | - private String templateCode; | |
| 35 | - | |
| 36 | - @ExcelProperty(value = "短信类型", converter = DictConvert.class) | |
| 37 | - @DictFormat(DictTypeConstants.SMS_TEMPLATE_TYPE) | |
| 38 | - private Integer templateType; | |
| 39 | - | |
| 40 | - @ExcelProperty("短信内容") | |
| 41 | - private String templateContent; | |
| 42 | - | |
| 43 | - @ExcelProperty(value = "短信参数", converter = JsonConvert.class) | |
| 44 | - private Map<String, Object> templateParams; | |
| 45 | - | |
| 46 | - @ExcelProperty("短信 API 的模板编号") | |
| 47 | - private String apiTemplateId; | |
| 48 | - | |
| 49 | - @ExcelProperty("手机号") | |
| 50 | - private String mobile; | |
| 51 | - | |
| 52 | - @ExcelProperty("用户编号") | |
| 53 | - private Long userId; | |
| 54 | - | |
| 55 | - @ExcelProperty(value = "用户类型", converter = DictConvert.class) | |
| 56 | - @DictFormat(DictTypeConstants.USER_TYPE) | |
| 57 | - private Integer userType; | |
| 58 | - | |
| 59 | - @ExcelProperty(value = "发送状态", converter = DictConvert.class) | |
| 60 | - @DictFormat(DictTypeConstants.SMS_SEND_STATUS) | |
| 61 | - private Integer sendStatus; | |
| 62 | - | |
| 63 | - @ExcelProperty("发送时间") | |
| 64 | - private LocalDateTime sendTime; | |
| 65 | - | |
| 66 | - @ExcelProperty("短信 API 发送结果的编码") | |
| 67 | - private String apiSendCode; | |
| 68 | - | |
| 69 | - @ExcelProperty("短信 API 发送失败的提示") | |
| 70 | - private String apiSendMsg; | |
| 71 | - | |
| 72 | - @ExcelProperty("短信 API 发送返回的唯一请求 ID") | |
| 73 | - private String apiRequestId; | |
| 74 | - | |
| 75 | - @ExcelProperty("短信 API 发送返回的序号") | |
| 76 | - private String apiSerialNo; | |
| 77 | - | |
| 78 | - @ExcelProperty(value = "接收状态", converter = DictConvert.class) | |
| 79 | - @DictFormat(DictTypeConstants.SMS_RECEIVE_STATUS) | |
| 80 | - private Integer receiveStatus; | |
| 81 | - | |
| 82 | - @ExcelProperty("接收时间") | |
| 83 | - private LocalDateTime receiveTime; | |
| 84 | - | |
| 85 | - @ExcelProperty("API 接收结果的编码") | |
| 86 | - private String apiReceiveCode; | |
| 87 | - | |
| 88 | - @ExcelProperty("API 接收结果的说明") | |
| 89 | - private String apiReceiveMsg; | |
| 90 | - | |
| 91 | - @ExcelProperty("创建时间") | |
| 92 | - private LocalDateTime createTime; | |
| 93 | - | |
| 94 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.system.controller.admin.sms.vo.log; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 6 | - | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | - | |
| 9 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 10 | - | |
| 11 | -@Schema(description = "管理后台 - 短信日志 Excel 导出 Request VO,参数和 SmsLogPageReqVO 是一致的") | |
| 12 | -@Data | |
| 13 | -public class SmsLogExportReqVO { | |
| 14 | - | |
| 15 | - @Schema(description = "短信渠道编号", example = "10") | |
| 16 | - private Long channelId; | |
| 17 | - | |
| 18 | - @Schema(description = "模板编号", example = "20") | |
| 19 | - private Long templateId; | |
| 20 | - | |
| 21 | - @Schema(description = "手机号", example = "15601691300") | |
| 22 | - private String mobile; | |
| 23 | - | |
| 24 | - @Schema(description = "发送状态", example = "1") | |
| 25 | - private Integer sendStatus; | |
| 26 | - | |
| 27 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 28 | - @Schema(description = "开始发送时间") | |
| 29 | - private LocalDateTime[] sendTime; | |
| 30 | - | |
| 31 | - @Schema(description = "接收状态", example = "0") | |
| 32 | - private Integer receiveStatus; | |
| 33 | - | |
| 34 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 35 | - @Schema(description = "开始接收时间") | |
| 36 | - private LocalDateTime[] receiveTime; | |
| 37 | - | |
| 38 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogRespVO.java
| 1 | 1 | package cn.iocoder.yudao.module.system.controller.admin.sms.vo.log; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 5 | +import cn.iocoder.yudao.framework.excel.core.convert.JsonConvert; | |
| 6 | +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | |
| 7 | +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | |
| 8 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 3 | 9 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 10 | import lombok.Data; |
| 5 | 11 | |
| ... | ... | @@ -8,75 +14,103 @@ import java.util.Map; |
| 8 | 14 | |
| 9 | 15 | @Schema(description = "管理后台 - 短信日志 Response VO") |
| 10 | 16 | @Data |
| 17 | +@ExcelIgnoreUnannotated | |
| 11 | 18 | public class SmsLogRespVO { |
| 12 | 19 | |
| 13 | 20 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 21 | + @ExcelProperty("编号") | |
| 14 | 22 | private Long id; |
| 15 | 23 | |
| 16 | 24 | @Schema(description = "短信渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") |
| 25 | + @ExcelProperty("短信渠道编号") | |
| 17 | 26 | private Long channelId; |
| 18 | 27 | |
| 19 | 28 | @Schema(description = "短信渠道编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "ALIYUN") |
| 29 | + @ExcelProperty("短信渠道编码") | |
| 20 | 30 | private String channelCode; |
| 21 | 31 | |
| 22 | 32 | @Schema(description = "模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20") |
| 33 | + @ExcelProperty("模板编号") | |
| 23 | 34 | private Long templateId; |
| 24 | 35 | |
| 25 | 36 | @Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "test-01") |
| 37 | + @ExcelProperty("模板编码") | |
| 26 | 38 | private String templateCode; |
| 27 | 39 | |
| 28 | 40 | @Schema(description = "短信类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 41 | + @ExcelProperty(value = "短信类型", converter = DictConvert.class) | |
| 42 | + @DictFormat(DictTypeConstants.SMS_TEMPLATE_TYPE) | |
| 29 | 43 | private Integer templateType; |
| 30 | 44 | |
| 31 | 45 | @Schema(description = "短信内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "你好,你的验证码是 1024") |
| 46 | + @ExcelProperty("短信内容") | |
| 32 | 47 | private String templateContent; |
| 33 | 48 | |
| 34 | 49 | @Schema(description = "短信参数", requiredMode = Schema.RequiredMode.REQUIRED, example = "name,code") |
| 50 | + @ExcelProperty(value = "短信参数", converter = JsonConvert.class) | |
| 35 | 51 | private Map<String, Object> templateParams; |
| 36 | 52 | |
| 37 | 53 | @Schema(description = "短信 API 的模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SMS_207945135") |
| 54 | + @ExcelProperty("短信 API 的模板编号") | |
| 38 | 55 | private String apiTemplateId; |
| 39 | 56 | |
| 40 | 57 | @Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300") |
| 58 | + @ExcelProperty("手机号") | |
| 41 | 59 | private String mobile; |
| 42 | 60 | |
| 43 | 61 | @Schema(description = "用户编号", example = "10") |
| 62 | + @ExcelProperty("用户编号") | |
| 44 | 63 | private Long userId; |
| 45 | 64 | |
| 46 | 65 | @Schema(description = "用户类型", example = "1") |
| 66 | + @ExcelProperty(value = "用户类型", converter = DictConvert.class) | |
| 67 | + @DictFormat(DictTypeConstants.USER_TYPE) | |
| 47 | 68 | private Integer userType; |
| 48 | 69 | |
| 49 | 70 | @Schema(description = "发送状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 71 | + @ExcelProperty(value = "发送状态", converter = DictConvert.class) | |
| 72 | + @DictFormat(DictTypeConstants.SMS_SEND_STATUS) | |
| 50 | 73 | private Integer sendStatus; |
| 51 | 74 | |
| 52 | 75 | @Schema(description = "发送时间") |
| 76 | + @ExcelProperty("发送时间") | |
| 53 | 77 | private LocalDateTime sendTime; |
| 54 | 78 | |
| 55 | 79 | @Schema(description = "短信 API 发送结果的编码", example = "SUCCESS") |
| 80 | + @ExcelProperty("短信 API 发送结果的编码") | |
| 56 | 81 | private String apiSendCode; |
| 57 | 82 | |
| 58 | 83 | @Schema(description = "短信 API 发送失败的提示", example = "成功") |
| 84 | + @ExcelProperty("短信 API 发送失败的提示") | |
| 59 | 85 | private String apiSendMsg; |
| 60 | 86 | |
| 61 | 87 | @Schema(description = "短信 API 发送返回的唯一请求 ID", example = "3837C6D3-B96F-428C-BBB2-86135D4B5B99") |
| 88 | + @ExcelProperty("短信 API 发送返回的唯一请求 ID") | |
| 62 | 89 | private String apiRequestId; |
| 63 | 90 | |
| 64 | 91 | @Schema(description = "短信 API 发送返回的序号", example = "62923244790") |
| 92 | + @ExcelProperty("短信 API 发送返回的序号") | |
| 65 | 93 | private String apiSerialNo; |
| 66 | 94 | |
| 67 | 95 | @Schema(description = "接收状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") |
| 96 | + @ExcelProperty(value = "接收状态", converter = DictConvert.class) | |
| 97 | + @DictFormat(DictTypeConstants.SMS_RECEIVE_STATUS) | |
| 68 | 98 | private Integer receiveStatus; |
| 69 | 99 | |
| 70 | 100 | @Schema(description = "接收时间") |
| 101 | + @ExcelProperty("接收时间") | |
| 71 | 102 | private LocalDateTime receiveTime; |
| 72 | 103 | |
| 73 | 104 | @Schema(description = "API 接收结果的编码", example = "DELIVRD") |
| 105 | + @ExcelProperty("API 接收结果的编码") | |
| 74 | 106 | private String apiReceiveCode; |
| 75 | 107 | |
| 76 | 108 | @Schema(description = "API 接收结果的说明", example = "用户接收成功") |
| 109 | + @ExcelProperty("API 接收结果的说明") | |
| 77 | 110 | private String apiReceiveMsg; |
| 78 | 111 | |
| 79 | 112 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 113 | + @ExcelProperty("创建时间") | |
| 80 | 114 | private LocalDateTime createTime; |
| 81 | 115 | |
| 82 | 116 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.system.controller.admin.sms.vo.template; | |
| 2 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 3 | -import lombok.Data; | |
| 4 | -import lombok.EqualsAndHashCode; | |
| 5 | -import lombok.ToString; | |
| 6 | - | |
| 7 | -@Schema(description = "管理后台 - 短信模板创建 Request VO") | |
| 8 | -@Data | |
| 9 | -@EqualsAndHashCode(callSuper = true) | |
| 10 | -@ToString(callSuper = true) | |
| 11 | -public class SmsTemplateCreateReqVO extends SmsTemplateBaseVO { | |
| 12 | - | |
| 13 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.system.controller.admin.sms.vo.template; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 4 | -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 5 | -import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | |
| 6 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 7 | -import lombok.Data; | |
| 8 | - | |
| 9 | -import java.time.LocalDateTime; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 短信模板 Excel VO | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -@Data | |
| 17 | -public class SmsTemplateExcelVO { | |
| 18 | - | |
| 19 | - @ExcelProperty("编号") | |
| 20 | - private Long id; | |
| 21 | - | |
| 22 | - @ExcelProperty(value = "短信签名", converter = DictConvert.class) | |
| 23 | - @DictFormat(DictTypeConstants.SMS_TEMPLATE_TYPE) | |
| 24 | - private Integer type; | |
| 25 | - | |
| 26 | - @ExcelProperty(value = "开启状态", converter = DictConvert.class) | |
| 27 | - @DictFormat(DictTypeConstants.COMMON_STATUS) | |
| 28 | - private Integer status; | |
| 29 | - | |
| 30 | - @ExcelProperty("模板编码") | |
| 31 | - private String code; | |
| 32 | - | |
| 33 | - @ExcelProperty("模板名称") | |
| 34 | - private String name; | |
| 35 | - | |
| 36 | - @ExcelProperty("模板内容") | |
| 37 | - private String content; | |
| 38 | - | |
| 39 | - @ExcelProperty("备注") | |
| 40 | - private String remark; | |
| 41 | - | |
| 42 | - @ExcelProperty("短信 API 的模板编号") | |
| 43 | - private String apiTemplateId; | |
| 44 | - | |
| 45 | - @ExcelProperty("短信渠道编号") | |
| 46 | - private Long channelId; | |
| 47 | - | |
| 48 | - @ExcelProperty(value = "短信渠道编码", converter = DictConvert.class) | |
| 49 | - @DictFormat(DictTypeConstants.SMS_CHANNEL_CODE) | |
| 50 | - private String channelCode; | |
| 51 | - | |
| 52 | - @ExcelProperty("创建时间") | |
| 53 | - private LocalDateTime createTime; | |
| 54 | - | |
| 55 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.system.controller.admin.sms.vo.template; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 6 | - | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | - | |
| 9 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 10 | - | |
| 11 | -@Schema(description = "管理后台 - 短信模板 Excel 导出 Request VO,参数和 SmsTemplatePageReqVO 是一致的") | |
| 12 | -@Data | |
| 13 | -public class SmsTemplateExportReqVO { | |
| 14 | - | |
| 15 | - @Schema(description = "短信签名", example = "1") | |
| 16 | - private Integer type; | |
| 17 | - | |
| 18 | - @Schema(description = "开启状态", example = "1") | |
| 19 | - private Integer status; | |
| 20 | - | |
| 21 | - @Schema(description = "模板编码,模糊匹配", example = "test_01") | |
| 22 | - private String code; | |
| 23 | - | |
| 24 | - @Schema(description = "模板内容,模糊匹配", example = "你好,{name}。你长的太{like}啦!") | |
| 25 | - private String content; | |
| 26 | - | |
| 27 | - @Schema(description = "短信 API 的模板编号,模糊匹配", example = "4383920") | |
| 28 | - private String apiTemplateId; | |
| 29 | - | |
| 30 | - @Schema(description = "短信渠道编号", example = "10") | |
| 31 | - private Long channelId; | |
| 32 | - | |
| 33 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 34 | - @Schema(description = "创建时间") | |
| 35 | - private LocalDateTime[] createTime; | |
| 36 | - | |
| 37 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateRespVO.java
| 1 | 1 | package cn.iocoder.yudao.module.system.controller.admin.sms.vo.template; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 5 | +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | |
| 6 | +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | |
| 7 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 3 | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 9 | import lombok.Data; |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | -import lombok.ToString; | |
| 7 | 10 | |
| 8 | 11 | import java.time.LocalDateTime; |
| 9 | 12 | import java.util.List; |
| 10 | 13 | |
| 11 | 14 | @Schema(description = "管理后台 - 短信模板 Response VO") |
| 12 | 15 | @Data |
| 13 | -@EqualsAndHashCode(callSuper = true) | |
| 14 | -@ToString(callSuper = true) | |
| 15 | -public class SmsTemplateRespVO extends SmsTemplateBaseVO { | |
| 16 | +@ExcelIgnoreUnannotated | |
| 17 | +public class SmsTemplateRespVO { | |
| 16 | 18 | |
| 17 | 19 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 20 | + @ExcelProperty("编号") | |
| 18 | 21 | private Long id; |
| 19 | 22 | |
| 20 | - @Schema(description = "短信渠道编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "ALIYUN") | |
| 21 | - private String channelCode; | |
| 23 | + @Schema(description = "短信类型,参见 SmsTemplateTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 24 | + @ExcelProperty(value = "短信签名", converter = DictConvert.class) | |
| 25 | + @DictFormat(DictTypeConstants.SMS_TEMPLATE_TYPE) | |
| 26 | + private Integer type; | |
| 27 | + | |
| 28 | + @Schema(description = "开启状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 29 | + @ExcelProperty(value = "开启状态", converter = DictConvert.class) | |
| 30 | + @DictFormat(DictTypeConstants.COMMON_STATUS) | |
| 31 | + private Integer status; | |
| 32 | + | |
| 33 | + @Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "test_01") | |
| 34 | + @ExcelProperty("模板编码") | |
| 35 | + private String code; | |
| 36 | + | |
| 37 | + @Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao") | |
| 38 | + @ExcelProperty("模板名称") | |
| 39 | + private String name; | |
| 40 | + | |
| 41 | + @Schema(description = "模板内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "你好,{name}。你长的太{like}啦!") | |
| 42 | + @ExcelProperty("模板内容") | |
| 43 | + private String content; | |
| 22 | 44 | |
| 23 | 45 | @Schema(description = "参数数组", example = "name,code") |
| 24 | 46 | private List<String> params; |
| 25 | 47 | |
| 48 | + @Schema(description = "备注", example = "哈哈哈") | |
| 49 | + @ExcelProperty("备注") | |
| 50 | + private String remark; | |
| 51 | + | |
| 52 | + @Schema(description = "短信 API 的模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "4383920") | |
| 53 | + @ExcelProperty("短信 API 的模板编号") | |
| 54 | + private String apiTemplateId; | |
| 55 | + | |
| 56 | + @Schema(description = "短信渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | |
| 57 | + @ExcelProperty("短信渠道编号") | |
| 58 | + private Long channelId; | |
| 59 | + | |
| 60 | + @Schema(description = "短信渠道编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "ALIYUN") | |
| 61 | + @ExcelProperty(value = "短信渠道编码", converter = DictConvert.class) | |
| 62 | + @DictFormat(DictTypeConstants.SMS_CHANNEL_CODE) | |
| 63 | + private String channelCode; | |
| 64 | + | |
| 26 | 65 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 66 | + @ExcelProperty("创建时间") | |
| 27 | 67 | private LocalDateTime createTime; |
| 28 | 68 | |
| 29 | 69 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateBaseVO.java renamed to yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateSaveReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.system.controller.admin.sms.vo.template; |
| 2 | + | |
| 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 3 | 4 | import lombok.Data; |
| 4 | 5 | |
| 5 | 6 | import javax.validation.constraints.NotNull; |
| 6 | 7 | |
| 7 | -/** | |
| 8 | -* 短信模板 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 9 | -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 10 | -*/ | |
| 8 | +@Schema(description = "管理后台 - 短信模板创建/修改 Request VO") | |
| 11 | 9 | @Data |
| 12 | -public class SmsTemplateBaseVO { | |
| 10 | +public class SmsTemplateSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "编号", example = "1024") | |
| 13 | + private Long id; | |
| 13 | 14 | |
| 14 | 15 | @Schema(description = "短信类型,参见 SmsTemplateTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 15 | 16 | @NotNull(message = "短信类型不能为空") | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.system.controller.admin.sms.vo.template; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | -import lombok.ToString; | |
| 7 | - | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 9 | - | |
| 10 | -@Schema(description = "管理后台 - 短信模板更新 Request VO") | |
| 11 | -@Data | |
| 12 | -@EqualsAndHashCode(callSuper = true) | |
| 13 | -@ToString(callSuper = true) | |
| 14 | -public class SmsTemplateUpdateReqVO extends SmsTemplateBaseVO { | |
| 15 | - | |
| 16 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 17 | - @NotNull(message = "编号不能为空") | |
| 18 | - private Long id; | |
| 19 | - | |
| 20 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsChannelConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.system.convert.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelCreateReqVO; | |
| 4 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelRespVO; | |
| 5 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSimpleRespVO; | |
| 6 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | -import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties; | |
| 10 | -import org.mapstruct.Mapper; | |
| 11 | -import org.mapstruct.factory.Mappers; | |
| 12 | - | |
| 13 | -import java.util.List; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * 短信渠道 Convert | |
| 17 | - * | |
| 18 | - * @author 芋道源码 | |
| 19 | - */ | |
| 20 | -@Mapper | |
| 21 | -public interface SmsChannelConvert { | |
| 22 | - | |
| 23 | - SmsChannelConvert INSTANCE = Mappers.getMapper(SmsChannelConvert.class); | |
| 24 | - | |
| 25 | - SmsChannelDO convert(SmsChannelCreateReqVO bean); | |
| 26 | - | |
| 27 | - SmsChannelDO convert(SmsChannelUpdateReqVO bean); | |
| 28 | - | |
| 29 | - SmsChannelRespVO convert(SmsChannelDO bean); | |
| 30 | - | |
| 31 | - List<SmsChannelRespVO> convertList(List<SmsChannelDO> list); | |
| 32 | - | |
| 33 | - PageResult<SmsChannelRespVO> convertPage(PageResult<SmsChannelDO> page); | |
| 34 | - | |
| 35 | - List<SmsChannelSimpleRespVO> convertList03(List<SmsChannelDO> list); | |
| 36 | - | |
| 37 | - SmsChannelProperties convert02(SmsChannelDO channel); | |
| 38 | - | |
| 39 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsLogConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.system.convert.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExcelVO; | |
| 4 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogRespVO; | |
| 5 | -import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsLogDO; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | -import org.mapstruct.Mapper; | |
| 8 | -import org.mapstruct.factory.Mappers; | |
| 9 | - | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 短信日志 Convert | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface SmsLogConvert { | |
| 19 | - | |
| 20 | - SmsLogConvert INSTANCE = Mappers.getMapper(SmsLogConvert.class); | |
| 21 | - | |
| 22 | - SmsLogRespVO convert(SmsLogDO bean); | |
| 23 | - | |
| 24 | - List<SmsLogRespVO> convertList(List<SmsLogDO> list); | |
| 25 | - | |
| 26 | - PageResult<SmsLogRespVO> convertPage(PageResult<SmsLogDO> page); | |
| 27 | - | |
| 28 | - List<SmsLogExcelVO> convertList02(List<SmsLogDO> list); | |
| 29 | - | |
| 30 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsTemplateConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.system.convert.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateCreateReqVO; | |
| 4 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateExcelVO; | |
| 5 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateRespVO; | |
| 6 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | -import org.mapstruct.Mapper; | |
| 10 | -import org.mapstruct.factory.Mappers; | |
| 11 | - | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -@Mapper | |
| 15 | -public interface SmsTemplateConvert { | |
| 16 | - | |
| 17 | - SmsTemplateConvert INSTANCE = Mappers.getMapper(SmsTemplateConvert.class); | |
| 18 | - | |
| 19 | - SmsTemplateDO convert(SmsTemplateCreateReqVO bean); | |
| 20 | - | |
| 21 | - SmsTemplateDO convert(SmsTemplateUpdateReqVO bean); | |
| 22 | - | |
| 23 | - SmsTemplateRespVO convert(SmsTemplateDO bean); | |
| 24 | - | |
| 25 | - List<SmsTemplateRespVO> convertList(List<SmsTemplateDO> list); | |
| 26 | - | |
| 27 | - PageResult<SmsTemplateRespVO> convertPage(PageResult<SmsTemplateDO> page); | |
| 28 | - | |
| 29 | - List<SmsTemplateExcelVO> convertList02(List<SmsTemplateDO> list); | |
| 30 | - | |
| 31 | -} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsLogMapper.java
| ... | ... | @@ -3,13 +3,10 @@ package cn.iocoder.yudao.module.system.dal.mysql.sms; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO; | |
| 7 | 6 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; |
| 8 | 7 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsLogDO; |
| 9 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 9 | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | 10 | @Mapper |
| 14 | 11 | public interface SmsLogMapper extends BaseMapperX<SmsLogDO> { |
| 15 | 12 | |
| ... | ... | @@ -25,16 +22,4 @@ public interface SmsLogMapper extends BaseMapperX<SmsLogDO> { |
| 25 | 22 | .orderByDesc(SmsLogDO::getId)); |
| 26 | 23 | } |
| 27 | 24 | |
| 28 | - default List<SmsLogDO> selectList(SmsLogExportReqVO reqVO) { | |
| 29 | - return selectList(new LambdaQueryWrapperX<SmsLogDO>() | |
| 30 | - .eqIfPresent(SmsLogDO::getChannelId, reqVO.getChannelId()) | |
| 31 | - .eqIfPresent(SmsLogDO::getTemplateId, reqVO.getTemplateId()) | |
| 32 | - .likeIfPresent(SmsLogDO::getMobile, reqVO.getMobile()) | |
| 33 | - .eqIfPresent(SmsLogDO::getSendStatus, reqVO.getSendStatus()) | |
| 34 | - .betweenIfPresent(SmsLogDO::getSendTime, reqVO.getSendTime()) | |
| 35 | - .eqIfPresent(SmsLogDO::getReceiveStatus, reqVO.getReceiveStatus()) | |
| 36 | - .betweenIfPresent(SmsLogDO::getReceiveTime, reqVO.getReceiveTime()) | |
| 37 | - .orderByDesc(SmsLogDO::getId)); | |
| 38 | - } | |
| 39 | - | |
| 40 | 25 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsTemplateMapper.java
| ... | ... | @@ -3,13 +3,10 @@ package cn.iocoder.yudao.module.system.dal.mysql.sms; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateExportReqVO; | |
| 7 | 6 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO; |
| 8 | 7 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; |
| 9 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 9 | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | 10 | @Mapper |
| 14 | 11 | public interface SmsTemplateMapper extends BaseMapperX<SmsTemplateDO> { |
| 15 | 12 | |
| ... | ... | @@ -29,18 +26,6 @@ public interface SmsTemplateMapper extends BaseMapperX<SmsTemplateDO> { |
| 29 | 26 | .orderByDesc(SmsTemplateDO::getId)); |
| 30 | 27 | } |
| 31 | 28 | |
| 32 | - default List<SmsTemplateDO> selectList(SmsTemplateExportReqVO reqVO) { | |
| 33 | - return selectList(new LambdaQueryWrapperX<SmsTemplateDO>() | |
| 34 | - .eqIfPresent(SmsTemplateDO::getType, reqVO.getType()) | |
| 35 | - .eqIfPresent(SmsTemplateDO::getStatus, reqVO.getStatus()) | |
| 36 | - .likeIfPresent(SmsTemplateDO::getCode, reqVO.getCode()) | |
| 37 | - .likeIfPresent(SmsTemplateDO::getContent, reqVO.getContent()) | |
| 38 | - .likeIfPresent(SmsTemplateDO::getApiTemplateId, reqVO.getApiTemplateId()) | |
| 39 | - .eqIfPresent(SmsTemplateDO::getChannelId, reqVO.getChannelId()) | |
| 40 | - .betweenIfPresent(SmsTemplateDO::getCreateTime, reqVO.getCreateTime()) | |
| 41 | - .orderByDesc(SmsTemplateDO::getId)); | |
| 42 | - } | |
| 43 | - | |
| 44 | 29 | default Long selectCountByChannelId(Long channelId) { |
| 45 | 30 | return selectCount(SmsTemplateDO::getChannelId, channelId); |
| 46 | 31 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelService.java
| ... | ... | @@ -2,9 +2,8 @@ package cn.iocoder.yudao.module.system.service.sms; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.sms.core.client.SmsClient; |
| 5 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelCreateReqVO; | |
| 6 | 5 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; |
| 7 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelUpdateReqVO; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSaveReqVO; | |
| 8 | 7 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; |
| 9 | 8 | |
| 10 | 9 | import javax.validation.Valid; |
| ... | ... | @@ -24,14 +23,14 @@ public interface SmsChannelService { |
| 24 | 23 | * @param createReqVO 创建信息 |
| 25 | 24 | * @return 编号 |
| 26 | 25 | */ |
| 27 | - Long createSmsChannel(@Valid SmsChannelCreateReqVO createReqVO); | |
| 26 | + Long createSmsChannel(@Valid SmsChannelSaveReqVO createReqVO); | |
| 28 | 27 | |
| 29 | 28 | /** |
| 30 | 29 | * 更新短信渠道 |
| 31 | 30 | * |
| 32 | 31 | * @param updateReqVO 更新信息 |
| 33 | 32 | */ |
| 34 | - void updateSmsChannel(@Valid SmsChannelUpdateReqVO updateReqVO); | |
| 33 | + void updateSmsChannel(@Valid SmsChannelSaveReqVO updateReqVO); | |
| 35 | 34 | |
| 36 | 35 | /** |
| 37 | 36 | * 删除短信渠道 | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceImpl.java
| ... | ... | @@ -2,13 +2,12 @@ package cn.iocoder.yudao.module.system.service.sms; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 5 | 6 | import cn.iocoder.yudao.framework.sms.core.client.SmsClient; |
| 6 | 7 | import cn.iocoder.yudao.framework.sms.core.client.SmsClientFactory; |
| 7 | 8 | import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties; |
| 8 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelCreateReqVO; | |
| 9 | 9 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; |
| 10 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelUpdateReqVO; | |
| 11 | -import cn.iocoder.yudao.module.system.convert.sms.SmsChannelConvert; | |
| 10 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSaveReqVO; | |
| 12 | 11 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; |
| 13 | 12 | import cn.iocoder.yudao.module.system.dal.mysql.sms.SmsChannelMapper; |
| 14 | 13 | import com.google.common.cache.CacheLoader; |
| ... | ... | @@ -47,7 +46,7 @@ public class SmsChannelServiceImpl implements SmsChannelService { |
| 47 | 46 | // 查询,然后尝试刷新 |
| 48 | 47 | SmsChannelDO channel = smsChannelMapper.selectById(id); |
| 49 | 48 | if (channel != null) { |
| 50 | - SmsChannelProperties properties = SmsChannelConvert.INSTANCE.convert02(channel); | |
| 49 | + SmsChannelProperties properties = BeanUtils.toBean(channel, SmsChannelProperties.class); | |
| 51 | 50 | smsClientFactory.createOrUpdateSmsClient(properties); |
| 52 | 51 | } |
| 53 | 52 | return smsClientFactory.getSmsClient(id); |
| ... | ... | @@ -67,7 +66,7 @@ public class SmsChannelServiceImpl implements SmsChannelService { |
| 67 | 66 | // 查询,然后尝试刷新 |
| 68 | 67 | SmsChannelDO channel = smsChannelMapper.selectByCode(code); |
| 69 | 68 | if (channel != null) { |
| 70 | - SmsChannelProperties properties = SmsChannelConvert.INSTANCE.convert02(channel); | |
| 69 | + SmsChannelProperties properties = BeanUtils.toBean(channel, SmsChannelProperties.class); | |
| 71 | 70 | smsClientFactory.createOrUpdateSmsClient(properties); |
| 72 | 71 | } |
| 73 | 72 | return smsClientFactory.getSmsClient(code); |
| ... | ... | @@ -85,18 +84,18 @@ public class SmsChannelServiceImpl implements SmsChannelService { |
| 85 | 84 | private SmsTemplateService smsTemplateService; |
| 86 | 85 | |
| 87 | 86 | @Override |
| 88 | - public Long createSmsChannel(SmsChannelCreateReqVO createReqVO) { | |
| 89 | - SmsChannelDO channel = SmsChannelConvert.INSTANCE.convert(createReqVO); | |
| 87 | + public Long createSmsChannel(SmsChannelSaveReqVO createReqVO) { | |
| 88 | + SmsChannelDO channel = BeanUtils.toBean(createReqVO, SmsChannelDO.class); | |
| 90 | 89 | smsChannelMapper.insert(channel); |
| 91 | 90 | return channel.getId(); |
| 92 | 91 | } |
| 93 | 92 | |
| 94 | 93 | @Override |
| 95 | - public void updateSmsChannel(SmsChannelUpdateReqVO updateReqVO) { | |
| 94 | + public void updateSmsChannel(SmsChannelSaveReqVO updateReqVO) { | |
| 96 | 95 | // 校验存在 |
| 97 | 96 | SmsChannelDO channel = validateSmsChannelExists(updateReqVO.getId()); |
| 98 | 97 | // 更新 |
| 99 | - SmsChannelDO updateObj = SmsChannelConvert.INSTANCE.convert(updateReqVO); | |
| 98 | + SmsChannelDO updateObj = BeanUtils.toBean(updateReqVO, SmsChannelDO.class); | |
| 100 | 99 | smsChannelMapper.updateById(updateObj); |
| 101 | 100 | |
| 102 | 101 | // 清空缓存 |
| ... | ... | @@ -108,7 +107,7 @@ public class SmsChannelServiceImpl implements SmsChannelService { |
| 108 | 107 | // 校验存在 |
| 109 | 108 | SmsChannelDO channel = validateSmsChannelExists(id); |
| 110 | 109 | // 校验是否有在使用该账号的模版 |
| 111 | - if (smsTemplateService.countByChannelId(id) > 0) { | |
| 110 | + if (smsTemplateService.getSmsTemplateCountByChannelId(id) > 0) { | |
| 112 | 111 | throw exception(SMS_CHANNEL_HAS_CHILDREN); |
| 113 | 112 | } |
| 114 | 113 | // 删除 | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsLogService.java
| 1 | 1 | package cn.iocoder.yudao.module.system.service.sms; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO; | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | 4 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsLogDO; |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | 6 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; |
| 8 | 7 | |
| 9 | 8 | import java.time.LocalDateTime; |
| 10 | -import java.util.List; | |
| 11 | 9 | import java.util.Map; |
| 12 | 10 | |
| 13 | 11 | /** |
| ... | ... | @@ -67,12 +65,4 @@ public interface SmsLogService { |
| 67 | 65 | */ |
| 68 | 66 | PageResult<SmsLogDO> getSmsLogPage(SmsLogPageReqVO pageReqVO); |
| 69 | 67 | |
| 70 | - /** | |
| 71 | - * 获得短信日志列表, 用于 Excel 导出 | |
| 72 | - * | |
| 73 | - * @param exportReqVO 查询条件 | |
| 74 | - * @return 短信日志列表 | |
| 75 | - */ | |
| 76 | - List<SmsLogDO> getSmsLogList(SmsLogExportReqVO exportReqVO); | |
| 77 | - | |
| 78 | 68 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.system.service.sms; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO; | |
| 5 | 4 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; |
| 6 | 5 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsLogDO; |
| 7 | 6 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; |
| ... | ... | @@ -13,7 +12,6 @@ import org.springframework.stereotype.Service; |
| 13 | 12 | |
| 14 | 13 | import javax.annotation.Resource; |
| 15 | 14 | import java.time.LocalDateTime; |
| 16 | -import java.util.List; | |
| 17 | 15 | import java.util.Map; |
| 18 | 16 | import java.util.Objects; |
| 19 | 17 | |
| ... | ... | @@ -78,9 +76,4 @@ public class SmsLogServiceImpl implements SmsLogService { |
| 78 | 76 | return smsLogMapper.selectPage(pageReqVO); |
| 79 | 77 | } |
| 80 | 78 | |
| 81 | - @Override | |
| 82 | - public List<SmsLogDO> getSmsLogList(SmsLogExportReqVO exportReqVO) { | |
| 83 | - return smsLogMapper.selectList(exportReqVO); | |
| 84 | - } | |
| 85 | - | |
| 86 | 79 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateService.java
| 1 | 1 | package cn.iocoder.yudao.module.system.service.sms; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateCreateReqVO; | |
| 4 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateExportReqVO; | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | 4 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO; |
| 6 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateUpdateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSaveReqVO; | |
| 7 | 6 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | 7 | |
| 10 | 8 | import javax.validation.Valid; |
| 11 | -import java.util.List; | |
| 12 | 9 | import java.util.Map; |
| 13 | 10 | |
| 14 | 11 | /** |
| ... | ... | @@ -25,14 +22,14 @@ public interface SmsTemplateService { |
| 25 | 22 | * @param createReqVO 创建信息 |
| 26 | 23 | * @return 编号 |
| 27 | 24 | */ |
| 28 | - Long createSmsTemplate(@Valid SmsTemplateCreateReqVO createReqVO); | |
| 25 | + Long createSmsTemplate(@Valid SmsTemplateSaveReqVO createReqVO); | |
| 29 | 26 | |
| 30 | 27 | /** |
| 31 | 28 | * 更新短信模板 |
| 32 | 29 | * |
| 33 | 30 | * @param updateReqVO 更新信息 |
| 34 | 31 | */ |
| 35 | - void updateSmsTemplate(@Valid SmsTemplateUpdateReqVO updateReqVO); | |
| 32 | + void updateSmsTemplate(@Valid SmsTemplateSaveReqVO updateReqVO); | |
| 36 | 33 | |
| 37 | 34 | /** |
| 38 | 35 | * 删除短信模板 |
| ... | ... | @@ -66,21 +63,12 @@ public interface SmsTemplateService { |
| 66 | 63 | PageResult<SmsTemplateDO> getSmsTemplatePage(SmsTemplatePageReqVO pageReqVO); |
| 67 | 64 | |
| 68 | 65 | /** |
| 69 | - * 获得短信模板列表, 用于 Excel 导出 | |
| 70 | - * | |
| 71 | - * @param exportReqVO 查询条件 | |
| 72 | - * @return 短信模板分页 | |
| 73 | - */ | |
| 74 | - List<SmsTemplateDO> getSmsTemplateList(SmsTemplateExportReqVO exportReqVO); | |
| 75 | - | |
| 76 | - /** | |
| 77 | 66 | * 获得指定短信渠道下的短信模板数量 |
| 78 | 67 | * |
| 79 | 68 | * @param channelId 短信渠道编号 |
| 80 | 69 | * @return 数量 |
| 81 | 70 | */ |
| 82 | - Long countByChannelId(Long channelId); | |
| 83 | - | |
| 71 | + Long getSmsTemplateCountByChannelId(Long channelId); | |
| 84 | 72 | |
| 85 | 73 | /** |
| 86 | 74 | * 格式化短信内容 | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceImpl.java
| ... | ... | @@ -6,14 +6,12 @@ import cn.hutool.core.util.ReUtil; |
| 6 | 6 | import cn.hutool.core.util.StrUtil; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 9 | 10 | import cn.iocoder.yudao.framework.sms.core.client.SmsClient; |
| 10 | 11 | import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO; |
| 11 | 12 | import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum; |
| 12 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateCreateReqVO; | |
| 13 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateExportReqVO; | |
| 14 | 13 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO; |
| 15 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateUpdateReqVO; | |
| 16 | -import cn.iocoder.yudao.module.system.convert.sms.SmsTemplateConvert; | |
| 14 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSaveReqVO; | |
| 17 | 15 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; |
| 18 | 16 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; |
| 19 | 17 | import cn.iocoder.yudao.module.system.dal.mysql.sms.SmsTemplateMapper; |
| ... | ... | @@ -55,7 +53,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService { |
| 55 | 53 | private SmsChannelService smsChannelService; |
| 56 | 54 | |
| 57 | 55 | @Override |
| 58 | - public Long createSmsTemplate(SmsTemplateCreateReqVO createReqVO) { | |
| 56 | + public Long createSmsTemplate(SmsTemplateSaveReqVO createReqVO) { | |
| 59 | 57 | // 校验短信渠道 |
| 60 | 58 | SmsChannelDO channelDO = validateSmsChannel(createReqVO.getChannelId()); |
| 61 | 59 | // 校验短信编码是否重复 |
| ... | ... | @@ -64,7 +62,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService { |
| 64 | 62 | validateApiTemplate(createReqVO.getChannelId(), createReqVO.getApiTemplateId()); |
| 65 | 63 | |
| 66 | 64 | // 插入 |
| 67 | - SmsTemplateDO template = SmsTemplateConvert.INSTANCE.convert(createReqVO); | |
| 65 | + SmsTemplateDO template = BeanUtils.toBean(createReqVO, SmsTemplateDO.class); | |
| 68 | 66 | template.setParams(parseTemplateContentParams(template.getContent())); |
| 69 | 67 | template.setChannelCode(channelDO.getCode()); |
| 70 | 68 | smsTemplateMapper.insert(template); |
| ... | ... | @@ -75,7 +73,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService { |
| 75 | 73 | @Override |
| 76 | 74 | @CacheEvict(cacheNames = RedisKeyConstants.SMS_TEMPLATE, |
| 77 | 75 | allEntries = true) // allEntries 清空所有缓存,因为可能修改到 code 字段,不好清理 |
| 78 | - public void updateSmsTemplate(SmsTemplateUpdateReqVO updateReqVO) { | |
| 76 | + public void updateSmsTemplate(SmsTemplateSaveReqVO updateReqVO) { | |
| 79 | 77 | // 校验存在 |
| 80 | 78 | validateSmsTemplateExists(updateReqVO.getId()); |
| 81 | 79 | // 校验短信渠道 |
| ... | ... | @@ -86,7 +84,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService { |
| 86 | 84 | validateApiTemplate(updateReqVO.getChannelId(), updateReqVO.getApiTemplateId()); |
| 87 | 85 | |
| 88 | 86 | // 更新 |
| 89 | - SmsTemplateDO updateObj = SmsTemplateConvert.INSTANCE.convert(updateReqVO); | |
| 87 | + SmsTemplateDO updateObj = BeanUtils.toBean(updateReqVO, SmsTemplateDO.class); | |
| 90 | 88 | updateObj.setParams(parseTemplateContentParams(updateObj.getContent())); |
| 91 | 89 | updateObj.setChannelCode(channelDO.getCode()); |
| 92 | 90 | smsTemplateMapper.updateById(updateObj); |
| ... | ... | @@ -126,12 +124,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService { |
| 126 | 124 | } |
| 127 | 125 | |
| 128 | 126 | @Override |
| 129 | - public List<SmsTemplateDO> getSmsTemplateList(SmsTemplateExportReqVO exportReqVO) { | |
| 130 | - return smsTemplateMapper.selectList(exportReqVO); | |
| 131 | - } | |
| 132 | - | |
| 133 | - @Override | |
| 134 | - public Long countByChannelId(Long channelId) { | |
| 127 | + public Long getSmsTemplateCountByChannelId(Long channelId) { | |
| 135 | 128 | return smsTemplateMapper.selectCountByChannelId(channelId); |
| 136 | 129 | } |
| 137 | 130 | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceTest.java
| ... | ... | @@ -2,14 +2,13 @@ package cn.iocoder.yudao.module.system.service.sms; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 5 | 6 | import cn.iocoder.yudao.framework.sms.core.client.SmsClient; |
| 6 | 7 | import cn.iocoder.yudao.framework.sms.core.client.SmsClientFactory; |
| 7 | 8 | import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties; |
| 8 | 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 9 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelCreateReqVO; | |
| 10 | 10 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; |
| 11 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelUpdateReqVO; | |
| 12 | -import cn.iocoder.yudao.module.system.convert.sms.SmsChannelConvert; | |
| 11 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSaveReqVO; | |
| 13 | 12 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; |
| 14 | 13 | import cn.iocoder.yudao.module.system.dal.mysql.sms.SmsChannelMapper; |
| 15 | 14 | import org.junit.jupiter.api.Test; |
| ... | ... | @@ -48,7 +47,8 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { |
| 48 | 47 | @Test |
| 49 | 48 | public void testCreateSmsChannel_success() { |
| 50 | 49 | // 准备参数 |
| 51 | - SmsChannelCreateReqVO reqVO = randomPojo(SmsChannelCreateReqVO.class, o -> o.setStatus(randomCommonStatus())); | |
| 50 | + SmsChannelSaveReqVO reqVO = randomPojo(SmsChannelSaveReqVO.class, o -> o.setStatus(randomCommonStatus())) | |
| 51 | + .setId(null); // 防止 id 被赋值 | |
| 52 | 52 | |
| 53 | 53 | // 调用 |
| 54 | 54 | Long smsChannelId = smsChannelService.createSmsChannel(reqVO); |
| ... | ... | @@ -56,7 +56,7 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { |
| 56 | 56 | assertNotNull(smsChannelId); |
| 57 | 57 | // 校验记录的属性是否正确 |
| 58 | 58 | SmsChannelDO smsChannel = smsChannelMapper.selectById(smsChannelId); |
| 59 | - assertPojoEquals(reqVO, smsChannel); | |
| 59 | + assertPojoEquals(reqVO, smsChannel, "id"); | |
| 60 | 60 | // 断言 cache |
| 61 | 61 | assertNull(smsChannelService.getIdClientCache().getIfPresent(smsChannel.getId())); |
| 62 | 62 | assertNull(smsChannelService.getCodeClientCache().getIfPresent(smsChannel.getCode())); |
| ... | ... | @@ -68,7 +68,7 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { |
| 68 | 68 | SmsChannelDO dbSmsChannel = randomPojo(SmsChannelDO.class); |
| 69 | 69 | smsChannelMapper.insert(dbSmsChannel);// @Sql: 先插入出一条存在的数据 |
| 70 | 70 | // 准备参数 |
| 71 | - SmsChannelUpdateReqVO reqVO = randomPojo(SmsChannelUpdateReqVO.class, o -> { | |
| 71 | + SmsChannelSaveReqVO reqVO = randomPojo(SmsChannelSaveReqVO.class, o -> { | |
| 72 | 72 | o.setId(dbSmsChannel.getId()); // 设置更新的 ID |
| 73 | 73 | o.setStatus(randomCommonStatus()); |
| 74 | 74 | o.setCallbackUrl(randomString()); |
| ... | ... | @@ -87,7 +87,7 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { |
| 87 | 87 | @Test |
| 88 | 88 | public void testUpdateSmsChannel_notExists() { |
| 89 | 89 | // 准备参数 |
| 90 | - SmsChannelUpdateReqVO reqVO = randomPojo(SmsChannelUpdateReqVO.class); | |
| 90 | + SmsChannelSaveReqVO reqVO = randomPojo(SmsChannelSaveReqVO.class); | |
| 91 | 91 | |
| 92 | 92 | // 调用, 并断言异常 |
| 93 | 93 | assertServiceException(() -> smsChannelService.updateSmsChannel(reqVO), SMS_CHANNEL_NOT_EXISTS); |
| ... | ... | @@ -127,7 +127,7 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { |
| 127 | 127 | // 准备参数 |
| 128 | 128 | Long id = dbSmsChannel.getId(); |
| 129 | 129 | // mock 方法 |
| 130 | - when(smsTemplateService.countByChannelId(eq(id))).thenReturn(10L); | |
| 130 | + when(smsTemplateService.getSmsTemplateCountByChannelId(eq(id))).thenReturn(10L); | |
| 131 | 131 | |
| 132 | 132 | // 调用, 并断言异常 |
| 133 | 133 | assertServiceException(() -> smsChannelService.deleteSmsChannel(id), SMS_CHANNEL_HAS_CHILDREN); |
| ... | ... | @@ -207,7 +207,7 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { |
| 207 | 207 | // 断言 |
| 208 | 208 | assertSame(client, mockClient); |
| 209 | 209 | verify(smsClientFactory).createOrUpdateSmsClient(argThat(arg -> { |
| 210 | - SmsChannelProperties properties = SmsChannelConvert.INSTANCE.convert02(channel); | |
| 210 | + SmsChannelProperties properties = BeanUtils.toBean(channel, SmsChannelProperties.class); | |
| 211 | 211 | return properties.equals(arg); |
| 212 | 212 | })); |
| 213 | 213 | } |
| ... | ... | @@ -228,7 +228,7 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { |
| 228 | 228 | // 断言 |
| 229 | 229 | assertSame(client, mockClient); |
| 230 | 230 | verify(smsClientFactory).createOrUpdateSmsClient(argThat(arg -> { |
| 231 | - SmsChannelProperties properties = SmsChannelConvert.INSTANCE.convert02(channel); | |
| 231 | + SmsChannelProperties properties = BeanUtils.toBean(channel, SmsChannelProperties.class); | |
| 232 | 232 | return properties.equals(arg); |
| 233 | 233 | })); |
| 234 | 234 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceImplTest.java
| ... | ... | @@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; |
| 7 | 7 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 8 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO; | |
| 9 | 8 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; |
| 10 | 9 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsLogDO; |
| 11 | 10 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; |
| ... | ... | @@ -18,7 +17,6 @@ import org.springframework.context.annotation.Import; |
| 18 | 17 | |
| 19 | 18 | import javax.annotation.Resource; |
| 20 | 19 | import java.time.LocalDateTime; |
| 21 | -import java.util.List; | |
| 22 | 20 | import java.util.Map; |
| 23 | 21 | import java.util.function.Consumer; |
| 24 | 22 | |
| ... | ... | @@ -87,50 +85,6 @@ public class SmsLogServiceImplTest extends BaseDbUnitTest { |
| 87 | 85 | } |
| 88 | 86 | |
| 89 | 87 | @Test |
| 90 | - public void testGetSmsLogList() { | |
| 91 | - // mock 数据 | |
| 92 | - SmsLogDO dbSmsLog = randomSmsLogDO(o -> { // 等会查询到 | |
| 93 | - o.setChannelId(1L); | |
| 94 | - o.setTemplateId(10L); | |
| 95 | - o.setMobile("15601691300"); | |
| 96 | - o.setSendStatus(SmsSendStatusEnum.INIT.getStatus()); | |
| 97 | - o.setSendTime(buildTime(2020, 11, 11)); | |
| 98 | - o.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus()); | |
| 99 | - o.setReceiveTime(buildTime(2021, 11, 11)); | |
| 100 | - }); | |
| 101 | - smsLogMapper.insert(dbSmsLog); | |
| 102 | - // 测试 channelId 不匹配 | |
| 103 | - smsLogMapper.insert(cloneIgnoreId(dbSmsLog, o -> o.setChannelId(2L))); | |
| 104 | - // 测试 templateId 不匹配 | |
| 105 | - smsLogMapper.insert(cloneIgnoreId(dbSmsLog, o -> o.setTemplateId(20L))); | |
| 106 | - // 测试 mobile 不匹配 | |
| 107 | - smsLogMapper.insert(cloneIgnoreId(dbSmsLog, o -> o.setMobile("18818260999"))); | |
| 108 | - // 测试 sendStatus 不匹配 | |
| 109 | - smsLogMapper.insert(cloneIgnoreId(dbSmsLog, o -> o.setSendStatus(SmsSendStatusEnum.IGNORE.getStatus()))); | |
| 110 | - // 测试 sendTime 不匹配 | |
| 111 | - smsLogMapper.insert(cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildTime(2020, 12, 12)))); | |
| 112 | - // 测试 receiveStatus 不匹配 | |
| 113 | - smsLogMapper.insert(cloneIgnoreId(dbSmsLog, o -> o.setReceiveStatus(SmsReceiveStatusEnum.SUCCESS.getStatus()))); | |
| 114 | - // 测试 receiveTime 不匹配 | |
| 115 | - smsLogMapper.insert(cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildTime(2021, 12, 12)))); | |
| 116 | - // 准备参数 | |
| 117 | - SmsLogExportReqVO reqVO = new SmsLogExportReqVO(); | |
| 118 | - reqVO.setChannelId(1L); | |
| 119 | - reqVO.setTemplateId(10L); | |
| 120 | - reqVO.setMobile("156"); | |
| 121 | - reqVO.setSendStatus(SmsSendStatusEnum.INIT.getStatus()); | |
| 122 | - reqVO.setSendTime(buildBetweenTime(2020, 11, 1, 2020, 11, 30)); | |
| 123 | - reqVO.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus()); | |
| 124 | - reqVO.setReceiveTime(buildBetweenTime(2021, 11, 1, 2021, 11, 30)); | |
| 125 | - | |
| 126 | - // 调用 | |
| 127 | - List<SmsLogDO> list = smsLogService.getSmsLogList(reqVO); | |
| 128 | - // 断言 | |
| 129 | - assertEquals(1, list.size()); | |
| 130 | - assertPojoEquals(dbSmsLog, list.get(0)); | |
| 131 | - } | |
| 132 | - | |
| 133 | - @Test | |
| 134 | 88 | public void testCreateSmsLog() { |
| 135 | 89 | // 准备参数 |
| 136 | 90 | String mobile = randomString(); | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceImplTest.java
| ... | ... | @@ -8,10 +8,8 @@ import cn.iocoder.yudao.framework.sms.core.client.SmsClient; |
| 8 | 8 | import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO; |
| 9 | 9 | import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum; |
| 10 | 10 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 11 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateCreateReqVO; | |
| 12 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateExportReqVO; | |
| 11 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSaveReqVO; | |
| 13 | 12 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO; |
| 14 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateUpdateReqVO; | |
| 15 | 13 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; |
| 16 | 14 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; |
| 17 | 15 | import cn.iocoder.yudao.module.system.dal.mysql.sms.SmsTemplateMapper; |
| ... | ... | @@ -66,11 +64,11 @@ public class SmsTemplateServiceImplTest extends BaseDbUnitTest { |
| 66 | 64 | @SuppressWarnings("unchecked") |
| 67 | 65 | public void testCreateSmsTemplate_success() throws Throwable { |
| 68 | 66 | // 准备参数 |
| 69 | - SmsTemplateCreateReqVO reqVO = randomPojo(SmsTemplateCreateReqVO.class, o -> { | |
| 67 | + SmsTemplateSaveReqVO reqVO = randomPojo(SmsTemplateSaveReqVO.class, o -> { | |
| 70 | 68 | o.setContent("正在进行登录操作{operation},您的验证码是{code}"); |
| 71 | 69 | o.setStatus(randomEle(CommonStatusEnum.values()).getStatus()); // 保证 status 的范围 |
| 72 | 70 | o.setType(randomEle(SmsTemplateTypeEnum.values()).getType()); // 保证 type 的 范围 |
| 73 | - }); | |
| 71 | + }).setId(null); // 防止 id 被赋值 | |
| 74 | 72 | // mock Channel 的方法 |
| 75 | 73 | SmsChannelDO channelDO = randomPojo(SmsChannelDO.class, o -> { |
| 76 | 74 | o.setId(reqVO.getChannelId()); |
| ... | ... | @@ -88,7 +86,7 @@ public class SmsTemplateServiceImplTest extends BaseDbUnitTest { |
| 88 | 86 | assertNotNull(smsTemplateId); |
| 89 | 87 | // 校验记录的属性是否正确 |
| 90 | 88 | SmsTemplateDO smsTemplate = smsTemplateMapper.selectById(smsTemplateId); |
| 91 | - assertPojoEquals(reqVO, smsTemplate); | |
| 89 | + assertPojoEquals(reqVO, smsTemplate, "id"); | |
| 92 | 90 | assertEquals(Lists.newArrayList("operation", "code"), smsTemplate.getParams()); |
| 93 | 91 | assertEquals(channelDO.getCode(), smsTemplate.getChannelCode()); |
| 94 | 92 | } |
| ... | ... | @@ -100,7 +98,7 @@ public class SmsTemplateServiceImplTest extends BaseDbUnitTest { |
| 100 | 98 | SmsTemplateDO dbSmsTemplate = randomSmsTemplateDO(); |
| 101 | 99 | smsTemplateMapper.insert(dbSmsTemplate);// @Sql: 先插入出一条存在的数据 |
| 102 | 100 | // 准备参数 |
| 103 | - SmsTemplateUpdateReqVO reqVO = randomPojo(SmsTemplateUpdateReqVO.class, o -> { | |
| 101 | + SmsTemplateSaveReqVO reqVO = randomPojo(SmsTemplateSaveReqVO.class, o -> { | |
| 104 | 102 | o.setId(dbSmsTemplate.getId()); // 设置更新的 ID |
| 105 | 103 | o.setContent("正在进行登录操作{operation},您的验证码是{code}"); |
| 106 | 104 | o.setStatus(randomEle(CommonStatusEnum.values()).getStatus()); // 保证 status 的范围 |
| ... | ... | @@ -129,7 +127,7 @@ public class SmsTemplateServiceImplTest extends BaseDbUnitTest { |
| 129 | 127 | @Test |
| 130 | 128 | public void testUpdateSmsTemplate_notExists() { |
| 131 | 129 | // 准备参数 |
| 132 | - SmsTemplateUpdateReqVO reqVO = randomPojo(SmsTemplateUpdateReqVO.class); | |
| 130 | + SmsTemplateSaveReqVO reqVO = randomPojo(SmsTemplateSaveReqVO.class); | |
| 133 | 131 | |
| 134 | 132 | // 调用, 并断言异常 |
| 135 | 133 | assertServiceException(() -> smsTemplateService.updateSmsTemplate(reqVO), SMS_TEMPLATE_NOT_EXISTS); |
| ... | ... | @@ -204,50 +202,6 @@ public class SmsTemplateServiceImplTest extends BaseDbUnitTest { |
| 204 | 202 | } |
| 205 | 203 | |
| 206 | 204 | @Test |
| 207 | - public void testGetSmsTemplateList() { | |
| 208 | - // mock 数据 | |
| 209 | - SmsTemplateDO dbSmsTemplate = randomPojo(SmsTemplateDO.class, o -> { // 等会查询到 | |
| 210 | - o.setType(SmsTemplateTypeEnum.PROMOTION.getType()); | |
| 211 | - o.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 212 | - o.setCode("tudou"); | |
| 213 | - o.setContent("芋道源码"); | |
| 214 | - o.setApiTemplateId("yunai"); | |
| 215 | - o.setChannelId(1L); | |
| 216 | - o.setCreateTime(buildTime(2021, 11, 11)); | |
| 217 | - }); | |
| 218 | - smsTemplateMapper.insert(dbSmsTemplate); | |
| 219 | - // 测试 type 不匹配 | |
| 220 | - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setType(SmsTemplateTypeEnum.VERIFICATION_CODE.getType()))); | |
| 221 | - // 测试 status 不匹配 | |
| 222 | - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); | |
| 223 | - // 测试 code 不匹配 | |
| 224 | - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCode("yuanma"))); | |
| 225 | - // 测试 content 不匹配 | |
| 226 | - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setContent("源码"))); | |
| 227 | - // 测试 apiTemplateId 不匹配 | |
| 228 | - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setApiTemplateId("nai"))); | |
| 229 | - // 测试 channelId 不匹配 | |
| 230 | - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setChannelId(2L))); | |
| 231 | - // 测试 createTime 不匹配 | |
| 232 | - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildTime(2021, 12, 12)))); | |
| 233 | - // 准备参数 | |
| 234 | - SmsTemplateExportReqVO reqVO = new SmsTemplateExportReqVO(); | |
| 235 | - reqVO.setType(SmsTemplateTypeEnum.PROMOTION.getType()); | |
| 236 | - reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 237 | - reqVO.setCode("tu"); | |
| 238 | - reqVO.setContent("芋道"); | |
| 239 | - reqVO.setApiTemplateId("yu"); | |
| 240 | - reqVO.setChannelId(1L); | |
| 241 | - reqVO.setCreateTime(buildBetweenTime(2021, 11, 1, 2021, 12, 1)); | |
| 242 | - | |
| 243 | - // 调用 | |
| 244 | - List<SmsTemplateDO> list = smsTemplateService.getSmsTemplateList(reqVO); | |
| 245 | - // 断言 | |
| 246 | - assertEquals(1, list.size()); | |
| 247 | - assertPojoEquals(dbSmsTemplate, list.get(0)); | |
| 248 | - } | |
| 249 | - | |
| 250 | - @Test | |
| 251 | 205 | public void testValidateSmsChannel_success() { |
| 252 | 206 | // 准备参数 |
| 253 | 207 | Long channelId = randomLongId(); | ... | ... |