diff --git a/system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/SmsSignController.java b/system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/SmsSignController.java index 5b489ea6e..49e367caa 100644 --- a/system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/SmsSignController.java +++ b/system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/SmsSignController.java @@ -1,14 +1,14 @@ package cn.iocoder.mall.admin.application.controller.admins; +import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.mall.admin.api.SmsService; +import cn.iocoder.mall.admin.api.bo.sms.PageSmsSignBO; import cn.iocoder.mall.admin.api.dto.sms.PageQuerySmsSignDTO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; /** * 短信服务 @@ -17,37 +17,40 @@ import org.springframework.web.bind.annotation.RestController; * @time 2019/5/26 12:26 PM */ @RestController -@RequestMapping("sms/sign") +@RequestMapping("admins/sms/sign") @Api("短信服务(签名)") public class SmsSignController { @Autowired private SmsService smsService; - @PostMapping("page") + @GetMapping("page") @ApiOperation("签名-page") - public void pageSign(PageQuerySmsSignDTO querySmsSignDTO) { - smsService.pageSmsSign(querySmsSignDTO); + public CommonResult pageSign(@Validated PageQuerySmsSignDTO querySmsSignDTO) { + return CommonResult.success(smsService.pageSmsSign(querySmsSignDTO)); } @PostMapping("add") @ApiOperation("签名-添加") - public void addSign(@RequestParam("sign") String sign, + public CommonResult addSign(@RequestParam("sign") String sign, @RequestParam("platform") Integer platform) { smsService.addSign(sign, platform); + return CommonResult.success(null); } - @PostMapping("update") + @PutMapping("update") @ApiOperation("签名-更新") - public void updateSign(@RequestParam("id") Integer id, - @RequestParam("sign") String sign, - @RequestParam("platform") Integer platform) { + public CommonResult updateSign(@RequestParam("id") Integer id, + @RequestParam("sign") String sign, + @RequestParam("platform") Integer platform) { smsService.updateSign(id, sign, platform); + return CommonResult.success(null); } - @PostMapping("deleted") + @DeleteMapping("deleted") @ApiOperation("签名-删除") - public void deletedSign(@RequestParam("id") Integer id) { + public CommonResult deletedSign(@RequestParam("id") Integer id) { smsService.deleteSign(id); + return CommonResult.success(null); } } diff --git a/system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/SmsTemplateController.java b/system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/SmsTemplateController.java index e2b1625b1..8166ba586 100644 --- a/system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/SmsTemplateController.java +++ b/system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/SmsTemplateController.java @@ -1,6 +1,7 @@ package cn.iocoder.mall.admin.application.controller.admins; import cn.iocoder.mall.admin.api.SmsService; +import cn.iocoder.mall.admin.api.bo.sms.PageSmsTemplateBO; import cn.iocoder.mall.admin.api.dto.sms.PageQuerySmsSignDTO; import cn.iocoder.mall.admin.api.dto.sms.PageQuerySmsTemplateDTO; import cn.iocoder.mall.admin.application.po.sms.SmsTemplateAddPO; @@ -29,8 +30,8 @@ public class SmsTemplateController { @PostMapping("page") @ApiOperation("短信模板-page") - public void pageSign(PageQuerySmsTemplateDTO pageQuerySmsTemplateDTO) { - smsService.pageSmsTemplate(pageQuerySmsTemplateDTO); + public PageSmsTemplateBO pageSign(PageQuerySmsTemplateDTO pageQuerySmsTemplateDTO) { + return smsService.pageSmsTemplate(pageQuerySmsTemplateDTO); } @PostMapping("add") diff --git a/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/bo/sms/PageSmsSignBO.java b/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/bo/sms/PageSmsSignBO.java index 8d8eee9ea..dba25d9c3 100644 --- a/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/bo/sms/PageSmsSignBO.java +++ b/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/bo/sms/PageSmsSignBO.java @@ -1,8 +1,13 @@ package cn.iocoder.mall.admin.api.bo.sms; +import cn.iocoder.common.framework.jsonField.DateFieldSerializer; +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; import java.util.List; /** @@ -33,16 +38,16 @@ public class PageSmsSignBO { */ private Integer id; /** - * 签名id 这个是第三方的 + * 短信平台 */ - private String platformId; + private Integer platform; /** * 签名名称 */ private String sign; /** * 审核状态 - * + *

* - 1、审核中 * - 2、审核成功 * - 3、审核失败 @@ -52,5 +57,15 @@ public class PageSmsSignBO { * 审核信息 */ private String applyMessage; + /** + * 更新时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date updateTime; + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; } } diff --git a/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/SmsApplyStatusEnum.java b/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/SmsApplyStatusEnum.java index 598ca98b6..4273b8aef 100644 --- a/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/SmsApplyStatusEnum.java +++ b/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/constant/SmsApplyStatusEnum.java @@ -10,7 +10,7 @@ public enum SmsApplyStatusEnum { CHECKING(1, "审核中"), SUCCESS(2, "审核成功"), - FAIL(3, "审核失败"), + FAIL(10, "审核失败"), ; private final Integer value; diff --git a/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/dto/sms/PageQuerySmsSignDTO.java b/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/dto/sms/PageQuerySmsSignDTO.java index 1ad0bcfa0..b69a3193d 100644 --- a/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/dto/sms/PageQuerySmsSignDTO.java +++ b/system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/dto/sms/PageQuerySmsSignDTO.java @@ -1,8 +1,11 @@ package cn.iocoder.mall.admin.api.dto.sms; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -13,13 +16,23 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) +@ApiModel("短信服务查询") public class PageQuerySmsSignDTO implements Serializable { - private Integer pageSize; + @ApiModelProperty("每页大小") + @NotNull + private Integer size; - private Integer pageCurrent; + @ApiModelProperty("当前页") + @NotNull + private Integer current; + @ApiModelProperty("编号") + private Integer id; + + @ApiModelProperty("签名") private String sign; + @ApiModelProperty("申请状态") private Integer applyStatus; } diff --git a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsSignDO.java b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsSignDO.java index eb9147f57..1b7fcdae8 100644 --- a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsSignDO.java +++ b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsSignDO.java @@ -38,7 +38,7 @@ public class SmsSignDO extends DeletableDO { * * - 1、审核中 * - 2、审核成功 - * - 3、审核失败 + * - 10、审核失败 */ private Integer applyStatus; /** diff --git a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsTemplateDO.java b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsTemplateDO.java index 9adf0d981..9634b6ae6 100644 --- a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsTemplateDO.java +++ b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/SmsTemplateDO.java @@ -49,7 +49,7 @@ public class SmsTemplateDO extends DeletableDO { * * 1、审核中 * 2、审核成功 - * 3、审核失败 + * 10、审核失败 */ private Integer applyStatus; /** diff --git a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/SmsServiceImpl.java b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/SmsServiceImpl.java index e7d338ce5..49972ab18 100644 --- a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/SmsServiceImpl.java +++ b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/SmsServiceImpl.java @@ -64,10 +64,13 @@ public class SmsServiceImpl implements SmsService { if (!StringUtils.isEmpty(queryDTO.getSign())) { queryWrapper.like("sign", queryDTO.getSign()); } + if (!StringUtils.isEmpty(queryDTO.getId())) { + queryWrapper.eq("id", queryDTO.getId()); + } Page page = new Page() - .setSize(queryDTO.getPageSize()) - .setCurrent(queryDTO.getPageCurrent()) + .setSize(queryDTO.getSize()) + .setCurrent(queryDTO.getCurrent()) .setDesc("create_time"); IPage signPage = smsSignMapper.selectPage(page, queryWrapper);