|
@@ -2,14 +2,15 @@ package com.css.simulation.resource.system.service;
|
|
|
|
|
|
import api.common.pojo.constants.DictConstants;
|
|
|
import api.common.pojo.constants.LogConstants;
|
|
|
+import api.common.pojo.dto.SmsDTO;
|
|
|
import api.common.pojo.param.system.UserParam;
|
|
|
import api.common.pojo.po.system.UserPO;
|
|
|
import api.common.pojo.vo.system.ParameterVO;
|
|
|
import api.common.pojo.vo.system.UserVO;
|
|
|
import api.common.util.EncryptUtil;
|
|
|
+import api.common.util.JsonUtil;
|
|
|
import api.common.util.ObjectUtil;
|
|
|
import api.common.util.StringUtil;
|
|
|
-import api.common.util.TencentSMSUtil;
|
|
|
import com.css.simulation.resource.common.oauth.OauthParameter;
|
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
|
import com.css.simulation.resource.common.utils.PageUtil;
|
|
@@ -19,6 +20,7 @@ import com.css.simulation.resource.log.service.LogService;
|
|
|
import com.css.simulation.resource.system.mapper.UserMapper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import lombok.SneakyThrows;
|
|
|
+import org.springframework.kafka.core.KafkaTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -42,6 +44,8 @@ public class UserService {
|
|
|
ParameterService parameterService;
|
|
|
@Resource
|
|
|
SmsConfiguration smsConfiguration;
|
|
|
+ @Resource
|
|
|
+ KafkaTemplate<String, String> kafkaTemplate;
|
|
|
|
|
|
public UserVO getCurrentUserInfo() {
|
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
@@ -129,15 +133,15 @@ public class UserService {
|
|
|
userMapper.insert(userPO);
|
|
|
logService.logUser(LogConstants.SYS_LOG_USER_INSERT, userPO);
|
|
|
|
|
|
- // 发送短信
|
|
|
- TencentSMSUtil.send(
|
|
|
- smsConfiguration.getSecretId(),
|
|
|
- smsConfiguration.getSecretKey(),
|
|
|
- smsConfiguration.getSdkAppId(),
|
|
|
- smsConfiguration.getSignName(),
|
|
|
- smsConfiguration.getTemplateIdForCreate(),
|
|
|
- new String[]{},
|
|
|
- new String[]{userPO.getPhone()}
|
|
|
+
|
|
|
+ kafkaTemplate.send(smsConfiguration.getKafkaTopic(),
|
|
|
+ JsonUtil.beanToJson(SmsDTO.builder()
|
|
|
+ .secretId(smsConfiguration.getSecretId())
|
|
|
+ .secretKey(smsConfiguration.getSecretKey())
|
|
|
+ .signName(smsConfiguration.getSignName())
|
|
|
+ .templateId(smsConfiguration.getTemplateIdForCreate())
|
|
|
+ .phone(userPO.getPhone())
|
|
|
+ .build())
|
|
|
);
|
|
|
|
|
|
} else {
|
|
@@ -157,14 +161,14 @@ public class UserService {
|
|
|
logService.logUser(LogConstants.SYS_LOG_USER_RESET, userPO);
|
|
|
|
|
|
// 发送短信
|
|
|
- TencentSMSUtil.send(
|
|
|
- smsConfiguration.getSecretId(),
|
|
|
- smsConfiguration.getSecretKey(),
|
|
|
- smsConfiguration.getSdkAppId(),
|
|
|
- smsConfiguration.getSignName(),
|
|
|
- smsConfiguration.getTemplateIdForReset(),
|
|
|
- new String[]{},
|
|
|
- new String[]{userPO.getPhone()}
|
|
|
+ kafkaTemplate.send(smsConfiguration.getKafkaTopic(),
|
|
|
+ JsonUtil.beanToJson(SmsDTO.builder()
|
|
|
+ .secretId(smsConfiguration.getSecretId())
|
|
|
+ .secretKey(smsConfiguration.getSecretKey())
|
|
|
+ .signName(smsConfiguration.getSignName())
|
|
|
+ .templateId(smsConfiguration.getTemplateIdForCreate())
|
|
|
+ .phone(userPO.getPhone())
|
|
|
+ .build())
|
|
|
);
|
|
|
}
|
|
|
|