|
|
|
|
@ -1,14 +1,22 @@
|
|
|
|
|
package org.qinan.safetyeval.adapter.web;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.jjb.saas.message.client.message.facede.MessageFacade;
|
|
|
|
|
import com.jjb.saas.message.client.message.request.MessageSendCmd;
|
|
|
|
|
import com.jjb.saas.message.client.message.request.MessageTargetCmd;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
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.AccountAddCmd;
|
|
|
|
|
import org.qinan.safetyeval.client.dto.AccountModifyCmd;
|
|
|
|
|
import org.qinan.safetyeval.client.dto.AccountPageQuery;
|
|
|
|
|
import org.qinan.safetyeval.client.dto.PageResponse;
|
|
|
|
|
import org.qinan.safetyeval.client.dto.SendMessageCmd;
|
|
|
|
|
import org.qinan.safetyeval.client.dto.SingleResponse;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
@ -25,6 +33,7 @@ import javax.annotation.Resource;
|
|
|
|
|
*
|
|
|
|
|
* @author safety-eval
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Api(tags = "用户管理")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/account")
|
|
|
|
|
@ -33,6 +42,9 @@ public class AccountController {
|
|
|
|
|
@Resource
|
|
|
|
|
private AccountApi accountApi;
|
|
|
|
|
|
|
|
|
|
@DubboReference
|
|
|
|
|
private MessageFacade messageFacade;
|
|
|
|
|
|
|
|
|
|
@ApiOperation("新增用户")
|
|
|
|
|
@PostMapping("/save")
|
|
|
|
|
public SingleResponse<AccountCO> add(@Validated @RequestBody AccountAddCmd cmd) {
|
|
|
|
|
@ -62,4 +74,25 @@ public class AccountController {
|
|
|
|
|
public PageResponse<AccountCO> page(@Validated AccountPageQuery query) {
|
|
|
|
|
return accountApi.page(query);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation("发送短信")
|
|
|
|
|
@PostMapping("/sendMessage")
|
|
|
|
|
public com.alibaba.cola.dto.SingleResponse<Boolean> sendMessage(@Validated @RequestBody SendMessageCmd cmd) {
|
|
|
|
|
MessageSendCmd messageSendCmd = new MessageSendCmd();
|
|
|
|
|
messageSendCmd.setBusinessId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
|
|
|
|
|
|
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
|
|
|
|
messageTargetCmd.setUserId(cmd.getUserId());
|
|
|
|
|
messageSendCmd.setTargetCmd(messageTargetCmd);
|
|
|
|
|
|
|
|
|
|
messageSendCmd.setSourceCode("MS000146");
|
|
|
|
|
messageSendCmd.setNeedTokenEnum(false);
|
|
|
|
|
messageSendCmd.setParams(cmd.getParams());
|
|
|
|
|
|
|
|
|
|
log.info("发送短信参数: messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd));
|
|
|
|
|
com.alibaba.cola.dto.SingleResponse<Boolean> result = messageFacade.send(messageSendCmd);
|
|
|
|
|
log.info("发送短信结果: result: {}", JSONUtil.toJsonStr(result));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|