Merge branch 'feature/admin' into preview

# Conflicts:
#	mcwl-admin/src/main/java/com/mcwl/web/controller/pay/AliPay/AliPayIntegration.java
#	mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java
feature/resource
Diyu0904 2025-01-16 18:58:49 +08:00
commit 6ae9eca9b6
18 changed files with 624 additions and 81 deletions

View File

@ -134,6 +134,46 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-green</artifactId>
<version>3.6.6</version>
</dependency>
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>2.0.9</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.aliyun.oss</groupId>-->
<!-- <artifactId>aliyun-sdk-oss</artifactId>-->
<!-- <version>2.8.3</version>-->
<!-- </dependency>-->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.aliyun/imageaudit20191230 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>imageaudit20191230</artifactId>
<version>2.0.6</version>
</dependency>
</dependencies>
<build>

View File

@ -1,8 +1,6 @@
package com.mcwl;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.mcwl.pay.config.AliConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.boot.SpringApplication;
@ -17,6 +15,7 @@ import org.springframework.context.annotation.Bean;
*
* @author mcwl
*/
@EnableConfigurationProperties
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class McWlApplication
{

View File

@ -4,7 +4,6 @@ import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.GetObjectRequest;
import com.aliyun.oss.model.PutObjectRequest;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
@ -14,15 +13,17 @@ import java.util.UUID;
/**
* Oss
*/
@Log4j2
public class OssUtil {
/**
* Endpoint AccessKeyaccessKeySecretAPI访 访
*/
private static String endPoint = "oss-cn-beijing.aliyuncs.com";
private static String accessKeyId = "LTAI5tSHZZ8wHJRP8X4r9TXT";
private static String accessKeySecret = "F82IVNx0IGJ3AnP6gSIfcyql1HCXIH";
private static String accessPre = "https://ybl2112.oss-cn-beijing.aliyuncs.com/";
/**
@ -38,7 +39,6 @@ public class OssUtil {
endPoint,
accessKeyId,
accessKeySecret);
log.info("oss服务连接成功");
}
/**

View File

@ -0,0 +1,81 @@
package com.mcwl.web.controller.common.baidu;
import org.codehaus.jettison.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.Map;
/**
* @author DaiZibo
* @date 2025/1/16
* @apiNote
*/
public class AuthService {
/**
* token
* @return
* {
* "access_token": "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567",
* "expires_in": 2592000
* }
*/
/**
* API访token
* token.
* @param ak - API Key
* @param sk - Securet Key
* @return assess_token
* "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567"
*/
public static String getAuth(String ak, String sk) {
// 获取token地址
String authHost = "https://aip.baidubce.com/oauth/2.0/token?";
String getAccessTokenUrl = authHost
// 1. grant_type为固定参数
+ "grant_type=client_credentials"
// 2. 官网获取的 API Key
+ "&client_id=" + ak
// 3. 官网获取的 Secret Key
+ "&client_secret=" + sk;
try {
URL realUrl = new URL(getAccessTokenUrl);
// 打开和URL之间的连接
HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
connection.setRequestMethod("GET");
connection.connect();
// 获取所有响应头字段
Map<String, List<String>> map = connection.getHeaderFields();
// 遍历所有的响应头字段
for (String key : map.keySet()) {
System.err.println(key + "--->" + map.get(key));
}
// 定义 BufferedReader输入流来读取URL的响应
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String result = "";
String line;
while ((line = in.readLine()) != null) {
result += line;
}
/**
*
*/
System.err.println("result:" + result);
JSONObject jsonObject = new JSONObject(result);
String access_token = jsonObject.getString("access_token");
return access_token;
} catch (Exception e) {
System.err.printf("获取token失败");
e.printStackTrace(System.err);
}
return null;
}
}

View File

@ -0,0 +1,126 @@
package com.mcwl.web.controller.common.baidu;
import com.mcwl.common.utils.Base64Util;
import com.mcwl.common.utils.HttpUtil;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
/**
* @author DaiZibo
* @date 2025/1/16
* @apiNote
*/
public class BaiduCensor {
//设置APPID/AK/SK
public static final String APP_ID = "115921420";
public static final String API_KEY = "UOU5eZh73FOrsQbSKbO0wAAA";
public static final String SECRET_KEY = "nKT1ztffZk9XTxEnhcFdQW0UFggMWq9t";
//图像审核
public static String ImageCnesor(String filePath) {
// 请求url
String url = "https://aip.baidubce.com/rest/2.0/solution/v1/img_censor/v2/user_defined";
try {
byte[] imgData = downloadImageFromOSS(filePath);
// 本地文件路径
// String filePath = "[本地文件路径]";
String imgStr = Base64Util.encode(imgData);
String imgParam = URLEncoder.encode(imgStr, "UTF-8");
String param = "image=" + imgParam;
//获取accessToken
String accessToken = AuthService.getAuth(API_KEY, SECRET_KEY);
String result = HttpUtil.post(url, accessToken, param);
//接口说明 https://ai.baidu.com/docs#/ImageCensoring-API/top
System.out.println(result);
return result;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String TextCensor(String content) {
// 请求url
String url = "https://aip.baidubce.com/rest/2.0/solution/v1/text_censor/v2/user_defined";
try {
String param = "text=" + URLEncoder.encode(content, "utf-8");
// 注意这里仅为了简化编码每一次请求都去获取access_token线上环境access_token有过期时间 客户端可自行缓存,过期后重新获取。
String accessToken = AuthService.getAuth(API_KEY, SECRET_KEY);
String result = HttpUtil.post(url, accessToken, param);
System.out.println(result);
return result;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
*
*
* @param ossUrl
* @return
*/
public static byte[] downloadImageFromOSS(String ossUrl) {
HttpURLConnection connection = null;
InputStream inputStream = null;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
//读取阿里云的图片使用次方法
URL url = new URL(ossUrl);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
inputStream = connection.getInputStream();
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
return outputStream.toByteArray();
} else {
System.err.println("Failed to retrieve data from OSS: HTTP error code " + responseCode);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
if (connection != null) {
connection.disconnect();
}
}
return null;
}
public static void main(String[] args) {
String s = BaiduCensor.TextCensor("我草你妈的");
String s1 = BaiduCensor.ImageCnesor("https://ybl2112.oss-cn-beijing.aliyuncs.com/2025/JANUARY/2/19/4/877e449c-3c0d-4630-a304-91ec110499f2.png");
}
}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.lang.UUID;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.json.JSONUtil;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.Config;
import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse;
import com.mcwl.common.JSONUtils;
import com.mcwl.common.annotation.Anonymous;
@ -16,15 +17,15 @@ import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.pay.domain.OrderTrade;
import com.mcwl.pay.domain.OrderTradeDto;
import com.mcwl.pay.service.OrderTradeService;
import lombok.extern.slf4j.Slf4j;
import com.alipay.easysdk.kernel.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @AuthorChenYan
@ -35,7 +36,6 @@ import java.util.*;
* @Date2025/1/3 14:46
*/
@Slf4j
@RestController
@RequestMapping("/web/pay")
@Validated
@ -177,7 +177,7 @@ public class OrderTradeController extends BaseController {
@PostMapping("/notify") // 注意这里必须是POST接口
public String payNotify(HttpServletRequest request) throws Exception {
log.info("已经进入回调接口");
if (request.getParameter("trade_status").equals("TRADE_SUCCESS")) {
System.out.println("=========支付宝异步回调========");

View File

@ -1,24 +1,74 @@
package com.mcwl.web.controller.rabbitmq.consumer;
import com.alibaba.fastjson.JSON;
import com.mcwl.common.constant.QueueConstants;
import lombok.extern.slf4j.Slf4j;
import com.mcwl.common.constant.RedisConstants;
import com.mcwl.common.core.domain.model.PhoneLoginBody;
import com.mcwl.common.core.redis.RedisCache;
import com.mcwl.common.utils.uuid.TelSmsUtils;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
*
*
* @author DaiZibo
* @date 2024/12/30
* @apiNote
*/
@Slf4j
@Component
public class CodeConsumer {
@RabbitListener(queues = QueueConstants.CODE_QUEUE)
public void code(String msg) {
@Autowired
private RedisCache redisCache;
@Autowired
private RedisTemplate<String, String> redisTemplate;
@RabbitListener(queues = QueueConstants.CODE_QUEUE)
public void code(Message message, Channel channel, String msg) {
if (msg == "") {
return;
}
String messageId = message.getMessageProperties().getMessageId();
try {
Long add = redisTemplate.opsForSet().add(RedisConstants.CODE_UUID + messageId, "1");
redisTemplate.expire(RedisConstants.CODE_UUID + messageId, 2, TimeUnit.MINUTES);
if (add > 0) {
PhoneLoginBody phoneLoginBody = JSON.parseObject(msg, PhoneLoginBody.class);
//发送短信服务
// 构建 sendDataMap
Map<String, String> sendDataMap = new HashMap<>();
sendDataMap.put("code", phoneLoginBody.getCode());
String s1 = TelSmsUtils.sendSms(phoneLoginBody.getPhone(), "SMS_478520014", sendDataMap);
//手动确认
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
}else {
}
} catch (IOException e) {
//删除标记
redisTemplate.delete(RedisConstants.CODE_UUID+messageId);
throw new RuntimeException(e);
}
log.info("消费者获取到的数据:{}", msg);
}
}

View File

@ -1,7 +1,7 @@
package com.mcwl.web.controller.resource;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.common.annotation.Anonymous;
import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.page.PageDomain;
@ -10,19 +10,14 @@ import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.request.RequestModel;
import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.MallProductVo;
import com.mcwl.resource.service.ModelImageService;
import com.mcwl.resource.service.ModelService;
import com.mcwl.resource.service.WorkFlowService;
import com.mcwl.system.service.ISysUserService;
import com.mcwl.web.controller.common.OssUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
*
@ -55,6 +50,7 @@ public class MallProductController extends BaseController {
* @param file
* @return
*/
@Anonymous
@PostMapping("/file")
public AjaxResult Malifile(@RequestParam MultipartFile file) {

View File

@ -1,5 +1,6 @@
package com.mcwl.web.controller.system;
import com.alibaba.fastjson2.JSONObject;
import com.mcwl.common.annotation.Anonymous;
import com.mcwl.common.constant.Constants;
import com.mcwl.common.constant.QueueConstants;
@ -18,15 +19,13 @@ import com.mcwl.framework.web.service.SysLoginService;
import com.mcwl.framework.web.service.SysPermissionService;
import com.mcwl.framework.web.service.TokenService;
import com.mcwl.system.service.ISysMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
@ -34,7 +33,6 @@ import java.util.concurrent.TimeUnit;
*
* @author mcwl
*/
@Slf4j
@RestController
public class SysLoginController
{
@ -74,19 +72,19 @@ public class SysLoginController
//生成验证码
String s = CodeUtils.generateCaptcha();
log.info("获取到的验证码:{}",s);
//存储redis
redisCache.setCacheObject(RedisConstants.CODE_PHONE+phone,s,1, TimeUnit.MINUTES);
//发送短信服务
// 构建 sendDataMap
Map<String, String> sendDataMap = new HashMap<>();
sendDataMap.put("code", s);
// TelSmsUtils.sendSms(phone,"SMS_460535072",sendDataMap);
PhoneLoginBody phoneLoginBody = PhoneLoginBody.builder().code(s)
.phone(phone).build();
rabbitTemplate.convertAndSend(QueueConstants.CODE_QUEUE,s);
rabbitTemplate.convertAndSend(QueueConstants.CODE_QUEUE, JSONObject.toJSONString(phoneLoginBody), message -> {
message.getMessageProperties().setMessageId(UUID.randomUUID().toString().replace("-",""));
return message;
});
return AjaxResult.success(s);
return AjaxResult.success();
}

View File

@ -76,6 +76,28 @@ spring:
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 1.13.246.108
# 端口默认为6379
port: 6370
# 数据库索引
database: 0
# 密码
password: MuYu_Cloud@Redis
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# 公众号配置
wechat:
@ -84,3 +106,26 @@ wechat:
# 应用密钥
secret: abbabcf1da711a3bbd95387ec83edcac
# yml版(application.yml)
aliyun:
oss:
bucketName: ybl2112
endpoint: oss-cn-beijing.aliyuncs.com
accessKeyId: LTAI5tSHZZ8wHJRP8X4r9TXT
accessKeySecret: F82IVNx0IGJ3AnP6gSIfcyql1HCXIH
accessPre: https://ybl2112.oss-cn-beijing.aliyuncs.com/
mall:
mgt:
aliPayConfig:
protocol: https
gatewayHost: openapi-sandbox.dl.alipaydev.com
signType: RSA2
appId: 9021000135682614
privateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCQxmQGcaiKjOhayWi+zNTvpp8B5YT8jFFkjLzrD+W+T2Dwf2GfFR4p95zsCJxYeoLWdghMPA6/GMFrLbuVFpaEjuTm4icqA9N8n5d3W0j7gh+wMjZoqyJclAIeb09ut7rY6mWzilA9kWmZnUG7MOWIU70RVRYrfJectCFw/odM9lG4XIVe13X2h+1ecTQyQzLWmnvKFCfo7dQjE7fIYiWfud1ZGUneNs3u73pNWMB6ThGTTCbs0atcgM3fYOg3q7fTxIu9VcaUCJiJ/kNbL9sVEyOrSyx2f2o6w06zdEaOiQFsuDeS8QPYGMg7pf42wAfqCO6hqxQiQT5vp1hvB0o1AgMBAAECggEAIhaEYLwMSispXo8D2cES9iaOU/z91hUX6Qv2Q4anuqqoEZh8nN91Db6etTjFz1NxURvTklelxTsH97t56n26DRY0MWTYgd0Kw9Iz8MeOpKGb4nnAM97vpUq4QQBGfLRIC2ENdzu+7vA5JBFR88hsky/cWaNmJ/EbJauIIDneE7GigMR2HF7kfzdZzOBN4ZEh/ef5NKeCnEieRJJhWRgrgNXVZ44Tqi67AM7ey9pyUtBe7fgzxXtrWXBN9yKaVxxSXm3KJXFQqA6mcilFVZaxMNlAySc4MP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1IqfxwUSIllbdvbjBvZFAIQlPa8U/zHJPgdGNHDt/Bwqp5uB0OkcGLB9PYyAXBEKiu6zdTsiZloUrPwgnBRJ0iNHYiWo/oOYD9KfopLA+D1nQjqq8m3ShZe46ecMo6ZCHtQI/HtgL/EGga5KY2zOUi0Wwviu8w79RjjzfdsDkzu5VnBdaSru4awDyiF9nAF+uPgA4ZOdLKkpoEANwuIorDW8tT69Gwh+mYx9sDJMxJf7XOekdPbymomiwIDAQAB
notifyUrl: https://253d7236.r27.cpolar.top/web/pay/notify
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do

View File

@ -65,28 +65,7 @@ spring:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: 1.13.246.108
# 端口默认为6379
port: 6370
# 数据库索引
database: 0
# 密码
password: MuYu_Cloud@Redis
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# token配置
token:
@ -163,25 +142,3 @@ xss:
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
# yml版(application.yml)
aliyun:
oss:
bucketName: ybl2112
endpoint: oss-cn-beijing.aliyuncs.com
accessKeyId: LTAI5tSHZZ8wHJRP8X4r9TXT
accessKeySecret: F82IVNx0IGJ3AnP6gSIfcyql1HCXIH
policy : https://ybl2112.oss-cn-beijing.aliyuncs.com/
mall:
mgt:
aliPayConfig:
protocol: https
gatewayHost: openapi-sandbox.dl.alipaydev.com
signType: RSA2
appId: 9021000135682614
privateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCQxmQGcaiKjOhayWi+zNTvpp8B5YT8jFFkjLzrD+W+T2Dwf2GfFR4p95zsCJxYeoLWdghMPA6/GMFrLbuVFpaEjuTm4icqA9N8n5d3W0j7gh+wMjZ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XwkXRtyzUYlhKh/r87JpAoGBAIavRp2mi/xrPvgpQQPv0k9L8llfOCHRnjoqC+thrZsNp8eRmJcBmMVnskofEZ2iHQuS71pw/n58EQTLo0ayJbhPjVJL8K3CovXzrfjbmqqoa5xi3bJQTiXdF6rMw1QpD6Uk05E1LVuQ6v/IZFr7kBYlAQWb8z3NhQq+bPU+nyLvAoGAGpBbSM8gPzdWQqkHoos0icu3cj0GhN3MU7+1Eb/rsXyh/lk5wtZTEnHjwhdUOUtwVNjvrv7CzA7unhOoaM6YcE/Zpd4zt8pjqH1Mhds7UHf4Xg+A+J4G6meYnhSwfBpOub02ncsqfBlXE0qhFv6AvcMewWndyLb8EYaUUXTYkG0=
publicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApHkjwHnoUnZuqbas+ZputyWIfU2WKBFKd+wFwlCZytpQhVA16CGAMCGpgjxUPpqbmOtPy74y0wxmDHB9IaYOVsVmi2SAl1IqfxwUSIllbdvbjBvZFAIQlPa8U/zHJPgdGNHDt/Bwqp5uB0OkcGLB9PYyAXBEKiu6zdTsiZloUrPwgnBRJ0iNHYiWo/oOYD9KfopLA+D1nQjqq8m3ShZe46ecMo6ZCHtQI/HtgL/EGga5KY2zOUi0Wwviu8w79RjjzfdsDkzu5VnBdaSru4awDyiF9nAF+uPgA4ZOdLKkpoEANwuIorDW8tT69Gwh+mYx9sDJMxJf7XOekdPbymomiwIDAQAB
notifyUrl: https://253d7236.r27.cpolar.top/web/pay/notify
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do

View File

@ -18,6 +18,24 @@
<dependencies>
<dependency>
<groupId>com.baidu.aip</groupId>
<artifactId>java-sdk</artifactId>
<version>4.12.0</version>
<exclusions>
<exclusion>
<artifactId>slf4j-simple</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- Jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!--OSS-->
<dependency>
<groupId>com.aliyun.oss</groupId>
@ -160,10 +178,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>

View File

@ -11,4 +11,6 @@ package com.mcwl.common.constant;
public class RedisConstants {
public static final String CODE_PHONE = "code_phone:";
public static final String CODE_UUID = "code_uuid:";
}

View File

@ -0,0 +1,69 @@
package com.mcwl.common.utils;
/**
* Base64
* @author DaiZibo
* @date 2025/1/16
* @apiNote
*/
public class Base64Util {
private static final char last2byte = (char) Integer.parseInt("00000011", 2);
private static final char last4byte = (char) Integer.parseInt("00001111", 2);
private static final char last6byte = (char) Integer.parseInt("00111111", 2);
private static final char lead6byte = (char) Integer.parseInt("11111100", 2);
private static final char lead4byte = (char) Integer.parseInt("11110000", 2);
private static final char lead2byte = (char) Integer.parseInt("11000000", 2);
private static final char[] encodeTable = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
public Base64Util() {
}
public static String encode(byte[] from) {
StringBuilder to = new StringBuilder((int) ((double) from.length * 1.34D) + 3);
int num = 0;
char currentByte = 0;
int i;
for (i = 0; i < from.length; ++i) {
for (num %= 8; num < 8; num += 6) {
switch (num) {
case 0:
currentByte = (char) (from[i] & lead6byte);
currentByte = (char) (currentByte >>> 2);
case 1:
case 3:
case 5:
default:
break;
case 2:
currentByte = (char) (from[i] & last6byte);
break;
case 4:
currentByte = (char) (from[i] & last4byte);
currentByte = (char) (currentByte << 2);
if (i + 1 < from.length) {
currentByte = (char) (currentByte | (from[i + 1] & lead2byte) >>> 6);
}
break;
case 6:
currentByte = (char) (from[i] & last2byte);
currentByte = (char) (currentByte << 4);
if (i + 1 < from.length) {
currentByte = (char) (currentByte | (from[i + 1] & lead4byte) >>> 4);
}
}
to.append(encodeTable[currentByte]);
}
}
if (to.length() % 4 != 0) {
for (i = 4 - to.length() % 4; i > 0; --i) {
to.append("=");
}
}
return to.toString();
}
}

View File

@ -0,0 +1,77 @@
package com.mcwl.common.utils;
import java.io.*;
/**
*
* @author DaiZibo
* @date 2025/1/16
* @apiNote
*/
public class FileUtil {
/**
*
*/
public static String readFileAsString(String filePath) throws IOException {
File file = new File(filePath);
if (!file.exists()) {
throw new FileNotFoundException(filePath);
}
if (file.length() > 1024 * 1024 * 1024) {
throw new IOException("File is too large");
}
StringBuilder sb = new StringBuilder((int) (file.length()));
// 创建字节输入流
FileInputStream fis = new FileInputStream(filePath);
// 创建一个长度为10240的Buffer
byte[] bbuf = new byte[10240];
// 用于保存实际读取的字节数
int hasRead = 0;
while ( (hasRead = fis.read(bbuf)) > 0 ) {
sb.append(new String(bbuf, 0, hasRead));
}
fis.close();
return sb.toString();
}
/**
* byte[]
*/
public static byte[] readFileByBytes(String filePath) throws IOException {
File file = new File(filePath);
if (!file.exists()) {
throw new FileNotFoundException(filePath);
} else {
ByteArrayOutputStream bos = new ByteArrayOutputStream((int) file.length());
BufferedInputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
short bufSize = 1024;
byte[] buffer = new byte[bufSize];
int len1;
while (-1 != (len1 = in.read(buffer, 0, bufSize))) {
bos.write(buffer, 0, len1);
}
byte[] var7 = bos.toByteArray();
return var7;
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException var14) {
var14.printStackTrace();
}
bos.close();
}
}
}
}

View File

@ -0,0 +1,82 @@
package com.mcwl.common.utils;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.Map;
/**
* http
*
* @author DaiZibo
* @date 2025/1/16
* @apiNote
*/
public class HttpUtil {
public static String post(String requestUrl, String accessToken, String params)
throws Exception {
String contentType = "application/x-www-form-urlencoded";
return HttpUtil.post(requestUrl, accessToken, contentType, params);
}
public static String post(String requestUrl, String accessToken, String contentType, String params)
throws Exception {
String encoding = "UTF-8";
if (requestUrl.contains("nlp")) {
encoding = "GBK";
}
return HttpUtil.post(requestUrl, accessToken, contentType, params, encoding);
}
public static String post(String requestUrl, String accessToken, String contentType, String params, String encoding)
throws Exception {
String url = requestUrl + "?access_token=" + accessToken;
return HttpUtil.postGeneralUrl(url, contentType, params, encoding);
}
public static String postGeneralUrl(String generalUrl, String contentType, String params, String encoding)
throws Exception {
URL url = new URL(generalUrl);
// 打开和URL之间的连接
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
// 设置通用的请求属性
connection.setRequestProperty("Content-Type", contentType);
connection.setRequestProperty("Connection", "Keep-Alive");
connection.setUseCaches(false);
connection.setDoOutput(true);
connection.setDoInput(true);
// 得到请求的输出流对象
DataOutputStream out = new DataOutputStream(connection.getOutputStream());
out.write(params.getBytes(encoding));
out.flush();
out.close();
// 建立实际的连接
connection.connect();
// 获取所有响应头字段
Map<String, List<String>> headers = connection.getHeaderFields();
// 遍历所有的响应头字段
for (String key : headers.keySet()) {
System.err.println(key + "--->" + headers.get(key));
}
// 定义 BufferedReader输入流来读取URL的响应
BufferedReader in = null;
in = new BufferedReader(
new InputStreamReader(connection.getInputStream(), encoding));
String result = "";
String getLine;
while ((getLine = in.readLine()) != null) {
result += getLine;
}
in.close();
System.err.println("result:" + result);
return result;
}
}

View File

@ -18,8 +18,8 @@ public class TelSmsUtils {
/**
* AccessKeyaccessKeySecretAPI访
*/
private static String accessKeyId = "LTAIEVXszCmcd1T5";
private static String accessKeySecret = "2zHwciQXln8wExSEnkIYtRTSwLeRNd";
private static String accessKeyId = "LTAI5tSHZZ8wHJRP8X4r9TXT";
private static String accessKeySecret = "F82IVNx0IGJ3AnP6gSIfcyql1HCXIH";
/**
* 访
@ -28,7 +28,7 @@ public class TelSmsUtils {
/**
*
*/
private static String signName = "帝宇";
private static String signName = "魔创未来";
/**
*
@ -65,7 +65,7 @@ public class TelSmsUtils {
/**
*
* @param tel
* @param templateCode SMS_153991546
* @param templateCode
* @param sendDataMap
*/
public static String sendSms(String tel , String templateCode , Map<String,String> sendDataMap){

View File

@ -23,6 +23,7 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- SpringBoot 拦截器 -->
<dependency>
<groupId>org.springframework.boot</groupId>