BooleanQAEnum
parent
3adef032c6
commit
18194a382d
|
|
@ -8,10 +8,13 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.qinan.safetyeval.client.api.AccountApi;
|
||||
import org.qinan.safetyeval.client.co.AccountCO;
|
||||
import org.qinan.safetyeval.client.dto.*;
|
||||
import org.qinan.safetyeval.domain.exception.BizException;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -20,6 +23,8 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.qinan.safetyeval.domain.exception.ErrorCode.SMS_SOURCE_CODE_NOT_EXIST;
|
||||
|
||||
/**
|
||||
* 用户适配层(Controller)
|
||||
*
|
||||
|
|
@ -37,6 +42,9 @@ public class AccountController {
|
|||
@DubboReference
|
||||
private MessageFacade messageFacade;
|
||||
|
||||
@Value("${sms.sign.sourceCode:}")
|
||||
private String sourceCode;
|
||||
|
||||
@ApiOperation("新增用户")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<AccountCO> add(@Validated @RequestBody AccountAddCmd cmd) {
|
||||
|
|
@ -70,6 +78,9 @@ public class AccountController {
|
|||
@ApiOperation("发送短信")
|
||||
@PostMapping("/sendMessage")
|
||||
public com.alibaba.cola.dto.SingleResponse<Boolean> sendMessage(@Validated @RequestBody SendMessageCmd cmd) {
|
||||
if (StringUtils.isBlank(sourceCode)) {
|
||||
throw new BizException(SMS_SOURCE_CODE_NOT_EXIST);
|
||||
}
|
||||
|
||||
MessageSendCmd messageSendCmd = new MessageSendCmd();
|
||||
messageSendCmd.setBusinessId(UUID.randomUUID().toString().replace("-", ""));
|
||||
|
|
@ -77,11 +88,12 @@ public class AccountController {
|
|||
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
||||
messageTargetCmd.setMobile(cmd.getMobile());
|
||||
messageSendCmd.setTargetCmd(messageTargetCmd);
|
||||
messageSendCmd.setNeedTokenEnum(null);
|
||||
messageSendCmd.setNeedTokenEnum(false);
|
||||
|
||||
messageSendCmd.setSourceCode("MS000146");
|
||||
messageSendCmd.setSourceCode(sourceCode);
|
||||
Map<String, Object> codeMap = new HashMap<>();
|
||||
codeMap.put("code", "512454");
|
||||
codeMap.put("others_1", "123456");
|
||||
codeMap.put("valid_code", "123456");
|
||||
messageSendCmd.setParams(codeMap);
|
||||
|
||||
log.info("发送短信参数: messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd));
|
||||
|
|
|
|||
|
|
@ -89,6 +89,12 @@ public enum ErrorCode {
|
|||
FILE_URL_GENERATE_FAILED("03-01-007", "文件地址生成失败"),
|
||||
FILE_SIZE_EXCEEDED("03-01-008", "文件大小超出限制"),
|
||||
|
||||
|
||||
/**
|
||||
* 短信码不存在
|
||||
*/
|
||||
SMS_SOURCE_CODE_NOT_EXIST("04-01-001", "短信码不存在"),
|
||||
|
||||
/**
|
||||
* 未知错误
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -50,3 +50,6 @@ openapi:
|
|||
#多个可以逗号隔开,可以为空
|
||||
tenantIds: 1838408702262321152
|
||||
|
||||
sms:
|
||||
sign:
|
||||
sourceCode: MS000151
|
||||
|
|
@ -49,3 +49,7 @@ openapi:
|
|||
apiCode: test:01
|
||||
#多个可以逗号隔开,可以为空
|
||||
tenantIds: 1838408702262321152
|
||||
|
||||
sms:
|
||||
sign:
|
||||
sourceCode: MS000146
|
||||
Loading…
Reference in New Issue