init
This commit is contained in:
27
blade-ops-api/blade-resource-api/pom.xml
Normal file
27
blade-ops-api/blade-resource-api/pom.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>blade-ops-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>blade-resource-api</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-starter-sms</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-starter-tenant</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.resource.feign;
|
||||
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springblade.core.sms.model.SmsResponse;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* ISmsClient
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@FeignClient(
|
||||
value = AppConstant.APPLICATION_RESOURCE_NAME,
|
||||
fallback = ISmsClientFallback.class
|
||||
)
|
||||
public interface ISmsClient {
|
||||
String API_PREFIX = "/feign/client/sms";
|
||||
String SEND_MESSAGE = API_PREFIX + "/send-message";
|
||||
String SEND_MESSAGE_BY_TENANT_ID = API_PREFIX + "/send-message-by-tenant-id";
|
||||
String SEND_VALIDATE = API_PREFIX + "/send-validate";
|
||||
String SEND_VALIDATE_BY_TENANT_ID = API_PREFIX + "/send-validate-by-tenant-id";
|
||||
String VALIDATE_MESSAGE = API_PREFIX + "/validate-message";
|
||||
String VALIDATE_MESSAGE_BY_TENANT_ID = API_PREFIX + "/validate-message-by-tenant-id";
|
||||
|
||||
/**
|
||||
* 通用短信发送
|
||||
*
|
||||
* @param code 资源编号
|
||||
* @param params 模板参数
|
||||
* @param phones 手机号集合
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping(SEND_MESSAGE)
|
||||
R<SmsResponse> sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones);
|
||||
|
||||
/**
|
||||
* 通用短信发送
|
||||
*
|
||||
* @param code 资源编号
|
||||
* @param params 模板参数
|
||||
* @param phones 手机号集合
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping(SEND_MESSAGE_BY_TENANT_ID)
|
||||
R<SmsResponse> sendMessage(@RequestParam("tenantId") String tenantId, @RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones);
|
||||
|
||||
/**
|
||||
* 短信验证码发送
|
||||
*
|
||||
* @param code 资源编号
|
||||
* @param phone 手机号
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping(SEND_VALIDATE)
|
||||
R sendValidate(@RequestParam("code") String code, @RequestParam("phone") String phone);
|
||||
|
||||
/**
|
||||
* 短信验证码发送
|
||||
*
|
||||
* @param code 资源编号
|
||||
* @param phone 手机号
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping(SEND_VALIDATE_BY_TENANT_ID)
|
||||
R sendValidate(@RequestParam("tenantId") String tenantId, @RequestParam("code") String code, @RequestParam("phone") String phone);
|
||||
|
||||
/**
|
||||
* 校验短信
|
||||
*
|
||||
* @param code 资源编号
|
||||
* @param id 校验id
|
||||
* @param value 校验值
|
||||
* @param phone 手机号
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping(VALIDATE_MESSAGE)
|
||||
R validateMessage(@RequestParam("code") String code, @RequestParam("id") String id, @RequestParam("value") String value, @RequestParam("phone") String phone);
|
||||
|
||||
/**
|
||||
* 校验短信
|
||||
*
|
||||
* @param code 资源编号
|
||||
* @param id 校验id
|
||||
* @param value 校验值
|
||||
* @param phone 手机号
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping(VALIDATE_MESSAGE_BY_TENANT_ID)
|
||||
R validateMessage(@RequestParam("tenantId") String tenantId, @RequestParam("code") String code, @RequestParam("id") String id, @RequestParam("value") String value, @RequestParam("phone") String phone);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.resource.feign;
|
||||
|
||||
import org.springblade.core.sms.model.SmsResponse;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 流程远程调用失败处理类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Component
|
||||
public class ISmsClientFallback implements ISmsClient {
|
||||
@Override
|
||||
public R<SmsResponse> sendMessage(String code, String params, String phones) {
|
||||
return R.fail("远程调用失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<SmsResponse> sendMessage(String tenantId, String code, String params, String phones) {
|
||||
return R.fail("远程调用失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R sendValidate(String code, String phone) {
|
||||
return R.fail("远程调用失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R sendValidate(String tenantId, String code, String phone) {
|
||||
return R.fail("远程调用失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R validateMessage(String code, String id, String value, String phone) {
|
||||
return R.fail("远程调用失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R validateMessage(String tenantId, String code, String id, String value, String phone) {
|
||||
return R.fail("远程调用失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.resource.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 附件表实体类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_attach")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "附件表")
|
||||
public class Attach extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 附件地址
|
||||
*/
|
||||
@Schema(description = "附件地址")
|
||||
private String link;
|
||||
/**
|
||||
* 附件域名
|
||||
*/
|
||||
@Schema(description = "附件域名")
|
||||
private String domainUrl;
|
||||
/**
|
||||
* 附件名称
|
||||
*/
|
||||
@Schema(description = "附件名称")
|
||||
private String name;
|
||||
/**
|
||||
* 附件原名
|
||||
*/
|
||||
@Schema(description = "附件原名")
|
||||
private String originalName;
|
||||
/**
|
||||
* 附件拓展名
|
||||
*/
|
||||
@Schema(description = "附件拓展名")
|
||||
private String extension;
|
||||
/**
|
||||
* 附件大小
|
||||
*/
|
||||
@Schema(description = "附件大小")
|
||||
private Long attachSize;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.resource.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
import org.springblade.core.tool.jackson.Sensitive;
|
||||
import org.springblade.core.tool.sensitive.SensitiveType;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 实体类
|
||||
*
|
||||
* @author BladeX
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_oss")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "Oss对象")
|
||||
public class Oss extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 所属分类
|
||||
*/
|
||||
@Schema(description = "所属分类")
|
||||
private Integer category;
|
||||
|
||||
/**
|
||||
* 资源编号
|
||||
*/
|
||||
@Schema(description = "资源编号")
|
||||
private String ossCode;
|
||||
|
||||
/**
|
||||
* 资源地址
|
||||
*/
|
||||
@Schema(description = "资源地址")
|
||||
private String endpoint;
|
||||
|
||||
/**
|
||||
* 外网资源地址
|
||||
*/
|
||||
@Schema(description = "外网资源地址")
|
||||
private String transformEndpoint;
|
||||
/**
|
||||
* accessKey
|
||||
*/
|
||||
@Sensitive(type = SensitiveType.KEYS)
|
||||
@Schema(description = "accessKey")
|
||||
private String accessKey;
|
||||
/**
|
||||
* secretKey
|
||||
*/
|
||||
@Sensitive(type = SensitiveType.KEYS)
|
||||
@Schema(description = "secretKey")
|
||||
private String secretKey;
|
||||
/**
|
||||
* 空间名
|
||||
*/
|
||||
@Schema(description = "空间名")
|
||||
private String bucketName;
|
||||
/**
|
||||
* 应用ID TencentCOS需要
|
||||
*/
|
||||
@Schema(description = "应用ID")
|
||||
private String appId;
|
||||
/**
|
||||
* 地域简称 TencentCOS需要
|
||||
*/
|
||||
@Schema(description = "地域简称")
|
||||
private String region;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.resource.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
import org.springblade.core.tool.jackson.Sensitive;
|
||||
import org.springblade.core.tool.sensitive.SensitiveType;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 短信配置表实体类
|
||||
*
|
||||
* @author BladeX
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_sms")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "短信配置表")
|
||||
public class Sms extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 资源编号
|
||||
*/
|
||||
@Schema(description = "资源编号")
|
||||
private String smsCode;
|
||||
|
||||
/**
|
||||
* 模板ID
|
||||
*/
|
||||
@Schema(description = "模板ID")
|
||||
private String templateId;
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@Schema(description = "分类")
|
||||
private Integer category;
|
||||
/**
|
||||
* accessKey
|
||||
*/
|
||||
@Sensitive(type = SensitiveType.KEYS)
|
||||
@Schema(description = "accessKey")
|
||||
private String accessKey;
|
||||
/**
|
||||
* secretKey
|
||||
*/
|
||||
@Sensitive(type = SensitiveType.KEYS)
|
||||
@Schema(description = "secretKey")
|
||||
private String secretKey;
|
||||
/**
|
||||
* regionId
|
||||
*/
|
||||
@Schema(description = "regionId")
|
||||
private String regionId;
|
||||
/**
|
||||
* appId
|
||||
*/
|
||||
@Schema(description = "appId")
|
||||
private String appId;
|
||||
/**
|
||||
* 短信签名
|
||||
*/
|
||||
@Schema(description = "短信签名")
|
||||
private String signName;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.resource.pojo.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springblade.core.tool.utils.StringPool;
|
||||
|
||||
/**
|
||||
* Sms资源编码枚举类
|
||||
*
|
||||
* @author Chill
|
||||
* @apiNote 该枚举类对应短信配置模块的资源编码,可根据业务需求自行拓展
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SmsCodeEnum {
|
||||
|
||||
/**
|
||||
* 默认编号
|
||||
*/
|
||||
DEFAULT(StringPool.EMPTY, 1),
|
||||
|
||||
/**
|
||||
* 验证码编号
|
||||
*/
|
||||
VALIDATE("validate", 2),
|
||||
|
||||
/**
|
||||
* 通知公告编号
|
||||
*/
|
||||
NOTICE("notice", 3),
|
||||
|
||||
/**
|
||||
* 下单通知编号
|
||||
*/
|
||||
ORDER("order", 4),
|
||||
|
||||
/**
|
||||
* 会议通知编号
|
||||
*/
|
||||
MEETING("meeting", 5),
|
||||
;
|
||||
|
||||
final String name;
|
||||
final int category;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.resource.pojo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.resource.pojo.entity.Attach;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 附件表视图实体类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "附件表")
|
||||
public class AttachVO extends Attach {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.springblade.resource.pojo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.resource.pojo.entity.Oss;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* OssVO
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "对象存储表")
|
||||
public class OssVO extends Oss {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 分类名
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String statusName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.resource.pojo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.resource.pojo.entity.Sms;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 短信配置表视图实体类
|
||||
*
|
||||
* @author BladeX
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "短信配置表")
|
||||
public class SmsVO extends Sms {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 分类名
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String statusName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.resource.utils;
|
||||
|
||||
import org.springblade.core.sms.model.SmsCode;
|
||||
import org.springblade.core.sms.model.SmsResponse;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.jackson.JsonUtil;
|
||||
import org.springblade.core.tool.utils.RandomType;
|
||||
import org.springblade.core.tool.utils.SpringUtil;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.resource.feign.ISmsClient;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 短信服务工具类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class SmsUtil {
|
||||
|
||||
public static final String PARAM_KEY = "code";
|
||||
public static final String SEND_SUCCESS = "短信发送成功";
|
||||
public static final String SEND_FAIL = "短信发送失败";
|
||||
public static final String VALIDATE_SUCCESS = "短信校验成功";
|
||||
public static final String VALIDATE_FAIL = "短信校验失败";
|
||||
|
||||
private static ISmsClient smsClient;
|
||||
|
||||
/**
|
||||
* 获取短信服务构建类
|
||||
*
|
||||
* @return SmsBuilder
|
||||
*/
|
||||
public static ISmsClient getSmsClient() {
|
||||
if (smsClient == null) {
|
||||
smsClient = SpringUtil.getBean(ISmsClient.class);
|
||||
}
|
||||
return smsClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取短信验证码参数
|
||||
*
|
||||
* @return 验证码参数
|
||||
*/
|
||||
public static Map<String, String> getValidateParams() {
|
||||
Map<String, String> params = new HashMap<>(1);
|
||||
params.put(PARAM_KEY, StringUtil.random(6, RandomType.INT));
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
*
|
||||
* @param code 资源编号
|
||||
* @param params 模板参数
|
||||
* @param phones 手机号集合
|
||||
* @return 发送结果
|
||||
*/
|
||||
public static SmsResponse sendMessage(String code, Map<String, String> params, String phones) {
|
||||
R<SmsResponse> result = getSmsClient().sendMessage(code, JsonUtil.toJson(params), phones);
|
||||
return result.getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送验证码
|
||||
*
|
||||
* @param code 资源编号
|
||||
* @param phone 手机号
|
||||
* @return 发送结果
|
||||
*/
|
||||
public static SmsCode sendValidate(String code, String phone) {
|
||||
SmsCode smsCode = new SmsCode();
|
||||
R result = getSmsClient().sendValidate(code, phone);
|
||||
if (result.isSuccess()) {
|
||||
smsCode = JsonUtil.parse(JsonUtil.toJson(result.getData()), SmsCode.class);
|
||||
} else {
|
||||
smsCode.setSuccess(Boolean.FALSE);
|
||||
}
|
||||
return smsCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验短信
|
||||
*
|
||||
* @param code 资源编号
|
||||
* @param id 校验id
|
||||
* @param value 校验值
|
||||
* @return 发送结果
|
||||
*/
|
||||
public static boolean validateMessage(String code, String id, String value, String phone) {
|
||||
R result = getSmsClient().validateMessage(code, id, value, phone);
|
||||
return result.isSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user