|
@@ -23,6 +23,7 @@ import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
+import reactor.core.publisher.Mono;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
@@ -58,7 +59,7 @@ public class DocumentAuthServiceImpl implements DocumentAuthService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public JsonModel getImgVerifyCode() {
|
|
|
+ public Mono<JsonModel> getImgVerifyCode() {
|
|
|
Map<String, Object> jsonResult = new HashMap<>(2);
|
|
|
try {
|
|
|
VerifyCodeUtils.VerifyCode verifyCode = null;
|
|
@@ -76,14 +77,14 @@ public class DocumentAuthServiceImpl implements DocumentAuthService {
|
|
|
}
|
|
|
jsonResult.put("baseImage", verifyCode.getBase64Image());
|
|
|
jsonResult.put("token", verifyCode.getMd5Code());
|
|
|
- return JsonModel.success(jsonResult);
|
|
|
+ return Mono.just(JsonModel.success(jsonResult));
|
|
|
} catch (Exception e) {
|
|
|
- return JsonModel.error("验证码获取失败");
|
|
|
+ return Mono.just(JsonModel.error("验证码获取失败"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public JsonModel ossNote(String mobile, String imgCode, String token) {
|
|
|
+ public Mono<JsonModel> ossNote(String mobile, String imgCode, String token) {
|
|
|
String code = (String) redisService.get("www:oss:" + token);
|
|
|
String mobileCode = RandomCodeGenerator.generateCodeInt(6);
|
|
|
//手机验证码,30分钟有效
|
|
@@ -93,7 +94,7 @@ public class DocumentAuthServiceImpl implements DocumentAuthService {
|
|
|
if (!StringUtils.isEmpty(code) && code.equals(imgCode)) {
|
|
|
boolean sms = SMSUtils.sendSms(mobile, content);
|
|
|
if (sms) {
|
|
|
- return JsonModel.success();
|
|
|
+ return Mono.just(JsonModel.success());
|
|
|
}
|
|
|
} else {
|
|
|
boolean exists = redisService.exists(mobile + ":mobileCode");
|
|
@@ -101,7 +102,7 @@ public class DocumentAuthServiceImpl implements DocumentAuthService {
|
|
|
redisService.remove(mobile + ":mobileCode");
|
|
|
}
|
|
|
}
|
|
|
- return JsonModel.error("验证码不正确");
|
|
|
+ return Mono.just(JsonModel.error("验证码不正确"));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -130,7 +131,7 @@ public class DocumentAuthServiceImpl implements DocumentAuthService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public JsonModel dataList(String name, Integer pageNum, Integer pageSize) {
|
|
|
+ public Mono<JsonModel> dataList(String name, Integer pageNum, Integer pageSize) {
|
|
|
pageNum = pageNum == null ? 1 : pageNum;
|
|
|
pageSize = pageSize == null ? 20 : pageSize;
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
@@ -146,11 +147,11 @@ public class DocumentAuthServiceImpl implements DocumentAuthService {
|
|
|
}
|
|
|
pageInfo = new PageInfo<>(ossArchiveList);
|
|
|
}
|
|
|
- return JsonModel.success(pageInfo);
|
|
|
+ return Mono.just(JsonModel.success(pageInfo));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public JsonModel dataDetails(Integer pdfId) {
|
|
|
+ public Mono<JsonModel> dataDetails(Integer pdfId) {
|
|
|
String endpoint = "https://oss-cn-shenzhen.aliyuncs.com";
|
|
|
String accessKeyId = "LTAI4GBL3o4YkWnbKYgf2Xia";
|
|
|
String accessKeySecret = "dBjAXqbYiEPP6Ukuk2ZsXQeET7FVkK";
|
|
@@ -166,6 +167,6 @@ public class DocumentAuthServiceImpl implements DocumentAuthService {
|
|
|
map.put("ossArchivePdf", ossArchivePdf);
|
|
|
map.put("ossArchive", ossArchive);
|
|
|
ossClient.shutdown();
|
|
|
- return JsonModel.success(map);
|
|
|
+ return Mono.just(JsonModel.success(map));
|
|
|
}
|
|
|
}
|