Skip to content

Commit

Permalink
- 短信服务 签名,添加后台管理
Browse files Browse the repository at this point in the history
  • Loading branch information
cherishsince committed May 26, 2019
1 parent 23864fa commit 24a7542
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -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.*;

/**
* 短信服务
Expand All @@ -17,37 +17,40 @@
* @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,
@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);
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand Down Expand Up @@ -33,16 +38,16 @@ public static class Sign {
*/
private Integer id;
/**
* 签名id 这个是第三方的
* 短信平台
*/
private String platformId;
private Integer platform;
/**
* 签名名称
*/
private String sign;
/**
* 审核状态
*
* <p>
* - 1、审核中
* - 2、审核成功
* - 3、审核失败
Expand All @@ -52,5 +57,15 @@ public static class Sign {
* 审核信息
*/
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum SmsApplyStatusEnum {

CHECKING(1, "审核中"),
SUCCESS(2, "审核成功"),
FAIL(3, "审核失败"),
FAIL(10, "审核失败"),
;

private final Integer value;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand All @@ -13,13 +16,23 @@
*/
@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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class SmsSignDO extends DeletableDO {
*
* - 1、审核中
* - 2、审核成功
* - 3、审核失败
* - 10、审核失败
*/
private Integer applyStatus;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class SmsTemplateDO extends DeletableDO {
*
* 1、审核中
* 2、审核成功
* 3、审核失败
* 10、审核失败
*/
private Integer applyStatus;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ public PageSmsSignBO pageSmsSign(PageQuerySmsSignDTO queryDTO) {
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);
Expand Down

0 comments on commit 24a7542

Please sign in to comment.