- 短信服务 签名,添加后台管理

This commit is contained in:
sin-ning@aliyun.com 2019-05-26 18:16:58 +08:00
parent 23864fac88
commit 24a7542704
8 changed files with 62 additions and 27 deletions

View File

@ -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<PageSmsSignBO> 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,
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);
}
}

View File

@ -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")

View File

@ -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;
/**
* 审核状态
*
* <p>
* - 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;
}
}

View File

@ -10,7 +10,7 @@ public enum SmsApplyStatusEnum {
CHECKING(1, "审核中"),
SUCCESS(2, "审核成功"),
FAIL(3, "审核失败"),
FAIL(10, "审核失败"),
;
private final Integer value;

View File

@ -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;
}

View File

@ -38,7 +38,7 @@ public class SmsSignDO extends DeletableDO {
*
* - 1审核中
* - 2审核成功
* - 3审核失败
* - 10审核失败
*/
private Integer applyStatus;
/**

View File

@ -49,7 +49,7 @@ public class SmsTemplateDO extends DeletableDO {
*
* 1审核中
* 2审核成功
* 3审核失败
* 10审核失败
*/
private Integer applyStatus;
/**

View File

@ -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<SmsSignDO> page = new Page<SmsSignDO>()
.setSize(queryDTO.getPageSize())
.setCurrent(queryDTO.getPageCurrent())
.setSize(queryDTO.getSize())
.setCurrent(queryDTO.getCurrent())
.setDesc("create_time");
IPage<SmsSignDO> signPage = smsSignMapper.selectPage(page, queryWrapper);