|
|
@@ -1,10 +1,10 @@
|
|
|
package com.sckw.message.service;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
-import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
+import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.message.model.vo.req.GetSmsVerifyCoderReqVO;
|
|
|
@@ -13,11 +13,14 @@ import com.sckw.redis.constant.RedisConstant;
|
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
|
import com.sckw.stream.enums.SmsCodeEnum;
|
|
|
import com.sckw.stream.model.SckwSms;
|
|
|
+import com.sckw.system.api.RemoteSystemService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.cloud.stream.function.StreamBridge;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
@@ -34,6 +37,9 @@ public class SmsService {
|
|
|
|
|
|
private final StreamBridge streamBridge;
|
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
+ private RemoteSystemService remoteSystemService;
|
|
|
+
|
|
|
/**
|
|
|
* @param param
|
|
|
* @return com.sckw.core.web.response.HttpResult
|
|
|
@@ -42,8 +48,15 @@ public class SmsService {
|
|
|
* @date: 2023-06-13 13:43
|
|
|
*/
|
|
|
public void sendVerifyCode(SendSmsVerifyCoderReqVO param) {
|
|
|
+ Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(Collections.singletonList(DictTypeEnum.SEND_SMS_TYPE.getType()));
|
|
|
+ Map<String, String> map;
|
|
|
+ if (CollectionUtils.isNotEmpty(dict)){
|
|
|
+ map = dict.get(DictTypeEnum.SEND_SMS_TYPE.getType());
|
|
|
+ }else {
|
|
|
+ map = new HashMap<>();
|
|
|
+ }
|
|
|
String type = param.getType();
|
|
|
- if (Objects.isNull(DictEnum.getLabel(DictTypeEnum.SEND_SMS_TYPE.getType(), type))) {
|
|
|
+ if (Objects.isNull(map.get(type))) {
|
|
|
throw new BusinessException("非法短信类型!");
|
|
|
}
|
|
|
String phone = param.getPhone();
|