|
@@ -1,5 +1,6 @@
|
|
|
package com.caimei.www.service.page.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.aliyun.oss.OSS;
|
|
|
import com.aliyun.oss.OSSClientBuilder;
|
|
|
import com.aliyun.oss.model.GetObjectRequest;
|
|
@@ -14,7 +15,6 @@ import com.caimei.www.service.page.DocumentAuthService;
|
|
|
import com.caimei.www.service.redis.RedisService;
|
|
|
import com.caimei.www.utils.ImageUtil;
|
|
|
import com.caimei.www.utils.RandomCodeGenerator;
|
|
|
-import com.caimei.www.utils.SMSUtils;
|
|
|
import com.caimei.www.utils.VerifyCodeUtils;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -24,7 +24,10 @@ import org.springframework.http.*;
|
|
|
import org.springframework.http.server.reactive.ServerHttpRequest;
|
|
|
import org.springframework.http.server.reactive.ServerHttpResponse;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.LinkedMultiValueMap;
|
|
|
+import org.springframework.util.MultiValueMap;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
import reactor.core.publisher.Mono;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -73,6 +76,9 @@ public class DocumentAuthServiceImpl implements DocumentAuthService {
|
|
|
@Value("${spring.profiles.active}")
|
|
|
private String active;
|
|
|
|
|
|
+ @Value("${caimei.coreServer}")
|
|
|
+ private String coreServer;
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean getAuthorizationCookie(String authorizationMobile) {
|
|
|
if (!StringUtils.isEmpty(authorizationMobile)) {
|
|
@@ -116,8 +122,17 @@ public class DocumentAuthServiceImpl implements DocumentAuthService {
|
|
|
String content = "采美资料库访问授权验证码:" + mobileCode + ",30分钟内有效";
|
|
|
if (!StringUtils.isEmpty(code) && code.equalsIgnoreCase(imgCode)) {
|
|
|
log.info("采美资料库访问授权验证码>>>>>" + mobileCode);
|
|
|
- boolean sms = SMSUtils.sendSms(mobile, content);
|
|
|
- if (sms) {
|
|
|
+ //boolean sms = SMSUtils.sendSms(mobile, content);
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
+ String uri = coreServer + "/tools/sms/send";
|
|
|
+ // 发起Post请求
|
|
|
+ MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>();
|
|
|
+ paramMap.add("mobile", mobile);
|
|
|
+ paramMap.add("content", content);
|
|
|
+ String result = restTemplate.postForObject(uri, paramMap, String.class);
|
|
|
+ log.info(result);
|
|
|
+ JSONObject json = (JSONObject) JSONObject.parse(result);
|
|
|
+ if (null != json && json.getInteger("code") == 0) {
|
|
|
return Mono.just(JsonModel.success());
|
|
|
}
|
|
|
} else {
|