├── elasticsearch-canal-demo
├── README.md
├── src
│ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── fox
│ │ │ └── es_canal
│ │ │ ├── constant
│ │ │ └── BlogConstants.java
│ │ │ ├── service
│ │ │ ├── BlogService.java
│ │ │ └── impl
│ │ │ │ └── BlogServiceImpl.java
│ │ │ ├── ElasticsearchCanalDemoApplication.java
│ │ │ ├── config
│ │ │ ├── WebMvcConfig.java
│ │ │ └── ElasticsearchConfig.java
│ │ │ ├── dto
│ │ │ └── BlogSimpleInfoDTO.java
│ │ │ ├── controller
│ │ │ ├── TestController.java
│ │ │ └── BlogController.java
│ │ │ └── entity
│ │ │ ├── Result.java
│ │ │ └── JacksonObjectMapper.java
│ │ └── resources
│ │ └── application.yml
├── doc
│ ├── es-mapping
│ └── table.sql
└── pom.xml
├── qrcode-demo
├── README.md
├── src
│ └── main
│ │ ├── resources
│ │ ├── application.yml
│ │ └── static
│ │ │ └── html
│ │ │ ├── zxing
│ │ │ ├── CommonBlackWhite.html
│ │ │ └── ZXingLogo.html
│ │ │ └── qrcodePlugin
│ │ │ ├── ColorCode.html
│ │ │ ├── ShapeCode.html
│ │ │ ├── CommonBlackWhiteCode.html
│ │ │ ├── ImgFillCode.html
│ │ │ ├── LogoBlackWhiteCode.html
│ │ │ └── BgBlackWhiteCode.html
│ │ └── java
│ │ └── com
│ │ └── zhulang
│ │ └── qrcode
│ │ ├── Application.java
│ │ ├── controller
│ │ ├── ZXingController.java
│ │ └── QrCodePluginController.java
│ │ └── util
│ │ ├── QrCodePluginUtils.java
│ │ └── ZXingUtils.java
└── pom.xml
├── .idea
├── vcs.xml
├── .gitignore
├── modules.xml
├── SpringbootDemo.iml
├── inspectionProfiles
│ └── Project_Default.xml
├── jarRepositories.xml
├── misc.xml
├── compiler.xml
└── encodings.xml
├── xfxh-web-support-context-demo
├── README.md
├── src
│ └── main
│ │ ├── resources
│ │ ├── META-INF
│ │ │ └── additional-spring-configuration-metadata.json
│ │ ├── demo-json
│ │ │ ├── request.json
│ │ │ └── response.json
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── zhulang
│ │ └── xfxh
│ │ ├── dto
│ │ ├── InteractMsg.java
│ │ ├── MsgDTO.java
│ │ ├── RequestDTO.java
│ │ ├── ResponseDTO.java
│ │ └── RecordsArray.java
│ │ ├── Application.java
│ │ ├── config
│ │ └── XfXhConfig.java
│ │ ├── component
│ │ ├── ScheduleTask.java
│ │ ├── MemoryUserRecordSpace.java
│ │ └── XfXhStreamClient.java
│ │ ├── listener
│ │ └── XfXhWebSocketListener.java
│ │ └── controller
│ │ └── TestController.java
└── pom.xml
├── elasticsearch-demo
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.yml
│ │ └── java
│ │ │ └── com
│ │ │ └── fox
│ │ │ └── es
│ │ │ ├── service
│ │ │ ├── BlogService.java
│ │ │ └── impl
│ │ │ │ └── BlogServiceImpl.java
│ │ │ ├── ElasticsearchDemoApplication.java
│ │ │ ├── dto
│ │ │ └── BlogSimpleInfoDTO.java
│ │ │ ├── config
│ │ │ ├── WebMvcConfig.java
│ │ │ └── ElasticsearchConfig.java
│ │ │ ├── controller
│ │ │ ├── TestController.java
│ │ │ └── BlogController.java
│ │ │ └── entity
│ │ │ ├── Result.java
│ │ │ └── JacksonObjectMapper.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── fox
│ │ └── es
│ │ └── CommonTest.java
├── doc
│ ├── table.sql
│ └── mapping.kibana
└── pom.xml
├── minio-chunk-demo
├── README.md
├── src
│ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── fox
│ │ │ └── miniodemo
│ │ │ ├── dao
│ │ │ └── MediaFileMapper.java
│ │ │ ├── MinioChunkDemoApplication.java
│ │ │ ├── handler
│ │ │ └── MyMetaObjectHandler.java
│ │ │ ├── config
│ │ │ ├── MyBatisPlusConfig.java
│ │ │ └── MinioConfig.java
│ │ │ ├── vo
│ │ │ ├── CheckChunkFileVO.java
│ │ │ └── UploadMergeChunksVO.java
│ │ │ ├── util
│ │ │ ├── FileFormatUtils.java
│ │ │ ├── RegexUtils.java
│ │ │ ├── FileTypeUtils.java
│ │ │ ├── CipherUtils.java
│ │ │ └── MinioClientUtils.java
│ │ │ ├── service
│ │ │ └── MediaFileService.java
│ │ │ ├── po
│ │ │ └── MediaFile.java
│ │ │ ├── constant
│ │ │ └── HttpStatus.java
│ │ │ ├── entity
│ │ │ └── Result.java
│ │ │ └── controller
│ │ │ └── MediaFileController.java
│ │ └── resources
│ │ └── application.yaml
├── doc
│ └── table.sql
└── pom.xml
├── sms-demo
├── src
│ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── fox
│ │ │ └── sms
│ │ │ ├── service
│ │ │ ├── SmsAliService.java
│ │ │ └── impl
│ │ │ │ └── SmsAliServiceImpl.java
│ │ │ ├── SmsDemoApplication.java
│ │ │ ├── constant
│ │ │ └── RedisConstants.java
│ │ │ ├── config
│ │ │ ├── SmsConfig.java
│ │ │ └── RedisConfig.java
│ │ │ ├── controller
│ │ │ └── SmsAliController.java
│ │ │ ├── util
│ │ │ ├── RegexUtils.java
│ │ │ ├── AliSmsTemplateUtils.java
│ │ │ └── RedisCacheUtils.java
│ │ │ ├── entity
│ │ │ └── Result.java
│ │ │ ├── component
│ │ │ └── FastJsonRedisSerializer.java
│ │ │ └── DirectTest
│ │ │ └── AliSmsTest.java
│ │ └── resources
│ │ └── application.yml
├── README.md
└── pom.xml
├── .gitignore
├── xfxh-web-simple-demo
├── src
│ └── main
│ │ ├── resources
│ │ ├── demo-json
│ │ │ ├── request.json
│ │ │ └── response.json
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── zhulang
│ │ └── xfxhsimple
│ │ ├── XfXhApplication.java
│ │ ├── dto
│ │ ├── MsgDTO.java
│ │ ├── RequestDTO.java
│ │ └── ResponseDTO.java
│ │ ├── config
│ │ └── XfXhConfig.java
│ │ ├── listener
│ │ └── XfXhWebSocketListener.java
│ │ ├── controller
│ │ └── TestController.java
│ │ └── component
│ │ └── XfXhStreamClient.java
├── README.md
└── pom.xml
└── README.md
/elasticsearch-canal-demo/README.md:
--------------------------------------------------------------------------------
1 | 1. 注意修改application.yml配置文件信息,改为你自己的ip地址
--------------------------------------------------------------------------------
/qrcode-demo/README.md:
--------------------------------------------------------------------------------
1 | 1.具体说明文档参考:[Java生成二维码(前后端分离项目实战)](https://blog.csdn.net/qq_62982856/article/details/132572246)
--------------------------------------------------------------------------------
/qrcode-demo/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | servlet:
3 | multipart:
4 | max-file-size: 10MB
5 | file-size-threshold: 2MB
6 | max-request-size: 15MB
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/xfxh-web-support-context-demo/README.md:
--------------------------------------------------------------------------------
1 | # 讯飞星火大模型后端接口
2 |
3 | 启动项目后,直接使用 GET 请求访问 http://localhost:8080/test/sendQuestion?question=hello&id=2
4 |
5 | 讯飞官方web文档:https://www.xfyun.cn/doc/spark/Web.html
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 | # Datasource local storage ignored files
7 | /dataSources/
8 | /dataSources.local.xml
9 |
--------------------------------------------------------------------------------
/xfxh-web-support-context-demo/src/main/resources/META-INF/additional-spring-configuration-metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "properties": [
3 | {
4 | "name": "xfxh.hostUrl",
5 | "type": "java.lang.String",
6 | "description": "Description for xfxh.hostUrl."
7 | }
8 | ] }
--------------------------------------------------------------------------------
/elasticsearch-demo/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | # 服务端口
3 | port: 9999
4 | elasticsearch:
5 | # es访问ip
6 | hostname: 127.0.0.1
7 | # es访问port
8 | port: 9200
9 | blog:
10 | # 访问索引
11 | index: blog
12 | # 搜索返回字段
13 | source_fields: id,userId,title,introduce,createTime
--------------------------------------------------------------------------------
/minio-chunk-demo/README.md:
--------------------------------------------------------------------------------
1 | 1.为了简单操作,这里只设计了一张表,即存放文件的表,放在了doc文件夹下,自行参考
2 |
3 | 2.代码的具体实现思路逻辑参考我的文章:[minio&前后端分离上传视频/上传大文件——前后端分离断点续传&minio分片上传实现](https://blog.csdn.net/qq_62982856/article/details/129002288)
4 |
5 | 3.MediaFileServiceImpl.java 中的uploadMergeChunks方法,里面有向数据库增加文件记录的操作,设置上传者id时我设置为了定值,实际开发中应当根据token拿到当前用户的Id。
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/src/main/java/com/fox/es_canal/constant/BlogConstants.java:
--------------------------------------------------------------------------------
1 | package com.fox.es_canal.constant;
2 |
3 | /**
4 | * @author 狐狸半面添
5 | * @create 2023-03-31 3:41
6 | */
7 | public class BlogConstants {
8 | /**
9 | * 每页搜索最多15条
10 | */
11 | public static final int SEARCH_PAGE_NUM = 15;
12 | }
13 |
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | # 服务端口
3 | port: 9999
4 | elasticsearch:
5 | # es访问ip
6 | hostname: 192.168.65.133
7 | # es访问port
8 | port: 9200
9 | blog:
10 | # 访问索引
11 | index: es_demo_collect
12 | # 搜索返回字段
13 | source_fields: userId,title,username,userIcon,introduce,createTime,updateTime
--------------------------------------------------------------------------------
/.idea/SpringbootDemo.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/sms-demo/src/main/java/com/fox/sms/service/SmsAliService.java:
--------------------------------------------------------------------------------
1 | package com.fox.sms.service;
2 |
3 | import com.fox.sms.entity.Result;
4 |
5 | /**
6 | * @author 狐狸半面添
7 | * @create 2023-04-01 16:26
8 | */
9 | public interface SmsAliService {
10 | /**
11 | * 发送用于登录与注册的验证码
12 | *
13 | * @param phone 手机号
14 | * @return 发送情况
15 | */
16 | Result sendLoginCode(String phone);
17 | }
18 |
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/java/com/fox/miniodemo/dao/MediaFileMapper.java:
--------------------------------------------------------------------------------
1 | package com.fox.miniodemo.dao;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.fox.miniodemo.po.MediaFile;
5 |
6 | /**
7 | *
8 | * 第三方服务-媒资文件表 Mapper 接口
9 | *
10 | *
11 | * @author 狐狸半面添
12 | * @since 2023-02-08
13 | */
14 | public interface MediaFileMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/xfxh-web-support-context-demo/src/main/java/com/zhulang/xfxh/dto/InteractMsg.java:
--------------------------------------------------------------------------------
1 | package com.zhulang.xfxh.dto;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | /**
8 | * @author 狐狸半面添
9 | * @create 2023-09-17 0:53
10 | */
11 | @Data
12 | @NoArgsConstructor
13 | @AllArgsConstructor
14 | public class InteractMsg {
15 | private MsgDTO userMsg;
16 | private MsgDTO assistantMsg;
17 | }
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java
11 | .mtj.
12 |
13 | # Package Files
14 | *.jar
15 | *.war
16 | *.nar
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # virtual machine crash logs, see
23 | http://www.java.com/en/download/help/error_hotspot.xml
24 | hs_err_pid*
25 |
26 | .classpath
27 | .project
28 | .settings
29 | target
30 | .idea
31 | *.iml
--------------------------------------------------------------------------------
/qrcode-demo/src/main/java/com/zhulang/qrcode/Application.java:
--------------------------------------------------------------------------------
1 | package com.zhulang.qrcode;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author 狐狸半面添
8 | * @create 2023-08-28 21:26
9 | */
10 | @SpringBootApplication
11 | public class Application {
12 | public static void main(String[] args) {
13 | SpringApplication.run(Application.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/xfxh-web-simple-demo/src/main/resources/demo-json/request.json:
--------------------------------------------------------------------------------
1 | {
2 | "header": {
3 | "app_id": "12345",
4 | "uid": "12345"
5 | },
6 | "parameter": {
7 | "chat": {
8 | "domain": "general",
9 | "temperature": 0.5,
10 | "max_tokens": 1024
11 | }
12 | },
13 | "payload": {
14 | "message": {
15 | "text": [
16 | {
17 | "role": "user",
18 | "content": "你是谁"
19 | }
20 | ]
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/sms-demo/src/main/java/com/fox/sms/SmsDemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.fox.sms;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author 狐狸半面添
8 | * @create 2023-03-22 18:07
9 | */
10 | @SpringBootApplication
11 | public class SmsDemoApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(SmsDemoApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/xfxh-web-support-context-demo/src/main/resources/demo-json/request.json:
--------------------------------------------------------------------------------
1 | {
2 | "header": {
3 | "app_id": "12345",
4 | "uid": "12345"
5 | },
6 | "parameter": {
7 | "chat": {
8 | "domain": "general",
9 | "temperature": 0.5,
10 | "max_tokens": 1024
11 | }
12 | },
13 | "payload": {
14 | "message": {
15 | "text": [
16 | {
17 | "role": "user",
18 | "content": "你是谁"
19 | }
20 | ]
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/xfxh-web-support-context-demo/src/main/java/com/zhulang/xfxh/Application.java:
--------------------------------------------------------------------------------
1 | package com.zhulang.xfxh;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author 狐狸半面添
8 | * @create 2023-09-15 0:43
9 | */
10 | @SpringBootApplication
11 | public class Application {
12 | public static void main(String[] args) {
13 | SpringApplication.run(Application.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/xfxh-web-simple-demo/src/main/java/com/zhulang/xfxhsimple/XfXhApplication.java:
--------------------------------------------------------------------------------
1 | package com.zhulang.xfxhsimple;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author 狐狸半面添
8 | * @create 2023-09-20 1:42
9 | */
10 | @SpringBootApplication
11 | public class XfXhApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(XfXhApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/elasticsearch-demo/src/main/java/com/fox/es/service/BlogService.java:
--------------------------------------------------------------------------------
1 | package com.fox.es.service;
2 |
3 | import com.fox.es.entity.Result;
4 |
5 | /**
6 | * @author 狐狸半面添
7 | * @create 2023-03-22 20:18
8 | */
9 | public interface BlogService {
10 |
11 | /**
12 | * 通过关键词获取数据列表
13 | *
14 | * @param keyWords 关键词
15 | * @param pageNo 页码
16 | * @param pageSize 每页大小
17 | * @return 数据列表,按照相关性从高到低进行排序
18 | */
19 | Result list(String keyWords, int pageNo, int pageSize);
20 | }
21 |
--------------------------------------------------------------------------------
/elasticsearch-demo/src/main/java/com/fox/es/ElasticsearchDemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.fox.es;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author 狐狸半面添
8 | * @create 2023-03-22 18:07
9 | */
10 | @SpringBootApplication
11 | public class ElasticsearchDemoApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(ElasticsearchDemoApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/src/main/java/com/fox/es_canal/service/BlogService.java:
--------------------------------------------------------------------------------
1 | package com.fox.es_canal.service;
2 |
3 | import com.fox.es_canal.entity.Result;
4 |
5 | /**
6 | * @author 狐狸半面添
7 | * @create 2023-03-22 20:18
8 | */
9 | public interface BlogService {
10 |
11 | /**
12 | * 通过关键词获取数据列表
13 | *
14 | * @param keyWords 关键词
15 | * @param pageNo 页码
16 | * @param pageSize 每页大小
17 | * @return 数据列表,按照相关性从高到低进行排序
18 | */
19 | Result list(String keyWords, int pageNo, int pageSize);
20 | }
21 |
--------------------------------------------------------------------------------
/sms-demo/src/main/java/com/fox/sms/constant/RedisConstants.java:
--------------------------------------------------------------------------------
1 | package com.fox.sms.constant;
2 |
3 | /**
4 | * 定义 redis 缓存的常量前缀
5 | *
6 | * @author 狐狸半面添
7 | * @create 2023-04-01 16:37
8 | */
9 | public class RedisConstants {
10 | /**
11 | * 用户登录&注册手机验证码
12 | * 有效期:5分钟
13 | * 剩余时长大于 4分钟 则无法再次发送
14 | */
15 | public static final String LOGIN_USER_CODE_KEY = "login:user:code:";
16 | public static final Long LOGIN_USER_CODE_TTL = 60 * 5L;
17 | public static final Long LOGIN_USER_CODE_AGAIN_TTL = 60 * 4L;
18 | }
19 |
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/src/main/java/com/fox/es_canal/ElasticsearchCanalDemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.fox.es_canal;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author 狐狸半面添
8 | * @create 2023-03-22 18:07
9 | */
10 | @SpringBootApplication
11 | public class ElasticsearchCanalDemoApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(ElasticsearchCanalDemoApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/sms-demo/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 10505
3 | spring:
4 | redis:
5 | host: 8.130.97.145
6 | port: 6379
7 | password: 123456
8 | lettuce:
9 | pool:
10 | max-active: 10
11 | max-idle: 10
12 | min-idle: 1
13 | time-between-eviction-runs: 10s
14 | database: 0
15 | sms:
16 | ali:
17 | # 子用户的访问键
18 | accessKeyId: LTAI5tFhzvktt9U5j4ak****
19 | # 子用户的访问密钥
20 | accessKeySecret: hYLiytNltwB1pOetnBiNcXPmXq****
21 | # 签名名称
22 | signName: 逐浪教育
23 | # 登录短信模板的code
24 | loginTemplateCode: SMS_275395309
25 |
--------------------------------------------------------------------------------
/elasticsearch-demo/src/test/java/com/fox/es/CommonTest.java:
--------------------------------------------------------------------------------
1 | package com.fox.es;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.fox.es.dto.BlogSimpleInfoDTO;
5 |
6 | /**
7 | * @author 狐狸半面添
8 | * @create 2023-03-23 1:04
9 | */
10 | public class CommonTest {
11 | public static void main(String[] args) {
12 | String json = "{\"createTime\":\"2023-03-23 00:40:20\",\"introduce\":\"Java的起源\",\"id\":1000,\"title\":\"Java语言\",\"userId\":1626989073847750657}";
13 | BlogSimpleInfoDTO blogSimpleInfoDTO = JSON.parseObject(json, BlogSimpleInfoDTO.class);
14 | System.out.println(blogSimpleInfoDTO);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/java/com/fox/miniodemo/MinioChunkDemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.fox.miniodemo;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.context.annotation.EnableAspectJAutoProxy;
6 |
7 | /**
8 | * 启动类
9 | * EnableAspectJAutoProxy 暴露代理对象
10 | *
11 | * @author 狐狸半面添
12 | * @create 2023-01-16 17:03
13 | */
14 | @SpringBootApplication
15 | @EnableAspectJAutoProxy(exposeProxy = true)
16 | public class MinioChunkDemoApplication {
17 | public static void main(String[] args) {
18 | SpringApplication.run(MinioChunkDemoApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/sms-demo/src/main/java/com/fox/sms/config/SmsConfig.java:
--------------------------------------------------------------------------------
1 | package com.fox.sms.config;
2 |
3 | import com.fox.sms.util.AliSmsTemplateUtils;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * @author 狐狸半面添
10 | * @create 2023-04-01 15:46
11 | */
12 | @Configuration
13 | public class SmsConfig {
14 |
15 | /**
16 | * 配置阿里短信发送工具类
17 | */
18 | @Bean
19 | @ConfigurationProperties(prefix = "sms.ali")
20 | public AliSmsTemplateUtils aliSmsTemplateUtils(){
21 | return new AliSmsTemplateUtils();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xfxh-web-simple-demo/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | xfxh:
2 | # 服务引擎使用 讯飞星火认知大模型V2.0,如果使用 V1.5 需要将 hostUrl 修改为 https://spark-api.xf-yun.com/v1.1/chat
3 | hostUrl: https://spark-api.xf-yun.com/v2.1/chat
4 | # 发送请求时指定的访问领域,如果是 V1.5版本 设置为 general,如果是 V2版本 设置为 generalv2
5 | domain: generalv2
6 | # 核采样阈值。用于决定结果随机性,取值越高随机性越强即相同的问题得到的不同答案的可能性越高。取值 [0,1]
7 | temperature: 0.5
8 | # 模型回答的tokens的最大长度,V1.5取值为[1,4096],V2.0取值为[1,8192]。
9 | maxTokens: 2048
10 | # 大模型回复问题的最大响应时长,单位 s
11 | maxResponseTime: 30
12 | # 允许同时连接大模型的 websocket 数,如果是普通(免费)用户为 2,超过这个数连接响应会报错,具体参考官网。
13 | QPS: 2
14 | # 用于权限验证,从服务接口认证信息中获取
15 | appId:
16 | # 用于权限验证,从服务接口认证信息中获取
17 | apiKey:
18 | # 用于权限验证,从服务接口认证信息中获取
19 | apiSecret:
--------------------------------------------------------------------------------
/xfxh-web-simple-demo/src/main/resources/demo-json/response.json:
--------------------------------------------------------------------------------
1 | // 接口为流式返回,此示例为最后一次返回结果,开发者需要将接口多次返回的结果进行拼接展示
2 |
3 | {
4 | "header": {
5 | "code": 0,
6 | "message": "Success",
7 | "sid": "cht000cb087@dx18793cd421fb894542",
8 | "status": 2
9 | },
10 | "payload": {
11 | "choices": {
12 | "status": 1,
13 | "seq": 0,
14 | "text": [
15 | {
16 | "content": "我有什么可",
17 | "role": "assistant",
18 | "index": 0
19 | }
20 | ]
21 | },
22 | "usage": {
23 | "text": {
24 | "question_tokens": 4,
25 | "prompt_tokens": 5,
26 | "completion_tokens": 9,
27 | "total_tokens": 14
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/xfxh-web-support-context-demo/src/main/resources/demo-json/response.json:
--------------------------------------------------------------------------------
1 | // 接口为流式返回,此示例为最后一次返回结果,开发者需要将接口多次返回的结果进行拼接展示
2 |
3 | {
4 | "header": {
5 | "code": 0,
6 | "message": "Success",
7 | "sid": "cht000cb087@dx18793cd421fb894542",
8 | "status": 2
9 | },
10 | "payload": {
11 | "choices": {
12 | "status": 1,
13 | "seq": 0,
14 | "text": [
15 | {
16 | "content": "我有什么可",
17 | "role": "assistant",
18 | "index": 0
19 | }
20 | ]
21 | },
22 | "usage": {
23 | "text": {
24 | "question_tokens": 4,
25 | "prompt_tokens": 5,
26 | "completion_tokens": 9,
27 | "total_tokens": 14
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/elasticsearch-demo/src/main/java/com/fox/es/dto/BlogSimpleInfoDTO.java:
--------------------------------------------------------------------------------
1 | package com.fox.es.dto;
2 |
3 | import com.fasterxml.jackson.annotation.JsonFormat;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | import java.time.LocalDateTime;
9 |
10 | /**
11 | * @author 狐狸半面添
12 | * @create 2023-03-22 21:33
13 | */
14 | @Data
15 | @NoArgsConstructor
16 | @AllArgsConstructor
17 | public class BlogSimpleInfoDTO {
18 | /**
19 | * 主键id
20 | */
21 | private Integer id;
22 | /**
23 | * 用户id
24 | */
25 | private Long userId;
26 | /**
27 | * 标题
28 | */
29 | private String title;
30 | /**
31 | * 介绍
32 | */
33 | private String introduce;
34 | /**
35 | * 创建时间
36 | */
37 | private LocalDateTime createTime;
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/xfxh-web-support-context-demo/src/main/java/com/zhulang/xfxh/config/XfXhConfig.java:
--------------------------------------------------------------------------------
1 | package com.zhulang.xfxh.config;
2 |
3 | import lombok.Data;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | /**
8 | * @author 狐狸半面添
9 | * @create 2023-09-15 0:46
10 | */
11 | @Configuration
12 | @ConfigurationProperties(prefix = "xfxh")
13 | @Data
14 | public class XfXhConfig {
15 | private String hostUrl;
16 | private String domain;
17 | private Float temperature;
18 | private Integer maxTokens;
19 | private String appId;
20 | private String apiKey;
21 | private String apiSecret;
22 | private Integer maxInteractCount;
23 | private Integer maxUserCount;
24 | private Integer userRecordMaxStatus;
25 | private Integer maxResponseTime;
26 | }
27 |
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/java/com/fox/miniodemo/handler/MyMetaObjectHandler.java:
--------------------------------------------------------------------------------
1 | package com.fox.miniodemo.handler;
2 |
3 | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
4 | import org.apache.ibatis.reflection.MetaObject;
5 |
6 | import java.time.LocalDateTime;
7 |
8 | /**
9 | * mybatis-plus 自动填充器
10 | *
11 | * @author 狐狸半面添
12 | * @create 2023-01-18 23:14
13 | */
14 |
15 | public class MyMetaObjectHandler implements MetaObjectHandler {
16 |
17 | @Override
18 | public void insertFill(MetaObject metaObject) {
19 | this.setFieldValByName("createTime", LocalDateTime.now(), metaObject);
20 | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject);
21 | }
22 |
23 | @Override
24 | public void updateFill(MetaObject metaObject) {
25 | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/java/com/fox/miniodemo/config/MyBatisPlusConfig.java:
--------------------------------------------------------------------------------
1 | package com.fox.miniodemo.config;
2 |
3 | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
4 | import com.fox.miniodemo.handler.MyMetaObjectHandler;
5 | import org.mybatis.spring.annotation.MapperScan;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.transaction.annotation.EnableTransactionManagement;
9 |
10 | /**
11 | * 与ORM框架mybatis-plus相关的配置
12 | * EnableTransactionManagement 开启事务
13 | *
14 | * @author 狐狸半面添
15 | * @create 2023-01-15 22:40
16 | */
17 | @Configuration
18 | @EnableTransactionManagement
19 | @MapperScan("com.fox.miniodemo.dao")
20 | public class MyBatisPlusConfig {
21 | @Bean
22 | public MetaObjectHandler metaObjectHandler(){
23 | return new MyMetaObjectHandler();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/elasticsearch-demo/src/main/java/com/fox/es/config/WebMvcConfig.java:
--------------------------------------------------------------------------------
1 | package com.fox.es.config;
2 |
3 | import com.fox.es.entity.JacksonObjectMapper;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.http.converter.HttpMessageConverter;
6 | import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author 狐狸半面添
13 | * @create 2023-02-11 23:25
14 | */
15 |
16 | @Configuration
17 | public class WebMvcConfig extends WebMvcConfigurationSupport {
18 |
19 | @Override
20 | protected void extendMessageConverters(List> converters) {
21 | MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
22 | messageConverter.setObjectMapper(new JacksonObjectMapper());
23 | converters.add(0, messageConverter);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SpringbootDemo
2 | 1.minio-chunk-demo 模块是minio分块处理服务,对应文章:[minio&前后端分离上传视频/上传大文件——前后端分离断点续传&minio分片上传实现](https://blog.csdn.net/qq_62982856/article/details/129002288)
3 | 在 minio-chunk-demo 模块下的doc文件下有数据库表的创建。
4 |
5 | 2.elasticsearch-demo 模块是es搜索服务实战代码,对应文章:[springboot整合es进行搜索](https://blog.csdn.net/qq_62982856/article/details/129722916)
6 |
7 | 3.elasticsearch-canal-demo 模块是es搜索服务+canal实现同步数据库数据到es的实战代码,对应文章:[docker环境安装mysql、canal、elasticsearch,基于binlog利用canal实现mysql的数据同步到elasticsearch中](https://blog.csdn.net/qq_62982856/article/details/129875733)
8 |
9 | 4.sms-demo 模块是手机短信服务,对应文章:[阿里云短信服务详细说明与实战开发后端代码](https://blog.csdn.net/qq_62982856/article/details/129901491)
10 |
11 | 5.qrcode-demo 模块是二维码服务,对应文章:[Java生成二维码(前后端分离项目实战)](https://blog.csdn.net/qq_62982856/article/details/132572246)
12 |
13 | 6.xfxh-web-simple-demo 模块是讯飞星火大模型后端接口服务,对应文章:[讯飞星火认知大模型Java后端接口](https://blog.csdn.net/qq_62982856/article/details/133151673)
14 |
15 | 7.xfxh-web-support-context-demo 模块是讯飞星火大模型后端接口增强服务,在 xfxh-web-simple-demo 模块接口基础上支持了基于上下文的问题回答
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/src/main/java/com/fox/es_canal/config/WebMvcConfig.java:
--------------------------------------------------------------------------------
1 | package com.fox.es_canal.config;
2 |
3 | import com.fox.es_canal.entity.JacksonObjectMapper;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.http.converter.HttpMessageConverter;
6 | import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author 狐狸半面添
13 | * @create 2023-02-11 23:25
14 | */
15 |
16 | @Configuration
17 | public class WebMvcConfig extends WebMvcConfigurationSupport {
18 |
19 | @Override
20 | protected void extendMessageConverters(List> converters) {
21 | MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
22 | messageConverter.setObjectMapper(new JacksonObjectMapper());
23 | converters.add(0, messageConverter);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/src/main/java/com/fox/es_canal/dto/BlogSimpleInfoDTO.java:
--------------------------------------------------------------------------------
1 | package com.fox.es_canal.dto;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | import java.time.LocalDateTime;
8 |
9 | /**
10 | * @author 狐狸半面添
11 | * @create 2023-03-22 21:33
12 | */
13 | @Data
14 | @NoArgsConstructor
15 | @AllArgsConstructor
16 | public class BlogSimpleInfoDTO {
17 | /**
18 | * 主键id
19 | */
20 | private Integer id;
21 | /**
22 | * 用户id
23 | */
24 | private Long userId;
25 | /**
26 | * 用户名
27 | */
28 | private String username;
29 | /**
30 | * 用户头像
31 | */
32 | private String userIcon;
33 | /**
34 | * 标题
35 | */
36 | private String title;
37 | /**
38 | * 介绍
39 | */
40 | private String introduce;
41 | /**
42 | * 创建时间
43 | */
44 | private LocalDateTime createTime;
45 | /**
46 | * 修改时间
47 | */
48 | private LocalDateTime updateTime;
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/elasticsearch-demo/src/main/java/com/fox/es/config/ElasticsearchConfig.java:
--------------------------------------------------------------------------------
1 | package com.fox.es.config;
2 |
3 | import org.apache.http.HttpHost;
4 | import org.elasticsearch.client.RestClient;
5 | import org.elasticsearch.client.RestClientBuilder;
6 | import org.elasticsearch.client.RestHighLevelClient;
7 | import org.springframework.beans.factory.annotation.Value;
8 | import org.springframework.context.annotation.Bean;
9 | import org.springframework.context.annotation.Configuration;
10 |
11 | /**
12 | * @author 狐狸半面添
13 | * @create 2023-03-22 17:51
14 | */
15 | @Configuration
16 | public class ElasticsearchConfig {
17 | @Value("${elasticsearch.hostname}")
18 | private String hostname;
19 | @Value("${elasticsearch.port}")
20 | private Integer port;
21 |
22 | @Bean
23 | public RestHighLevelClient restHighLevelClient() {
24 | RestClientBuilder builder = RestClient.builder(
25 | new HttpHost(hostname, port, "http")
26 | );
27 | return new RestHighLevelClient(builder);
28 | }
29 | }
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/java/com/fox/miniodemo/vo/CheckChunkFileVO.java:
--------------------------------------------------------------------------------
1 | package com.fox.miniodemo.vo;
2 |
3 | import com.fox.miniodemo.util.RegexUtils;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | import javax.validation.constraints.Min;
9 | import javax.validation.constraints.NotBlank;
10 | import javax.validation.constraints.NotNull;
11 | import javax.validation.constraints.Pattern;
12 |
13 | /**
14 | * 分块文件上传检查封装类
15 | *
16 | * @author 狐狸半面添
17 | * @create 2023-02-08 16:54
18 | */
19 | @Data
20 | @NoArgsConstructor
21 | @AllArgsConstructor
22 | public class CheckChunkFileVO {
23 | /**
24 | * 需要上传的文件的md5值
25 | */
26 | @NotBlank(message = "文件md5不能为空")
27 | @Pattern(regexp = RegexUtils.RegexPatterns.MD5_HEX_REGEX, message = "文件md5格式错误")
28 | private String fileMd5;
29 | /**
30 | * 该分块文件的索引
31 | */
32 | @NotNull(message = "分块文件索引不能为空")
33 | @Min(value = 0, message = "分块文件索引必须是大于等于0的整数")
34 | private Integer chunkIndex;
35 | }
36 |
--------------------------------------------------------------------------------
/elasticsearch-demo/doc/table.sql:
--------------------------------------------------------------------------------
1 | # 如果存在 es_demo 数据库则删除
2 | DROP DATABASE IF EXISTS `es_demo`;
3 | # 创建新数据库
4 | CREATE DATABASE `es_demo`;
5 |
6 | # 创建一张博客表
7 | CREATE TABLE `blog`(
8 | `id` INT NOT NULL AUTO_INCREMENT COMMENT '主键id',
9 | `user_id` BIGINT NOT NULL COMMENT '用户id(雪花算法生成)',
10 | `title` VARCHAR(255) NOT NULL COMMENT '标题',
11 | `tags` VARCHAR(64) NOT NULL COMMENT '标签',
12 | `introduce` VARCHAR(512) NOT NULL COMMENT '介绍',
13 | `content` TEXT NOT NULL COMMENT '文章内容',
14 | `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
15 | `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
16 | PRIMARY KEY(`id`),
17 | KEY `idx_user_create`(`user_id`,`create_time` DESC)
18 | )ENGINE=INNODB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='博客信息表';
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/java/com/fox/miniodemo/config/MinioConfig.java:
--------------------------------------------------------------------------------
1 | package com.fox.miniodemo.config;
2 |
3 | import io.minio.MinioClient;
4 | import org.springframework.beans.factory.annotation.Value;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * @author 狐狸半面添
10 | * @create 2023-02-08 16:26
11 | */
12 | @Configuration
13 | public class MinioConfig {
14 |
15 | /**
16 | * 连接的ip和端口
17 | */
18 | @Value("${minio.endpoint}")
19 | private String endpoint;
20 | /**
21 | * 访问秘钥(也称用户id)
22 | */
23 | @Value("${minio.accessKey}")
24 | private String accessKey;
25 | /**
26 | * 私有秘钥(也称密码)
27 | */
28 | @Value("${minio.secretKey}")
29 | private String secretKey;
30 |
31 | @Bean
32 | public MinioClient minioClient() {
33 | return MinioClient.builder()
34 | .endpoint(endpoint)
35 | .credentials(accessKey, secretKey)
36 | .build();
37 | }
38 | }
--------------------------------------------------------------------------------
/qrcode-demo/src/main/resources/static/html/zxing/CommonBlackWhite.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 生成普通黑白二维码
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
30 |
31 |
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/src/main/java/com/fox/es_canal/config/ElasticsearchConfig.java:
--------------------------------------------------------------------------------
1 | package com.fox.es_canal.config;
2 |
3 | import org.apache.http.HttpHost;
4 | import org.elasticsearch.client.RestClient;
5 | import org.elasticsearch.client.RestClientBuilder;
6 | import org.elasticsearch.client.RestHighLevelClient;
7 | import org.springframework.beans.factory.annotation.Value;
8 | import org.springframework.context.annotation.Bean;
9 | import org.springframework.context.annotation.Configuration;
10 |
11 | /**
12 | * @author 狐狸半面添
13 | * @create 2023-03-22 17:51
14 | */
15 | @Configuration
16 | public class ElasticsearchConfig {
17 | @Value("${elasticsearch.hostname}")
18 | private String hostname;
19 | @Value("${elasticsearch.port}")
20 | private Integer port;
21 |
22 | @Bean
23 | public RestHighLevelClient restHighLevelClient() {
24 | RestClientBuilder builder = RestClient.builder(
25 | new HttpHost(hostname, port, "http")
26 | );
27 | return new RestHighLevelClient(builder);
28 | }
29 | }
--------------------------------------------------------------------------------
/qrcode-demo/src/main/resources/static/html/qrcodePlugin/ColorCode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 生成彩色二维码
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
30 |
31 |
--------------------------------------------------------------------------------
/qrcode-demo/src/main/resources/static/html/qrcodePlugin/ShapeCode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 生成特殊形状的二维码
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
30 |
31 |
--------------------------------------------------------------------------------
/xfxh-web-support-context-demo/src/main/java/com/zhulang/xfxh/dto/MsgDTO.java:
--------------------------------------------------------------------------------
1 | package com.zhulang.xfxh.dto;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import lombok.*;
5 |
6 | /**
7 | * 消息对象
8 | *
9 | * @author 狐狸半面添
10 | * @create 2023-09-15 0:42
11 | */
12 | @Data
13 | @AllArgsConstructor
14 | @NoArgsConstructor
15 | @JsonInclude(JsonInclude.Include.NON_NULL)
16 | public class MsgDTO {
17 | /**
18 | * 角色
19 | */
20 | private String role;
21 | /**
22 | * 消息内容
23 | */
24 | private String content;
25 | /**
26 | * 响应结果字段:结果序号,取值为[0,10]; 当前为保留字段,开发者可忽略
27 | */
28 | private Integer index;
29 |
30 | public static final String ROLE_USER = "user";
31 | public static final String ROLE_ASSISTANT = "assistant";
32 |
33 | public static MsgDTO createUserMsg(String content){
34 | return new MsgDTO(ROLE_USER,content,null);
35 | }
36 |
37 | public static MsgDTO createAssistantMsg(String content){
38 | return new MsgDTO(ROLE_ASSISTANT,content,null);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/xfxh-web-support-context-demo/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | xfxh:
2 | # 服务引擎使用 讯飞星火认知大模型V2.0,如果使用 V1.5 需要将 hostUrl 修改为 https://spark-api.xf-yun.com/v1.1/chat
3 | hostUrl: https://spark-api.xf-yun.com/v2.1/chat
4 | # 发送请求时指定的访问领域,如果是 V1.5版本 设置为 general,如果是 V2版本 设置为 generalv2
5 | domain: generalv2
6 | # 核采样阈值。用于决定结果随机性,取值越高随机性越强即相同的问题得到的不同答案的可能性越高。取值 [0,1]
7 | temperature: 0.5
8 | # 模型回答的tokens的最大长度,V1.5取值为[1,4096],V2.0取值为[1,8192]。
9 | maxTokens: 2048
10 | # 用于权限验证,从服务接口认证信息中获取
11 | appId:
12 | # 用于权限验证,从服务接口认证信息中获取
13 | apiKey:
14 | # 用于权限验证,从服务接口认证信息中获取
15 | apiSecret:
16 | # 每个 id 用户能保存的最大交互记录数,需要注意所有累计tokens需控制8192以内
17 | maxInteractCount: 3
18 | # 内存中能够保存的最大用户数量
19 | maxUserCount: 15
20 | # 用户记录最大状态为 6,状态超过 userRecordMaxStatus 会从记录空间中移除该用户
21 | userRecordMaxStatus: 6
22 | # 大模型回复问题的最大响应时长,单位 s
23 | maxResponseTime: 40
24 | # 允许同时连接大模型的 websocket 数,如果是普通(免费)用户为 2,超过这个数连接响应会报错,具体参考官网。
25 | QPS: 2
26 | scheduled:
27 | # 单位 ms,600000 表示每隔十分钟用户记录状态+1,直到状态超过 userRecordMaxStatus 会从记录空间中移除该用户
28 | updateUserStatusFixedDelay: 600000
--------------------------------------------------------------------------------
/qrcode-demo/src/main/resources/static/html/qrcodePlugin/CommonBlackWhiteCode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 生成普通黑白二维码
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
30 |
31 |
--------------------------------------------------------------------------------
/minio-chunk-demo/doc/table.sql:
--------------------------------------------------------------------------------
1 | create database minio_demo;
2 |
3 | CREATE TABLE service_media_file
4 | (
5 | `id` BIGINT UNSIGNED PRIMARY KEY COMMENT '主键id(雪花算法)',
6 | `file_name` VARCHAR(255) NOT NULL COMMENT '文件名称',
7 | `file_type` CHAR(2) NOT NULL COMMENT '文件类型:文本,图片,音频,视频,其它',
8 | `file_format` VARCHAR(128) NOT NULL COMMENT '文件格式',
9 | `tag` VARCHAR(32) NOT NULL COMMENT '标签',
10 | `bucket` VARCHAR(32) NOT NULL COMMENT '存储桶',
11 | `file_path` VARCHAR(512) NOT NULL COMMENT '文件存储路径',
12 | `file_md5` CHAR(32) NOT NULL UNIQUE COMMENT '文件的md5值',
13 | `file_byte_size` BIGINT UNSIGNED NOT NULL COMMENT '文件的字节大小',
14 | `file_format_size` VARCHAR(24) NOT NULL COMMENT '文件的格式大小',
15 | `user_id` BIGINT NOT NULL COMMENT '上传人id',
16 | `create_time` DATETIME NOT NULL COMMENT '创建时间(上传时间)',
17 | `update_time` DATETIME NOT NULL COMMENT '修改时间'
18 | ) ENGINE = INNODB
19 | CHARACTER SET = utf8mb4 COMMENT '第三方服务-媒资文件表';
--------------------------------------------------------------------------------
/elasticsearch-demo/src/main/java/com/fox/es/controller/TestController.java:
--------------------------------------------------------------------------------
1 | package com.fox.es.controller;
2 |
3 | import com.fox.es.entity.Result;
4 | import org.elasticsearch.client.RequestOptions;
5 | import org.elasticsearch.client.RestHighLevelClient;
6 | import org.elasticsearch.client.core.MainResponse;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import javax.annotation.Resource;
11 | import java.io.IOException;
12 |
13 | /**
14 | * @author 狐狸半面添
15 | * @create 2023-03-22 18:33
16 | */
17 | @RestController
18 | public class TestController {
19 | @Resource
20 | private RestHighLevelClient restHighLevelClient;
21 |
22 | /**
23 | * 用于测试是否连接 es 成功
24 | *
25 | * @return 返回 es 的基本信息,等价于访问:http://127.0.0.1:9200
26 | * @throws IOException 异常信息
27 | */
28 | @GetMapping("/getEsInfo")
29 | public Result getEsInfo() throws IOException {
30 | MainResponse info = restHighLevelClient.info(RequestOptions.DEFAULT);
31 | return Result.ok(info);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/sms-demo/src/main/java/com/fox/sms/controller/SmsAliController.java:
--------------------------------------------------------------------------------
1 | package com.fox.sms.controller;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.fox.sms.entity.Result;
5 | import com.fox.sms.service.SmsAliService;
6 | import org.springframework.web.bind.annotation.PostMapping;
7 | import org.springframework.web.bind.annotation.RequestBody;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import javax.annotation.Resource;
12 |
13 | /**
14 | * @author 狐狸半面添
15 | * @create 2023-04-01 15:45
16 | */
17 | @RestController
18 | @RequestMapping("/sms-ali")
19 | public class SmsAliController {
20 | @Resource
21 | private SmsAliService smsAliService;
22 |
23 | /**
24 | * 发送用于登录的验证码
25 | *
26 | * @param object 手机号的json对象
27 | * @return 发送情况
28 | */
29 | @PostMapping("/sendLoginCode")
30 | public Result sendLoginCode(@RequestBody JSONObject object){
31 | String phone = object.getString("phone");
32 | return smsAliService.sendLoginCode(phone);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/src/main/java/com/fox/es_canal/controller/TestController.java:
--------------------------------------------------------------------------------
1 | package com.fox.es_canal.controller;
2 |
3 | import com.fox.es_canal.entity.Result;
4 | import org.elasticsearch.client.RequestOptions;
5 | import org.elasticsearch.client.RestHighLevelClient;
6 | import org.elasticsearch.client.core.MainResponse;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import javax.annotation.Resource;
11 | import java.io.IOException;
12 |
13 | /**
14 | * @author 狐狸半面添
15 | * @create 2023-03-22 18:33
16 | */
17 | @RestController
18 | public class TestController {
19 | @Resource
20 | private RestHighLevelClient restHighLevelClient;
21 |
22 | /**
23 | * 用于测试是否连接 es 成功
24 | *
25 | * @return 返回 es 的基本信息,等价于访问:http://192.168.65.133:9200
26 | * @throws IOException 异常信息
27 | */
28 | @GetMapping("/getEsInfo")
29 | public Result getEsInfo() throws IOException {
30 | MainResponse info = restHighLevelClient.info(RequestOptions.DEFAULT);
31 | return Result.ok(info);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/elasticsearch-demo/doc/mapping.kibana:
--------------------------------------------------------------------------------
1 | PUT /blog
2 | {
3 | "settings": {
4 | "number_of_shards": 1,
5 | "number_of_replicas": 0
6 | },
7 | "mappings": {
8 | "properties": {
9 | "id": {
10 | "type": "keyword"
11 | },
12 | "userId": {
13 | "type": "long"
14 | },
15 | "title": {
16 | "analyzer": "ik_max_word",
17 | "search_analyzer": "ik_smart",
18 | "type": "text"
19 | },
20 | "tags": {
21 | "analyzer": "ik_max_word",
22 | "search_analyzer": "ik_smart",
23 | "type": "text"
24 | },
25 | "introduce":{
26 | "analyzer": "ik_max_word",
27 | "search_analyzer": "ik_smart",
28 | "type": "text"
29 | },
30 | "content":{
31 | "analyzer": "ik_max_word",
32 | "search_analyzer": "ik_smart",
33 | "type": "text"
34 | },
35 | "createTime":{
36 | "format": "yyyy-MM-dd HH:mm:ss",
37 | "type": "date"
38 | },
39 | "updateTime":{
40 | "format": "yyyy-MM-dd HH:mm:ss",
41 | "type": "date"
42 | }
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/xfxh-web-simple-demo/README.md:
--------------------------------------------------------------------------------
1 | # 讯飞星火大模型后端接口
2 |
3 | 启动项目后,直接使用 GET 请求访问 http://localhost:8080/test/sendQuestion?question=hello
4 |
5 | 讯飞官方web文档:https://www.xfyun.cn/doc/spark/Web.html
6 |
7 | # 说明
8 | 该后端接口的大致实现逻辑:
9 |
10 | 1. 以 GET 方式访问 SpringBoot 后端接口;
11 | 2. 根据你的配置信息生成通用**鉴权URL**,并携带 question 建立 **websocket 连接**;
12 | 3. 星火大模型**流式返回**生成的回答;
13 | 4. 当大模型返回给后端的响应中出现 **已返回全部回答的标识status** 后,后端关闭 websocket 连接;
14 | 5. 后端将生成的完整回答响应给接口调用者。
15 |
16 | 如果你想了解更详细的与星火大模型之间的参数说明,请参考 [星火认知大模型Web文档](https://www.xfyun.cn/doc/spark/Web.html)
17 |
18 | 该项目后端接口的实现功能:
19 |
20 | - 能回答单个问题,但不支持上下文;
21 | - 对星火大模型限制的 QPS 做了处理;
22 | - 通过配置文件可以规定大模型回复问题的最大响应时长;
23 |
24 | 如果想要使用支持上下文的接口,只需要找到 **xfxh-web-support-context-demo** 模块,它在 **xfxh-web-simple-demo** 模块基础上实现了基于上下文的回答,该增强模块的后端接口说明:
25 |
26 | - 将上下文内容信息保存到了内存中,可以通过配置文件设置保存的上下文内容条数以及用户信息数;
27 | - 一份交互记录指的是两条上下文内容,分别是用户的问题和大模型的回答;
28 | - 支持了唯一标识的用户必须先等他的上一条问题的回答生成才能发送新的问题;
29 | - 由于信息存储在内存中,因此设置了定时任务检查用户是否过期并移除,这个过期时间可以在配置文件中设置。
30 |
31 | 代码还是易懂的,如果想了解如何实现的,建议先看完有完整注释的 **xfxh-web-simple-demo** 模块,再去看 **xfxh-web-support-context-demo** 模块。**xfxh-web-support-context-demo** 模块只是在 **xfxh-web-simple-demo** 模块进行了补充/增强。
32 |
33 |
--------------------------------------------------------------------------------
/xfxh-web-simple-demo/src/main/java/com/zhulang/xfxhsimple/dto/MsgDTO.java:
--------------------------------------------------------------------------------
1 | package com.zhulang.xfxhsimple.dto;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * 消息对象
10 | *
11 | * @author 狐狸半面添
12 | * @create 2023-09-15 0:42
13 | */
14 | @Data
15 | @AllArgsConstructor
16 | @NoArgsConstructor
17 | @JsonInclude(JsonInclude.Include.NON_NULL)
18 | public class MsgDTO {
19 | /**
20 | * 角色
21 | */
22 | private String role;
23 | /**
24 | * 消息内容
25 | */
26 | private String content;
27 | /**
28 | * 响应结果字段:结果序号,取值为[0,10]; 当前为保留字段,开发者可忽略
29 | */
30 | private Integer index;
31 |
32 | public static final String ROLE_USER = "user";
33 | public static final String ROLE_ASSISTANT = "assistant";
34 |
35 | public static MsgDTO createUserMsg(String content) {
36 | return new MsgDTO(ROLE_USER, content, null);
37 | }
38 |
39 | public static MsgDTO createAssistantMsg(String content) {
40 | return new MsgDTO(ROLE_ASSISTANT, content, null);
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/java/com/fox/miniodemo/util/FileFormatUtils.java:
--------------------------------------------------------------------------------
1 | package com.fox.miniodemo.util;
2 |
3 | import java.text.DecimalFormat;
4 |
5 | /**
6 | * 文件格式工具
7 | *
8 | * @author 狐狸半面添
9 | * @create 2023-02-09 19:43
10 | */
11 | public class FileFormatUtils {
12 | /**
13 | * 将字节单位的文件大小转为格式化的文件大小表示
14 | *
15 | * @param fileLength 文件字节大小
16 | * @return 格式化文件大小表示
17 | */
18 | public static String formatFileSize(long fileLength) {
19 | DecimalFormat df = new DecimalFormat("#.00");
20 | String fileSizeString = "";
21 | String wrongSize = "0B";
22 | if (fileLength == 0) {
23 | return wrongSize;
24 | }
25 | if (fileLength < 1024) {
26 | fileSizeString = df.format((double) fileLength) + " B";
27 | } else if (fileLength < 1048576) {
28 | fileSizeString = df.format((double) fileLength / 1024) + " KB";
29 | } else if (fileLength < 1073741824) {
30 | fileSizeString = df.format((double) fileLength / 1048576) + " MB";
31 | } else {
32 | fileSizeString = df.format((double) fileLength / 1073741824) + " GB";
33 | }
34 | return fileSizeString;
35 | }
36 | }
--------------------------------------------------------------------------------
/elasticsearch-demo/src/main/java/com/fox/es/controller/BlogController.java:
--------------------------------------------------------------------------------
1 | package com.fox.es.controller;
2 |
3 | import com.fox.es.entity.Result;
4 | import com.fox.es.service.BlogService;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RequestParam;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import javax.annotation.Resource;
11 |
12 | /**
13 | * @author 狐狸半面添
14 | * @create 2023-03-22 20:16
15 | */
16 | @RestController
17 | @RequestMapping("/blog")
18 | public class BlogController {
19 |
20 | @Resource
21 | private BlogService blogService;
22 |
23 | /**
24 | * 通过关键词获取数据列表
25 | *
26 | * @param keyWords 关键词
27 | * @param pageNo 页码
28 | * @param pageSize 每页大小
29 | * @return 数据列表,按照相关性从高到低进行排序
30 | */
31 | @GetMapping("/list")
32 | public Result list(@RequestParam("keyWords") String keyWords,
33 | @RequestParam("pageNo") Integer pageNo,
34 | @RequestParam("pageSize") Integer pageSize) {
35 | return blogService.list(keyWords, pageNo, pageSize);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sms-demo/src/main/java/com/fox/sms/util/RegexUtils.java:
--------------------------------------------------------------------------------
1 | package com.fox.sms.util;
2 |
3 | import cn.hutool.core.util.StrUtil;
4 |
5 | /**
6 | * 校验格式工具类
7 | *
8 | * @author 狐狸半面添
9 | * @create 2023-04-01 16:32
10 | */
11 | public class RegexUtils {
12 |
13 |
14 | /**
15 | * 正则表达式模板
16 | *
17 | * @author 狐狸半面添
18 | * @create 2023-01-16 22:39
19 | */
20 | public static class RegexPatterns {
21 | /**
22 | * 手机号正则
23 | */
24 | public static final String PHONE_REGEX = "^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\\d{8}$";
25 | }
26 |
27 | /**
28 | * 是否是无效手机格式
29 | *
30 | * @param phone 要校验的手机号
31 | * @return true:符合,false:不符合
32 | */
33 | public static boolean isPhoneInvalid(String phone) {
34 | return mismatch(phone, RegexPatterns.PHONE_REGEX);
35 | }
36 |
37 | /**
38 | * 校验是否不符合正则格式
39 | *
40 | * @param str 字符串
41 | * @param regex 正则表达式
42 | * @return true:符合 false:不符合
43 | */
44 | private static boolean mismatch(String str, String regex) {
45 | if (StrUtil.isBlank(str)) {
46 | return true;
47 | }
48 | return !str.matches(regex);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/java/com/fox/miniodemo/vo/UploadMergeChunksVO.java:
--------------------------------------------------------------------------------
1 | package com.fox.miniodemo.vo;
2 |
3 | import com.fox.miniodemo.util.RegexUtils;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | import javax.validation.constraints.Min;
9 | import javax.validation.constraints.NotBlank;
10 | import javax.validation.constraints.NotNull;
11 | import javax.validation.constraints.Pattern;
12 |
13 | /**
14 | * @author 狐狸半面添
15 | * @create 2023-02-09 22:56
16 | */
17 | @Data
18 | @NoArgsConstructor
19 | @AllArgsConstructor
20 | public class UploadMergeChunksVO {
21 | @NotBlank(message = "文件md5不能为空")
22 | @Pattern(regexp = RegexUtils.RegexPatterns.MD5_HEX_REGEX, message = "文件md5格式错误")
23 | private String fileMd5;
24 |
25 | @NotBlank(message = "文件名不能为空")
26 | @Pattern(regexp = RegexUtils.RegexPatterns.FILE_NAME_REGEX, message = "文件名最多255个字符")
27 | private String fileName;
28 |
29 | @NotBlank(message = "文件标签不能为空")
30 | @Pattern(regexp = RegexUtils.RegexPatterns.FILE_TAG_REGEX, message = "文件标签最多32个字符")
31 | private String tag;
32 |
33 | @NotNull(message = "分块文件数不能为空")
34 | @Min(value = 1, message = "块总数必须大于等于1")
35 | private Integer chunkTotal;
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/src/main/java/com/fox/es_canal/controller/BlogController.java:
--------------------------------------------------------------------------------
1 | package com.fox.es_canal.controller;
2 |
3 | import com.fox.es_canal.constant.BlogConstants;
4 | import com.fox.es_canal.entity.Result;
5 | import com.fox.es_canal.service.BlogService;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import javax.annotation.Resource;
12 |
13 | /**
14 | * @author 狐狸半面添
15 | * @create 2023-03-22 20:16
16 | */
17 | @RestController
18 | @RequestMapping("/blog")
19 | public class BlogController {
20 |
21 | @Resource
22 | private BlogService blogService;
23 |
24 | /**
25 | * 通过关键词获取数据列表
26 | *
27 | * @param keyWords 关键词
28 | * @param pageNo 页码
29 | * @return 数据列表,按照相关性从高到低进行排序
30 | */
31 | @GetMapping("/list")
32 | public Result list(@RequestParam("keyWords") String keyWords,
33 | @RequestParam("pageNo") Integer pageNo) {
34 | // BlogConstants是我写的一个常量类,里面定义了一个变量 SEARCH_PAGE_NUM = 15
35 | return blogService.list(keyWords, pageNo, BlogConstants.SEARCH_PAGE_NUM);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sms-demo/README.md:
--------------------------------------------------------------------------------
1 | ## 1.application.yml 文件中的配置需要进行修改。
2 |
3 | - redis 地址
4 | - redis 密码
5 | - 短信平台信息
6 |
7 | ## 2.ubuntu安装docker的步骤
8 |
9 | 1. 安装需要的包
10 |
11 | ```shell
12 | sudo apt-get update
13 | ```
14 |
15 | 2. 安装依赖包
16 |
17 | ```shell
18 | sudo apt-get install \
19 | apt-transport-https \
20 | ca-certificates \
21 | curl \
22 | gnupg-agent \
23 | software-properties-common
24 | ```
25 |
26 | 3. 添加 Docker 的官方 GPG 密钥
27 |
28 | ```shell
29 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
30 | ```
31 |
32 | 4. 设置远程仓库
33 |
34 | ```shell
35 | sudo add-apt-repository \
36 | "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
37 | $(lsb_release -cs) \
38 | stable"
39 | ```
40 |
41 | 5. 安装 Docker-CE
42 |
43 | ```shell
44 | sudo apt-get update
45 |
46 | sudo apt-get install docker-ce docker-ce-cli containerd.io
47 | ```
48 |
49 | 6. 验证是否成功
50 |
51 | ```shell
52 | sudo docker run hello-world
53 | ```
54 |
55 | ## 3.使用 docker 安装redis并设置密码的步骤
56 |
57 | ```shell
58 | # 拉取redis镜像
59 | docker pull redis
60 |
61 | # 启动容器的时候,并为其设置密码
62 | docker run -d --name myredis -p 6379:6379 redis --requirepass "123456"
63 | ```
64 |
65 | ## 其它注意事项
66 |
67 | 注意需要将防火墙6379端口打开。
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/src/main/java/com/fox/es_canal/entity/Result.java:
--------------------------------------------------------------------------------
1 | package com.fox.es_canal.entity;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import lombok.Data;
5 | import lombok.Getter;
6 | import lombok.Setter;
7 |
8 | /**
9 | * 统一返回对象
10 | *
11 | * @author 狐狸半面添
12 | * @create 2023-03-22 18:34
13 | */
14 | @Getter
15 | @Setter
16 | @JsonInclude(JsonInclude.Include.NON_EMPTY)
17 | public class Result {
18 | private Integer code;
19 | private String msg;
20 | private Object data;
21 |
22 | private Result(Integer code, String msg, Object data) {
23 | this.code = code;
24 | this.msg = msg;
25 | this.data = data;
26 | }
27 |
28 | private Result(Integer code, String msg) {
29 | this.code = code;
30 | this.msg = msg;
31 | }
32 |
33 | private Result(){}
34 |
35 | public static Result ok() {
36 | return new Result(200, "success");
37 | }
38 |
39 | public static Result ok(Object data) {
40 | return new Result(200, "success", data);
41 | }
42 |
43 | public static Result error(String msg) {
44 | return new Result(500, msg);
45 | }
46 |
47 | public static Result error(Integer code, String msg) {
48 | return new Result(code, msg);
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/qrcode-demo/src/main/java/com/zhulang/qrcode/controller/ZXingController.java:
--------------------------------------------------------------------------------
1 | package com.zhulang.qrcode.controller;
2 |
3 | import com.google.zxing.WriterException;
4 | import com.zhulang.qrcode.util.ZXingUtils;
5 | import org.springframework.web.bind.annotation.*;
6 | import org.springframework.web.multipart.MultipartFile;
7 |
8 | import java.io.IOException;
9 | import java.util.HashMap;
10 | import java.util.Map;
11 |
12 | /**
13 | * @author 狐狸半面添
14 | * @create 2023-08-28 21:35
15 | */
16 | @CrossOrigin
17 | @RestController
18 | @RequestMapping("/zxing")
19 | public class ZXingController {
20 | @GetMapping("/getCommonBlackWhite")
21 | public Map getCommonBlackWhite(@RequestParam("content") String content) throws IOException, WriterException {
22 | Map map = new HashMap<>(1);
23 | map.put("imgEncode", ZXingUtils.generateBlackWhiteCode(content));
24 | return map;
25 | }
26 |
27 | @PostMapping("/getLogo")
28 | public Map getLogo(@RequestParam("content") String content, @RequestParam("logo") MultipartFile logo) throws IOException, WriterException {
29 | Map map = new HashMap<>(1);
30 | map.put("imgEncode", ZXingUtils.generateLogoCode(content, logo));
31 | return map;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/elasticsearch-demo/src/main/java/com/fox/es/entity/Result.java:
--------------------------------------------------------------------------------
1 | package com.fox.es.entity;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import lombok.Data;
5 | import lombok.Getter;
6 | import lombok.NoArgsConstructor;
7 | import lombok.Setter;
8 |
9 | /**
10 | * 统一返回对象
11 | *
12 | * @author 狐狸半面添
13 | * @create 2023-03-22 18:34
14 | */
15 | @Getter
16 | @Setter
17 | @JsonInclude(JsonInclude.Include.NON_EMPTY)
18 | public class Result {
19 | private Integer code;
20 | private String msg;
21 | private Object data;
22 |
23 | private Result(Integer code, String msg, Object data) {
24 | this.code = code;
25 | this.msg = msg;
26 | this.data = data;
27 | }
28 |
29 | private Result(Integer code, String msg) {
30 | this.code = code;
31 | this.msg = msg;
32 | }
33 |
34 | private Result(){}
35 |
36 | public static Result ok() {
37 | return new Result(200, "success");
38 | }
39 |
40 | public static Result ok(Object data) {
41 | return new Result(200, "success", data);
42 | }
43 |
44 | public static Result error(String msg) {
45 | return new Result(500, msg);
46 | }
47 |
48 | public static Result error(Integer code, String msg) {
49 | return new Result(code, msg);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/sms-demo/src/main/java/com/fox/sms/entity/Result.java:
--------------------------------------------------------------------------------
1 | package com.fox.sms.entity;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 |
7 | /**
8 | * 统一返回对象
9 | *
10 | * @author 狐狸半面添
11 | * @create 2023-03-22 18:34
12 | */
13 | @Getter
14 | @Setter
15 | @JsonInclude(JsonInclude.Include.NON_EMPTY)
16 | public class Result {
17 | private Integer code;
18 | private String msg;
19 | private Object data;
20 |
21 | private Result(Integer code, String msg, Object data) {
22 | this.code = code;
23 | this.msg = msg;
24 | this.data = data;
25 | }
26 |
27 | private Result(Integer code, String msg) {
28 | this.code = code;
29 | this.msg = msg;
30 | }
31 |
32 | private Result(){}
33 |
34 | public static Result ok() {
35 | return new Result(200, "success");
36 | }
37 |
38 | public static Result ok(Object data) {
39 | return new Result(200, "success", data);
40 | }
41 |
42 | public static Result error(String msg) {
43 | return new Result(500, msg);
44 | }
45 |
46 | public static Result error(Integer code, String msg) {
47 | return new Result(code, msg);
48 | }
49 |
50 | public static Result error(){
51 | return new Result(500,"服务器异常");
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/xfxh-web-simple-demo/src/main/java/com/zhulang/xfxhsimple/config/XfXhConfig.java:
--------------------------------------------------------------------------------
1 | package com.zhulang.xfxhsimple.config;
2 |
3 | import lombok.Data;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | /**
8 | * @author 狐狸半面添
9 | * @create 2023-09-15 0:46
10 | */
11 | @Configuration
12 | @ConfigurationProperties(prefix = "xfxh")
13 | @Data
14 | public class XfXhConfig {
15 | /**
16 | * 服务引擎使用 讯飞星火认知大模型V2.0,如果使用 V1.5 需要将 hostUrl 修改为 https://spark-api.xf-yun.com/v1.1/chat
17 | */
18 | private String hostUrl;
19 | /**
20 | * 发送请求时指定的访问领域,如果是 V1.5版本 设置为 general,如果是 V2版本 设置为 generalv2
21 | */
22 | private String domain;
23 | /**
24 | * 核采样阈值。用于决定结果随机性,取值越高随机性越强即相同的问题得到的不同答案的可能性越高。取值 [0,1]
25 | */
26 | private Float temperature;
27 | /**
28 | * 模型回答的tokens的最大长度,V1.5取值为[1,4096],V2.0取值为[1,8192]。
29 | */
30 | private Integer maxTokens;
31 | /**
32 | * 大模型回复问题的最大响应时长,单位 s
33 | */
34 | private Integer maxResponseTime;
35 | /**
36 | * 用于权限验证,从服务接口认证信息中获取
37 | */
38 | private String appId;
39 | /**
40 | * 用于权限验证,从服务接口认证信息中获取
41 | */
42 | private String apiKey;
43 | /**
44 | * 用于权限验证,从服务接口认证信息中获取
45 | */
46 | private String apiSecret;
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/doc/es-mapping:
--------------------------------------------------------------------------------
1 | 【PUT】 http://192.168.65.133:9200/es_demo_collect
2 |
3 | {
4 | "settings": {
5 | "number_of_shards": 1,
6 | "number_of_replicas": 0
7 | },
8 | "mappings": {
9 | "properties": {
10 | "userId": {
11 | "type": "long"
12 | },
13 | "username":{
14 | "analyzer": "ik_max_word",
15 | "search_analyzer": "ik_smart",
16 | "type": "text"
17 | },
18 | "userIcon":{
19 | "type": "keyword",
20 | "index": false
21 | },
22 | "title": {
23 | "analyzer": "ik_max_word",
24 | "search_analyzer": "ik_smart",
25 | "type": "text"
26 | },
27 | "tags": {
28 | "analyzer": "ik_max_word",
29 | "search_analyzer": "ik_smart",
30 | "type": "text"
31 | },
32 | "introduce":{
33 | "analyzer": "ik_max_word",
34 | "search_analyzer": "ik_smart",
35 | "type": "text"
36 | },
37 | "content":{
38 | "analyzer": "ik_max_word",
39 | "search_analyzer": "ik_smart",
40 | "type": "text"
41 | },
42 | "createTime":{
43 | "format": "date_optional_time||epoch_millis",
44 | "type": "date"
45 | },
46 | "updateTime":{
47 | "format": "date_optional_time||epoch_millis",
48 | "type": "date"
49 | }
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/qrcode-demo/src/main/resources/static/html/qrcodePlugin/ImgFillCode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 生成图片填充二维码
6 |
7 |
8 | 请输入文本内容:
9 | 请选择图片:
10 |
11 |
12 |
13 |
14 |
15 |
40 |
41 |
--------------------------------------------------------------------------------
/qrcode-demo/src/main/resources/static/html/qrcodePlugin/LogoBlackWhiteCode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 生成带 logo 的二维码
6 |
7 |
8 | 请输入文本内容:
9 | 请选择图片:
10 |
11 |
12 |
13 |
14 |
15 |
40 |
41 |
--------------------------------------------------------------------------------
/qrcode-demo/src/main/resources/static/html/qrcodePlugin/BgBlackWhiteCode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 生成带背景图的黑白二维码
6 |
7 |
8 | 请输入文本内容:
9 | 请选择图片:
10 |
11 |
12 |
13 |
14 |
15 |
40 |
41 |
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/resources/application.yaml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 60000
3 | spring:
4 | main:
5 | allow-circular-references: true # 允许循环依赖
6 | servlet:
7 | multipart:
8 | max-file-size: 3MB
9 | max-request-size: 5MB
10 | datasource:
11 | username: root
12 | password: 123456
13 | url: jdbc:mysql://127.0.0.1:3306/minio_demo?characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
14 | driver-class-name: com.mysql.cj.jdbc.Driver
15 | # 指定数据源
16 | type: com.alibaba.druid.pool.DruidDataSource
17 | # Spring Boot 默认是不注入这些属性值的,需要自己绑定
18 | # druid 数据源专有配置
19 | initialSize: 5
20 | minIdle: 5
21 | maxActive: 20
22 | maxWait: 60000
23 | timeBetweenEvictionRunsMillis: 60000
24 | minEvictableIdleTimeMillis: 300000
25 | validationQuery: SELECT 1 FROM DUAL
26 | testWhileIdle: true
27 | testOnBorrow: false
28 | testOnReturn: false
29 | poolPreparedStatements: true
30 | mybatis-plus:
31 | mapper-locations: classpath:/mapper/**/*.xml
32 | global-config:
33 | db-config:
34 | id-type: assign_id # 使用雪花算法生成id
35 | logic-delete-value: 1 # 逻辑已删除值
36 | logic-not-delete-value: 0 # 逻辑未删除值
37 | configuration:
38 | # 这里我们配置出底层的sql,可以输出sql日志信息,方便我们观察
39 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
40 | minio:
41 | # 指定连接的ip和端口
42 | endpoint: http://192.168.65.129:9000
43 | # 指定 访问秘钥(也称用户id)
44 | accessKey: minioadmin
45 | # 指定 私有秘钥(也称密码)
46 | secretKey: minioadmin
--------------------------------------------------------------------------------
/elasticsearch-canal-demo/doc/table.sql:
--------------------------------------------------------------------------------
1 | # 如果存在 es_demo 数据库则删除
2 | DROP DATABASE IF EXISTS `es_demo`;
3 |
4 | # 创建新数据库
5 | CREATE DATABASE `es_demo`;
6 |
7 | # 使用数据库
8 | USE `es_demo`;
9 |
10 | # 创建一张用户表,注意自增主键id是从1000开始
11 | CREATE TABLE `user`(
12 | `id` INT NOT NULL AUTO_INCREMENT COMMENT '主键id',
13 | `username` VARCHAR(24) NOT NULL COMMENT '用户名',
14 | `icon` VARCHAR(255) NOT NULL COMMENT '头像url',
15 | PRIMARY KEY(`id`)
16 | )ENGINE=INNODB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
17 |
18 | # 创建一张博客表,注意自增主键id是从1000开始
19 | CREATE TABLE `blog`(
20 | `id` INT NOT NULL AUTO_INCREMENT COMMENT '主键id',
21 | `user_id` INT NOT NULL COMMENT '用户id(雪花算法生成)',
22 | `title` VARCHAR(255) NOT NULL COMMENT '标题',
23 | `tags` VARCHAR(64) NOT NULL COMMENT '标签',
24 | `introduce` VARCHAR(512) NOT NULL COMMENT '介绍',
25 | `content` TEXT NOT NULL COMMENT '文章内容',
26 | `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
27 | `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
28 | PRIMARY KEY(`id`),
29 | KEY `idx_user_create`(`user_id`,`create_time` DESC)
30 | )ENGINE=INNODB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COMMENT='博客信息表';
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/java/com/fox/miniodemo/service/MediaFileService.java:
--------------------------------------------------------------------------------
1 | package com.fox.miniodemo.service;
2 |
3 | import com.baomidou.mybatisplus.extension.service.IService;
4 | import com.fox.miniodemo.entity.Result;
5 | import com.fox.miniodemo.po.MediaFile;
6 |
7 | /**
8 | *
9 | * 第三方服务-媒资文件表 服务类
10 | *
11 | *
12 | * @author 狐狸半面添
13 | * @since 2023-02-08
14 | */
15 | public interface MediaFileService extends IService {
16 |
17 | /**
18 | * 文件上传前检查文件是否存在
19 | *
20 | * @param fileMd5 需要上传的文件的md5值
21 | * @return 是否存在, false-不存在 true-存在
22 | */
23 | Result checkFile(String fileMd5);
24 |
25 | /**
26 | * 分块文件上传前检测分块文件是否已存在
27 | *
28 | * @param fileMd5 分块文件的源文件md5
29 | * @param chunkIndex 分块文件索引
30 | * @return 是否存在, false-不存在 true-存在
31 | */
32 | Result checkChunk(String fileMd5, Integer chunkIndex);
33 |
34 | /**
35 | * 上传分块文件
36 | *
37 | * @param fileMd5 原文件md5值
38 | * @param chunkIndex 分块文件索引
39 | * @param bytes 分块文件的字节数组形式
40 | * @return 上传情况
41 | */
42 | Result uploadChunk(String fileMd5, Integer chunkIndex, byte[] bytes);
43 |
44 | /**
45 | * 合并分块文件
46 | *
47 | * @param fileMd5 文件的md5十六进制值
48 | * @param fileName 文件名
49 | * @param tag 文件标签
50 | * @param chunkTotal 文件块总数
51 | * @return 合并与上传情况
52 | */
53 | Result uploadMergeChunks(String fileMd5, String fileName, String tag, Integer chunkTotal);
54 | }
55 |
--------------------------------------------------------------------------------
/qrcode-demo/src/main/resources/static/html/zxing/ZXingLogo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ZXing 生成带 logo 的二维码
6 |
7 |
8 | 请输入文本内容:
9 | 请选择图片:
10 |
11 |
12 |
13 |
14 |
15 |
40 |
41 |
--------------------------------------------------------------------------------
/minio-chunk-demo/src/main/java/com/fox/miniodemo/util/RegexUtils.java:
--------------------------------------------------------------------------------
1 | package com.fox.miniodemo.util;
2 |
3 | import cn.hutool.core.util.StrUtil;
4 |
5 | /**
6 | * 校验格式工具类
7 | *
8 | * @author 狐狸半面添
9 | * @create 2023-01-16 22:17
10 | */
11 | public class RegexUtils {
12 |
13 | /**
14 | * 正则表达式模板
15 | *
16 | * @author 狐狸半面添
17 | * @create 2023-01-16 22:39
18 | */
19 | public static class RegexPatterns {
20 |
21 | /**
22 | * md5十六进制正则:32个字符
23 | */
24 | public static final String MD5_HEX_REGEX = "^[0-9abcdef]{32}$";
25 |
26 | /**
27 | * 文件名称正则:最多255个字符
28 | */
29 | public static final String FILE_NAME_REGEX = "^.{1,255}$";
30 |
31 | /**
32 | * 文件标签正则:最多32个字符
33 | */
34 | public static final String FILE_TAG_REGEX = "^.{1,32}$";
35 |
36 | }
37 |
38 |
39 | /**
40 | * 校验是否不符合正则格式
41 | *
42 | * @param str 字符串
43 | * @param regex 正则表达式
44 | * @return true:符合 false:不符合
45 | */
46 | private static boolean mismatch(String str, String regex) {
47 | if (StrUtil.isBlank(str)) {
48 | return true;
49 | }
50 | return !str.matches(regex);
51 | }
52 |
53 |
54 | /**
55 | * 是否是无效十六进制md5格式
56 | *
57 | * @param md5Hex md5的十六进制
58 | * @return true:符合,false:不符合
59 | */
60 | public static boolean isMd5HexInvalid(String md5Hex){
61 | return mismatch(md5Hex, RegexPatterns.MD5_HEX_REGEX);
62 | }
63 |
64 | }
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/sms-demo/src/main/java/com/fox/sms/config/RedisConfig.java:
--------------------------------------------------------------------------------
1 | package com.fox.sms.config;
2 |
3 | import com.fox.sms.component.FastJsonRedisSerializer;
4 | import com.fox.sms.util.RedisCacheUtils;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.data.redis.connection.RedisConnectionFactory;
8 | import org.springframework.data.redis.core.RedisTemplate;
9 | import org.springframework.data.redis.serializer.StringRedisSerializer;
10 |
11 | /**
12 | * @author 狐狸半面添
13 | * @create 2023-01-17 21:00
14 | */
15 | @Configuration
16 | public class RedisConfig {
17 |
18 | @Bean
19 | @SuppressWarnings(value = { "unchecked", "rawtypes" })
20 | public RedisTemplate